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