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