LCOV - code coverage report
Current view: top level - gcc/m2/gm2-gcc - m2builtins.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 86.8 % 575 499
Test Date: 2026-09-12 16:25:28 Functions: 86.4 % 59 51
Legend: Lines:     hit not hit

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

Generated by: LCOV version 2.4-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.