7 DEF(TOK_WHILE
, "while")
8 DEF(TOK_BREAK
, "break")
9 DEF(TOK_RETURN
, "return")
11 DEF(TOK_EXTERN
, "extern")
12 DEF(TOK_STATIC
, "static")
13 DEF(TOK_UNSIGNED
, "unsigned")
16 DEF(TOK_CONTINUE
, "continue")
17 DEF(TOK_SWITCH
, "switch")
20 DEF(TOK_CONST1
, "const")
21 DEF(TOK_CONST2
, "__const") /* gcc keyword */
22 DEF(TOK_CONST3
, "__const__") /* gcc keyword */
23 DEF(TOK_VOLATILE1
, "volatile")
24 DEF(TOK_VOLATILE2
, "__volatile") /* gcc keyword */
25 DEF(TOK_VOLATILE3
, "__volatile__") /* gcc keyword */
27 DEF(TOK_REGISTER
, "register")
28 DEF(TOK_SIGNED1
, "signed")
29 DEF(TOK_SIGNED2
, "__signed") /* gcc keyword */
30 DEF(TOK_SIGNED3
, "__signed__") /* gcc keyword */
32 DEF(TOK_INLINE1
, "inline")
33 DEF(TOK_INLINE2
, "__inline") /* gcc keyword */
34 DEF(TOK_INLINE3
, "__inline__") /* gcc keyword */
35 DEF(TOK_RESTRICT1
, "restrict")
36 DEF(TOK_RESTRICT2
, "__restrict")
37 DEF(TOK_RESTRICT3
, "__restrict__")
38 DEF(TOK_EXTENSION
, "__extension__") /* gcc keyword */
40 DEF(TOK_GENERIC
, "_Generic")
41 DEF(TOK_STATIC_ASSERT
, "_Static_assert")
43 DEF(TOK_FLOAT
, "float")
44 DEF(TOK_DOUBLE
, "double")
45 DEF(TOK_BOOL
, "_Bool")
46 DEF(TOK_SHORT
, "short")
47 DEF(TOK_STRUCT
, "struct")
48 DEF(TOK_UNION
, "union")
49 DEF(TOK_TYPEDEF
, "typedef")
50 DEF(TOK_DEFAULT
, "default")
52 DEF(TOK_SIZEOF
, "sizeof")
53 DEF(TOK_ATTRIBUTE1
, "__attribute")
54 DEF(TOK_ATTRIBUTE2
, "__attribute__")
55 DEF(TOK_ALIGNOF1
, "__alignof")
56 DEF(TOK_ALIGNOF2
, "__alignof__")
57 DEF(TOK_ALIGNOF3
, "_Alignof")
58 DEF(TOK_ALIGNAS
, "_Alignas")
59 DEF(TOK_TYPEOF1
, "typeof")
60 DEF(TOK_TYPEOF2
, "__typeof")
61 DEF(TOK_TYPEOF3
, "__typeof__")
62 DEF(TOK_LABEL
, "__label__")
64 DEF(TOK_ASM2
, "__asm")
65 DEF(TOK_ASM3
, "__asm__")
67 #ifdef TCC_TARGET_ARM64
68 DEF(TOK_UINT128
, "__uint128_t")
71 /*********************************************************************/
72 /* the following are not keywords. They are included to ease parsing */
73 /* preprocessor only */
74 DEF(TOK_DEFINE
, "define")
75 DEF(TOK_INCLUDE
, "include")
76 DEF(TOK_INCLUDE_NEXT
, "include_next")
77 DEF(TOK_IFDEF
, "ifdef")
78 DEF(TOK_IFNDEF
, "ifndef")
80 DEF(TOK_ENDIF
, "endif")
81 DEF(TOK_DEFINED
, "defined")
82 DEF(TOK_UNDEF
, "undef")
83 DEF(TOK_ERROR
, "error")
84 DEF(TOK_WARNING
, "warning")
86 DEF(TOK_PRAGMA
, "pragma")
87 DEF(TOK___LINE__
, "__LINE__")
88 DEF(TOK___FILE__
, "__FILE__")
89 DEF(TOK___DATE__
, "__DATE__")
90 DEF(TOK___TIME__
, "__TIME__")
91 DEF(TOK___FUNCTION__
, "__FUNCTION__")
92 DEF(TOK___VA_ARGS__
, "__VA_ARGS__")
93 DEF(TOK___COUNTER__
, "__COUNTER__")
94 DEF(TOK___HAS_INCLUDE
, "__has_include")
96 /* special identifiers */
97 DEF(TOK___FUNC__
, "__func__")
99 /* special floating point values */
100 DEF(TOK___NAN__
, "__nan__")
101 DEF(TOK___SNAN__
, "__snan__")
102 DEF(TOK___INF__
, "__inf__")
104 /* attribute identifiers */
105 /* XXX: handle all tokens generically since speed is not critical */
106 DEF(TOK_SECTION1
, "section")
107 DEF(TOK_SECTION2
, "__section__")
108 DEF(TOK_ALIGNED1
, "aligned")
109 DEF(TOK_ALIGNED2
, "__aligned__")
110 DEF(TOK_PACKED1
, "packed")
111 DEF(TOK_PACKED2
, "__packed__")
112 DEF(TOK_WEAK1
, "weak")
113 DEF(TOK_WEAK2
, "__weak__")
114 DEF(TOK_ALIAS1
, "alias")
115 DEF(TOK_ALIAS2
, "__alias__")
116 DEF(TOK_UNUSED1
, "unused")
117 DEF(TOK_UNUSED2
, "__unused__")
118 DEF(TOK_CDECL1
, "cdecl")
119 DEF(TOK_CDECL2
, "__cdecl")
120 DEF(TOK_CDECL3
, "__cdecl__")
121 DEF(TOK_STDCALL1
, "stdcall")
122 DEF(TOK_STDCALL2
, "__stdcall")
123 DEF(TOK_STDCALL3
, "__stdcall__")
124 DEF(TOK_FASTCALL1
, "fastcall")
125 DEF(TOK_FASTCALL2
, "__fastcall")
126 DEF(TOK_FASTCALL3
, "__fastcall__")
127 DEF(TOK_REGPARM1
, "regparm")
128 DEF(TOK_REGPARM2
, "__regparm__")
129 DEF(TOK_CLEANUP1
, "cleanup")
130 DEF(TOK_CLEANUP2
, "__cleanup__")
131 DEF(TOK_CONSTRUCTOR1
, "constructor")
132 DEF(TOK_CONSTRUCTOR2
, "__constructor__")
133 DEF(TOK_DESTRUCTOR1
, "destructor")
134 DEF(TOK_DESTRUCTOR2
, "__destructor__")
135 DEF(TOK_ALWAYS_INLINE1
, "always_inline")
136 DEF(TOK_ALWAYS_INLINE2
, "__always_inline__")
138 DEF(TOK_MODE
, "__mode__")
139 DEF(TOK_MODE_QI
, "__QI__")
140 DEF(TOK_MODE_DI
, "__DI__")
141 DEF(TOK_MODE_HI
, "__HI__")
142 DEF(TOK_MODE_SI
, "__SI__")
143 DEF(TOK_MODE_word
, "__word__")
145 DEF(TOK_DLLEXPORT
, "dllexport")
146 DEF(TOK_DLLIMPORT
, "dllimport")
147 DEF(TOK_NODECORATE
, "nodecorate")
148 DEF(TOK_NORETURN1
, "noreturn")
149 DEF(TOK_NORETURN2
, "__noreturn__")
150 DEF(TOK_NORETURN3
, "_Noreturn")
151 DEF(TOK_VISIBILITY1
, "visibility")
152 DEF(TOK_VISIBILITY2
, "__visibility__")
154 DEF(TOK_builtin_types_compatible_p
, "__builtin_types_compatible_p")
155 DEF(TOK_builtin_choose_expr
, "__builtin_choose_expr")
156 DEF(TOK_builtin_constant_p
, "__builtin_constant_p")
157 DEF(TOK_builtin_frame_address
, "__builtin_frame_address")
158 DEF(TOK_builtin_return_address
, "__builtin_return_address")
159 DEF(TOK_builtin_expect
, "__builtin_expect")
160 /*DEF(TOK_builtin_va_list, "__builtin_va_list")*/
161 #if defined TCC_TARGET_PE && defined TCC_TARGET_X86_64
162 DEF(TOK_builtin_va_start
, "__builtin_va_start")
163 #elif defined TCC_TARGET_X86_64
164 DEF(TOK_builtin_va_arg_types
, "__builtin_va_arg_types")
165 #elif defined TCC_TARGET_ARM64
166 DEF(TOK_builtin_va_start
, "__builtin_va_start")
167 DEF(TOK_builtin_va_arg
, "__builtin_va_arg")
168 #elif defined TCC_TARGET_RISCV64
169 DEF(TOK_builtin_va_start
, "__builtin_va_start")
173 DEF(TOK_pack
, "pack")
174 #if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_X86_64) && \
175 !defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_ARM64)
176 /* already defined for assembler */
177 DEF(TOK_ASM_push
, "push")
178 DEF(TOK_ASM_pop
, "pop")
180 DEF(TOK_comment
, "comment")
182 DEF(TOK_push_macro
, "push_macro")
183 DEF(TOK_pop_macro
, "pop_macro")
184 DEF(TOK_once
, "once")
185 DEF(TOK_option
, "option")
187 /* builtin functions or variables */
189 DEF(TOK_memcpy
, "memcpy")
190 DEF(TOK_memmove
, "memmove")
191 DEF(TOK_memset
, "memset")
192 DEF(TOK___divdi3
, "__divdi3")
193 DEF(TOK___moddi3
, "__moddi3")
194 DEF(TOK___udivdi3
, "__udivdi3")
195 DEF(TOK___umoddi3
, "__umoddi3")
196 DEF(TOK___ashrdi3
, "__ashrdi3")
197 DEF(TOK___lshrdi3
, "__lshrdi3")
198 DEF(TOK___ashldi3
, "__ashldi3")
199 DEF(TOK___floatundisf
, "__floatundisf")
200 DEF(TOK___floatundidf
, "__floatundidf")
202 DEF(TOK___floatundixf
, "__floatundixf")
203 DEF(TOK___fixunsxfdi
, "__fixunsxfdi")
205 DEF(TOK___fixunssfdi
, "__fixunssfdi")
206 DEF(TOK___fixunsdfdi
, "__fixunsdfdi")
209 #if defined TCC_TARGET_ARM
211 DEF(TOK_memcpy
, "__aeabi_memcpy")
212 DEF(TOK_memmove
, "__aeabi_memmove")
213 DEF(TOK_memmove4
, "__aeabi_memmove4")
214 DEF(TOK_memmove8
, "__aeabi_memmove8")
215 DEF(TOK_memset
, "__aeabi_memset")
216 DEF(TOK___aeabi_ldivmod
, "__aeabi_ldivmod")
217 DEF(TOK___aeabi_uldivmod
, "__aeabi_uldivmod")
218 DEF(TOK___aeabi_idivmod
, "__aeabi_idivmod")
219 DEF(TOK___aeabi_uidivmod
, "__aeabi_uidivmod")
220 DEF(TOK___divsi3
, "__aeabi_idiv")
221 DEF(TOK___udivsi3
, "__aeabi_uidiv")
222 DEF(TOK___floatdisf
, "__aeabi_l2f")
223 DEF(TOK___floatdidf
, "__aeabi_l2d")
224 DEF(TOK___fixsfdi
, "__aeabi_f2lz")
225 DEF(TOK___fixdfdi
, "__aeabi_d2lz")
226 DEF(TOK___ashrdi3
, "__aeabi_lasr")
227 DEF(TOK___lshrdi3
, "__aeabi_llsr")
228 DEF(TOK___ashldi3
, "__aeabi_llsl")
229 DEF(TOK___floatundisf
, "__aeabi_ul2f")
230 DEF(TOK___floatundidf
, "__aeabi_ul2d")
231 DEF(TOK___fixunssfdi
, "__aeabi_f2ulz")
232 DEF(TOK___fixunsdfdi
, "__aeabi_d2ulz")
234 DEF(TOK___modsi3
, "__modsi3")
235 DEF(TOK___umodsi3
, "__umodsi3")
236 DEF(TOK___divsi3
, "__divsi3")
237 DEF(TOK___udivsi3
, "__udivsi3")
238 DEF(TOK___floatdisf
, "__floatdisf")
239 DEF(TOK___floatdidf
, "__floatdidf")
241 DEF(TOK___floatdixf
, "__floatdixf")
242 DEF(TOK___fixunssfsi
, "__fixunssfsi")
243 DEF(TOK___fixunsdfsi
, "__fixunsdfsi")
244 DEF(TOK___fixunsxfsi
, "__fixunsxfsi")
245 DEF(TOK___fixxfdi
, "__fixxfdi")
247 DEF(TOK___fixsfdi
, "__fixsfdi")
248 DEF(TOK___fixdfdi
, "__fixdfdi")
252 #if defined TCC_TARGET_C67
253 DEF(TOK__divi
, "_divi")
254 DEF(TOK__divu
, "_divu")
255 DEF(TOK__divf
, "_divf")
256 DEF(TOK__divd
, "_divd")
257 DEF(TOK__remi
, "_remi")
258 DEF(TOK__remu
, "_remu")
261 #if defined TCC_TARGET_I386
262 DEF(TOK___fixsfdi
, "__fixsfdi")
263 DEF(TOK___fixdfdi
, "__fixdfdi")
264 DEF(TOK___fixxfdi
, "__fixxfdi")
267 #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
268 DEF(TOK_alloca
, "alloca")
271 #if defined TCC_TARGET_PE
272 DEF(TOK___chkstk
, "__chkstk")
274 #if defined TCC_TARGET_ARM64 || defined TCC_TARGET_RISCV64
275 DEF(TOK___arm64_clear_cache
, "__arm64_clear_cache")
276 DEF(TOK___addtf3
, "__addtf3")
277 DEF(TOK___subtf3
, "__subtf3")
278 DEF(TOK___multf3
, "__multf3")
279 DEF(TOK___divtf3
, "__divtf3")
280 DEF(TOK___extendsftf2
, "__extendsftf2")
281 DEF(TOK___extenddftf2
, "__extenddftf2")
282 DEF(TOK___trunctfsf2
, "__trunctfsf2")
283 DEF(TOK___trunctfdf2
, "__trunctfdf2")
284 DEF(TOK___fixtfsi
, "__fixtfsi")
285 DEF(TOK___fixtfdi
, "__fixtfdi")
286 DEF(TOK___fixunstfsi
, "__fixunstfsi")
287 DEF(TOK___fixunstfdi
, "__fixunstfdi")
288 DEF(TOK___floatsitf
, "__floatsitf")
289 DEF(TOK___floatditf
, "__floatditf")
290 DEF(TOK___floatunsitf
, "__floatunsitf")
291 DEF(TOK___floatunditf
, "__floatunditf")
292 DEF(TOK___eqtf2
, "__eqtf2")
293 DEF(TOK___netf2
, "__netf2")
294 DEF(TOK___lttf2
, "__lttf2")
295 DEF(TOK___letf2
, "__letf2")
296 DEF(TOK___gttf2
, "__gttf2")
297 DEF(TOK___getf2
, "__getf2")
300 /* bound checking symbols */
301 #ifdef CONFIG_TCC_BCHECK
302 DEF(TOK___bound_ptr_add
, "__bound_ptr_add")
303 DEF(TOK___bound_ptr_indir1
, "__bound_ptr_indir1")
304 DEF(TOK___bound_ptr_indir2
, "__bound_ptr_indir2")
305 DEF(TOK___bound_ptr_indir4
, "__bound_ptr_indir4")
306 DEF(TOK___bound_ptr_indir8
, "__bound_ptr_indir8")
307 DEF(TOK___bound_ptr_indir12
, "__bound_ptr_indir12")
308 DEF(TOK___bound_ptr_indir16
, "__bound_ptr_indir16")
309 DEF(TOK___bound_main_arg
, "__bound_main_arg")
310 DEF(TOK___bound_local_new
, "__bound_local_new")
311 DEF(TOK___bound_local_delete
, "__bound_local_delete")
312 DEF(TOK___bound_setjmp
, "__bound_setjmp")
313 DEF(TOK___bound_longjmp
, "__bound_longjmp")
314 DEF(TOK___bound_new_region
, "__bound_new_region")
315 # ifdef TCC_TARGET_PE
316 # ifdef TCC_TARGET_X86_64
317 DEF(TOK___bound_alloca_nr
, "__bound_alloca_nr")
320 DEF(TOK_sigsetjmp
, "sigsetjmp")
321 DEF(TOK___sigsetjmp
, "__sigsetjmp")
322 DEF(TOK_siglongjmp
, "siglongjmp")
324 DEF(TOK_setjmp
, "setjmp")
325 DEF(TOK__setjmp
, "_setjmp")
326 DEF(TOK_longjmp
, "longjmp")
330 DEF_ASMDIR(byte
) /* must be first directive */
353 DEF_ASMDIR(pushsection
)
354 DEF_ASMDIR(popsection
)
360 #if defined(TCC_TARGET_I386)
363 #elif defined(TCC_TARGET_X86_64)
369 DEF_ASMDIR(section
) /* must be last directive */
371 #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
372 #include "i386-tok.h"
374 #if defined TCC_TARGET_ARM || defined TCC_TARGET_ARM64