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