LCOV - code coverage report
Current view: top level - gcc/m2/gm2-gcc - m2builtins.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 88.2 % 502 443
Test Date: 2024-06-15 14:19:33 Functions: 81.6 % 49 40
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* m2builtins.cc provides an interface to the GCC builtins.
       2                 :             : 
       3                 :             : Copyright (C) 2012-2024 Free Software Foundation, Inc.
       4                 :             : Contributed by Gaius Mulley <gaius@glam.ac.uk>.
       5                 :             : 
       6                 :             : This file is part of GNU Modula-2.
       7                 :             : 
       8                 :             : GNU Modula-2 is free software; you can redistribute it and/or modify
       9                 :             : it under the terms of the GNU General Public License as published by
      10                 :             : the Free Software Foundation; either version 3, or (at your option)
      11                 :             : any later version.
      12                 :             : 
      13                 :             : GNU Modula-2 is distributed in the hope that it will be useful, but
      14                 :             : WITHOUT ANY WARRANTY; without even the implied warranty of
      15                 :             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16                 :             : General Public License for more details.
      17                 :             : 
      18                 :             : You should have received a copy of the GNU General Public License
      19                 :             : along with GNU Modula-2; see the file COPYING3.  If not see
      20                 :             : <http://www.gnu.org/licenses/>.  */
      21                 :             : 
      22                 :             : #include "gcc-consolidation.h"
      23                 :             : 
      24                 :             : #include "m2block.h"
      25                 :             : #include "m2convert.h"
      26                 :             : #include "m2decl.h"
      27                 :             : #include "m2expr.h"
      28                 :             : #include "m2statement.h"
      29                 :             : #include "m2tree.h"
      30                 :             : #include "m2treelib.h"
      31                 :             : #include "m2type.h"
      32                 :             : #include "m2configure.h"
      33                 :             : 
      34                 :             : #undef DEBUGGING
      35                 :             : 
      36                 :             : #define GM2
      37                 :             : #define GM2_BUG_REPORT                                                        \
      38                 :             :   "Please report this crash to the GNU Modula-2 mailing list "                \
      39                 :             :   "<gm2@nongnu.org>\n"
      40                 :             : 
      41                 :             : #define ASSERT(X, Y)                                                          \
      42                 :             :   {                                                                           \
      43                 :             :     if (!(X))                                                                 \
      44                 :             :       {                                                                       \
      45                 :             :         debug_tree (Y);                                                       \
      46                 :             :         internal_error ("%s:%d:assertion of condition %qs failed", __FILE__, __LINE__,  \
      47                 :             :                         #X);                                                  \
      48                 :             :       }                                                                       \
      49                 :             :   }
      50                 :             : #define ERROR(X)                                                              \
      51                 :             :   {                                                                           \
      52                 :             :     internal_error ("%s:%d:%s", __FILE__, __LINE__, X);                     \
      53                 :             :   }
      54                 :             : 
      55                 :             : typedef enum {
      56                 :             :   BT_FN_NONE,
      57                 :             :   BT_FN_PTR_SIZE,
      58                 :             :   BT_FN_TRAD_PTR_PTR_CONST_PTR_SIZE,
      59                 :             :   BT_FN_FLOAT,
      60                 :             :   BT_FN_DOUBLE,
      61                 :             :   BT_FN_LONG_DOUBLE,
      62                 :             :   BT_FN_FLOAT_FLOAT,
      63                 :             :   BT_FN_DOUBLE_DOUBLE,
      64                 :             :   BT_FN_LONG_DOUBLE_LONG_DOUBLE,
      65                 :             :   BT_FN_STRING_CONST_STRING_INT,
      66                 :             :   BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
      67                 :             :   BT_FN_TRAD_PTR_PTR_INT_SIZE,
      68                 :             :   BT_FN_STRING_STRING_CONST_STRING,
      69                 :             :   BT_FN_STRING_STRING_CONST_STRING_SIZE,
      70                 :             :   BT_FN_INT_CONST_STRING_CONST_STRING,
      71                 :             :   BT_FN_INT_CONST_STRING_CONST_STRING_SIZE,
      72                 :             :   BT_FN_INT_CONST_STRING,
      73                 :             :   BT_FN_STRING_CONST_STRING_CONST_STRING,
      74                 :             :   BT_FN_SIZE_CONST_STRING_CONST_STRING,
      75                 :             :   BT_FN_PTR_UNSIGNED,
      76                 :             :   BT_FN_VOID_PTR_INT,
      77                 :             :   BT_FN_INT_PTR,
      78                 :             :   BT_FN_INT_FLOAT,
      79                 :             :   BT_FN_INT_DOUBLE,
      80                 :             :   BT_FN_INT_LONG_DOUBLE,
      81                 :             :   BT_FN_FLOAT_FCOMPLEX,
      82                 :             :   BT_FN_DOUBLE_DCOMPLEX,
      83                 :             :   BT_FN_LONG_DOUBLE_LDCOMPLEX,
      84                 :             : 
      85                 :             :   BT_FN_FCOMPLEX_FCOMPLEX,
      86                 :             :   BT_FN_DCOMPLEX_DCOMPLEX,
      87                 :             :   BT_FN_LDCOMPLEX_LDCOMPLEX,
      88                 :             : 
      89                 :             :   BT_FN_DCOMPLEX_DOUBLE_DCOMPLEX,
      90                 :             :   BT_FN_FCOMPLEX_FLOAT_FCOMPLEX,
      91                 :             :   BT_FN_LDCOMPLEX_LONG_DOUBLE_LDCOMPLEX,
      92                 :             : 
      93                 :             :   BT_FN_FLOAT_FLOAT_FLOATPTR,
      94                 :             :   BT_FN_DOUBLE_DOUBLE_DOUBLEPTR,
      95                 :             :   BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLEPTR,
      96                 :             : 
      97                 :             :   BT_FN_FLOAT_FLOAT_LONG_DOUBLE,
      98                 :             :   BT_FN_DOUBLE_DOUBLE_LONG_DOUBLE,
      99                 :             :   BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
     100                 :             : 
     101                 :             :   BT_FN_FLOAT_FLOAT_LONG,
     102                 :             :   BT_FN_DOUBLE_DOUBLE_LONG,
     103                 :             :   BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG,
     104                 :             : 
     105                 :             :   BT_FN_FLOAT_FLOAT_INT,
     106                 :             :   BT_FN_DOUBLE_DOUBLE_INT,
     107                 :             :   BT_FN_LONG_DOUBLE_LONG_DOUBLE_INT,
     108                 :             : 
     109                 :             :   BT_FN_FLOAT_FLOAT_FLOAT,
     110                 :             :   BT_FN_DOUBLE_DOUBLE_DOUBLE,
     111                 :             : } builtin_prototype;
     112                 :             : 
     113                 :             : typedef enum
     114                 :             : {
     115                 :             :   bf_true,
     116                 :             :   bf_false,
     117                 :             :   bf_extension_lib,
     118                 :             :   bf_default_lib,
     119                 :             :   bf_gcc,
     120                 :             :   bf_c99,
     121                 :             :   bf_c99_c90res,
     122                 :             :   bf_extension_lib_floatn,
     123                 :             :   bf_c99_compl,
     124                 :             : } bf_category;
     125                 :             : 
     126                 :             : struct builtin_function_entry
     127                 :             : {
     128                 :             :   const char *name;
     129                 :             :   builtin_prototype defn;
     130                 :             :   int function_code;
     131                 :             :   enum built_in_class fclass;
     132                 :             :   const char *library_name;
     133                 :             :   tree function_node;
     134                 :             :   tree return_node;
     135                 :             :   bf_category function_avail;
     136                 :             : };
     137                 :             : 
     138                 :             : /* Entries are added by examining gcc/builtins.def and copying those
     139                 :             :    functions which can be applied to Modula-2.  */
     140                 :             : 
     141                 :             : static struct builtin_function_entry list_of_builtins[] = {
     142                 :             :   { "__builtin_alloca", BT_FN_PTR_SIZE, BUILT_IN_ALLOCA, BUILT_IN_NORMAL,
     143                 :             :     "alloca", NULL, NULL, bf_extension_lib },
     144                 :             :   { "__builtin_memcpy", BT_FN_TRAD_PTR_PTR_CONST_PTR_SIZE, BUILT_IN_MEMCPY,
     145                 :             :     BUILT_IN_NORMAL, "memcpy", NULL, NULL, bf_default_lib },
     146                 :             :   { "__builtin_isfinite", BT_FN_INT_DOUBLE, BUILT_IN_ISFINITE, BUILT_IN_NORMAL,
     147                 :             :     "isfinite", NULL, NULL, bf_gcc },
     148                 :             :   { "__builtin_isnan", BT_FN_INT_DOUBLE, BUILT_IN_ISNAN, BUILT_IN_NORMAL,
     149                 :             :     "isnan", NULL, NULL, bf_gcc },
     150                 :             :   { "__builtin_sinf", BT_FN_FLOAT_FLOAT, BUILT_IN_SINF, BUILT_IN_NORMAL,
     151                 :             :     "sinf", NULL, NULL, bf_c99_c90res },
     152                 :             :   { "__builtin_sin", BT_FN_DOUBLE_DOUBLE, BUILT_IN_SIN, BUILT_IN_NORMAL, "sin",
     153                 :             :     NULL, NULL, bf_c99_c90res },
     154                 :             :   { "__builtin_sinl", BT_FN_LONG_DOUBLE_LONG_DOUBLE, BUILT_IN_SINL,
     155                 :             :     BUILT_IN_NORMAL, "sinl", NULL, NULL, bf_c99_c90res },
     156                 :             :   { "__builtin_cosf", BT_FN_FLOAT_FLOAT, BUILT_IN_SINF, BUILT_IN_NORMAL,
     157                 :             :     "cosf", NULL, NULL, bf_c99_c90res },
     158                 :             :   { "__builtin_cos", BT_FN_DOUBLE_DOUBLE, BUILT_IN_COS, BUILT_IN_NORMAL, "cos",
     159                 :             :     NULL, NULL, bf_c99_c90res },
     160                 :             :   { "__builtin_cosl", BT_FN_LONG_DOUBLE_LONG_DOUBLE, BUILT_IN_COSL,
     161                 :             :     BUILT_IN_NORMAL, "cosl", NULL, NULL, bf_c99_c90res },
     162                 :             :   { "__builtin_sqrtf", BT_FN_FLOAT_FLOAT, BUILT_IN_SQRTF, BUILT_IN_NORMAL,
     163                 :             :     "sqrtf", NULL, NULL, bf_c99_c90res },
     164                 :             :   { "__builtin_sqrt", BT_FN_DOUBLE_DOUBLE, BUILT_IN_SQRT, BUILT_IN_NORMAL,
     165                 :             :     "sqrt", NULL, NULL, bf_default_lib },
     166                 :             :   { "__builtin_sqrtl", BT_FN_LONG_DOUBLE_LONG_DOUBLE, BUILT_IN_SQRTL,
     167                 :             :     BUILT_IN_NORMAL, "sqrtl", NULL, NULL, bf_c99_c90res },
     168                 :             :   { "__builtin_fabsf", BT_FN_FLOAT_FLOAT, BUILT_IN_FABSF, BUILT_IN_NORMAL,
     169                 :             :     "fabsf", NULL, NULL, bf_c99_c90res },
     170                 :             :   { "__builtin_fabs", BT_FN_DOUBLE_DOUBLE, BUILT_IN_FABS, BUILT_IN_NORMAL,
     171                 :             :     "fabs", NULL, NULL, bf_default_lib },
     172                 :             :   { "__builtin_fabsl", BT_FN_LONG_DOUBLE_LONG_DOUBLE, BUILT_IN_FABSL,
     173                 :             :     BUILT_IN_NORMAL, "fabsl", NULL, NULL, bf_c99_c90res },
     174                 :             :   { "__builtin_logf", BT_FN_FLOAT_FLOAT, BUILT_IN_LOGF, BUILT_IN_NORMAL,
     175                 :             :     "logf", NULL, NULL, bf_c99_c90res },
     176                 :             :   { "__builtin_log", BT_FN_DOUBLE_DOUBLE, BUILT_IN_LOG, BUILT_IN_NORMAL, "log",
     177                 :             :     NULL, NULL, bf_extension_lib_floatn },
     178                 :             :   { "__builtin_logl", BT_FN_LONG_DOUBLE_LONG_DOUBLE, BUILT_IN_LOGL,
     179                 :             :     BUILT_IN_NORMAL, "logl", NULL, NULL, bf_c99_c90res },
     180                 :             :   { "__builtin_expf", BT_FN_FLOAT_FLOAT, BUILT_IN_EXPF, BUILT_IN_NORMAL,
     181                 :             :     "expf", NULL, NULL, bf_c99_c90res },
     182                 :             :   { "__builtin_exp", BT_FN_DOUBLE_DOUBLE, BUILT_IN_EXP, BUILT_IN_NORMAL, "exp",
     183                 :             :     NULL, NULL, bf_extension_lib_floatn },
     184                 :             :   { "__builtin_expl", BT_FN_LONG_DOUBLE_LONG_DOUBLE, BUILT_IN_EXPL,
     185                 :             :     BUILT_IN_NORMAL, "expl", NULL, NULL, bf_c99_c90res },
     186                 :             :   { "__builtin_log10f", BT_FN_FLOAT_FLOAT, BUILT_IN_LOG10F, BUILT_IN_NORMAL,
     187                 :             :     "log10f", NULL, NULL, bf_c99_c90res },
     188                 :             :   { "__builtin_log10", BT_FN_DOUBLE_DOUBLE, BUILT_IN_LOG10, BUILT_IN_NORMAL,
     189                 :             :     "log10", NULL, NULL, bf_default_lib },
     190                 :             :   { "__builtin_log10l", BT_FN_LONG_DOUBLE_LONG_DOUBLE, BUILT_IN_LOG10L,
     191                 :             :     BUILT_IN_NORMAL, "log10l", NULL, NULL, bf_c99_c90res },
     192                 :             :   { "__builtin_ilogbf", BT_FN_INT_FLOAT, BUILT_IN_ILOGBF, BUILT_IN_NORMAL,
     193                 :             :     "ilogbf", NULL, NULL, bf_c99 },
     194                 :             :   { "__builtin_ilogb", BT_FN_INT_DOUBLE, BUILT_IN_ILOGB, BUILT_IN_NORMAL,
     195                 :             :     "ilogb", NULL, NULL, bf_c99 },
     196                 :             :   { "__builtin_ilogbl", BT_FN_INT_LONG_DOUBLE, BUILT_IN_ILOGBL,
     197                 :             :     BUILT_IN_NORMAL, "ilogbl", NULL, NULL, bf_c99 },
     198                 :             : 
     199                 :             :   { "__builtin_atan2f", BT_FN_FLOAT_FLOAT_FLOAT, BUILT_IN_ATAN2F,
     200                 :             :     BUILT_IN_NORMAL, "atan2f", NULL, NULL, bf_c99_c90res },
     201                 :             :   { "__builtin_atan2", BT_FN_DOUBLE_DOUBLE_DOUBLE, BUILT_IN_ATAN2,
     202                 :             :     BUILT_IN_NORMAL, "atan2", NULL, NULL, bf_default_lib },
     203                 :             :   { "__builtin_atan2l", BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
     204                 :             :     BUILT_IN_ATAN2L, BUILT_IN_NORMAL, "atan2l", NULL, NULL, bf_c99_c90res },
     205                 :             : 
     206                 :             :   { "__builtin_signbit", BT_FN_INT_DOUBLE, BUILT_IN_SIGNBIT, BUILT_IN_NORMAL,
     207                 :             :     "signbit", NULL, NULL, bf_extension_lib },
     208                 :             :   { "__builtin_signbitf", BT_FN_INT_FLOAT, BUILT_IN_SIGNBITF, BUILT_IN_NORMAL,
     209                 :             :     "signbitf", NULL, NULL, bf_extension_lib },
     210                 :             :   { "__builtin_signbitl", BT_FN_INT_LONG_DOUBLE, BUILT_IN_SIGNBITL,
     211                 :             :     BUILT_IN_NORMAL, "signbitl", NULL, NULL, bf_extension_lib },
     212                 :             :   { "__builtin_modf", BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, BUILT_IN_MODF,
     213                 :             :     BUILT_IN_NORMAL, "modf", NULL, NULL, bf_default_lib },
     214                 :             :   { "__builtin_modff", BT_FN_FLOAT_FLOAT_FLOATPTR, BUILT_IN_MODFF,
     215                 :             :     BUILT_IN_NORMAL, "modff", NULL, NULL, bf_c99_c90res },
     216                 :             :   { "__builtin_modfl", BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLEPTR,
     217                 :             :     BUILT_IN_MODFL, BUILT_IN_NORMAL, "modfl", NULL, NULL, bf_c99_c90res },
     218                 :             :   { "__builtin_nextafter", BT_FN_DOUBLE_DOUBLE_DOUBLE, BUILT_IN_NEXTAFTER,
     219                 :             :     BUILT_IN_NORMAL, "nextafter", NULL, NULL, bf_c99 },
     220                 :             :   { "__builtin_nextafterf", BT_FN_FLOAT_FLOAT_FLOAT, BUILT_IN_NEXTAFTERF,
     221                 :             :     BUILT_IN_NORMAL, "nextafterf", NULL, NULL, bf_c99 },
     222                 :             :   { "__builtin_nextafterl", BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
     223                 :             :     BUILT_IN_NEXTAFTERL, BUILT_IN_NORMAL, "nextafterl", NULL, NULL, bf_c99 },
     224                 :             :   { "__builtin_nexttoward", BT_FN_DOUBLE_DOUBLE_LONG_DOUBLE,
     225                 :             :     BUILT_IN_NEXTTOWARD, BUILT_IN_NORMAL, "nexttoward", NULL, NULL, bf_c99 },
     226                 :             :   { "__builtin_nexttowardf", BT_FN_FLOAT_FLOAT_LONG_DOUBLE,
     227                 :             :     BUILT_IN_NEXTTOWARDF, BUILT_IN_NORMAL, "nexttowardf", NULL, NULL, bf_c99 },
     228                 :             :   { "__builtin_nexttowardl", BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE,
     229                 :             :     BUILT_IN_NEXTTOWARDL, BUILT_IN_NORMAL, "nexttowardl", NULL, NULL, bf_c99 },
     230                 :             :   { "__builtin_scalbln", BT_FN_DOUBLE_DOUBLE_LONG, BUILT_IN_SCALBLN,
     231                 :             :     BUILT_IN_NORMAL, "scalbln", NULL, NULL, bf_extension_lib },
     232                 :             :   { "__builtin_scalblnf", BT_FN_FLOAT_FLOAT_LONG, BUILT_IN_SCALBLNF,
     233                 :             :     BUILT_IN_NORMAL, "scalblnf", NULL, NULL, bf_extension_lib },
     234                 :             :   { "__builtin_scalblnl", BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG,
     235                 :             :     BUILT_IN_SCALBLNL, BUILT_IN_NORMAL, "scalblnl", NULL, NULL, bf_extension_lib },
     236                 :             :   { "__builtin_scalbn", BT_FN_DOUBLE_DOUBLE_INT, BUILT_IN_SCALBN,
     237                 :             :     BUILT_IN_NORMAL, "scalbln", NULL, NULL, bf_extension_lib },
     238                 :             :   { "__builtin_scalbnf", BT_FN_FLOAT_FLOAT_INT, BUILT_IN_SCALBNF,
     239                 :             :     BUILT_IN_NORMAL, "scalblnf", NULL, NULL, bf_extension_lib },
     240                 :             :   { "__builtin_scalbnl", BT_FN_LONG_DOUBLE_LONG_DOUBLE_INT, BUILT_IN_SCALBNL,
     241                 :             :     BUILT_IN_NORMAL, "scalblnl", NULL, NULL, bf_extension_lib },
     242                 :             : 
     243                 :             :   /* Complex intrinsic functions.  */
     244                 :             :   { "__builtin_cabs", BT_FN_DOUBLE_DCOMPLEX, BUILT_IN_CABS, BUILT_IN_NORMAL,
     245                 :             :     "cabs", NULL, NULL, bf_c99_compl },
     246                 :             :   { "__builtin_cabsf", BT_FN_FLOAT_FCOMPLEX, BUILT_IN_CABSF, BUILT_IN_NORMAL,
     247                 :             :     "cabsf", NULL, NULL, bf_c99_compl },
     248                 :             :   { "__builtin_cabsl", BT_FN_LONG_DOUBLE_LDCOMPLEX, BUILT_IN_CABSL,
     249                 :             :     BUILT_IN_NORMAL, "cabsl", NULL, NULL, bf_c99_compl },
     250                 :             : 
     251                 :             :   { "__builtin_carg", BT_FN_DOUBLE_DCOMPLEX, BUILT_IN_CABS, BUILT_IN_NORMAL,
     252                 :             :     "carg", NULL, NULL, bf_c99_compl },
     253                 :             :   { "__builtin_cargf", BT_FN_FLOAT_FCOMPLEX, BUILT_IN_CABSF, BUILT_IN_NORMAL,
     254                 :             :     "cargf", NULL, NULL, bf_c99_compl },
     255                 :             :   { "__builtin_cargl", BT_FN_LONG_DOUBLE_LDCOMPLEX, BUILT_IN_CABSL,
     256                 :             :     BUILT_IN_NORMAL, "cargl", NULL, NULL, bf_c99_compl },
     257                 :             : 
     258                 :             :   { "__builtin_conj", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CONJ, BUILT_IN_NORMAL,
     259                 :             :     "carg", NULL, NULL, bf_c99_compl },
     260                 :             :   { "__builtin_conjf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CONJF,
     261                 :             :     BUILT_IN_NORMAL, "conjf", NULL, NULL, bf_c99_compl },
     262                 :             :   { "__builtin_conjl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CONJL,
     263                 :             :     BUILT_IN_NORMAL, "conjl", NULL, NULL, bf_c99_compl },
     264                 :             : 
     265                 :             :   { "__builtin_cpow", BT_FN_DCOMPLEX_DOUBLE_DCOMPLEX, BUILT_IN_CPOW,
     266                 :             :     BUILT_IN_NORMAL, "cpow", NULL, NULL, bf_c99_compl },
     267                 :             :   { "__builtin_cpowf", BT_FN_FCOMPLEX_FLOAT_FCOMPLEX, BUILT_IN_CPOWF,
     268                 :             :     BUILT_IN_NORMAL, "cpowf", NULL, NULL, bf_c99_compl },
     269                 :             :   { "__builtin_cpowl", BT_FN_LDCOMPLEX_LONG_DOUBLE_LDCOMPLEX, BUILT_IN_CPOWL,
     270                 :             :     BUILT_IN_NORMAL, "cpowl", NULL, NULL, bf_c99_compl },
     271                 :             : 
     272                 :             :   { "__builtin_csqrt", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CSQRT,
     273                 :             :     BUILT_IN_NORMAL, "csqrt", NULL, NULL, bf_c99_compl },
     274                 :             :   { "__builtin_csqrtf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CSQRTF,
     275                 :             :     BUILT_IN_NORMAL, "csqrtf", NULL, NULL, bf_c99_compl },
     276                 :             :   { "__builtin_csqrtl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CSQRTL,
     277                 :             :     BUILT_IN_NORMAL, "csqrtl", NULL, NULL, bf_c99_compl },
     278                 :             : 
     279                 :             :   { "__builtin_cexp", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CEXP, BUILT_IN_NORMAL,
     280                 :             :     "cexp", NULL, NULL, bf_c99_compl },
     281                 :             :   { "__builtin_cexpf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CEXPF,
     282                 :             :     BUILT_IN_NORMAL, "cexpf", NULL, NULL, bf_c99_compl },
     283                 :             :   { "__builtin_cexpl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CEXPL,
     284                 :             :     BUILT_IN_NORMAL, "cexpl", NULL, NULL, bf_c99_compl },
     285                 :             : 
     286                 :             :   { "__builtin_clog", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CLOG, BUILT_IN_NORMAL,
     287                 :             :     "clog", NULL, NULL, bf_c99_compl },
     288                 :             :   { "__builtin_clogf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CLOGF, BUILT_IN_NORMAL,
     289                 :             :     "clogf", NULL, NULL, bf_c99_compl },
     290                 :             :   { "__builtin_clogl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CLOGL,
     291                 :             :     BUILT_IN_NORMAL, "clogl", NULL, NULL, bf_c99_compl },
     292                 :             : 
     293                 :             :   { "__builtin_csin", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CSIN, BUILT_IN_NORMAL,
     294                 :             :     "csin", NULL, NULL, bf_c99_compl },
     295                 :             :   { "__builtin_csinf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CSINF,
     296                 :             :     BUILT_IN_NORMAL, "csinf", NULL, NULL, bf_c99_compl },
     297                 :             :   { "__builtin_csinl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CSINL,
     298                 :             :     BUILT_IN_NORMAL, "csinl", NULL, NULL, bf_c99_compl },
     299                 :             : 
     300                 :             :   { "__builtin_ccos", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CCOS, BUILT_IN_NORMAL,
     301                 :             :     "ccos", NULL, NULL, bf_c99_compl },
     302                 :             :   { "__builtin_ccosf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CCOSF,
     303                 :             :     BUILT_IN_NORMAL, "ccosf", NULL, NULL, bf_c99_compl },
     304                 :             :   { "__builtin_ccosl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CCOSL,
     305                 :             :     BUILT_IN_NORMAL, "ccosl", NULL, NULL, bf_c99_compl },
     306                 :             : 
     307                 :             :   { "__builtin_ctan", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CTAN, BUILT_IN_NORMAL,
     308                 :             :     "ctan", NULL, NULL, bf_c99_compl },
     309                 :             :   { "__builtin_ctanf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CTANF,
     310                 :             :     BUILT_IN_NORMAL, "ctanf", NULL, NULL, bf_c99_compl },
     311                 :             :   { "__builtin_ctanl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CTANL,
     312                 :             :     BUILT_IN_NORMAL, "ctanl", NULL, NULL, bf_c99_compl },
     313                 :             : 
     314                 :             :   { "__builtin_casin", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CASIN,
     315                 :             :     BUILT_IN_NORMAL, "casin", NULL, NULL, bf_c99_compl },
     316                 :             :   { "__builtin_casinf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CASINF,
     317                 :             :     BUILT_IN_NORMAL, "casinf", NULL, NULL, bf_c99_compl },
     318                 :             :   { "__builtin_casinl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CASINL,
     319                 :             :     BUILT_IN_NORMAL, "casinl", NULL, NULL, bf_c99_compl },
     320                 :             : 
     321                 :             :   { "__builtin_cacos", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CACOS,
     322                 :             :     BUILT_IN_NORMAL, "cacos", NULL, NULL, bf_c99_compl },
     323                 :             :   { "__builtin_cacosf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CACOSF,
     324                 :             :     BUILT_IN_NORMAL, "cacosf", NULL, NULL, bf_c99_compl },
     325                 :             :   { "__builtin_cacosl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CACOSL,
     326                 :             :     BUILT_IN_NORMAL, "cacosl", NULL, NULL, bf_c99_compl },
     327                 :             : 
     328                 :             :   { "__builtin_catan", BT_FN_DCOMPLEX_DCOMPLEX, BUILT_IN_CATAN,
     329                 :             :     BUILT_IN_NORMAL, "catan", NULL, NULL, bf_c99_compl },
     330                 :             :   { "__builtin_catanf", BT_FN_FCOMPLEX_FCOMPLEX, BUILT_IN_CATANF,
     331                 :             :     BUILT_IN_NORMAL, "catanf", NULL, NULL, bf_c99_compl },
     332                 :             :   { "__builtin_catanl", BT_FN_LDCOMPLEX_LDCOMPLEX, BUILT_IN_CATANL,
     333                 :             :     BUILT_IN_NORMAL, "catanl", NULL, NULL, bf_c99_compl },
     334                 :             : 
     335                 :             :   { "__builtin_huge_val", BT_FN_DOUBLE, BUILT_IN_HUGE_VAL, BUILT_IN_NORMAL,
     336                 :             :     "huge_val", NULL, NULL, bf_gcc },
     337                 :             :   { "__builtin_huge_valf", BT_FN_FLOAT, BUILT_IN_HUGE_VALF, BUILT_IN_NORMAL,
     338                 :             :     "huge_valf", NULL, NULL, bf_gcc },
     339                 :             :   { "__builtin_huge_vall", BT_FN_LONG_DOUBLE, BUILT_IN_HUGE_VALL,
     340                 :             :     BUILT_IN_NORMAL, "huge_vall", NULL, NULL, bf_gcc },
     341                 :             : 
     342                 :             :   { "__builtin_index", BT_FN_STRING_CONST_STRING_INT, BUILT_IN_INDEX,
     343                 :             :     BUILT_IN_NORMAL, "index", NULL, NULL, bf_extension_lib },
     344                 :             :   { "__builtin_rindex", BT_FN_STRING_CONST_STRING_INT, BUILT_IN_RINDEX,
     345                 :             :     BUILT_IN_NORMAL, "rindex", NULL, NULL, bf_extension_lib },
     346                 :             :   { "__builtin_memcmp", BT_FN_INT_CONST_PTR_CONST_PTR_SIZE, BUILT_IN_MEMCMP,
     347                 :             :     BUILT_IN_NORMAL, "memcmp", NULL, NULL, bf_default_lib },
     348                 :             :   { "__builtin_memmove", BT_FN_TRAD_PTR_PTR_CONST_PTR_SIZE, BUILT_IN_MEMMOVE,
     349                 :             :     BUILT_IN_NORMAL, "memmove", NULL, NULL, bf_default_lib },
     350                 :             :   { "__builtin_memset", BT_FN_TRAD_PTR_PTR_INT_SIZE, BUILT_IN_MEMSET,
     351                 :             :     BUILT_IN_NORMAL, "memset", NULL, NULL, bf_default_lib },
     352                 :             :   { "__builtin_strcat", BT_FN_STRING_STRING_CONST_STRING, BUILT_IN_STRCAT,
     353                 :             :     BUILT_IN_NORMAL, "strcat", NULL, NULL, bf_default_lib },
     354                 :             :   { "__builtin_strncat", BT_FN_STRING_STRING_CONST_STRING_SIZE,
     355                 :             :     BUILT_IN_STRNCAT, BUILT_IN_NORMAL, "strncat", NULL, NULL, bf_default_lib },
     356                 :             :   { "__builtin_strcpy", BT_FN_STRING_STRING_CONST_STRING, BUILT_IN_STRCPY,
     357                 :             :     BUILT_IN_NORMAL, "strcpy", NULL, NULL, bf_default_lib },
     358                 :             :   { "__builtin_strncpy", BT_FN_STRING_STRING_CONST_STRING_SIZE,
     359                 :             :     BUILT_IN_STRNCPY, BUILT_IN_NORMAL, "strncpy", NULL, NULL, bf_default_lib },
     360                 :             :   { "__builtin_strcmp", BT_FN_INT_CONST_STRING_CONST_STRING, BUILT_IN_STRCMP,
     361                 :             :     BUILT_IN_NORMAL, "strcmp", NULL, NULL, bf_default_lib },
     362                 :             :   { "__builtin_strncmp", BT_FN_INT_CONST_STRING_CONST_STRING_SIZE,
     363                 :             :     BUILT_IN_STRNCMP, BUILT_IN_NORMAL, "strncmp", NULL, NULL, bf_default_lib },
     364                 :             :   { "__builtin_strlen", BT_FN_INT_CONST_STRING, BUILT_IN_STRLEN,
     365                 :             :     BUILT_IN_NORMAL, "strlen", NULL, NULL, bf_default_lib },
     366                 :             :   { "__builtin_strstr", BT_FN_STRING_CONST_STRING_CONST_STRING,
     367                 :             :     BUILT_IN_STRSTR, BUILT_IN_NORMAL, "strstr", NULL, NULL, bf_default_lib },
     368                 :             :   { "__builtin_strpbrk", BT_FN_STRING_CONST_STRING_CONST_STRING,
     369                 :             :     BUILT_IN_STRPBRK, BUILT_IN_NORMAL, "strpbrk", NULL, NULL, bf_default_lib },
     370                 :             :   { "__builtin_strspn", BT_FN_SIZE_CONST_STRING_CONST_STRING, BUILT_IN_STRSPN,
     371                 :             :     BUILT_IN_NORMAL, "strspn", NULL, NULL, bf_default_lib },
     372                 :             :   { "__builtin_strcspn", BT_FN_SIZE_CONST_STRING_CONST_STRING,
     373                 :             :     BUILT_IN_STRCSPN, BUILT_IN_NORMAL, "strcspn", NULL, NULL, bf_default_lib },
     374                 :             :   { "__builtin_strchr", BT_FN_STRING_CONST_STRING_INT, BUILT_IN_STRCHR,
     375                 :             :     BUILT_IN_NORMAL, "strchr", NULL, NULL, bf_default_lib },
     376                 :             :   { "__builtin_strrchr", BT_FN_STRING_CONST_STRING_INT, BUILT_IN_STRCHR,
     377                 :             :     BUILT_IN_NORMAL, "strrchr", NULL, NULL, bf_default_lib },
     378                 :             :   { "__builtin_frame_address", BT_FN_PTR_UNSIGNED, BUILT_IN_FRAME_ADDRESS,
     379                 :             :     BUILT_IN_NORMAL, "frame_address", NULL, NULL, bf_gcc },
     380                 :             :   { "__builtin_return_address", BT_FN_PTR_UNSIGNED, BUILT_IN_RETURN_ADDRESS,
     381                 :             :     BUILT_IN_NORMAL, "return_address", NULL, NULL, bf_gcc },
     382                 :             :   { "__builtin_longjmp", BT_FN_VOID_PTR_INT, BUILT_IN_LONGJMP, BUILT_IN_NORMAL,
     383                 :             :     "longjmp", NULL, NULL, bf_gcc },
     384                 :             :   { "__builtin_setjmp", BT_FN_INT_PTR, BUILT_IN_SETJMP, BUILT_IN_NORMAL,
     385                 :             :     "setjmp", NULL, NULL, bf_gcc },
     386                 :             :   { NULL, BT_FN_NONE, 0, NOT_BUILT_IN, "", NULL, NULL, bf_false}
     387                 :             : };
     388                 :             : 
     389                 :             : struct builtin_type_info
     390                 :             : {
     391                 :             :   const char *name;
     392                 :             :   unsigned int returnType;
     393                 :             :   tree (*functionHandler) (location_t, tree);
     394                 :             : };
     395                 :             : 
     396                 :             : struct GTY(()) builtin_macro_definition
     397                 :             : {
     398                 :             :   const char *name;
     399                 :             :   tree function_node;
     400                 :             :   tree return_node;
     401                 :             : };
     402                 :             : 
     403                 :             : static GTY (()) tree sizetype_endlink;
     404                 :             : static GTY (()) tree unsigned_endlink;
     405                 :             : static GTY (()) tree endlink;
     406                 :             : static GTY (()) tree math_endlink;
     407                 :             : static GTY (()) tree int_endlink;
     408                 :             : static GTY (()) tree ptr_endlink;
     409                 :             : static GTY (()) tree const_ptr_endlink;
     410                 :             : static GTY (()) tree double_ftype_void;
     411                 :             : static GTY (()) tree float_ftype_void;
     412                 :             : static GTY (()) tree ldouble_ftype_void;
     413                 :             : static GTY (()) tree float_ftype_float;
     414                 :             : static GTY (()) tree double_ftype_double;
     415                 :             : static GTY (()) tree ldouble_ftype_ldouble;
     416                 :             : static GTY (()) tree gm2_alloca_node;
     417                 :             : static GTY (()) tree gm2_memcpy_node;
     418                 :             : static GTY (()) tree gm2_memset_node;
     419                 :             : static GTY (()) tree gm2_isfinite_node;
     420                 :             : static GTY (()) tree gm2_isnan_node;
     421                 :             : static GTY (()) tree gm2_huge_valf_node;
     422                 :             : static GTY (()) tree gm2_huge_val_node;
     423                 :             : static GTY (()) tree gm2_huge_vall_node;
     424                 :             : static GTY (()) tree long_doubleptr_type_node;
     425                 :             : static GTY (()) tree doubleptr_type_node;
     426                 :             : static GTY (()) tree floatptr_type_node;
     427                 :             : static GTY (()) tree builtin_ftype_int_var;
     428                 :             : static GTY (()) vec<builtin_macro_definition, va_gc> *builtin_macros;
     429                 :             : 
     430                 :             : /* Prototypes for locally defined functions.  */
     431                 :             : static tree DoBuiltinAlloca (location_t location, tree n);
     432                 :             : static tree DoBuiltinMemCopy (location_t location, tree dest, tree src,
     433                 :             :                               tree n);
     434                 :             : static tree DoBuiltinIsfinite (location_t location, tree value);
     435                 :             : static tree DoBuiltinIsnan (location_t location, tree value);
     436                 :             : static void create_function_prototype (location_t location,
     437                 :             :                                        struct builtin_function_entry *fe);
     438                 :             : static tree doradix (location_t location, tree type);
     439                 :             : static tree doplaces (location_t location, tree type);
     440                 :             : static tree doexponentmin (location_t location, tree type);
     441                 :             : static tree doexponentmax (location_t location, tree type);
     442                 :             : static tree dolarge (location_t location, tree type);
     443                 :             : static tree dosmall (location_t location, tree type);
     444                 :             : static tree doiec559 (location_t location, tree type);
     445                 :             : static tree dolia1 (location_t location, tree type);
     446                 :             : static tree doiso (location_t location, tree type);
     447                 :             : static tree doieee (location_t location, tree type);
     448                 :             : static tree dorounds (location_t location, tree type);
     449                 :             : static tree dogUnderflow (location_t location, tree type);
     450                 :             : static tree doexception (location_t location, tree type);
     451                 :             : static tree doextend (location_t location, tree type);
     452                 :             : static tree donModes (location_t location, tree type);
     453                 :             : /* Prototypes finish here.  */
     454                 :             : 
     455                 :             : #define m2builtins_c
     456                 :             : #include "m2builtins.h"
     457                 :             : 
     458                 :             : static struct builtin_type_info m2_type_info[] = {
     459                 :             :   { "radix", 2, doradix },
     460                 :             :   { "places", 2, doplaces },
     461                 :             :   { "expoMin", 2, doexponentmin },
     462                 :             :   { "expoMax", 2, doexponentmax },
     463                 :             :   { "large", 3, dolarge },
     464                 :             :   { "small", 3, dosmall },
     465                 :             :   { "IEC559", 1, doiec559 },
     466                 :             :   { "LIA1", 1, dolia1 },
     467                 :             :   { "ISO", 1, doiso },
     468                 :             :   { "IEEE", 1, doieee },
     469                 :             :   { "rounds", 1, dorounds },
     470                 :             :   { "gUnderflow", 1, dogUnderflow },
     471                 :             :   { "exception", 1, doexception },
     472                 :             :   { "extend", 1, doextend },
     473                 :             :   { "nModes", 2, donModes },
     474                 :             :   { NULL, 0, NULL },
     475                 :             : };
     476                 :             : 
     477                 :             : /* Return a definition for a builtin function named NAME and whose
     478                 :             : data type is TYPE.  TYPE should be a function type with argument
     479                 :             : types.  FUNCTION_CODE tells later passes how to compile calls to this
     480                 :             : function.  See tree.h for its possible values.
     481                 :             : 
     482                 :             : If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME, the
     483                 :             : name to be called if we can't opencode the function.  */
     484                 :             : 
     485                 :             : tree
     486                 :     1664829 : builtin_function (location_t location, const char *name, tree type,
     487                 :             :                   int function_code, enum built_in_class fclass,
     488                 :             :                   const char *library_name, tree attrs)
     489                 :             : {
     490                 :     1664829 :   tree decl = add_builtin_function (name, type, function_code, fclass,
     491                 :             :                                     library_name, attrs);
     492                 :     1664829 :   DECL_SOURCE_LOCATION (decl) = location;
     493                 :             : 
     494                 :     1664829 :   m2block_pushDecl (decl);
     495                 :     1664829 :   return decl;
     496                 :             : }
     497                 :             : 
     498                 :             : /* GetBuiltinConst - returns the gcc tree of a builtin constant,
     499                 :             :    name.  NIL is returned if the constant is unknown.  */
     500                 :             : 
     501                 :             : tree
     502                 :       27984 : m2builtins_GetBuiltinConst (char *name)
     503                 :             : {
     504                 :       27984 :   if (strcmp (name, "BITS_PER_UNIT") == 0)
     505                 :       13992 :     return m2decl_BuildIntegerConstant (BITS_PER_UNIT);
     506                 :       13992 :   if (strcmp (name, "BITS_PER_WORD") == 0)
     507                 :           0 :     return m2decl_BuildIntegerConstant (BITS_PER_WORD);
     508                 :       13992 :   if (strcmp (name, "BITS_PER_CHAR") == 0)
     509                 :           0 :     return m2decl_BuildIntegerConstant (CHAR_TYPE_SIZE);
     510                 :       13992 :   if (strcmp (name, "UNITS_PER_WORD") == 0)
     511                 :       14280 :     return m2decl_BuildIntegerConstant (UNITS_PER_WORD);
     512                 :             : 
     513                 :             :   return NULL_TREE;
     514                 :             : }
     515                 :             : 
     516                 :             : /* GetBuiltinConstType - returns the type of a builtin constant,
     517                 :             :    name.  0 = unknown constant name 1 = integer 2 = real.  */
     518                 :             : 
     519                 :             : unsigned int
     520                 :           0 : m2builtins_GetBuiltinConstType (char *name)
     521                 :             : {
     522                 :           0 :   if (strcmp (name, "BITS_PER_UNIT") == 0)
     523                 :             :     return 1;
     524                 :           0 :   if (strcmp (name, "BITS_PER_WORD") == 0)
     525                 :             :     return 1;
     526                 :           0 :   if (strcmp (name, "BITS_PER_CHAR") == 0)
     527                 :             :     return 1;
     528                 :           0 :   if (strcmp (name, "UNITS_PER_WORD") == 0)
     529                 :           0 :     return 1;
     530                 :             : 
     531                 :             :   return 0;
     532                 :             : }
     533                 :             : 
     534                 :             : /* GetBuiltinTypeInfoType - returns value: 0 is ident is unknown.  1
     535                 :             :    if ident is IEC559, LIA1, ISO, IEEE, rounds, underflow, exception,
     536                 :             :    extend.  2 if ident is radix, places, exponentmin, exponentmax,
     537                 :             :    noofmodes.  3 if ident is large, small.  */
     538                 :             : 
     539                 :             : unsigned int
     540                 :         360 : m2builtins_GetBuiltinTypeInfoType (const char *ident)
     541                 :             : {
     542                 :         360 :   int i = 0;
     543                 :             : 
     544                 :        2880 :   while (m2_type_info[i].name != NULL)
     545                 :        2880 :     if (strcmp (m2_type_info[i].name, ident) == 0)
     546                 :         360 :       return m2_type_info[i].returnType;
     547                 :             :     else
     548                 :        2520 :       i++;
     549                 :             :   return 0;
     550                 :             : }
     551                 :             : 
     552                 :             : /* GetBuiltinTypeInfo - returns value: NULL_TREE if ident is unknown.
     553                 :             :    boolean Tree if ident is IEC559, LIA1, ISO, IEEE, rounds,
     554                 :             :    underflow, exception, extend.  ZType Tree if ident is radix,
     555                 :             :    places, exponentmin, exponentmax, noofmodes.
     556                 :             :    RType Tree if ident is large, small.  */
     557                 :             : 
     558                 :             : tree
     559                 :         360 : m2builtins_GetBuiltinTypeInfo (location_t location, tree type,
     560                 :             :                                const char *ident)
     561                 :             : {
     562                 :         360 :   int i = 0;
     563                 :             : 
     564                 :         360 :   type = m2tree_skip_type_decl (type);
     565                 :        3240 :   while (m2_type_info[i].name != NULL)
     566                 :        2880 :     if (strcmp (m2_type_info[i].name, ident) == 0)
     567                 :         360 :       return (*m2_type_info[i].functionHandler) (location, type);
     568                 :             :     else
     569                 :        2520 :       i++;
     570                 :             :   return NULL_TREE;
     571                 :             : }
     572                 :             : 
     573                 :             : /* doradix - returns the radix of the floating point, type.  */
     574                 :             : 
     575                 :             : static tree
     576                 :          24 : doradix (location_t location ATTRIBUTE_UNUSED, tree type)
     577                 :             : {
     578                 :          24 :   if (SCALAR_FLOAT_TYPE_P (type))
     579                 :             :     {
     580                 :          24 :       enum machine_mode mode = TYPE_MODE (type);
     581                 :          24 :       int radix = REAL_MODE_FORMAT (mode)->b;
     582                 :          24 :       return m2decl_BuildIntegerConstant (radix);
     583                 :             :     }
     584                 :             :   else
     585                 :             :     return NULL_TREE;
     586                 :             : }
     587                 :             : 
     588                 :             : /* doplaces - returns the whole number value of the number of radix
     589                 :             :    places used to store values of the corresponding real number type.  */
     590                 :             : 
     591                 :             : static tree
     592                 :          24 : doplaces (location_t location ATTRIBUTE_UNUSED, tree type)
     593                 :             : {
     594                 :          24 :   if (SCALAR_FLOAT_TYPE_P (type))
     595                 :             :     {
     596                 :             :       /* Taken from c-family/c-cppbuiltin.cc.  */
     597                 :             :       /* The number of decimal digits, q, such that any floating-point
     598                 :             :          number with q decimal digits can be rounded into a
     599                 :             :          floating-point number with p radix b digits and back again
     600                 :             :          without change to the q decimal digits, p log10 b if b is a
     601                 :             :          power of 10 floor((p - 1) log10 b) otherwise.  */
     602                 :          24 :       enum machine_mode mode = TYPE_MODE (type);
     603                 :          24 :       const struct real_format *fmt = REAL_MODE_FORMAT (mode);
     604                 :          24 :       const double log10_2 = .30102999566398119521;
     605                 :          24 :       double log10_b = log10_2;
     606                 :          24 :       int digits = (fmt->p - 1) * log10_b;
     607                 :          24 :       return m2decl_BuildIntegerConstant (digits);
     608                 :             :     }
     609                 :             :   else
     610                 :             :     return NULL_TREE;
     611                 :             : }
     612                 :             : 
     613                 :             : /* doexponentmin - returns the whole number of the exponent minimum.  */
     614                 :             : 
     615                 :             : static tree
     616                 :          24 : doexponentmin (location_t location ATTRIBUTE_UNUSED, tree type)
     617                 :             : {
     618                 :          24 :   if (SCALAR_FLOAT_TYPE_P (type))
     619                 :             :     {
     620                 :          24 :       enum machine_mode mode = TYPE_MODE (type);
     621                 :          24 :       int emin = REAL_MODE_FORMAT (mode)->emin;
     622                 :          24 :       return m2decl_BuildIntegerConstant (emin);
     623                 :             :     }
     624                 :             :   else
     625                 :             :     return NULL_TREE;
     626                 :             : }
     627                 :             : 
     628                 :             : /* doexponentmax - returns the whole number of the exponent maximum.  */
     629                 :             : 
     630                 :             : static tree
     631                 :          24 : doexponentmax (location_t location ATTRIBUTE_UNUSED, tree type)
     632                 :             : {
     633                 :          24 :   if (SCALAR_FLOAT_TYPE_P (type))
     634                 :             :     {
     635                 :          24 :       enum machine_mode mode = TYPE_MODE (type);
     636                 :          24 :       int emax = REAL_MODE_FORMAT (mode)->emax;
     637                 :          24 :       return m2decl_BuildIntegerConstant (emax);
     638                 :             :     }
     639                 :             :   else
     640                 :             :     return NULL_TREE;
     641                 :             : }
     642                 :             : 
     643                 :             : static tree
     644                 :          24 : computeLarge (tree type)
     645                 :             : {
     646                 :          24 :   enum machine_mode mode = TYPE_MODE (type);
     647                 :          24 :   const struct real_format *fmt = REAL_MODE_FORMAT (mode);
     648                 :          24 :   REAL_VALUE_TYPE real;
     649                 :          24 :   char buf[128];
     650                 :             : 
     651                 :             :   /* Shamelessly taken from c-cppbuiltin.cc:builtin_define_float_constants.  */
     652                 :             : 
     653                 :             :   /* Since, for the supported formats, B is always a power of 2, we
     654                 :             :   construct the following numbers directly as a hexadecimal constants.  */
     655                 :             : 
     656                 :          24 :   get_max_float (fmt, buf, sizeof (buf), false);
     657                 :          24 :   real_from_string (&real, buf);
     658                 :          24 :   return build_real (type, real);
     659                 :             : }
     660                 :             : 
     661                 :             : /* dolarge - return the largest value of the corresponding real type.  */
     662                 :             : 
     663                 :             : static tree
     664                 :          24 : dolarge (location_t location ATTRIBUTE_UNUSED, tree type)
     665                 :             : {
     666                 :          24 :   if (SCALAR_FLOAT_TYPE_P (type))
     667                 :          24 :     return computeLarge (type);
     668                 :             :   return NULL_TREE;
     669                 :             : }
     670                 :             : 
     671                 :             : static tree
     672                 :          24 : computeSmall (tree type)
     673                 :             : {
     674                 :          24 :   enum machine_mode mode = TYPE_MODE (type);
     675                 :          24 :   const struct real_format *fmt = REAL_MODE_FORMAT (mode);
     676                 :          24 :   REAL_VALUE_TYPE real;
     677                 :          24 :   char buf[128];
     678                 :             : 
     679                 :             :   /* The minimum normalized positive floating-point number,
     680                 :             :   b**(emin-1).  */
     681                 :             : 
     682                 :          24 :   sprintf (buf, "0x1p%d", fmt->emin - 1);
     683                 :          24 :   real_from_string (&real, buf);
     684                 :          24 :   return build_real (type, real);
     685                 :             : }
     686                 :             : 
     687                 :             : /* dosmall - return the smallest positive value of the corresponding
     688                 :             :    real type.  */
     689                 :             : 
     690                 :             : static tree
     691                 :          24 : dosmall (location_t location ATTRIBUTE_UNUSED, tree type)
     692                 :             : {
     693                 :          24 :   if (SCALAR_FLOAT_TYPE_P (type))
     694                 :          24 :     return computeSmall (type);
     695                 :             :   return NULL_TREE;
     696                 :             : }
     697                 :             : 
     698                 :             : /* doiec559 - a boolean value that is true if and only if the
     699                 :             :    implementation of the corresponding real number type conforms to
     700                 :             :    IEC 559:1989 (also known as IEEE 754:1987) in all regards.  */
     701                 :             : 
     702                 :             : static tree
     703                 :          24 : doiec559 (location_t location, tree type)
     704                 :             : {
     705                 :          24 :   if (m2expr_IsTrue (m2expr_BuildEqualTo (location,
     706                 :             :                                           m2decl_BuildIntegerConstant (32),
     707                 :             :                                           m2expr_GetSizeOfInBits (type))))
     708                 :           0 :     return m2type_GetBooleanTrue ();
     709                 :          24 :   if (m2expr_IsTrue (m2expr_BuildEqualTo (location,
     710                 :             :                                           m2decl_BuildIntegerConstant (64),
     711                 :             :                                           m2expr_GetSizeOfInBits (type))))
     712                 :           0 :     return m2type_GetBooleanTrue ();
     713                 :          24 :   return m2type_GetBooleanFalse ();
     714                 :             : }
     715                 :             : 
     716                 :             : /* dolia1 - returns TRUE if using ieee (currently always TRUE).  */
     717                 :             : 
     718                 :             : static tree
     719                 :          24 : dolia1 (location_t location, tree type)
     720                 :             : {
     721                 :          48 :   return doieee (location, type);
     722                 :             : }
     723                 :             : 
     724                 :             : /* doiso - returns TRUE if using ieee (--fixme--).  */
     725                 :             : 
     726                 :             : static tree
     727                 :          24 : doiso (location_t location, tree type)
     728                 :             : {
     729                 :          48 :   return doieee (location, type);
     730                 :             : }
     731                 :             : 
     732                 :             : /* doieee - returns TRUE if ieee arithmetic is being used.  */
     733                 :             : 
     734                 :             : static tree
     735                 :          72 : doieee (location_t location ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED)
     736                 :             : {
     737                 :             :   /* --fixme-- maybe we should look for the -mno-ieee flag and return this
     738                 :             :      result.  */
     739                 :          72 :   return m2type_GetBooleanTrue ();
     740                 :             : }
     741                 :             : 
     742                 :             : /* dorounds - returns TRUE if and only if each operation produces a
     743                 :             :    result that is one of the values of the corresponding real number
     744                 :             :    type nearest to the mathematical result.  */
     745                 :             : 
     746                 :             : static tree
     747                 :          24 : dorounds (location_t location ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED)
     748                 :             : {
     749                 :          24 :   if (FLT_ROUNDS)
     750                 :          24 :     return m2type_GetBooleanTrue ();
     751                 :             :   else
     752                 :             :     return m2type_GetBooleanFalse ();
     753                 :             : }
     754                 :             : 
     755                 :             : /* dogUnderflow - returns TRUE if and only if there are values of the
     756                 :             :    corresponding real number type between 0.0 and small.  */
     757                 :             : 
     758                 :             : static tree
     759                 :          24 : dogUnderflow (location_t location ATTRIBUTE_UNUSED, tree type)
     760                 :             : {
     761                 :          24 :   if (SCALAR_FLOAT_TYPE_P (type))
     762                 :             :     {
     763                 :          24 :       enum machine_mode mode = TYPE_MODE (type);
     764                 :          24 :       const struct real_format *fmt = REAL_MODE_FORMAT (mode);
     765                 :          24 :       if (fmt->has_denorm)
     766                 :          24 :         return m2type_GetBooleanTrue ();
     767                 :             :       else
     768                 :           0 :         return m2type_GetBooleanFalse ();
     769                 :             :     }
     770                 :             :   return NULL_TREE;
     771                 :             : }
     772                 :             : 
     773                 :             : /* doexception - */
     774                 :             : 
     775                 :             : static tree
     776                 :          24 : doexception (location_t location ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED)
     777                 :             : {
     778                 :          24 :   return m2type_GetBooleanTrue ();
     779                 :             : }
     780                 :             : 
     781                 :             : /* doextend - */
     782                 :             : 
     783                 :             : static tree
     784                 :          24 : doextend (location_t location ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED)
     785                 :             : {
     786                 :          24 :   return m2type_GetBooleanTrue ();
     787                 :             : }
     788                 :             : 
     789                 :             : /* donModes - */
     790                 :             : 
     791                 :             : static tree
     792                 :          24 : donModes (location_t location ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED)
     793                 :             : {
     794                 :          24 :   return m2decl_BuildIntegerConstant (1);
     795                 :             : }
     796                 :             : 
     797                 :             : /* BuiltinMemCopy - copy n bytes of memory efficiently from address
     798                 :             :    src to dest.  */
     799                 :             : 
     800                 :             : tree
     801                 :        5788 : m2builtins_BuiltinMemCopy (location_t location, tree dest, tree src, tree n)
     802                 :             : {
     803                 :        5788 :   return DoBuiltinMemCopy (location, dest, src, n);
     804                 :             : }
     805                 :             : 
     806                 :             : 
     807                 :             : static tree
     808                 :           0 : DoBuiltinMemSet (location_t location, tree ptr, tree bytevalue, tree nbytes)
     809                 :             : {
     810                 :           0 :   tree functype = TREE_TYPE (gm2_memset_node);
     811                 :           0 :   tree funcptr
     812                 :           0 :       = build1 (ADDR_EXPR, build_pointer_type (functype), gm2_memset_node);
     813                 :           0 :   tree call
     814                 :           0 :       = m2treelib_DoCall3 (location, ptr_type_node, funcptr, ptr, bytevalue, nbytes);
     815                 :           0 :   return call;
     816                 :             : }
     817                 :             : 
     818                 :             : /* BuiltinMemSet set copy n bytes of memory efficiently from address
     819                 :             :    src to dest.  */
     820                 :             : 
     821                 :             : tree
     822                 :           0 : m2builtins_BuiltinMemSet (location_t location, tree ptr, tree bytevalue, tree nbytes)
     823                 :             : {
     824                 :           0 :   return DoBuiltinMemSet (location, ptr, bytevalue, nbytes);
     825                 :             : }
     826                 :             : 
     827                 :             : /* BuiltInAlloca - given an expression, n, allocate, n, bytes on the
     828                 :             :    stack for the life of the current function.  */
     829                 :             : 
     830                 :             : tree
     831                 :        4352 : m2builtins_BuiltInAlloca (location_t location, tree n)
     832                 :             : {
     833                 :        4352 :   return DoBuiltinAlloca (location, n);
     834                 :             : }
     835                 :             : 
     836                 :             : /* BuiltInIsfinite - return integer 1 if the real expression is
     837                 :             :    finite otherwise return integer 0.  */
     838                 :             : 
     839                 :             : tree
     840                 :        3116 : m2builtins_BuiltInIsfinite (location_t location, tree expression)
     841                 :             : {
     842                 :        3116 :   return DoBuiltinIsfinite (location, expression);
     843                 :             : }
     844                 :             : 
     845                 :             : /* BuiltInIsnan - return integer 1 if the real expression is
     846                 :             :    nan otherwise return integer 0.  */
     847                 :             : 
     848                 :             : tree
     849                 :           0 : m2builtins_BuiltInIsnan (location_t location, tree expression)
     850                 :             : {
     851                 :           0 :   return DoBuiltinIsnan (location, expression);
     852                 :             : }
     853                 :             : 
     854                 :             : 
     855                 :             : /* do_target_support_exists returns true if the builting function
     856                 :             :    is supported by the target.  */
     857                 :             : 
     858                 :             : static
     859                 :             : bool
     860                 :         792 : do_target_support_exists (struct builtin_function_entry *fe)
     861                 :             : {
     862                 :         792 :   tree type = TREE_TYPE (fe->function_node);
     863                 :             : 
     864                 :         792 :   switch (fe->function_avail)
     865                 :             :     {
     866                 :             :     case bf_true:
     867                 :             :       return true;
     868                 :           0 :     case bf_false:
     869                 :           0 :       return false;
     870                 :             :     case bf_extension_lib:
     871                 :             :       return true;
     872                 :             :     case bf_default_lib:
     873                 :             :       return true;
     874                 :             :     case bf_gcc:
     875                 :             :       return true;
     876                 :          48 :     case bf_c99:
     877                 :          48 :       return targetm.libc_has_function (function_c99_misc, type);
     878                 :         380 :     case bf_c99_c90res:
     879                 :         380 :       return targetm.libc_has_function (function_c99_misc, type);
     880                 :             :     case bf_extension_lib_floatn:
     881                 :             :       return true;
     882                 :           0 :     case bf_c99_compl:
     883                 :           0 :       return targetm.libc_has_function (function_c99_math_complex, type);
     884                 :           0 :     default:
     885                 :           0 :       gcc_unreachable ();
     886                 :             :     }
     887                 :             :   return false;
     888                 :             : }
     889                 :             : 
     890                 :             : 
     891                 :             : static
     892                 :             : bool
     893                 :         792 : target_support_exists (struct builtin_function_entry *fe)
     894                 :             : {
     895                 :             : #if defined(DEBUGGING)
     896                 :             :   printf ("target_support_exists (%s): ", fe->library_name);
     897                 :             : #endif
     898                 :         792 :   if (do_target_support_exists (fe))
     899                 :             :     {
     900                 :             : #if defined(DEBUGGING)
     901                 :             :       printf ("yes\n");
     902                 :             : #endif
     903                 :             :       return true;
     904                 :             :     }
     905                 :             :   else
     906                 :             :     {
     907                 :             : #if defined(DEBUGGING)
     908                 :             :       printf ("no\n");
     909                 :             : #endif
     910                 :           0 :       return false;
     911                 :             :     }
     912                 :             : }
     913                 :             : 
     914                 :             : 
     915                 :             : /* BuiltinExists - returns TRUE if the builtin function, name, exists
     916                 :             :    for this target architecture.  */
     917                 :             : 
     918                 :             : bool
     919                 :        8850 : m2builtins_BuiltinExists (char *name)
     920                 :             : {
     921                 :        8850 :   struct builtin_function_entry *fe;
     922                 :             : 
     923                 :      434102 :   for (fe = &list_of_builtins[0]; fe->name != NULL; fe++)
     924                 :      432482 :     if (strcmp (name, fe->name) == 0)
     925                 :             :       return true;
     926                 :             :       // return target_support_exists (fe);
     927                 :        1620 :   int length = vec_safe_length (builtin_macros);
     928                 :       30024 :   for (int idx = 0; idx < length; idx++)
     929                 :       29160 :     if (strcmp ((*builtin_macros)[idx].name, name) == 0)
     930                 :             :       return true;
     931                 :             :   return false;
     932                 :             : }
     933                 :             : 
     934                 :             : /* lookup_builtin_function returns a builtin macro.  */
     935                 :             : 
     936                 :             : static
     937                 :             : tree
     938                 :         108 : lookup_builtin_macro (location_t location, char *name)
     939                 :             : {
     940                 :         108 :   int length = vec_safe_length (builtin_macros);
     941                 :        1080 :   for (int idx = 0; idx < length; idx++)
     942                 :        1080 :     if (strcmp ((*builtin_macros)[idx].name, name) == 0)
     943                 :             :       {
     944                 :         108 :         tree functype = TREE_TYPE ((*builtin_macros)[idx].function_node);
     945                 :         108 :         tree funcptr = build1 (ADDR_EXPR, build_pointer_type (functype),
     946                 :             :                                (*builtin_macros)[idx].function_node);
     947                 :         216 :         tree call = m2treelib_DoCall (
     948                 :         108 :            location, (*builtin_macros)[idx].return_node,
     949                 :             :            funcptr, m2statement_GetParamList ());
     950                 :         108 :         m2statement_SetLastFunction (call);
     951                 :         108 :         m2statement_SetParamList (NULL_TREE);
     952                 :         108 :         if ((*builtin_macros)[idx].return_node == void_type_node)
     953                 :           0 :           m2statement_SetLastFunction (NULL_TREE);
     954                 :         108 :         return call;
     955                 :             :       }
     956                 :             :   return NULL_TREE;
     957                 :             : }
     958                 :             : 
     959                 :             : /* lookup_builtin_function returns a builtin function.  */
     960                 :             : 
     961                 :             : static
     962                 :             : tree
     963                 :         900 : lookup_builtin_function (location_t location, char *name)
     964                 :             : {
     965                 :         900 :   struct builtin_function_entry *fe;
     966                 :             : 
     967                 :       41362 :   for (fe = &list_of_builtins[0]; fe->name != NULL; fe++)
     968                 :       41254 :     if ((strcmp (name, fe->name) == 0) && target_support_exists (fe))
     969                 :             :       {
     970                 :         792 :         tree functype = TREE_TYPE (fe->function_node);
     971                 :         792 :         tree funcptr = build1 (ADDR_EXPR, build_pointer_type (functype),
     972                 :             :                                fe->function_node);
     973                 :         792 :         tree call = m2treelib_DoCall (
     974                 :             :            location, fe->return_node, funcptr, m2statement_GetParamList ());
     975                 :         792 :         m2statement_SetLastFunction (call);
     976                 :         792 :         m2statement_SetParamList (NULL_TREE);
     977                 :         792 :         if (fe->return_node == void_type_node)
     978                 :          24 :           m2statement_SetLastFunction (NULL_TREE);
     979                 :         792 :         return call;
     980                 :             :       }
     981                 :             :   return NULL_TREE;
     982                 :             : }
     983                 :             : 
     984                 :             : /* BuildBuiltinTree - returns a Tree containing the builtin function,
     985                 :             :    name.  */
     986                 :             : 
     987                 :             : tree
     988                 :         900 : m2builtins_BuildBuiltinTree (location_t location, char *name)
     989                 :             : {
     990                 :         900 :   tree call;
     991                 :         900 :   m2statement_SetLastFunction (NULL_TREE);
     992                 :             : 
     993                 :         900 :   call = lookup_builtin_function (location, name);
     994                 :         900 :   if (call == NULL_TREE)
     995                 :             :     {
     996                 :         108 :       call = lookup_builtin_macro (location, name);
     997                 :         108 :       if (call == NULL_TREE)
     998                 :             :         {
     999                 :           0 :           m2statement_SetParamList (NULL_TREE);
    1000                 :           0 :           return m2statement_GetLastFunction ();
    1001                 :             :         }
    1002                 :             :     }
    1003                 :             :   return call;
    1004                 :             : }
    1005                 :             : 
    1006                 :             : static tree
    1007                 :        5788 : DoBuiltinMemCopy (location_t location, tree dest, tree src, tree bytes)
    1008                 :             : {
    1009                 :        5788 :   tree functype = TREE_TYPE (gm2_memcpy_node);
    1010                 :        5788 :   tree funcptr
    1011                 :        5788 :       = build1 (ADDR_EXPR, build_pointer_type (functype), gm2_memcpy_node);
    1012                 :        5788 :   tree call
    1013                 :        5788 :       = m2treelib_DoCall3 (location, ptr_type_node, funcptr, dest, src, bytes);
    1014                 :        5788 :   return call;
    1015                 :             : }
    1016                 :             : 
    1017                 :             : static tree
    1018                 :        4352 : DoBuiltinAlloca (location_t location, tree bytes)
    1019                 :             : {
    1020                 :        4352 :   tree functype = TREE_TYPE (gm2_alloca_node);
    1021                 :        4352 :   tree funcptr
    1022                 :        4352 :       = build1 (ADDR_EXPR, build_pointer_type (functype), gm2_alloca_node);
    1023                 :        4352 :   tree call = m2treelib_DoCall1 (location, ptr_type_node, funcptr, bytes);
    1024                 :             : 
    1025                 :        4352 :   return call;
    1026                 :             : }
    1027                 :             : 
    1028                 :             : static tree
    1029                 :        3116 : DoBuiltinIsfinite (location_t location, tree value)
    1030                 :             : {
    1031                 :        3116 :   tree functype = TREE_TYPE (gm2_isfinite_node);
    1032                 :        3116 :   tree funcptr
    1033                 :        3116 :       = build1 (ADDR_EXPR, build_pointer_type (functype), gm2_isfinite_node);
    1034                 :        3116 :   tree call = m2treelib_DoCall1 (location, ptr_type_node, funcptr, value);
    1035                 :             : 
    1036                 :        3116 :   return call;
    1037                 :             : }
    1038                 :             : 
    1039                 :             : static tree
    1040                 :           0 : DoBuiltinIsnan (location_t location, tree value)
    1041                 :             : {
    1042                 :           0 :   tree functype = TREE_TYPE (gm2_isnan_node);
    1043                 :           0 :   tree funcptr
    1044                 :           0 :       = build1 (ADDR_EXPR, build_pointer_type (functype), gm2_isnan_node);
    1045                 :           0 :   tree call = m2treelib_DoCall1 (location, ptr_type_node, funcptr, value);
    1046                 :             : 
    1047                 :           0 :   return call;
    1048                 :             : }
    1049                 :             : 
    1050                 :             : tree
    1051                 :           0 : m2builtins_BuiltInHugeVal (location_t location)
    1052                 :             : {
    1053                 :           0 :   tree functype = TREE_TYPE (gm2_huge_val_node);
    1054                 :           0 :   tree funcptr
    1055                 :           0 :       = build1 (ADDR_EXPR, build_pointer_type (functype), gm2_huge_val_node);
    1056                 :           0 :   tree call = m2treelib_DoCall0 (location, ptr_type_node, funcptr);
    1057                 :           0 :   return call;
    1058                 :             : }
    1059                 :             : 
    1060                 :             : tree
    1061                 :           0 : m2builtins_BuiltInHugeValShort (location_t location)
    1062                 :             : {
    1063                 :           0 :   tree functype = TREE_TYPE (gm2_huge_valf_node);
    1064                 :           0 :   tree funcptr
    1065                 :           0 :       = build1 (ADDR_EXPR, build_pointer_type (functype), gm2_huge_valf_node);
    1066                 :           0 :   tree call = m2treelib_DoCall0 (location, ptr_type_node, funcptr);
    1067                 :           0 :   return call;
    1068                 :             : }
    1069                 :             : 
    1070                 :             : tree
    1071                 :           0 : m2builtins_BuiltInHugeValLong (location_t location)
    1072                 :             : {
    1073                 :           0 :   tree functype = TREE_TYPE (gm2_huge_vall_node);
    1074                 :           0 :   tree funcptr
    1075                 :           0 :       = build1 (ADDR_EXPR, build_pointer_type (functype), gm2_huge_vall_node);
    1076                 :           0 :   tree call = m2treelib_DoCall0 (location, ptr_type_node, funcptr);
    1077                 :           0 :   return call;
    1078                 :             : }
    1079                 :             : 
    1080                 :             : static void
    1081                 :     1664829 : create_function_prototype (location_t location,
    1082                 :             :                            struct builtin_function_entry *fe)
    1083                 :             : {
    1084                 :     1664829 :   tree ftype;
    1085                 :             : 
    1086                 :     1664829 :   switch (fe->defn)
    1087                 :             :     {
    1088                 :             : 
    1089                 :       14733 :     case BT_FN_PTR_SIZE:
    1090                 :       14733 :       ftype = build_function_type (ptr_type_node, sizetype_endlink);
    1091                 :       14733 :       fe->return_node = ptr_type_node;
    1092                 :       14733 :       break;
    1093                 :             : 
    1094                 :       58932 :     case BT_FN_STRING_STRING_CONST_STRING_SIZE:
    1095                 :       58932 :     case BT_FN_TRAD_PTR_PTR_CONST_PTR_SIZE:
    1096                 :       58932 :       ftype = build_function_type (
    1097                 :             :           ptr_type_node, tree_cons (NULL_TREE, ptr_type_node,
    1098                 :             :                                     tree_cons (NULL_TREE, const_ptr_type_node,
    1099                 :             :                                                sizetype_endlink)));
    1100                 :       58932 :       fe->return_node = ptr_type_node;
    1101                 :       58932 :       break;
    1102                 :       14733 :     case BT_FN_FLOAT:
    1103                 :       14733 :       ftype = float_ftype_void;
    1104                 :       14733 :       fe->return_node = float_type_node;
    1105                 :       14733 :       break;
    1106                 :       14733 :     case BT_FN_DOUBLE:
    1107                 :       14733 :       ftype = double_ftype_void;
    1108                 :       14733 :       fe->return_node = double_type_node;
    1109                 :       14733 :       break;
    1110                 :       14733 :     case BT_FN_LONG_DOUBLE:
    1111                 :       14733 :       ftype = ldouble_ftype_void;
    1112                 :       14733 :       fe->return_node = m2type_GetM2LongRealType ();
    1113                 :       14733 :       break;
    1114                 :      103131 :     case BT_FN_FLOAT_FLOAT:
    1115                 :      103131 :       ftype = float_ftype_float;
    1116                 :      103131 :       fe->return_node = float_type_node;
    1117                 :      103131 :       break;
    1118                 :      103131 :     case BT_FN_DOUBLE_DOUBLE:
    1119                 :      103131 :       ftype = double_ftype_double;
    1120                 :      103131 :       fe->return_node = double_type_node;
    1121                 :      103131 :       break;
    1122                 :      103131 :     case BT_FN_LONG_DOUBLE_LONG_DOUBLE:
    1123                 :      103131 :       ftype = ldouble_ftype_ldouble;
    1124                 :      103131 :       fe->return_node = m2type_GetM2LongRealType ();
    1125                 :      103131 :       break;
    1126                 :       58932 :     case BT_FN_STRING_CONST_STRING_INT:
    1127                 :       58932 :       ftype = build_function_type (
    1128                 :             :           ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, int_endlink));
    1129                 :       58932 :       fe->return_node = ptr_type_node;
    1130                 :       58932 :       break;
    1131                 :       14733 :     case BT_FN_INT_CONST_PTR_CONST_PTR_SIZE:
    1132                 :       14733 :       ftype = build_function_type (
    1133                 :             :           integer_type_node,
    1134                 :             :           tree_cons (NULL_TREE, const_ptr_type_node,
    1135                 :             :                      tree_cons (NULL_TREE, const_ptr_type_node, int_endlink)));
    1136                 :       14733 :       fe->return_node = integer_type_node;
    1137                 :       14733 :       break;
    1138                 :       14733 :     case BT_FN_TRAD_PTR_PTR_INT_SIZE:
    1139                 :       14733 :       ftype = build_function_type (
    1140                 :             :           ptr_type_node, tree_cons (NULL_TREE, ptr_type_node,
    1141                 :             :                                     tree_cons (NULL_TREE, integer_type_node,
    1142                 :             :                                                sizetype_endlink)));
    1143                 :       14733 :       fe->return_node = ptr_type_node;
    1144                 :       14733 :       break;
    1145                 :       29466 :     case BT_FN_STRING_STRING_CONST_STRING:
    1146                 :       29466 :       ftype = build_function_type (
    1147                 :             :           ptr_type_node, tree_cons (NULL_TREE, ptr_type_node, ptr_endlink));
    1148                 :       29466 :       fe->return_node = ptr_type_node;
    1149                 :       29466 :       break;
    1150                 :       14733 :     case BT_FN_INT_CONST_STRING_CONST_STRING:
    1151                 :       14733 :       ftype = build_function_type (
    1152                 :             :           integer_type_node,
    1153                 :             :           tree_cons (NULL_TREE, const_ptr_type_node, ptr_endlink));
    1154                 :       14733 :       fe->return_node = integer_type_node;
    1155                 :       14733 :       break;
    1156                 :       14733 :     case BT_FN_INT_CONST_STRING_CONST_STRING_SIZE:
    1157                 :       14733 :       ftype = build_function_type (
    1158                 :             :           integer_type_node,
    1159                 :             :           tree_cons (
    1160                 :             :               NULL_TREE, const_ptr_type_node,
    1161                 :             :               tree_cons (NULL_TREE, const_ptr_type_node, sizetype_endlink)));
    1162                 :       14733 :       fe->return_node = integer_type_node;
    1163                 :       14733 :       break;
    1164                 :       14733 :     case BT_FN_INT_CONST_STRING:
    1165                 :       14733 :       ftype = build_function_type (integer_type_node, ptr_endlink);
    1166                 :       14733 :       fe->return_node = integer_type_node;
    1167                 :       14733 :       break;
    1168                 :       29466 :     case BT_FN_STRING_CONST_STRING_CONST_STRING:
    1169                 :       29466 :       ftype = build_function_type (
    1170                 :             :           ptr_type_node,
    1171                 :             :           tree_cons (NULL_TREE, const_ptr_type_node, const_ptr_endlink));
    1172                 :       29466 :       fe->return_node = ptr_type_node;
    1173                 :       29466 :       break;
    1174                 :       29466 :     case BT_FN_SIZE_CONST_STRING_CONST_STRING:
    1175                 :       29466 :       ftype = build_function_type (
    1176                 :             :           sizetype,
    1177                 :             :           tree_cons (NULL_TREE, const_ptr_type_node, const_ptr_endlink));
    1178                 :       29466 :       fe->return_node = sizetype;
    1179                 :       29466 :       break;
    1180                 :       29466 :     case BT_FN_PTR_UNSIGNED:
    1181                 :       29466 :       ftype = build_function_type (ptr_type_node, unsigned_endlink);
    1182                 :       29466 :       fe->return_node = ptr_type_node;
    1183                 :       29466 :       break;
    1184                 :       14733 :     case BT_FN_VOID_PTR_INT:
    1185                 :       14733 :       ftype = build_function_type (
    1186                 :             :           void_type_node, tree_cons (NULL_TREE, ptr_type_node, int_endlink));
    1187                 :       14733 :       fe->return_node = void_type_node;
    1188                 :       14733 :       break;
    1189                 :       14733 :     case BT_FN_INT_PTR:
    1190                 :       14733 :       ftype = build_function_type (integer_type_node, ptr_endlink);
    1191                 :       14733 :       fe->return_node = integer_type_node;
    1192                 :       14733 :       break;
    1193                 :       29466 :     case BT_FN_INT_FLOAT:
    1194                 :       29466 :       ftype = build_function_type (
    1195                 :             :           integer_type_node, tree_cons (NULL_TREE, float_type_node, endlink));
    1196                 :       29466 :       fe->return_node = integer_type_node;
    1197                 :       29466 :       break;
    1198                 :       58932 :     case BT_FN_INT_DOUBLE:
    1199                 :       58932 :       ftype = build_function_type (
    1200                 :             :           integer_type_node, tree_cons (NULL_TREE, double_type_node, endlink));
    1201                 :       58932 :       fe->return_node = integer_type_node;
    1202                 :       58932 :       break;
    1203                 :       29466 :     case BT_FN_INT_LONG_DOUBLE:
    1204                 :       29466 :       ftype = build_function_type (
    1205                 :             :           integer_type_node,
    1206                 :             :           tree_cons (NULL_TREE, m2type_GetM2LongRealType (), endlink));
    1207                 :       29466 :       fe->return_node = integer_type_node;
    1208                 :       29466 :       break;
    1209                 :       29466 :     case BT_FN_FLOAT_FCOMPLEX:
    1210                 :       29466 :       ftype = build_function_type (
    1211                 :             :           float_type_node,
    1212                 :             :           tree_cons (NULL_TREE, complex_float_type_node, endlink));
    1213                 :       29466 :       fe->return_node = float_type_node;
    1214                 :       29466 :       break;
    1215                 :       29466 :     case BT_FN_DOUBLE_DCOMPLEX:
    1216                 :       29466 :       ftype = build_function_type (
    1217                 :             :           double_type_node,
    1218                 :             :           tree_cons (NULL_TREE, complex_double_type_node, endlink));
    1219                 :       29466 :       fe->return_node = double_type_node;
    1220                 :       29466 :       break;
    1221                 :       29466 :     case BT_FN_LONG_DOUBLE_LDCOMPLEX:
    1222                 :       29466 :       ftype = build_function_type (
    1223                 :             :           m2type_GetM2LongRealType (),
    1224                 :             :           tree_cons (NULL_TREE, m2type_GetM2LongComplexType (), endlink));
    1225                 :       29466 :       fe->return_node = m2type_GetM2LongRealType ();
    1226                 :       29466 :       break;
    1227                 :      147330 :     case BT_FN_FCOMPLEX_FCOMPLEX:
    1228                 :      147330 :       ftype = build_function_type (
    1229                 :             :           complex_float_type_node,
    1230                 :             :           tree_cons (NULL_TREE, complex_float_type_node, endlink));
    1231                 :      147330 :       fe->return_node = complex_float_type_node;
    1232                 :      147330 :       break;
    1233                 :      147330 :     case BT_FN_DCOMPLEX_DCOMPLEX:
    1234                 :      147330 :       ftype = build_function_type (
    1235                 :             :           complex_double_type_node,
    1236                 :             :           tree_cons (NULL_TREE, complex_double_type_node, endlink));
    1237                 :      147330 :       fe->return_node = complex_double_type_node;
    1238                 :      147330 :       break;
    1239                 :      147330 :     case BT_FN_LDCOMPLEX_LDCOMPLEX:
    1240                 :      147330 :       ftype = build_function_type (
    1241                 :             :           m2type_GetM2LongComplexType (),
    1242                 :             :           tree_cons (NULL_TREE, m2type_GetM2LongComplexType (), endlink));
    1243                 :      147330 :       fe->return_node = m2type_GetM2LongComplexType ();
    1244                 :      147330 :       break;
    1245                 :       14733 :     case BT_FN_DCOMPLEX_DOUBLE_DCOMPLEX:
    1246                 :       14733 :       ftype = build_function_type (
    1247                 :             :           complex_double_type_node,
    1248                 :             :           tree_cons (NULL_TREE, complex_double_type_node,
    1249                 :             :                      tree_cons (NULL_TREE, double_type_node, endlink)));
    1250                 :       14733 :       fe->return_node = complex_double_type_node;
    1251                 :       14733 :       break;
    1252                 :       14733 :     case BT_FN_FCOMPLEX_FLOAT_FCOMPLEX:
    1253                 :       14733 :       ftype = build_function_type (
    1254                 :             :           complex_float_type_node,
    1255                 :             :           tree_cons (NULL_TREE, complex_float_type_node,
    1256                 :             :                      tree_cons (NULL_TREE, float_type_node, endlink)));
    1257                 :       14733 :       fe->return_node = complex_float_type_node;
    1258                 :       14733 :       break;
    1259                 :       14733 :     case BT_FN_LDCOMPLEX_LONG_DOUBLE_LDCOMPLEX:
    1260                 :       14733 :       ftype = build_function_type (
    1261                 :             :           m2type_GetM2LongComplexType (),
    1262                 :             :           tree_cons (NULL_TREE, m2type_GetM2LongComplexType (),
    1263                 :             :                      tree_cons (NULL_TREE, m2type_GetM2LongRealType (), endlink)));
    1264                 :       14733 :       fe->return_node = m2type_GetM2LongComplexType ();
    1265                 :       14733 :       break;
    1266                 :       14733 :     case BT_FN_FLOAT_FLOAT_FLOATPTR:
    1267                 :       14733 :       ftype = build_function_type (
    1268                 :             :           float_type_node,
    1269                 :             :           tree_cons (NULL_TREE, float_type_node,
    1270                 :             :                      tree_cons (NULL_TREE, floatptr_type_node, endlink)));
    1271                 :       14733 :       fe->return_node = float_type_node;
    1272                 :       14733 :       break;
    1273                 :       14733 :     case BT_FN_DOUBLE_DOUBLE_DOUBLEPTR:
    1274                 :       14733 :       ftype = build_function_type (
    1275                 :             :           double_type_node,
    1276                 :             :           tree_cons (NULL_TREE, double_type_node,
    1277                 :             :                      tree_cons (NULL_TREE, doubleptr_type_node, endlink)));
    1278                 :       14733 :       fe->return_node = double_type_node;
    1279                 :       14733 :       break;
    1280                 :       14733 :     case BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLEPTR:
    1281                 :       14733 :       ftype = build_function_type (
    1282                 :             :           m2type_GetM2LongRealType (),
    1283                 :             :           tree_cons (
    1284                 :             :               NULL_TREE, m2type_GetM2LongRealType (),
    1285                 :             :               tree_cons (NULL_TREE, long_doubleptr_type_node, endlink)));
    1286                 :       14733 :       fe->return_node = m2type_GetM2LongRealType ();
    1287                 :       14733 :       break;
    1288                 :       14733 :     case BT_FN_FLOAT_FLOAT_LONG_DOUBLE:
    1289                 :       14733 :       ftype = build_function_type (
    1290                 :             :           float_type_node,
    1291                 :             :           tree_cons (NULL_TREE, float_type_node,
    1292                 :             :                      tree_cons (NULL_TREE, m2type_GetM2LongRealType (), endlink)));
    1293                 :       14733 :       fe->return_node = float_type_node;
    1294                 :       14733 :       break;
    1295                 :       14733 :     case BT_FN_DOUBLE_DOUBLE_LONG_DOUBLE:
    1296                 :       14733 :       ftype = build_function_type (
    1297                 :             :           double_type_node,
    1298                 :             :           tree_cons (NULL_TREE, double_type_node,
    1299                 :             :                      tree_cons (NULL_TREE, m2type_GetM2LongRealType (), endlink)));
    1300                 :       14733 :       fe->return_node = double_type_node;
    1301                 :       14733 :       break;
    1302                 :       44199 :     case BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE:
    1303                 :       44199 :       ftype = build_function_type (
    1304                 :             :           m2type_GetM2LongRealType (),
    1305                 :             :           tree_cons (NULL_TREE, m2type_GetM2LongRealType (),
    1306                 :             :                      tree_cons (NULL_TREE, m2type_GetM2LongRealType (), endlink)));
    1307                 :       44199 :       fe->return_node = m2type_GetM2LongRealType ();
    1308                 :       44199 :       break;
    1309                 :       14733 :     case BT_FN_FLOAT_FLOAT_LONG:
    1310                 :       14733 :       ftype = build_function_type (
    1311                 :             :           float_type_node,
    1312                 :             :           tree_cons (NULL_TREE, float_type_node,
    1313                 :             :                      tree_cons (NULL_TREE, long_integer_type_node, endlink)));
    1314                 :       14733 :       fe->return_node = float_type_node;
    1315                 :       14733 :       break;
    1316                 :       14733 :     case BT_FN_DOUBLE_DOUBLE_LONG:
    1317                 :       14733 :       ftype = build_function_type (
    1318                 :             :           double_type_node,
    1319                 :             :           tree_cons (NULL_TREE, double_type_node,
    1320                 :             :                      tree_cons (NULL_TREE, long_integer_type_node, endlink)));
    1321                 :       14733 :       fe->return_node = double_type_node;
    1322                 :       14733 :       break;
    1323                 :       14733 :     case BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG:
    1324                 :       14733 :       ftype = build_function_type (
    1325                 :             :           m2type_GetM2LongRealType (),
    1326                 :             :           tree_cons (NULL_TREE, m2type_GetM2LongRealType (),
    1327                 :             :                      tree_cons (NULL_TREE, long_integer_type_node, endlink)));
    1328                 :       14733 :       fe->return_node = m2type_GetM2LongRealType ();
    1329                 :       14733 :       break;
    1330                 :       14733 :     case BT_FN_FLOAT_FLOAT_INT:
    1331                 :       14733 :       ftype = build_function_type (
    1332                 :             :           float_type_node,
    1333                 :             :           tree_cons (NULL_TREE, float_type_node,
    1334                 :             :                      tree_cons (NULL_TREE, integer_type_node, endlink)));
    1335                 :       14733 :       fe->return_node = float_type_node;
    1336                 :       14733 :       break;
    1337                 :       14733 :     case BT_FN_DOUBLE_DOUBLE_INT:
    1338                 :       14733 :       ftype = build_function_type (
    1339                 :             :           double_type_node,
    1340                 :             :           tree_cons (NULL_TREE, double_type_node,
    1341                 :             :                      tree_cons (NULL_TREE, integer_type_node, endlink)));
    1342                 :       14733 :       fe->return_node = double_type_node;
    1343                 :       14733 :       break;
    1344                 :       14733 :     case BT_FN_LONG_DOUBLE_LONG_DOUBLE_INT:
    1345                 :       14733 :       ftype = build_function_type (
    1346                 :             :           m2type_GetM2LongRealType (),
    1347                 :             :           tree_cons (NULL_TREE, m2type_GetM2LongRealType (),
    1348                 :             :                      tree_cons (NULL_TREE, integer_type_node, endlink)));
    1349                 :       14733 :       fe->return_node = m2type_GetM2LongRealType ();
    1350                 :       14733 :       break;
    1351                 :       29466 :     case BT_FN_FLOAT_FLOAT_FLOAT:
    1352                 :       29466 :       ftype = build_function_type (
    1353                 :             :           float_type_node,
    1354                 :             :           tree_cons (NULL_TREE, float_type_node,
    1355                 :             :                      tree_cons (NULL_TREE, float_type_node, endlink)));
    1356                 :       29466 :       fe->return_node = float_type_node;
    1357                 :       29466 :       break;
    1358                 :       29466 :     case BT_FN_DOUBLE_DOUBLE_DOUBLE:
    1359                 :       29466 :       ftype = build_function_type (
    1360                 :             :           double_type_node,
    1361                 :             :           tree_cons (NULL_TREE, double_type_node,
    1362                 :             :                      tree_cons (NULL_TREE, double_type_node, endlink)));
    1363                 :       29466 :       fe->return_node = double_type_node;
    1364                 :       29466 :       break;
    1365                 :           0 :     default:
    1366                 :           0 :       ERROR ("enum has no case");
    1367                 :             :     }
    1368                 :     1664829 :   fe->function_node
    1369                 :     1664829 :       = builtin_function (location, fe->name, ftype, fe->function_code,
    1370                 :             :                           fe->fclass, fe->library_name, NULL);
    1371                 :     1664829 : }
    1372                 :             : 
    1373                 :             : static tree
    1374                 :      117864 : find_builtin_tree (const char *name)
    1375                 :             : {
    1376                 :      117864 :   struct builtin_function_entry *fe;
    1377                 :             : 
    1378                 :     5539608 :   for (fe = &list_of_builtins[0]; fe->name != NULL; fe++)
    1379                 :     5539608 :     if (strcmp (name, fe->name) == 0)
    1380                 :      117864 :       return fe->function_node;
    1381                 :             : 
    1382                 :           0 :   ERROR ("cannot find builtin function");
    1383                 :             :   return NULL_TREE;
    1384                 :             : }
    1385                 :             : 
    1386                 :             : 
    1387                 :             : static void
    1388                 :      368325 : set_decl_built_in_class (tree decl, built_in_class c)
    1389                 :             : {
    1390                 :      368325 :   FUNCTION_DECL_CHECK (decl)->function_decl.built_in_class = c;
    1391                 :      368325 : }
    1392                 :             : 
    1393                 :             : 
    1394                 :             : static void
    1395                 :      368325 : set_decl_function_code (tree decl, built_in_function f)
    1396                 :             : {
    1397                 :      368325 :   tree_function_decl &fndecl = FUNCTION_DECL_CHECK (decl)->function_decl;
    1398                 :      368325 :   fndecl.function_code = f;
    1399                 :      368325 : }
    1400                 :             : 
    1401                 :             : /* Define a single builtin.  */
    1402                 :             : 
    1403                 :             : static void
    1404                 :      368325 : define_builtin (enum built_in_function val, const char *name, tree prototype,
    1405                 :             :                 const char *libname, int flags)
    1406                 :             : {
    1407                 :      368325 :   tree decl;
    1408                 :      368325 :   builtin_macro_definition bmd;
    1409                 :             : 
    1410                 :      368325 :   decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL, get_identifier (name),
    1411                 :             :                      prototype);
    1412                 :      368325 :   DECL_EXTERNAL (decl) = 1;
    1413                 :      368325 :   TREE_PUBLIC (decl) = 1;
    1414                 :      368325 :   SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
    1415                 :      368325 :   m2block_pushDecl (decl);
    1416                 :      368325 :   set_decl_built_in_class (decl, BUILT_IN_NORMAL);
    1417                 :      368325 :   set_decl_function_code (decl, val);
    1418                 :      368325 :   set_call_expr_flags (decl, flags);
    1419                 :      368325 :   set_builtin_decl (val, decl, true);
    1420                 :      368325 :   bmd.name = name;
    1421                 :      368325 :   bmd.function_node = decl;
    1422                 :      368325 :   bmd.return_node = TREE_TYPE (prototype);
    1423                 :      368325 :   vec_safe_push (builtin_macros, bmd);
    1424                 :      368325 : }
    1425                 :             : 
    1426                 :             : /* Define a math type variant of the builtin function.  */
    1427                 :             : 
    1428                 :             : static
    1429                 :             : void
    1430                 :      235728 : define_builtin_ext  (enum built_in_function val, const char *name, tree type,
    1431                 :             :                      const char *libname, int flags, const char *ext)
    1432                 :             : {
    1433                 :      235728 :   char *newname = (char *) xmalloc (strlen (name) + strlen (ext) + 1);
    1434                 :      235728 :   char *newlibname = (char *) xmalloc (strlen (libname) + strlen (ext) + 1);
    1435                 :      235728 :   strcpy (newname, name);
    1436                 :      235728 :   strcat (newname, ext);
    1437                 :      235728 :   strcpy (newlibname, libname);
    1438                 :      235728 :   strcat (newlibname, ext);
    1439                 :      235728 :   define_builtin (val, newname, type, newlibname, flags);
    1440                 :      235728 : }
    1441                 :             : 
    1442                 :             : /* Define all support math type versions of this builtin.  */
    1443                 :             : 
    1444                 :             : static void
    1445                 :      117864 : define_builtin_math (enum built_in_function val, const char *name, tree type,
    1446                 :             :                      const char *libname, int flags)
    1447                 :             : {
    1448                 :             :   /* SHORTREAL version.  */
    1449                 :      117864 :   define_builtin_ext (val, name, type, libname, flags, "f");
    1450                 :             :   /* LONGREAL version.  */
    1451                 :      117864 :   define_builtin_ext (val, name, type, libname, flags, "l");
    1452                 :             :   /* REAL version.  */
    1453                 :      117864 :   define_builtin (val, name, type, libname, flags);
    1454                 :             :   /* Perhaps it should declare SYSTEM.def types size floating point
    1455                 :             :      versions as well?  */
    1456                 :      117864 : }
    1457                 :             : 
    1458                 :             : void
    1459                 :       14733 : m2builtins_init (location_t location)
    1460                 :             : {
    1461                 :       14733 :   int i;
    1462                 :             : 
    1463                 :       14733 :   m2block_pushGlobalScope ();
    1464                 :       14733 :   endlink = void_list_node;
    1465                 :       14733 :   sizetype_endlink = tree_cons (NULL_TREE, sizetype, endlink);
    1466                 :       14733 :   math_endlink = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
    1467                 :       14733 :   int_endlink = tree_cons (NULL_TREE, integer_type_node, NULL_TREE);
    1468                 :       14733 :   ptr_endlink = tree_cons (NULL_TREE, ptr_type_node, NULL_TREE);
    1469                 :       14733 :   const_ptr_endlink = tree_cons (NULL_TREE, const_ptr_type_node, NULL_TREE);
    1470                 :       14733 :   unsigned_endlink = tree_cons (NULL_TREE, unsigned_type_node, NULL_TREE);
    1471                 :             : 
    1472                 :       14733 :   float_ftype_void = build_function_type (float_type_node, math_endlink);
    1473                 :       14733 :   double_ftype_void = build_function_type (double_type_node, math_endlink);
    1474                 :       14733 :   ldouble_ftype_void
    1475                 :       14733 :       = build_function_type (m2type_GetM2LongRealType (), math_endlink);
    1476                 :             : 
    1477                 :       14733 :   long_doubleptr_type_node = build_pointer_type (m2type_GetM2LongRealType ());
    1478                 :       14733 :   doubleptr_type_node = build_pointer_type (double_type_node);
    1479                 :       14733 :   floatptr_type_node = build_pointer_type (float_type_node);
    1480                 :             : 
    1481                 :       14733 :   float_ftype_float = build_function_type (
    1482                 :             :       float_type_node, tree_cons (NULL_TREE, float_type_node, math_endlink));
    1483                 :             : 
    1484                 :       14733 :   double_ftype_double = build_function_type (
    1485                 :             :       double_type_node, tree_cons (NULL_TREE, double_type_node, math_endlink));
    1486                 :             : 
    1487                 :       14733 :   ldouble_ftype_ldouble = build_function_type (
    1488                 :             :       m2type_GetM2LongRealType (),
    1489                 :             :       tree_cons (NULL_TREE, m2type_GetM2LongRealType (), endlink));
    1490                 :             : 
    1491                 :       14733 :   builtin_ftype_int_var = build_function_type (
    1492                 :             :       integer_type_node, tree_cons (NULL_TREE, double_type_node, endlink));
    1493                 :             : 
    1494                 :     1679562 :   for (i = 0; list_of_builtins[i].name != NULL; i++)
    1495                 :     1664829 :     create_function_prototype (location, &list_of_builtins[i]);
    1496                 :             : 
    1497                 :       14733 :   define_builtin (BUILT_IN_TRAP, "__builtin_trap",
    1498                 :             :                   build_function_type_list (void_type_node, NULL_TREE),
    1499                 :             :                   "__builtin_trap", ECF_NOTHROW | ECF_LEAF | ECF_NORETURN);
    1500                 :       14733 :   define_builtin_math (BUILT_IN_ISGREATER, "isgreater", builtin_ftype_int_var,
    1501                 :             :                        "__builtin_isgreater", ECF_CONST | ECF_NOTHROW | ECF_LEAF);
    1502                 :       14733 :   define_builtin_math (BUILT_IN_ISGREATEREQUAL, "isgreaterequal",
    1503                 :             :                        builtin_ftype_int_var, "__builtin_isgreaterequal",
    1504                 :             :                        ECF_CONST | ECF_NOTHROW | ECF_LEAF);
    1505                 :       14733 :   define_builtin_math (BUILT_IN_ISLESS, "isless", builtin_ftype_int_var,
    1506                 :             :                        "__builtin_isless", ECF_CONST | ECF_NOTHROW | ECF_LEAF);
    1507                 :       14733 :   define_builtin_math (BUILT_IN_ISLESSEQUAL, "islessequal", builtin_ftype_int_var,
    1508                 :             :                        "__builtin_islessequal", ECF_CONST | ECF_NOTHROW | ECF_LEAF);
    1509                 :       14733 :   define_builtin_math (BUILT_IN_ISLESSGREATER, "islessgreater",
    1510                 :             :                        builtin_ftype_int_var, "__builtin_islessgreater",
    1511                 :             :                        ECF_CONST | ECF_NOTHROW | ECF_LEAF);
    1512                 :       14733 :   define_builtin_math (BUILT_IN_ISUNORDERED, "isunordered", builtin_ftype_int_var,
    1513                 :             :                        "__builtin_isunordered", ECF_CONST | ECF_NOTHROW | ECF_LEAF);
    1514                 :       14733 :   define_builtin_math (BUILT_IN_ISNORMAL, "isnormal", builtin_ftype_int_var,
    1515                 :             :                        "__builtin_isnormal", ECF_CONST | ECF_NOTHROW | ECF_LEAF);
    1516                 :       14733 :   define_builtin_math (BUILT_IN_ISINF_SIGN, "isinf_sign", builtin_ftype_int_var,
    1517                 :             :                        "__builtin_isinf_sign", ECF_CONST | ECF_NOTHROW | ECF_LEAF);
    1518                 :             : 
    1519                 :       14733 :   gm2_alloca_node = find_builtin_tree ("__builtin_alloca");
    1520                 :       14733 :   gm2_memcpy_node = find_builtin_tree ("__builtin_memcpy");
    1521                 :       14733 :   gm2_memset_node = find_builtin_tree ("__builtin_memset");
    1522                 :       14733 :   gm2_huge_valf_node = find_builtin_tree ("__builtin_huge_valf");
    1523                 :       14733 :   gm2_huge_val_node = find_builtin_tree ("__builtin_huge_val");
    1524                 :       14733 :   gm2_huge_vall_node = find_builtin_tree ("__builtin_huge_vall");
    1525                 :       14733 :   gm2_isfinite_node = find_builtin_tree ("__builtin_isfinite");
    1526                 :       14733 :   gm2_isnan_node = find_builtin_tree ("__builtin_isnan");
    1527                 :       14733 :   m2block_popGlobalScope ();
    1528                 :       14733 : }
    1529                 :             : 
    1530                 :             : #include "gt-m2-m2builtins.h"
    1531                 :             : 
    1532                 :             : /* END m2builtins.  */
        

Generated by: LCOV version 2.1-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.