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