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