GCC Middle and Back End API Reference
gencfn-macros.cc File Reference
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
#include "hash-table.h"
#include "hash-set.h"
#include "errors.h"
#include "builtins.def"
#include "internal-fn.def"
Include dependency graph for gencfn-macros.cc:

Macros

#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND)    #ENUM,
 
#define DEF_INTERNAL_FLT_FN(NAME, FLAGS, OPTAB, TYPE)    #NAME,
 
#define DEF_INTERNAL_INT_FN(NAME, FLAGS, OPTAB, TYPE)    #NAME,
 

Typedefs

typedef hash_set< nofree_string_hashstring_set
 

Functions

static void add_to_set (string_set *set, const char *const *names)
 
static bool is_group (string_set *builtins, const char *name, const char *const *suffixes)
 
static void print_case_cfn (const char *name, bool internal_p, const char *const *suffixes, const char *floatn)
 
static void print_define_operator_list (const char *name, bool internal_p, const char *const *suffixes, const char *floatn)
 
int main (int argc, char **argv)
 

Variables

const char *const builtin_names []
 
const char *const internal_fn_flt_names []
 
const char *const internal_fn_int_names []
 
static const char *const flt_suffixes [] = { "F", "", "L", NULL }
 
static const char *const fltfn_suffixes []
 
static const char *const fltall_suffixes []
 
static const char *const int_suffixes [] = { "", "L", "LL", "IMAX", NULL }
 
static const char *const *const suffix_lists []
 

Macro Definition Documentation

◆ DEF_BUILTIN

#define DEF_BUILTIN ( ENUM,
N,
C,
T,
LT,
B,
F,
NA,
AT,
IM,
COND )    #ENUM,

◆ DEF_INTERNAL_FLT_FN

#define DEF_INTERNAL_FLT_FN ( NAME,
FLAGS,
OPTAB,
TYPE )    #NAME,

◆ DEF_INTERNAL_INT_FN

#define DEF_INTERNAL_INT_FN ( NAME,
FLAGS,
OPTAB,
TYPE )    #NAME,

Typedef Documentation

◆ string_set

Generate macros based on the combined_fn enum.
   Copyright (C) 2015-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Automatically generate code fragments related to combined_fn.

The program looks for math built-in functions that have float, double
and long double variants, such as {sqrtf, sqrt, sqrtl}, and that may
or may not have an associated internal function as well.  It also looks
for integer built-in functions that have int, long, long long and
intmax_t variants, such as {clz, clzl, clzll, clzimax}, and that
again may or may not have an associated internal function as well.

When run with -c, the generator prints a list of macros such as:

   CASE_CFN_SQRT

for each group of functions described above, with 'case CFN_*'
statements for each built-in and internal function in the group.
For example, there are both built-in and internal implementations
of SQRT, so "CASE_CFN_SQRT:" is equivalent to:

   case CFN_BUILT_IN_SQRTF:
   case CFN_BUILT_IN_SQRT:
   case CFN_BUILT_IN_SQRTL:
   case CFN_SQRT:

The macros for groups with no internal function drop the last line.

When run with -o, the generator prints a similar list of
define_operator_list directives, for use by match.pd.  Each operator
list starts with the built-in functions, in order of ascending type width.
This is followed by an entry for the internal function, or "null" if there
is no internal function for the group.  For example:

  (define_operator_list SQRT
      BUILT_IN_SQRTF
      BUILT_IN_SQRT
      BUILT_IN_SQRTL
      IFN_SQRT)

and:

  (define_operator_list CABS
      BUILT_IN_CABSF
      BUILT_IN_CABS
      BUILT_IN_CABSL
      null)   

Function Documentation

◆ add_to_set()

static void add_to_set ( string_set * set,
const char *const * names )
static
Add all names in null-terminated list NAMES to SET.   

References i, and names.

Referenced by main().

◆ is_group()

static bool is_group ( string_set * builtins,
const char * name,
const char *const * suffixes )
static
Return true if *BUILTINS contains BUILT_IN_<NAME><SUFFIX> for all
suffixes in null-terminated list SUFFIXES.   

References hash_set< KeyId, Lazy, Traits >::contains(), ggc_alloc(), i, and NULL.

Referenced by main().

◆ main()

◆ print_case_cfn()

static void print_case_cfn ( const char * name,
bool internal_p,
const char *const * suffixes,
const char * floatn )
static
Print a macro for all combined functions related to NAME, with the
null-terminated list of suffixes in SUFFIXES.  INTERNAL_P says whether
CFN_<NAME> also exists.  FLOATN_P is a suffix to the operator name, blank
for normal operators, "_FN" for _Float<N>/_Float<N>X operators only, and
"_ALL" for both the traditional operators and the _Float<N>/_Float<N>X
operators.   

References ggc_alloc(), and i.

Referenced by main().

◆ print_define_operator_list()

static void print_define_operator_list ( const char * name,
bool internal_p,
const char *const * suffixes,
const char * floatn )
static
Print an operator list for all combined functions related to NAME, with the
null-terminated list of suffixes in SUFFIXES.  INTERNAL_P says whether
CFN_<NAME> also exists.  FLOATN_P is a suffix to the operator name, blank
for normal operators, "_FN" for _Float<N>/_Float<N>X operators only, and
"_ALL" for both the traditional operators and the _Float<N>/_Float<N>X
operators.   

References ggc_alloc(), and i.

Referenced by main().

Variable Documentation

◆ builtin_names

const char* const builtin_names[]
Initial value:
= {
#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) \
}
#define NULL
Definition system.h:50

Referenced by main().

◆ flt_suffixes

const char* const flt_suffixes[] = { "F", "", "L", NULL }
static

Referenced by main().

◆ fltall_suffixes

const char* const fltall_suffixes[]
static
Initial value:
= { "F", "", "L", "F16", "F32",
"F64", "F128", "F32X", "F64X",
"F128X", NULL }

Referenced by main().

◆ fltfn_suffixes

const char* const fltfn_suffixes[]
static
Initial value:
= { "F16", "F32", "F64", "F128",
"F32X", "F64X", "F128X", NULL }

Referenced by main().

◆ int_suffixes

const char* const int_suffixes[] = { "", "L", "LL", "IMAX", NULL }
static

Referenced by main().

◆ internal_fn_flt_names

const char* const internal_fn_flt_names[]
Initial value:
= {
#define DEF_INTERNAL_FLT_FN(NAME, FLAGS, OPTAB, TYPE) \
}

Referenced by main().

◆ internal_fn_int_names

const char* const internal_fn_int_names[]
Initial value:
= {
#define DEF_INTERNAL_INT_FN(NAME, FLAGS, OPTAB, TYPE) \
}

Referenced by main().

◆ suffix_lists

const char* const* const suffix_lists[]
static
Initial value:
= {
}
static const char *const int_suffixes[]
Definition gencfn-macros.cc:163
static const char *const flt_suffixes[]
Definition gencfn-macros.cc:157

Referenced by main().