xref: /freebsd/contrib/llvm-project/llvm/include/llvm/AsmParser/LLToken.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===- LLToken.h - Token Codes for LLVM Assembly Files ----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the enums for the .ll lexer.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_ASMPARSER_LLTOKEN_H
14 #define LLVM_ASMPARSER_LLTOKEN_H
15 
16 namespace llvm {
17 namespace lltok {
18 enum Kind {
19   // Markers
20   Eof,
21   Error,
22 
23   // Tokens with no info.
24   dotdotdot, // ...
25   equal,
26   comma, // =  ,
27   star,  // *
28   lsquare,
29   rsquare, // [  ]
30   lbrace,
31   rbrace, // {  }
32   less,
33   greater, // <  >
34   lparen,
35   rparen,  // (  )
36   exclaim, // !
37   bar,     // |
38   colon,   // :
39   hash,    // #
40 
41   kw_vscale,
42   kw_x,
43   kw_true,
44   kw_false,
45   kw_declare,
46   kw_define,
47   kw_global,
48   kw_constant,
49 
50   kw_dso_local,
51   kw_dso_preemptable,
52 
53   kw_private,
54   kw_internal,
55   kw_linkonce,
56   kw_linkonce_odr,
57   kw_weak, // Used as a linkage, and a modifier for "cmpxchg".
58   kw_weak_odr,
59   kw_appending,
60   kw_dllimport,
61   kw_dllexport,
62   kw_common,
63   kw_available_externally,
64   kw_default,
65   kw_hidden,
66   kw_protected,
67   kw_unnamed_addr,
68   kw_local_unnamed_addr,
69   kw_externally_initialized,
70   kw_extern_weak,
71   kw_external,
72   kw_thread_local,
73   kw_localdynamic,
74   kw_initialexec,
75   kw_localexec,
76   kw_zeroinitializer,
77   kw_undef,
78   kw_poison,
79   kw_null,
80   kw_none,
81   kw_to,
82   kw_caller,
83   kw_within,
84   kw_from,
85   kw_tail,
86   kw_musttail,
87   kw_notail,
88   kw_target,
89   kw_triple,
90   kw_source_filename,
91   kw_unwind,
92   kw_datalayout,
93   kw_volatile,
94   kw_atomic,
95   kw_unordered,
96   kw_monotonic,
97   kw_acquire,
98   kw_release,
99   kw_acq_rel,
100   kw_seq_cst,
101   kw_syncscope,
102   kw_nnan,
103   kw_ninf,
104   kw_nsz,
105   kw_arcp,
106   kw_contract,
107   kw_reassoc,
108   kw_afn,
109   kw_fast,
110   kw_nuw,
111   kw_nsw,
112   kw_nusw,
113   kw_exact,
114   kw_disjoint,
115   kw_inbounds,
116   kw_nneg,
117   kw_inrange,
118   kw_addrspace,
119   kw_section,
120   kw_partition,
121   kw_code_model,
122   kw_alias,
123   kw_ifunc,
124   kw_module,
125   kw_asm,
126   kw_sideeffect,
127   kw_inteldialect,
128   kw_gc,
129   kw_prefix,
130   kw_prologue,
131   kw_c,
132 
133   kw_cc,
134   kw_ccc,
135   kw_fastcc,
136   kw_coldcc,
137   kw_intel_ocl_bicc,
138   kw_cfguard_checkcc,
139   kw_x86_stdcallcc,
140   kw_x86_fastcallcc,
141   kw_x86_thiscallcc,
142   kw_x86_vectorcallcc,
143   kw_x86_regcallcc,
144   kw_arm_apcscc,
145   kw_arm_aapcscc,
146   kw_arm_aapcs_vfpcc,
147   kw_aarch64_vector_pcs,
148   kw_aarch64_sve_vector_pcs,
149   kw_aarch64_sme_preservemost_from_x0,
150   kw_aarch64_sme_preservemost_from_x1,
151   kw_aarch64_sme_preservemost_from_x2,
152   kw_msp430_intrcc,
153   kw_avr_intrcc,
154   kw_avr_signalcc,
155   kw_ptx_kernel,
156   kw_ptx_device,
157   kw_spir_kernel,
158   kw_spir_func,
159   kw_x86_64_sysvcc,
160   kw_win64cc,
161   kw_anyregcc,
162   kw_swiftcc,
163   kw_swifttailcc,
164   kw_preserve_mostcc,
165   kw_preserve_allcc,
166   kw_preserve_nonecc,
167   kw_ghccc,
168   kw_x86_intrcc,
169   kw_hhvmcc,
170   kw_hhvm_ccc,
171   kw_cxx_fast_tlscc,
172   kw_amdgpu_vs,
173   kw_amdgpu_ls,
174   kw_amdgpu_hs,
175   kw_amdgpu_es,
176   kw_amdgpu_gs,
177   kw_amdgpu_ps,
178   kw_amdgpu_cs,
179   kw_amdgpu_cs_chain,
180   kw_amdgpu_cs_chain_preserve,
181   kw_amdgpu_kernel,
182   kw_amdgpu_gfx,
183   kw_tailcc,
184   kw_m68k_rtdcc,
185   kw_graalcc,
186   kw_riscv_vector_cc,
187 
188   // Attributes:
189   kw_attributes,
190   kw_sync,
191   kw_async,
192 #define GET_ATTR_NAMES
193 #define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) \
194   kw_##DISPLAY_NAME,
195 #include "llvm/IR/Attributes.inc"
196 
197   // Memory attribute:
198   kw_read,
199   kw_write,
200   kw_readwrite,
201   kw_argmem,
202   kw_inaccessiblemem,
203 
204   // Legacy memory attributes:
205   kw_argmemonly,
206   kw_inaccessiblememonly,
207   kw_inaccessiblemem_or_argmemonly,
208 
209   // nofpclass attribute:
210   kw_all,
211   kw_nan,
212   kw_snan,
213   kw_qnan,
214   kw_inf,
215   // kw_ninf, - already an fmf
216   kw_pinf,
217   kw_norm,
218   kw_nnorm,
219   kw_pnorm,
220   // kw_sub,  - already an instruction
221   kw_nsub,
222   kw_psub,
223   kw_zero,
224   kw_nzero,
225   kw_pzero,
226 
227   kw_type,
228   kw_opaque,
229 
230   kw_comdat,
231 
232   // Comdat types
233   kw_any,
234   kw_exactmatch,
235   kw_largest,
236   kw_nodeduplicate,
237   kw_samesize,
238 
239   kw_eq,
240   kw_ne,
241   kw_slt,
242   kw_sgt,
243   kw_sle,
244   kw_sge,
245   kw_ult,
246   kw_ugt,
247   kw_ule,
248   kw_uge,
249   kw_oeq,
250   kw_one,
251   kw_olt,
252   kw_ogt,
253   kw_ole,
254   kw_oge,
255   kw_ord,
256   kw_uno,
257   kw_ueq,
258   kw_une,
259 
260   // atomicrmw operations that aren't also instruction keywords.
261   kw_xchg,
262   kw_nand,
263   kw_max,
264   kw_min,
265   kw_umax,
266   kw_umin,
267   kw_fmax,
268   kw_fmin,
269   kw_uinc_wrap,
270   kw_udec_wrap,
271 
272   // Instruction Opcodes (Opcode in UIntVal).
273   kw_fneg,
274   kw_add,
275   kw_fadd,
276   kw_sub,
277   kw_fsub,
278   kw_mul,
279   kw_fmul,
280   kw_udiv,
281   kw_sdiv,
282   kw_fdiv,
283   kw_urem,
284   kw_srem,
285   kw_frem,
286   kw_shl,
287   kw_lshr,
288   kw_ashr,
289   kw_and,
290   kw_or,
291   kw_xor,
292   kw_icmp,
293   kw_fcmp,
294 
295   kw_phi,
296   kw_call,
297   kw_trunc,
298   kw_zext,
299   kw_sext,
300   kw_fptrunc,
301   kw_fpext,
302   kw_uitofp,
303   kw_sitofp,
304   kw_fptoui,
305   kw_fptosi,
306   kw_inttoptr,
307   kw_ptrtoint,
308   kw_bitcast,
309   kw_addrspacecast,
310   kw_select,
311   kw_va_arg,
312 
313   kw_landingpad,
314   kw_personality,
315   kw_cleanup,
316   kw_catch,
317   kw_filter,
318 
319   kw_ret,
320   kw_br,
321   kw_switch,
322   kw_indirectbr,
323   kw_invoke,
324   kw_resume,
325   kw_unreachable,
326   kw_cleanupret,
327   kw_catchswitch,
328   kw_catchret,
329   kw_catchpad,
330   kw_cleanuppad,
331   kw_callbr,
332 
333   kw_alloca,
334   kw_load,
335   kw_store,
336   kw_fence,
337   kw_cmpxchg,
338   kw_atomicrmw,
339   kw_getelementptr,
340 
341   kw_extractelement,
342   kw_insertelement,
343   kw_shufflevector,
344   kw_splat,
345   kw_extractvalue,
346   kw_insertvalue,
347   kw_blockaddress,
348   kw_dso_local_equivalent,
349   kw_no_cfi,
350   kw_ptrauth,
351 
352   kw_freeze,
353 
354   // Metadata types.
355   kw_distinct,
356 
357   // Use-list order directives.
358   kw_uselistorder,
359   kw_uselistorder_bb,
360 
361   // Summary index keywords
362   kw_path,
363   kw_hash,
364   kw_gv,
365   kw_guid,
366   kw_name,
367   kw_summaries,
368   kw_flags,
369   kw_blockcount,
370   kw_linkage,
371   kw_visibility,
372   kw_notEligibleToImport,
373   kw_live,
374   kw_dsoLocal,
375   kw_canAutoHide,
376   kw_importType,
377   kw_definition,
378   kw_declaration,
379   kw_function,
380   kw_insts,
381   kw_funcFlags,
382   kw_readNone,
383   kw_readOnly,
384   kw_noRecurse,
385   kw_returnDoesNotAlias,
386   kw_noInline,
387   kw_alwaysInline,
388   kw_noUnwind,
389   kw_mayThrow,
390   kw_hasUnknownCall,
391   kw_mustBeUnreachable,
392   kw_calls,
393   kw_callee,
394   kw_params,
395   kw_param,
396   kw_hotness,
397   kw_unknown,
398   kw_critical,
399   kw_relbf,
400   kw_variable,
401   kw_vTableFuncs,
402   kw_virtFunc,
403   kw_aliasee,
404   kw_refs,
405   kw_typeIdInfo,
406   kw_typeTests,
407   kw_typeTestAssumeVCalls,
408   kw_typeCheckedLoadVCalls,
409   kw_typeTestAssumeConstVCalls,
410   kw_typeCheckedLoadConstVCalls,
411   kw_vFuncId,
412   kw_offset,
413   kw_args,
414   kw_typeid,
415   kw_typeidCompatibleVTable,
416   kw_summary,
417   kw_typeTestRes,
418   kw_kind,
419   kw_unsat,
420   kw_byteArray,
421   kw_inline,
422   kw_single,
423   kw_allOnes,
424   kw_sizeM1BitWidth,
425   kw_alignLog2,
426   kw_sizeM1,
427   kw_bitMask,
428   kw_inlineBits,
429   kw_vcall_visibility,
430   kw_wpdResolutions,
431   kw_wpdRes,
432   kw_indir,
433   kw_singleImpl,
434   kw_branchFunnel,
435   kw_singleImplName,
436   kw_resByArg,
437   kw_byArg,
438   kw_uniformRetVal,
439   kw_uniqueRetVal,
440   kw_virtualConstProp,
441   kw_info,
442   kw_byte,
443   kw_bit,
444   kw_varFlags,
445   // The following are used by MemProf summary info.
446   kw_callsites,
447   kw_clones,
448   kw_stackIds,
449   kw_allocs,
450   kw_versions,
451   kw_memProf,
452   kw_notcold,
453 
454   // GV's with __attribute__((no_sanitize("address"))), or things in
455   // -fsanitize-ignorelist when built with ASan.
456   kw_no_sanitize_address,
457   // GV's with __attribute__((no_sanitize("hwaddress"))), or things in
458   // -fsanitize-ignorelist when built with HWASan.
459   kw_no_sanitize_hwaddress,
460   // GV's where the clang++ frontend (when ASan is used) notes that this is
461   // dynamically initialized, and thus needs ODR detection.
462   kw_sanitize_address_dyninit,
463 
464   // Unsigned Valued tokens (UIntVal).
465   LabelID,    // 42:
466   GlobalID,   // @42
467   LocalVarID, // %42
468   AttrGrpID,  // #42
469   SummaryID,  // ^42
470 
471   // String valued tokens (StrVal).
472   LabelStr,         // foo:
473   GlobalVar,        // @foo @"foo"
474   ComdatVar,        // $foo
475   LocalVar,         // %foo %"foo"
476   MetadataVar,      // !foo
477   StringConstant,   // "foo"
478   DwarfTag,         // DW_TAG_foo
479   DwarfAttEncoding, // DW_ATE_foo
480   DwarfVirtuality,  // DW_VIRTUALITY_foo
481   DwarfLang,        // DW_LANG_foo
482   DwarfCC,          // DW_CC_foo
483   EmissionKind,     // lineTablesOnly
484   NameTableKind,    // GNU
485   DwarfOp,          // DW_OP_foo
486   DIFlag,           // DIFlagFoo
487   DISPFlag,         // DISPFlagFoo
488   DwarfMacinfo,     // DW_MACINFO_foo
489   ChecksumKind,     // CSK_foo
490   DbgRecordType,    // dbg_foo
491 
492   // Type valued tokens (TyVal).
493   Type,
494 
495   APFloat, // APFloatVal
496   APSInt   // APSInt
497 };
498 } // end namespace lltok
499 } // end namespace llvm
500 
501 #endif
502