2 * This file is part of cparser.
3 * Copyright (C) 2007-2010 Matthias Braun <matze@braunis.de>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 * GNU builtin or MS intrinsic functions.
28 typedef enum builtin_kind_t {
31 bk_gnu_builtin___memcpy_chk,
32 bk_gnu_builtin___memmove_chk,
33 bk_gnu_builtin___memset_chk,
34 bk_gnu_builtin___snprintf_chk,
35 bk_gnu_builtin___sprintf_chk,
36 bk_gnu_builtin___stpcpy_chk,
37 bk_gnu_builtin___strcat_chk,
38 bk_gnu_builtin___strcpy_chk,
39 bk_gnu_builtin___strncat_chk,
40 bk_gnu_builtin___strncpy_chk,
41 bk_gnu_builtin___vsnprintf_chk,
42 bk_gnu_builtin___vsprintf_chk,
45 bk_gnu_builtin_alloca,
53 bk_gnu_builtin_expect,
57 bk_gnu_builtin_frame_address,
58 bk_gnu_builtin_huge_val,
59 bk_gnu_builtin_huge_valf,
60 bk_gnu_builtin_huge_vall,
66 bk_gnu_builtin_malloc,
67 bk_gnu_builtin_memcmp,
68 bk_gnu_builtin_memcpy,
69 bk_gnu_builtin_memmove,
70 bk_gnu_builtin_memset,
74 bk_gnu_builtin_object_size,
75 bk_gnu_builtin_parity,
76 bk_gnu_builtin_popcount,
77 bk_gnu_builtin_popcountl,
78 bk_gnu_builtin_popcountll,
79 bk_gnu_builtin_prefetch,
80 bk_gnu_builtin_return_address,
81 bk_gnu_builtin_snprintf,
82 bk_gnu_builtin_sprintf,
83 bk_gnu_builtin_stpcpy,
84 bk_gnu_builtin_strcat,
85 bk_gnu_builtin_strcmp,
86 bk_gnu_builtin_strcpy,
87 bk_gnu_builtin_strlen,
88 bk_gnu_builtin_strncat,
89 bk_gnu_builtin_strncpy,
91 bk_gnu_builtin_va_end,
92 bk_gnu_builtin_vsnprintf,
93 bk_gnu_builtin_vsprintf,
95 bk_ms_AddressOfReturnAddress,
98 bk_ms_InterlockedExchange,
99 bk_ms_InterlockedExchange64,
110 bk_ms_byteswap_uint64,
111 bk_ms_byteswap_ulong,
112 bk_ms_byteswap_ushort,
122 * Create predefined gnu builtins.
124 void create_gnu_builtins(void);
127 * Create predefined MS intrinsics.
129 void create_microsoft_intrinsics(void);
132 * Some of the gnu builtins are simply more elaborate declarations of
133 * library functions. Return the library function name so we can simply
134 * replace the builtins with these during code generation
136 entity_t *get_builtin_replacement(const entity_t *builtin_entity);
138 int get_builtin_chk_arg_pos(builtin_kind_t kind);