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