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