Rev 647 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
145 | halyavin | 1 | /* keywords */ |
2 | DEF(TOK_INT, "int") |
||
3 | DEF(TOK_VOID, "void") |
||
4 | DEF(TOK_CHAR, "char") |
||
5 | DEF(TOK_IF, "if") |
||
6 | DEF(TOK_ELSE, "else") |
||
7 | DEF(TOK_WHILE, "while") |
||
8 | DEF(TOK_BREAK, "break") |
||
9 | DEF(TOK_RETURN, "return") |
||
10 | DEF(TOK_FOR, "for") |
||
11 | DEF(TOK_EXTERN, "extern") |
||
12 | DEF(TOK_STATIC, "static") |
||
13 | DEF(TOK_UNSIGNED, "unsigned") |
||
14 | DEF(TOK_GOTO, "goto") |
||
15 | DEF(TOK_DO, "do") |
||
16 | DEF(TOK_CONTINUE, "continue") |
||
17 | DEF(TOK_SWITCH, "switch") |
||
18 | DEF(TOK_CASE, "case") |
||
19 | |||
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 */ |
||
26 | DEF(TOK_LONG, "long") |
||
27 | DEF(TOK_REGISTER, "register") |
||
28 | DEF(TOK_SIGNED1, "signed") |
||
29 | DEF(TOK_SIGNED2, "__signed") /* gcc keyword */ |
||
30 | DEF(TOK_SIGNED3, "__signed__") /* gcc keyword */ |
||
31 | DEF(TOK_AUTO, "auto") |
||
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 */ |
||
39 | |||
40 | DEF(TOK_FLOAT, "float") |
||
41 | DEF(TOK_DOUBLE, "double") |
||
42 | DEF(TOK_BOOL, "_Bool") |
||
43 | DEF(TOK_SHORT, "short") |
||
44 | DEF(TOK_STRUCT, "struct") |
||
45 | DEF(TOK_UNION, "union") |
||
46 | DEF(TOK_TYPEDEF, "typedef") |
||
47 | DEF(TOK_DEFAULT, "default") |
||
48 | DEF(TOK_ENUM, "enum") |
||
49 | DEF(TOK_SIZEOF, "sizeof") |
||
50 | DEF(TOK_ATTRIBUTE1, "__attribute") |
||
51 | DEF(TOK_ATTRIBUTE2, "__attribute__") |
||
52 | DEF(TOK_ALIGNOF1, "__alignof") |
||
53 | DEF(TOK_ALIGNOF2, "__alignof__") |
||
54 | DEF(TOK_TYPEOF1, "typeof") |
||
55 | DEF(TOK_TYPEOF2, "__typeof") |
||
56 | DEF(TOK_TYPEOF3, "__typeof__") |
||
57 | DEF(TOK_LABEL, "__label__") |
||
58 | DEF(TOK_ASM1, "asm") |
||
59 | DEF(TOK_ASM2, "__asm") |
||
60 | DEF(TOK_ASM3, "__asm__") |
||
61 | |||
6429 | siemargl | 62 | #ifdef TCC_TARGET_ARM64 |
63 | DEF(TOK_UINT128, "__uint128_t") |
||
64 | #endif |
||
65 | |||
145 | halyavin | 66 | /*********************************************************************/ |
67 | /* the following are not keywords. They are included to ease parsing */ |
||
68 | /* preprocessor only */ |
||
69 | DEF(TOK_DEFINE, "define") |
||
70 | DEF(TOK_INCLUDE, "include") |
||
71 | DEF(TOK_INCLUDE_NEXT, "include_next") |
||
72 | DEF(TOK_IFDEF, "ifdef") |
||
73 | DEF(TOK_IFNDEF, "ifndef") |
||
74 | DEF(TOK_ELIF, "elif") |
||
75 | DEF(TOK_ENDIF, "endif") |
||
76 | DEF(TOK_DEFINED, "defined") |
||
77 | DEF(TOK_UNDEF, "undef") |
||
78 | DEF(TOK_ERROR, "error") |
||
79 | DEF(TOK_WARNING, "warning") |
||
80 | DEF(TOK_LINE, "line") |
||
81 | DEF(TOK_PRAGMA, "pragma") |
||
82 | DEF(TOK___LINE__, "__LINE__") |
||
83 | DEF(TOK___FILE__, "__FILE__") |
||
84 | DEF(TOK___DATE__, "__DATE__") |
||
85 | DEF(TOK___TIME__, "__TIME__") |
||
86 | DEF(TOK___FUNCTION__, "__FUNCTION__") |
||
87 | DEF(TOK___VA_ARGS__, "__VA_ARGS__") |
||
6429 | siemargl | 88 | |
145 | halyavin | 89 | /* special identifiers */ |
90 | DEF(TOK___FUNC__, "__func__") |
||
6429 | siemargl | 91 | |
92 | /* special floating point values */ |
||
93 | DEF(TOK___NAN__, "__nan__") |
||
94 | DEF(TOK___SNAN__, "__snan__") |
||
95 | DEF(TOK___INF__, "__inf__") |
||
96 | |||
145 | halyavin | 97 | /* attribute identifiers */ |
98 | /* XXX: handle all tokens generically since speed is not critical */ |
||
99 | DEF(TOK_SECTION1, "section") |
||
100 | DEF(TOK_SECTION2, "__section__") |
||
101 | DEF(TOK_ALIGNED1, "aligned") |
||
102 | DEF(TOK_ALIGNED2, "__aligned__") |
||
103 | DEF(TOK_PACKED1, "packed") |
||
104 | DEF(TOK_PACKED2, "__packed__") |
||
6429 | siemargl | 105 | DEF(TOK_WEAK1, "weak") |
106 | DEF(TOK_WEAK2, "__weak__") |
||
107 | DEF(TOK_ALIAS1, "alias") |
||
108 | DEF(TOK_ALIAS2, "__alias__") |
||
145 | halyavin | 109 | DEF(TOK_UNUSED1, "unused") |
110 | DEF(TOK_UNUSED2, "__unused__") |
||
111 | DEF(TOK_CDECL1, "cdecl") |
||
112 | DEF(TOK_CDECL2, "__cdecl") |
||
113 | DEF(TOK_CDECL3, "__cdecl__") |
||
114 | DEF(TOK_STDCALL1, "stdcall") |
||
115 | DEF(TOK_STDCALL2, "__stdcall") |
||
116 | DEF(TOK_STDCALL3, "__stdcall__") |
||
6429 | siemargl | 117 | DEF(TOK_FASTCALL1, "fastcall") |
118 | DEF(TOK_FASTCALL2, "__fastcall") |
||
119 | DEF(TOK_FASTCALL3, "__fastcall__") |
||
120 | DEF(TOK_MODE, "__mode__") |
||
121 | DEF(TOK_MODE_DI, "__DI__") |
||
122 | DEF(TOK_MODE_HI, "__HI__") |
||
123 | DEF(TOK_MODE_SI, "__SI__") |
||
145 | halyavin | 124 | DEF(TOK_DLLEXPORT, "dllexport") |
6429 | siemargl | 125 | DEF(TOK_DLLIMPORT, "dllimport") |
145 | halyavin | 126 | DEF(TOK_NORETURN1, "noreturn") |
127 | DEF(TOK_NORETURN2, "__noreturn__") |
||
6429 | siemargl | 128 | DEF(TOK_VISIBILITY1, "visibility") |
129 | DEF(TOK_VISIBILITY2, "__visibility__") |
||
145 | halyavin | 130 | DEF(TOK_builtin_types_compatible_p, "__builtin_types_compatible_p") |
131 | DEF(TOK_builtin_constant_p, "__builtin_constant_p") |
||
6429 | siemargl | 132 | DEF(TOK_builtin_frame_address, "__builtin_frame_address") |
133 | DEF(TOK_builtin_return_address, "__builtin_return_address") |
||
134 | DEF(TOK_builtin_expect, "__builtin_expect") |
||
135 | #ifdef TCC_TARGET_X86_64 |
||
136 | #ifdef TCC_TARGET_PE |
||
137 | DEF(TOK_builtin_va_start, "__builtin_va_start") |
||
138 | #else |
||
139 | DEF(TOK_builtin_va_arg_types, "__builtin_va_arg_types") |
||
140 | #endif |
||
141 | #endif |
||
145 | halyavin | 142 | DEF(TOK_REGPARM1, "regparm") |
143 | DEF(TOK_REGPARM2, "__regparm__") |
||
144 | |||
6429 | siemargl | 145 | #ifdef TCC_TARGET_ARM64 |
146 | DEF(TOK___va_start, "__va_start") |
||
147 | DEF(TOK___va_arg, "__va_arg") |
||
148 | #endif |
||
149 | |||
145 | halyavin | 150 | /* pragma */ |
151 | DEF(TOK_pack, "pack") |
||
6429 | siemargl | 152 | #if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_X86_64) |
145 | halyavin | 153 | /* already defined for assembler */ |
154 | DEF(TOK_ASM_push, "push") |
||
155 | DEF(TOK_ASM_pop, "pop") |
||
156 | #endif |
||
6429 | siemargl | 157 | DEF(TOK_comment, "comment") |
158 | DEF(TOK_lib, "lib") |
||
159 | DEF(TOK_push_macro, "push_macro") |
||
160 | DEF(TOK_pop_macro, "pop_macro") |
||
161 | DEF(TOK_once, "once") |
||
145 | halyavin | 162 | |
163 | /* builtin functions or variables */ |
||
6429 | siemargl | 164 | #ifndef TCC_ARM_EABI |
145 | halyavin | 165 | DEF(TOK_memcpy, "memcpy") |
6429 | siemargl | 166 | DEF(TOK_memmove, "memmove") |
145 | halyavin | 167 | DEF(TOK_memset, "memset") |
168 | DEF(TOK___divdi3, "__divdi3") |
||
169 | DEF(TOK___moddi3, "__moddi3") |
||
170 | DEF(TOK___udivdi3, "__udivdi3") |
||
171 | DEF(TOK___umoddi3, "__umoddi3") |
||
6429 | siemargl | 172 | DEF(TOK___ashrdi3, "__ashrdi3") |
173 | DEF(TOK___lshrdi3, "__lshrdi3") |
||
174 | DEF(TOK___ashldi3, "__ashldi3") |
||
175 | DEF(TOK___floatundisf, "__floatundisf") |
||
176 | DEF(TOK___floatundidf, "__floatundidf") |
||
177 | # ifndef TCC_ARM_VFP |
||
178 | DEF(TOK___floatundixf, "__floatundixf") |
||
179 | DEF(TOK___fixunsxfdi, "__fixunsxfdi") |
||
180 | # endif |
||
181 | DEF(TOK___fixunssfdi, "__fixunssfdi") |
||
182 | DEF(TOK___fixunsdfdi, "__fixunsdfdi") |
||
183 | #endif |
||
184 | |||
185 | #if defined TCC_TARGET_ARM |
||
186 | # ifdef TCC_ARM_EABI |
||
187 | DEF(TOK_memcpy, "__aeabi_memcpy") |
||
188 | DEF(TOK_memcpy4, "__aeabi_memcpy4") |
||
189 | DEF(TOK_memcpy8, "__aeabi_memcpy8") |
||
190 | DEF(TOK_memmove, "__aeabi_memmove") |
||
191 | DEF(TOK_memset, "__aeabi_memset") |
||
192 | DEF(TOK___aeabi_ldivmod, "__aeabi_ldivmod") |
||
193 | DEF(TOK___aeabi_uldivmod, "__aeabi_uldivmod") |
||
194 | DEF(TOK___aeabi_idivmod, "__aeabi_idivmod") |
||
195 | DEF(TOK___aeabi_uidivmod, "__aeabi_uidivmod") |
||
196 | DEF(TOK___divsi3, "__aeabi_idiv") |
||
197 | DEF(TOK___udivsi3, "__aeabi_uidiv") |
||
198 | DEF(TOK___floatdisf, "__aeabi_l2f") |
||
199 | DEF(TOK___floatdidf, "__aeabi_l2d") |
||
200 | DEF(TOK___fixsfdi, "__aeabi_f2lz") |
||
201 | DEF(TOK___fixdfdi, "__aeabi_d2lz") |
||
202 | DEF(TOK___ashrdi3, "__aeabi_lasr") |
||
203 | DEF(TOK___lshrdi3, "__aeabi_llsr") |
||
204 | DEF(TOK___ashldi3, "__aeabi_llsl") |
||
205 | DEF(TOK___floatundisf, "__aeabi_ul2f") |
||
206 | DEF(TOK___floatundidf, "__aeabi_ul2d") |
||
207 | DEF(TOK___fixunssfdi, "__aeabi_f2ulz") |
||
208 | DEF(TOK___fixunsdfdi, "__aeabi_d2ulz") |
||
209 | # else |
||
210 | DEF(TOK___modsi3, "__modsi3") |
||
211 | DEF(TOK___umodsi3, "__umodsi3") |
||
145 | halyavin | 212 | DEF(TOK___divsi3, "__divsi3") |
213 | DEF(TOK___udivsi3, "__udivsi3") |
||
6429 | siemargl | 214 | DEF(TOK___floatdisf, "__floatdisf") |
215 | DEF(TOK___floatdidf, "__floatdidf") |
||
216 | # ifndef TCC_ARM_VFP |
||
217 | DEF(TOK___floatdixf, "__floatdixf") |
||
145 | halyavin | 218 | DEF(TOK___fixunssfsi, "__fixunssfsi") |
219 | DEF(TOK___fixunsdfsi, "__fixunsdfsi") |
||
220 | DEF(TOK___fixunsxfsi, "__fixunsxfsi") |
||
6429 | siemargl | 221 | DEF(TOK___fixxfdi, "__fixxfdi") |
222 | # endif |
||
145 | halyavin | 223 | DEF(TOK___fixsfdi, "__fixsfdi") |
224 | DEF(TOK___fixdfdi, "__fixdfdi") |
||
6429 | siemargl | 225 | # endif |
226 | #endif |
||
227 | |||
228 | #if defined TCC_TARGET_C67 |
||
145 | halyavin | 229 | DEF(TOK__divi, "_divi") |
230 | DEF(TOK__divu, "_divu") |
||
231 | DEF(TOK__divf, "_divf") |
||
232 | DEF(TOK__divd, "_divd") |
||
233 | DEF(TOK__remi, "_remi") |
||
234 | DEF(TOK__remu, "_remu") |
||
235 | #endif |
||
6429 | siemargl | 236 | |
237 | #if defined TCC_TARGET_I386 |
||
238 | DEF(TOK___fixsfdi, "__fixsfdi") |
||
239 | DEF(TOK___fixdfdi, "__fixdfdi") |
||
240 | DEF(TOK___fixxfdi, "__fixxfdi") |
||
241 | |||
242 | #ifndef COMMIT_4ad186c5ef61_IS_FIXED |
||
243 | DEF(TOK___tcc_cvt_ftol, "__tcc_cvt_ftol") |
||
244 | #endif |
||
245 | #endif |
||
246 | |||
247 | #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64 |
||
248 | DEF(TOK_alloca, "alloca") |
||
249 | #endif |
||
250 | |||
251 | #if defined TCC_TARGET_PE |
||
145 | halyavin | 252 | DEF(TOK___chkstk, "__chkstk") |
6429 | siemargl | 253 | #endif |
254 | #ifdef TCC_TARGET_ARM64 |
||
255 | DEF(TOK___arm64_clear_cache, "__arm64_clear_cache") |
||
256 | DEF(TOK___addtf3, "__addtf3") |
||
257 | DEF(TOK___subtf3, "__subtf3") |
||
258 | DEF(TOK___multf3, "__multf3") |
||
259 | DEF(TOK___divtf3, "__divtf3") |
||
260 | DEF(TOK___extendsftf2, "__extendsftf2") |
||
261 | DEF(TOK___extenddftf2, "__extenddftf2") |
||
262 | DEF(TOK___trunctfsf2, "__trunctfsf2") |
||
263 | DEF(TOK___trunctfdf2, "__trunctfdf2") |
||
264 | DEF(TOK___fixtfsi, "__fixtfsi") |
||
265 | DEF(TOK___fixtfdi, "__fixtfdi") |
||
266 | DEF(TOK___fixunstfsi, "__fixunstfsi") |
||
267 | DEF(TOK___fixunstfdi, "__fixunstfdi") |
||
268 | DEF(TOK___floatsitf, "__floatsitf") |
||
269 | DEF(TOK___floatditf, "__floatditf") |
||
270 | DEF(TOK___floatunsitf, "__floatunsitf") |
||
271 | DEF(TOK___floatunditf, "__floatunditf") |
||
272 | DEF(TOK___eqtf2, "__eqtf2") |
||
273 | DEF(TOK___netf2, "__netf2") |
||
274 | DEF(TOK___lttf2, "__lttf2") |
||
275 | DEF(TOK___letf2, "__letf2") |
||
276 | DEF(TOK___gttf2, "__gttf2") |
||
277 | DEF(TOK___getf2, "__getf2") |
||
278 | #endif |
||
145 | halyavin | 279 | |
280 | /* bound checking symbols */ |
||
281 | #ifdef CONFIG_TCC_BCHECK |
||
282 | DEF(TOK___bound_ptr_add, "__bound_ptr_add") |
||
283 | DEF(TOK___bound_ptr_indir1, "__bound_ptr_indir1") |
||
284 | DEF(TOK___bound_ptr_indir2, "__bound_ptr_indir2") |
||
285 | DEF(TOK___bound_ptr_indir4, "__bound_ptr_indir4") |
||
286 | DEF(TOK___bound_ptr_indir8, "__bound_ptr_indir8") |
||
287 | DEF(TOK___bound_ptr_indir12, "__bound_ptr_indir12") |
||
288 | DEF(TOK___bound_ptr_indir16, "__bound_ptr_indir16") |
||
6429 | siemargl | 289 | DEF(TOK___bound_main_arg, "__bound_main_arg") |
145 | halyavin | 290 | DEF(TOK___bound_local_new, "__bound_local_new") |
291 | DEF(TOK___bound_local_delete, "__bound_local_delete") |
||
6429 | siemargl | 292 | DEF(TOK___bound_init, "__bound_init") |
293 | # ifdef TCC_TARGET_PE |
||
145 | halyavin | 294 | DEF(TOK_malloc, "malloc") |
295 | DEF(TOK_free, "free") |
||
296 | DEF(TOK_realloc, "realloc") |
||
297 | DEF(TOK_memalign, "memalign") |
||
298 | DEF(TOK_calloc, "calloc") |
||
6429 | siemargl | 299 | # endif |
145 | halyavin | 300 | DEF(TOK_strlen, "strlen") |
301 | DEF(TOK_strcpy, "strcpy") |
||
302 | #endif |
||
303 | |||
304 | /* Tiny Assembler */ |
||
6429 | siemargl | 305 | DEF_ASMDIR(byte) /* must be first directive */ |
306 | DEF_ASMDIR(word) |
||
307 | DEF_ASMDIR(align) |
||
308 | DEF_ASMDIR(p2align) |
||
309 | DEF_ASMDIR(skip) |
||
310 | DEF_ASMDIR(space) |
||
311 | DEF_ASMDIR(string) |
||
312 | DEF_ASMDIR(asciz) |
||
313 | DEF_ASMDIR(ascii) |
||
314 | DEF_ASMDIR(file) |
||
315 | DEF_ASMDIR(globl) |
||
316 | DEF_ASMDIR(global) |
||
317 | DEF_ASMDIR(weak) |
||
318 | DEF_ASMDIR(hidden) |
||
319 | DEF_ASMDIR(ident) |
||
320 | DEF_ASMDIR(size) |
||
321 | DEF_ASMDIR(type) |
||
322 | DEF_ASMDIR(text) |
||
323 | DEF_ASMDIR(data) |
||
324 | DEF_ASMDIR(bss) |
||
325 | DEF_ASMDIR(previous) |
||
326 | DEF_ASMDIR(fill) |
||
327 | DEF_ASMDIR(rept) |
||
328 | DEF_ASMDIR(endr) |
||
329 | DEF_ASMDIR(org) |
||
330 | DEF_ASMDIR(quad) |
||
331 | #if defined(TCC_TARGET_I386) |
||
332 | DEF_ASMDIR(code16) |
||
333 | DEF_ASMDIR(code32) |
||
334 | #elif defined(TCC_TARGET_X86_64) |
||
335 | DEF_ASMDIR(code64) |
||
336 | #endif |
||
337 | DEF_ASMDIR(short) |
||
338 | DEF_ASMDIR(long) |
||
339 | DEF_ASMDIR(int) |
||
340 | DEF_ASMDIR(section) /* must be last directive */ |
||
145 | halyavin | 341 | |
6429 | siemargl | 342 | #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64 |
343 | #include "i386-tok.h" |
||
145 | halyavin | 344 | #endif |