LLVMBitCodes.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- LLVMBitCodes.h - Enum values for the LLVM bitcode format -*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This header defines Bitcode enum values for LLVM IR bitcode files.
  15. //
  16. // The enum values defined in this file should be considered permanent. If
  17. // new features are added, they should have values added at the end of the
  18. // respective lists.
  19. //
  20. //===----------------------------------------------------------------------===//
  21. #ifndef LLVM_BITCODE_LLVMBITCODES_H
  22. #define LLVM_BITCODE_LLVMBITCODES_H
  23. // This is the only file included, and it, in turn, is a leaf header.
  24. // This allows external tools to dump the AST of this file and analyze it for
  25. // changes without needing to fully or partially build LLVM itself.
  26. #include "llvm/Bitstream/BitCodeEnums.h"
  27. namespace llvm {
  28. namespace bitc {
  29. // The only top-level block types are MODULE, IDENTIFICATION, STRTAB and SYMTAB.
  30. enum BlockIDs {
  31. // Blocks
  32. MODULE_BLOCK_ID = FIRST_APPLICATION_BLOCKID,
  33. // Module sub-block id's.
  34. PARAMATTR_BLOCK_ID,
  35. PARAMATTR_GROUP_BLOCK_ID,
  36. CONSTANTS_BLOCK_ID,
  37. FUNCTION_BLOCK_ID,
  38. // Block intended to contains information on the bitcode versioning.
  39. // Can be used to provide better error messages when we fail to parse a
  40. // bitcode file.
  41. IDENTIFICATION_BLOCK_ID,
  42. VALUE_SYMTAB_BLOCK_ID,
  43. METADATA_BLOCK_ID,
  44. METADATA_ATTACHMENT_ID,
  45. TYPE_BLOCK_ID_NEW,
  46. USELIST_BLOCK_ID,
  47. MODULE_STRTAB_BLOCK_ID,
  48. GLOBALVAL_SUMMARY_BLOCK_ID,
  49. OPERAND_BUNDLE_TAGS_BLOCK_ID,
  50. METADATA_KIND_BLOCK_ID,
  51. STRTAB_BLOCK_ID,
  52. FULL_LTO_GLOBALVAL_SUMMARY_BLOCK_ID,
  53. SYMTAB_BLOCK_ID,
  54. SYNC_SCOPE_NAMES_BLOCK_ID,
  55. };
  56. /// Identification block contains a string that describes the producer details,
  57. /// and an epoch that defines the auto-upgrade capability.
  58. enum IdentificationCodes {
  59. IDENTIFICATION_CODE_STRING = 1, // IDENTIFICATION: [strchr x N]
  60. IDENTIFICATION_CODE_EPOCH = 2, // EPOCH: [epoch#]
  61. };
  62. /// The epoch that defines the auto-upgrade compatibility for the bitcode.
  63. ///
  64. /// LLVM guarantees in a major release that a minor release can read bitcode
  65. /// generated by previous minor releases. We translate this by making the reader
  66. /// accepting only bitcode with the same epoch, except for the X.0 release which
  67. /// also accepts N-1.
  68. enum { BITCODE_CURRENT_EPOCH = 0 };
  69. /// MODULE blocks have a number of optional fields and subblocks.
  70. enum ModuleCodes {
  71. MODULE_CODE_VERSION = 1, // VERSION: [version#]
  72. MODULE_CODE_TRIPLE = 2, // TRIPLE: [strchr x N]
  73. MODULE_CODE_DATALAYOUT = 3, // DATALAYOUT: [strchr x N]
  74. MODULE_CODE_ASM = 4, // ASM: [strchr x N]
  75. MODULE_CODE_SECTIONNAME = 5, // SECTIONNAME: [strchr x N]
  76. // Deprecated, but still needed to read old bitcode files.
  77. MODULE_CODE_DEPLIB = 6, // DEPLIB: [strchr x N]
  78. // GLOBALVAR: [pointer type, isconst, initid,
  79. // linkage, alignment, section, visibility, threadlocal]
  80. MODULE_CODE_GLOBALVAR = 7,
  81. // FUNCTION: [type, callingconv, isproto, linkage, paramattrs, alignment,
  82. // section, visibility, gc, unnamed_addr]
  83. MODULE_CODE_FUNCTION = 8,
  84. // ALIAS: [alias type, aliasee val#, linkage, visibility]
  85. MODULE_CODE_ALIAS_OLD = 9,
  86. MODULE_CODE_GCNAME = 11, // GCNAME: [strchr x N]
  87. MODULE_CODE_COMDAT = 12, // COMDAT: [selection_kind, name]
  88. MODULE_CODE_VSTOFFSET = 13, // VSTOFFSET: [offset]
  89. // ALIAS: [alias value type, addrspace, aliasee val#, linkage, visibility]
  90. MODULE_CODE_ALIAS = 14,
  91. MODULE_CODE_METADATA_VALUES_UNUSED = 15,
  92. // SOURCE_FILENAME: [namechar x N]
  93. MODULE_CODE_SOURCE_FILENAME = 16,
  94. // HASH: [5*i32]
  95. MODULE_CODE_HASH = 17,
  96. // IFUNC: [ifunc value type, addrspace, resolver val#, linkage, visibility]
  97. MODULE_CODE_IFUNC = 18,
  98. };
  99. /// PARAMATTR blocks have code for defining a parameter attribute set.
  100. enum AttributeCodes {
  101. // Deprecated, but still needed to read old bitcode files.
  102. PARAMATTR_CODE_ENTRY_OLD = 1, // ENTRY: [paramidx0, attr0,
  103. // paramidx1, attr1...]
  104. PARAMATTR_CODE_ENTRY = 2, // ENTRY: [attrgrp0, attrgrp1, ...]
  105. PARAMATTR_GRP_CODE_ENTRY = 3 // ENTRY: [grpid, idx, attr0, attr1, ...]
  106. };
  107. /// TYPE blocks have codes for each type primitive they use.
  108. enum TypeCodes {
  109. TYPE_CODE_NUMENTRY = 1, // NUMENTRY: [numentries]
  110. // Type Codes
  111. TYPE_CODE_VOID = 2, // VOID
  112. TYPE_CODE_FLOAT = 3, // FLOAT
  113. TYPE_CODE_DOUBLE = 4, // DOUBLE
  114. TYPE_CODE_LABEL = 5, // LABEL
  115. TYPE_CODE_OPAQUE = 6, // OPAQUE
  116. TYPE_CODE_INTEGER = 7, // INTEGER: [width]
  117. TYPE_CODE_POINTER = 8, // POINTER: [pointee type]
  118. TYPE_CODE_FUNCTION_OLD = 9, // FUNCTION: [vararg, attrid, retty,
  119. // paramty x N]
  120. TYPE_CODE_HALF = 10, // HALF
  121. TYPE_CODE_ARRAY = 11, // ARRAY: [numelts, eltty]
  122. TYPE_CODE_VECTOR = 12, // VECTOR: [numelts, eltty]
  123. // These are not with the other floating point types because they're
  124. // a late addition, and putting them in the right place breaks
  125. // binary compatibility.
  126. TYPE_CODE_X86_FP80 = 13, // X86 LONG DOUBLE
  127. TYPE_CODE_FP128 = 14, // LONG DOUBLE (112 bit mantissa)
  128. TYPE_CODE_PPC_FP128 = 15, // PPC LONG DOUBLE (2 doubles)
  129. TYPE_CODE_METADATA = 16, // METADATA
  130. TYPE_CODE_X86_MMX = 17, // X86 MMX
  131. TYPE_CODE_STRUCT_ANON = 18, // STRUCT_ANON: [ispacked, eltty x N]
  132. TYPE_CODE_STRUCT_NAME = 19, // STRUCT_NAME: [strchr x N]
  133. TYPE_CODE_STRUCT_NAMED = 20, // STRUCT_NAMED: [ispacked, eltty x N]
  134. TYPE_CODE_FUNCTION = 21, // FUNCTION: [vararg, retty, paramty x N]
  135. TYPE_CODE_TOKEN = 22, // TOKEN
  136. TYPE_CODE_BFLOAT = 23, // BRAIN FLOATING POINT
  137. TYPE_CODE_X86_AMX = 24, // X86 AMX
  138. TYPE_CODE_OPAQUE_POINTER = 25, // OPAQUE_POINTER: [addrspace]
  139. TYPE_CODE_TARGET_TYPE = 26, // TARGET_TYPE
  140. };
  141. enum OperandBundleTagCode {
  142. OPERAND_BUNDLE_TAG = 1, // TAG: [strchr x N]
  143. };
  144. enum SyncScopeNameCode {
  145. SYNC_SCOPE_NAME = 1,
  146. };
  147. // Value symbol table codes.
  148. enum ValueSymtabCodes {
  149. VST_CODE_ENTRY = 1, // VST_ENTRY: [valueid, namechar x N]
  150. VST_CODE_BBENTRY = 2, // VST_BBENTRY: [bbid, namechar x N]
  151. VST_CODE_FNENTRY = 3, // VST_FNENTRY: [valueid, offset, namechar x N]
  152. // VST_COMBINED_ENTRY: [valueid, refguid]
  153. VST_CODE_COMBINED_ENTRY = 5
  154. };
  155. // The module path symbol table only has one code (MST_CODE_ENTRY).
  156. enum ModulePathSymtabCodes {
  157. MST_CODE_ENTRY = 1, // MST_ENTRY: [modid, namechar x N]
  158. MST_CODE_HASH = 2, // MST_HASH: [5*i32]
  159. };
  160. // The summary section uses different codes in the per-module
  161. // and combined index cases.
  162. enum GlobalValueSummarySymtabCodes {
  163. // PERMODULE: [valueid, flags, instcount, numrefs, numrefs x valueid,
  164. // n x (valueid)]
  165. FS_PERMODULE = 1,
  166. // PERMODULE_PROFILE: [valueid, flags, instcount, numrefs,
  167. // numrefs x valueid,
  168. // n x (valueid, hotness)]
  169. FS_PERMODULE_PROFILE = 2,
  170. // PERMODULE_GLOBALVAR_INIT_REFS: [valueid, flags, n x valueid]
  171. FS_PERMODULE_GLOBALVAR_INIT_REFS = 3,
  172. // COMBINED: [valueid, modid, flags, instcount, numrefs, numrefs x valueid,
  173. // n x (valueid)]
  174. FS_COMBINED = 4,
  175. // COMBINED_PROFILE: [valueid, modid, flags, instcount, numrefs,
  176. // numrefs x valueid,
  177. // n x (valueid, hotness)]
  178. FS_COMBINED_PROFILE = 5,
  179. // COMBINED_GLOBALVAR_INIT_REFS: [valueid, modid, flags, n x valueid]
  180. FS_COMBINED_GLOBALVAR_INIT_REFS = 6,
  181. // ALIAS: [valueid, flags, valueid]
  182. FS_ALIAS = 7,
  183. // COMBINED_ALIAS: [valueid, modid, flags, valueid]
  184. FS_COMBINED_ALIAS = 8,
  185. // COMBINED_ORIGINAL_NAME: [original_name_hash]
  186. FS_COMBINED_ORIGINAL_NAME = 9,
  187. // VERSION of the summary, bumped when adding flags for instance.
  188. FS_VERSION = 10,
  189. // The list of llvm.type.test type identifiers used by the following function
  190. // that are used other than by an llvm.assume.
  191. // [n x typeid]
  192. FS_TYPE_TESTS = 11,
  193. // The list of virtual calls made by this function using
  194. // llvm.assume(llvm.type.test) intrinsics that do not have all constant
  195. // integer arguments.
  196. // [n x (typeid, offset)]
  197. FS_TYPE_TEST_ASSUME_VCALLS = 12,
  198. // The list of virtual calls made by this function using
  199. // llvm.type.checked.load intrinsics that do not have all constant integer
  200. // arguments.
  201. // [n x (typeid, offset)]
  202. FS_TYPE_CHECKED_LOAD_VCALLS = 13,
  203. // Identifies a virtual call made by this function using an
  204. // llvm.assume(llvm.type.test) intrinsic with all constant integer arguments.
  205. // [typeid, offset, n x arg]
  206. FS_TYPE_TEST_ASSUME_CONST_VCALL = 14,
  207. // Identifies a virtual call made by this function using an
  208. // llvm.type.checked.load intrinsic with all constant integer arguments.
  209. // [typeid, offset, n x arg]
  210. FS_TYPE_CHECKED_LOAD_CONST_VCALL = 15,
  211. // Assigns a GUID to a value ID. This normally appears only in combined
  212. // summaries, but it can also appear in per-module summaries for PGO data.
  213. // [valueid, guid]
  214. FS_VALUE_GUID = 16,
  215. // The list of local functions with CFI jump tables. Function names are
  216. // strings in strtab.
  217. // [n * name]
  218. FS_CFI_FUNCTION_DEFS = 17,
  219. // The list of external functions with CFI jump tables. Function names are
  220. // strings in strtab.
  221. // [n * name]
  222. FS_CFI_FUNCTION_DECLS = 18,
  223. // Per-module summary that also adds relative block frequency to callee info.
  224. // PERMODULE_RELBF: [valueid, flags, instcount, numrefs,
  225. // numrefs x valueid,
  226. // n x (valueid, relblockfreq)]
  227. FS_PERMODULE_RELBF = 19,
  228. // Index-wide flags
  229. FS_FLAGS = 20,
  230. // Maps type identifier to summary information for that type identifier.
  231. // Produced by the thin link (only lives in combined index).
  232. // TYPE_ID: [typeid, kind, bitwidth, align, size, bitmask, inlinebits,
  233. // n x (typeid, kind, name, numrba,
  234. // numrba x (numarg, numarg x arg, kind, info, byte, bit))]
  235. FS_TYPE_ID = 21,
  236. // For background see overview at https://llvm.org/docs/TypeMetadata.html.
  237. // The type metadata includes both the type identifier and the offset of
  238. // the address point of the type (the address held by objects of that type
  239. // which may not be the beginning of the virtual table). Vtable definitions
  240. // are decorated with type metadata for the types they are compatible with.
  241. //
  242. // Maps type identifier to summary information for that type identifier
  243. // computed from type metadata: the valueid of each vtable definition
  244. // decorated with a type metadata for that identifier, and the offset from
  245. // the corresponding type metadata.
  246. // Exists in the per-module summary to provide information to thin link
  247. // for index-based whole program devirtualization.
  248. // TYPE_ID_METADATA: [typeid, n x (valueid, offset)]
  249. FS_TYPE_ID_METADATA = 22,
  250. // Summarizes vtable definition for use in index-based whole program
  251. // devirtualization during the thin link.
  252. // PERMODULE_VTABLE_GLOBALVAR_INIT_REFS: [valueid, flags, varflags,
  253. // numrefs, numrefs x valueid,
  254. // n x (valueid, offset)]
  255. FS_PERMODULE_VTABLE_GLOBALVAR_INIT_REFS = 23,
  256. // The total number of basic blocks in the module.
  257. FS_BLOCK_COUNT = 24,
  258. // Range information for accessed offsets for every argument.
  259. // [n x (paramno, range, numcalls, numcalls x (callee_guid, paramno, range))]
  260. FS_PARAM_ACCESS = 25,
  261. // Summary of per-module memprof callsite metadata.
  262. // [valueid, n x stackidindex]
  263. FS_PERMODULE_CALLSITE_INFO = 26,
  264. // Summary of per-module allocation memprof metadata.
  265. // [n x (alloc type, nummib, nummib x stackidindex)]
  266. FS_PERMODULE_ALLOC_INFO = 27,
  267. // Summary of combined index memprof callsite metadata.
  268. // [valueid, numstackindices, numver,
  269. // numstackindices x stackidindex, numver x version]
  270. FS_COMBINED_CALLSITE_INFO = 28,
  271. // Summary of combined index allocation memprof metadata.
  272. // [nummib, numver,
  273. // nummib x (alloc type, numstackids, numstackids x stackidindex),
  274. // numver x version]
  275. FS_COMBINED_ALLOC_INFO = 29,
  276. FS_STACK_IDS = 30,
  277. };
  278. enum MetadataCodes {
  279. METADATA_STRING_OLD = 1, // MDSTRING: [values]
  280. METADATA_VALUE = 2, // VALUE: [type num, value num]
  281. METADATA_NODE = 3, // NODE: [n x md num]
  282. METADATA_NAME = 4, // STRING: [values]
  283. METADATA_DISTINCT_NODE = 5, // DISTINCT_NODE: [n x md num]
  284. METADATA_KIND = 6, // [n x [id, name]]
  285. METADATA_LOCATION = 7, // [distinct, line, col, scope, inlined-at?]
  286. METADATA_OLD_NODE = 8, // OLD_NODE: [n x (type num, value num)]
  287. METADATA_OLD_FN_NODE = 9, // OLD_FN_NODE: [n x (type num, value num)]
  288. METADATA_NAMED_NODE = 10, // NAMED_NODE: [n x mdnodes]
  289. METADATA_ATTACHMENT = 11, // [m x [value, [n x [id, mdnode]]]
  290. METADATA_GENERIC_DEBUG = 12, // [distinct, tag, vers, header, n x md num]
  291. METADATA_SUBRANGE = 13, // [distinct, count, lo]
  292. METADATA_ENUMERATOR = 14, // [isUnsigned|distinct, value, name]
  293. METADATA_BASIC_TYPE = 15, // [distinct, tag, name, size, align, enc]
  294. METADATA_FILE = 16, // [distinct, filename, directory, checksumkind, checksum]
  295. METADATA_DERIVED_TYPE = 17, // [distinct, ...]
  296. METADATA_COMPOSITE_TYPE = 18, // [distinct, ...]
  297. METADATA_SUBROUTINE_TYPE = 19, // [distinct, flags, types, cc]
  298. METADATA_COMPILE_UNIT = 20, // [distinct, ...]
  299. METADATA_SUBPROGRAM = 21, // [distinct, ...]
  300. METADATA_LEXICAL_BLOCK = 22, // [distinct, scope, file, line, column]
  301. METADATA_LEXICAL_BLOCK_FILE = 23, //[distinct, scope, file, discriminator]
  302. METADATA_NAMESPACE = 24, // [distinct, scope, file, name, line, exportSymbols]
  303. METADATA_TEMPLATE_TYPE = 25, // [distinct, scope, name, type, ...]
  304. METADATA_TEMPLATE_VALUE = 26, // [distinct, scope, name, type, value, ...]
  305. METADATA_GLOBAL_VAR = 27, // [distinct, ...]
  306. METADATA_LOCAL_VAR = 28, // [distinct, ...]
  307. METADATA_EXPRESSION = 29, // [distinct, n x element]
  308. METADATA_OBJC_PROPERTY = 30, // [distinct, name, file, line, ...]
  309. METADATA_IMPORTED_ENTITY = 31, // [distinct, tag, scope, entity, line, name]
  310. METADATA_MODULE = 32, // [distinct, scope, name, ...]
  311. METADATA_MACRO = 33, // [distinct, macinfo, line, name, value]
  312. METADATA_MACRO_FILE = 34, // [distinct, macinfo, line, file, ...]
  313. METADATA_STRINGS = 35, // [count, offset] blob([lengths][chars])
  314. METADATA_GLOBAL_DECL_ATTACHMENT = 36, // [valueid, n x [id, mdnode]]
  315. METADATA_GLOBAL_VAR_EXPR = 37, // [distinct, var, expr]
  316. METADATA_INDEX_OFFSET = 38, // [offset]
  317. METADATA_INDEX = 39, // [bitpos]
  318. METADATA_LABEL = 40, // [distinct, scope, name, file, line]
  319. METADATA_STRING_TYPE = 41, // [distinct, name, size, align,...]
  320. // Codes 42 and 43 are reserved for support for Fortran array specific debug
  321. // info.
  322. METADATA_COMMON_BLOCK = 44, // [distinct, scope, name, variable,...]
  323. METADATA_GENERIC_SUBRANGE = 45, // [distinct, count, lo, up, stride]
  324. METADATA_ARG_LIST = 46, // [n x [type num, value num]]
  325. METADATA_ASSIGN_ID = 47, // [distinct, ...]
  326. };
  327. // The constants block (CONSTANTS_BLOCK_ID) describes emission for each
  328. // constant and maintains an implicit current type value.
  329. enum ConstantsCodes {
  330. CST_CODE_SETTYPE = 1, // SETTYPE: [typeid]
  331. CST_CODE_NULL = 2, // NULL
  332. CST_CODE_UNDEF = 3, // UNDEF
  333. CST_CODE_INTEGER = 4, // INTEGER: [intval]
  334. CST_CODE_WIDE_INTEGER = 5, // WIDE_INTEGER: [n x intval]
  335. CST_CODE_FLOAT = 6, // FLOAT: [fpval]
  336. CST_CODE_AGGREGATE = 7, // AGGREGATE: [n x value number]
  337. CST_CODE_STRING = 8, // STRING: [values]
  338. CST_CODE_CSTRING = 9, // CSTRING: [values]
  339. CST_CODE_CE_BINOP = 10, // CE_BINOP: [opcode, opval, opval]
  340. CST_CODE_CE_CAST = 11, // CE_CAST: [opcode, opty, opval]
  341. CST_CODE_CE_GEP = 12, // CE_GEP: [n x operands]
  342. CST_CODE_CE_SELECT = 13, // CE_SELECT: [opval, opval, opval]
  343. CST_CODE_CE_EXTRACTELT = 14, // CE_EXTRACTELT: [opty, opval, opval]
  344. CST_CODE_CE_INSERTELT = 15, // CE_INSERTELT: [opval, opval, opval]
  345. CST_CODE_CE_SHUFFLEVEC = 16, // CE_SHUFFLEVEC: [opval, opval, opval]
  346. CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred]
  347. CST_CODE_INLINEASM_OLD = 18, // INLINEASM: [sideeffect|alignstack,
  348. // asmstr,conststr]
  349. CST_CODE_CE_SHUFVEC_EX = 19, // SHUFVEC_EX: [opty, opval, opval, opval]
  350. CST_CODE_CE_INBOUNDS_GEP = 20, // INBOUNDS_GEP: [n x operands]
  351. CST_CODE_BLOCKADDRESS = 21, // CST_CODE_BLOCKADDRESS [fnty, fnval, bb#]
  352. CST_CODE_DATA = 22, // DATA: [n x elements]
  353. CST_CODE_INLINEASM_OLD2 = 23, // INLINEASM: [sideeffect|alignstack|
  354. // asmdialect,asmstr,conststr]
  355. CST_CODE_CE_GEP_WITH_INRANGE_INDEX = 24, // [opty, flags, n x operands]
  356. CST_CODE_CE_UNOP = 25, // CE_UNOP: [opcode, opval]
  357. CST_CODE_POISON = 26, // POISON
  358. CST_CODE_DSO_LOCAL_EQUIVALENT = 27, // DSO_LOCAL_EQUIVALENT [gvty, gv]
  359. CST_CODE_INLINEASM_OLD3 = 28, // INLINEASM: [sideeffect|alignstack|
  360. // asmdialect|unwind,
  361. // asmstr,conststr]
  362. CST_CODE_NO_CFI_VALUE = 29, // NO_CFI [ fty, f ]
  363. CST_CODE_INLINEASM = 30, // INLINEASM: [fnty,
  364. // sideeffect|alignstack|
  365. // asmdialect|unwind,
  366. // asmstr,conststr]
  367. };
  368. /// CastOpcodes - These are values used in the bitcode files to encode which
  369. /// cast a CST_CODE_CE_CAST or a XXX refers to. The values of these enums
  370. /// have no fixed relation to the LLVM IR enum values. Changing these will
  371. /// break compatibility with old files.
  372. enum CastOpcodes {
  373. CAST_TRUNC = 0,
  374. CAST_ZEXT = 1,
  375. CAST_SEXT = 2,
  376. CAST_FPTOUI = 3,
  377. CAST_FPTOSI = 4,
  378. CAST_UITOFP = 5,
  379. CAST_SITOFP = 6,
  380. CAST_FPTRUNC = 7,
  381. CAST_FPEXT = 8,
  382. CAST_PTRTOINT = 9,
  383. CAST_INTTOPTR = 10,
  384. CAST_BITCAST = 11,
  385. CAST_ADDRSPACECAST = 12
  386. };
  387. /// UnaryOpcodes - These are values used in the bitcode files to encode which
  388. /// unop a CST_CODE_CE_UNOP or a XXX refers to. The values of these enums
  389. /// have no fixed relation to the LLVM IR enum values. Changing these will
  390. /// break compatibility with old files.
  391. enum UnaryOpcodes {
  392. UNOP_FNEG = 0
  393. };
  394. /// BinaryOpcodes - These are values used in the bitcode files to encode which
  395. /// binop a CST_CODE_CE_BINOP or a XXX refers to. The values of these enums
  396. /// have no fixed relation to the LLVM IR enum values. Changing these will
  397. /// break compatibility with old files.
  398. enum BinaryOpcodes {
  399. BINOP_ADD = 0,
  400. BINOP_SUB = 1,
  401. BINOP_MUL = 2,
  402. BINOP_UDIV = 3,
  403. BINOP_SDIV = 4, // overloaded for FP
  404. BINOP_UREM = 5,
  405. BINOP_SREM = 6, // overloaded for FP
  406. BINOP_SHL = 7,
  407. BINOP_LSHR = 8,
  408. BINOP_ASHR = 9,
  409. BINOP_AND = 10,
  410. BINOP_OR = 11,
  411. BINOP_XOR = 12
  412. };
  413. /// These are values used in the bitcode files to encode AtomicRMW operations.
  414. /// The values of these enums have no fixed relation to the LLVM IR enum
  415. /// values. Changing these will break compatibility with old files.
  416. enum RMWOperations {
  417. RMW_XCHG = 0,
  418. RMW_ADD = 1,
  419. RMW_SUB = 2,
  420. RMW_AND = 3,
  421. RMW_NAND = 4,
  422. RMW_OR = 5,
  423. RMW_XOR = 6,
  424. RMW_MAX = 7,
  425. RMW_MIN = 8,
  426. RMW_UMAX = 9,
  427. RMW_UMIN = 10,
  428. RMW_FADD = 11,
  429. RMW_FSUB = 12,
  430. RMW_FMAX = 13,
  431. RMW_FMIN = 14,
  432. RMW_UINC_WRAP = 15,
  433. RMW_UDEC_WRAP = 16
  434. };
  435. /// OverflowingBinaryOperatorOptionalFlags - Flags for serializing
  436. /// OverflowingBinaryOperator's SubclassOptionalData contents.
  437. enum OverflowingBinaryOperatorOptionalFlags {
  438. OBO_NO_UNSIGNED_WRAP = 0,
  439. OBO_NO_SIGNED_WRAP = 1
  440. };
  441. /// FastMath Flags
  442. /// This is a fixed layout derived from the bitcode emitted by LLVM 5.0
  443. /// intended to decouple the in-memory representation from the serialization.
  444. enum FastMathMap {
  445. UnsafeAlgebra = (1 << 0), // Legacy
  446. NoNaNs = (1 << 1),
  447. NoInfs = (1 << 2),
  448. NoSignedZeros = (1 << 3),
  449. AllowReciprocal = (1 << 4),
  450. AllowContract = (1 << 5),
  451. ApproxFunc = (1 << 6),
  452. AllowReassoc = (1 << 7)
  453. };
  454. /// PossiblyExactOperatorOptionalFlags - Flags for serializing
  455. /// PossiblyExactOperator's SubclassOptionalData contents.
  456. enum PossiblyExactOperatorOptionalFlags { PEO_EXACT = 0 };
  457. /// Encoded AtomicOrdering values.
  458. enum AtomicOrderingCodes {
  459. ORDERING_NOTATOMIC = 0,
  460. ORDERING_UNORDERED = 1,
  461. ORDERING_MONOTONIC = 2,
  462. ORDERING_ACQUIRE = 3,
  463. ORDERING_RELEASE = 4,
  464. ORDERING_ACQREL = 5,
  465. ORDERING_SEQCST = 6
  466. };
  467. /// Markers and flags for call instruction.
  468. enum CallMarkersFlags {
  469. CALL_TAIL = 0,
  470. CALL_CCONV = 1,
  471. CALL_MUSTTAIL = 14,
  472. CALL_EXPLICIT_TYPE = 15,
  473. CALL_NOTAIL = 16,
  474. CALL_FMF = 17 // Call has optional fast-math-flags.
  475. };
  476. // The function body block (FUNCTION_BLOCK_ID) describes function bodies. It
  477. // can contain a constant block (CONSTANTS_BLOCK_ID).
  478. enum FunctionCodes {
  479. FUNC_CODE_DECLAREBLOCKS = 1, // DECLAREBLOCKS: [n]
  480. FUNC_CODE_INST_BINOP = 2, // BINOP: [opcode, ty, opval, opval]
  481. FUNC_CODE_INST_CAST = 3, // CAST: [opcode, ty, opty, opval]
  482. FUNC_CODE_INST_GEP_OLD = 4, // GEP: [n x operands]
  483. FUNC_CODE_INST_SELECT = 5, // SELECT: [ty, opval, opval, opval]
  484. FUNC_CODE_INST_EXTRACTELT = 6, // EXTRACTELT: [opty, opval, opval]
  485. FUNC_CODE_INST_INSERTELT = 7, // INSERTELT: [ty, opval, opval, opval]
  486. FUNC_CODE_INST_SHUFFLEVEC = 8, // SHUFFLEVEC: [ty, opval, opval, opval]
  487. FUNC_CODE_INST_CMP = 9, // CMP: [opty, opval, opval, pred]
  488. FUNC_CODE_INST_RET = 10, // RET: [opty,opval<both optional>]
  489. FUNC_CODE_INST_BR = 11, // BR: [bb#, bb#, cond] or [bb#]
  490. FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, op0, op1, ...]
  491. FUNC_CODE_INST_INVOKE = 13, // INVOKE: [attr, fnty, op0,op1, ...]
  492. // 14 is unused.
  493. FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE
  494. FUNC_CODE_INST_PHI = 16, // PHI: [ty, val0,bb0, ...]
  495. // 17 is unused.
  496. // 18 is unused.
  497. FUNC_CODE_INST_ALLOCA = 19, // ALLOCA: [instty, opty, op, align]
  498. FUNC_CODE_INST_LOAD = 20, // LOAD: [opty, op, align, vol]
  499. // 21 is unused.
  500. // 22 is unused.
  501. FUNC_CODE_INST_VAARG = 23, // VAARG: [valistty, valist, instty]
  502. // This store code encodes the pointer type, rather than the value type
  503. // this is so information only available in the pointer type (e.g. address
  504. // spaces) is retained.
  505. FUNC_CODE_INST_STORE_OLD = 24, // STORE: [ptrty,ptr,val, align, vol]
  506. // 25 is unused.
  507. FUNC_CODE_INST_EXTRACTVAL = 26, // EXTRACTVAL: [n x operands]
  508. FUNC_CODE_INST_INSERTVAL = 27, // INSERTVAL: [n x operands]
  509. // fcmp/icmp returning Int1TY or vector of Int1Ty. Same as CMP, exists to
  510. // support legacy vicmp/vfcmp instructions.
  511. FUNC_CODE_INST_CMP2 = 28, // CMP2: [opty, opval, opval, pred]
  512. // new select on i1 or [N x i1]
  513. FUNC_CODE_INST_VSELECT = 29, // VSELECT: [ty,opval,opval,predty,pred]
  514. FUNC_CODE_INST_INBOUNDS_GEP_OLD = 30, // INBOUNDS_GEP: [n x operands]
  515. FUNC_CODE_INST_INDIRECTBR = 31, // INDIRECTBR: [opty, op0, op1, ...]
  516. // 32 is unused.
  517. FUNC_CODE_DEBUG_LOC_AGAIN = 33, // DEBUG_LOC_AGAIN
  518. FUNC_CODE_INST_CALL = 34, // CALL: [attr, cc, fnty, fnid, args...]
  519. FUNC_CODE_DEBUG_LOC = 35, // DEBUG_LOC: [Line,Col,ScopeVal, IAVal]
  520. FUNC_CODE_INST_FENCE = 36, // FENCE: [ordering, synchscope]
  521. FUNC_CODE_INST_CMPXCHG_OLD = 37, // CMPXCHG: [ptrty, ptr, cmp, val, vol,
  522. // ordering, synchscope,
  523. // failure_ordering?, weak?]
  524. FUNC_CODE_INST_ATOMICRMW_OLD = 38, // ATOMICRMW: [ptrty,ptr,val, operation,
  525. // align, vol,
  526. // ordering, synchscope]
  527. FUNC_CODE_INST_RESUME = 39, // RESUME: [opval]
  528. FUNC_CODE_INST_LANDINGPAD_OLD =
  529. 40, // LANDINGPAD: [ty,val,val,num,id0,val0...]
  530. FUNC_CODE_INST_LOADATOMIC = 41, // LOAD: [opty, op, align, vol,
  531. // ordering, synchscope]
  532. FUNC_CODE_INST_STOREATOMIC_OLD = 42, // STORE: [ptrty,ptr,val, align, vol
  533. // ordering, synchscope]
  534. FUNC_CODE_INST_GEP = 43, // GEP: [inbounds, n x operands]
  535. FUNC_CODE_INST_STORE = 44, // STORE: [ptrty,ptr,valty,val, align, vol]
  536. FUNC_CODE_INST_STOREATOMIC = 45, // STORE: [ptrty,ptr,val, align, vol
  537. FUNC_CODE_INST_CMPXCHG = 46, // CMPXCHG: [ptrty, ptr, cmp, val, vol,
  538. // success_ordering, synchscope,
  539. // failure_ordering, weak]
  540. FUNC_CODE_INST_LANDINGPAD = 47, // LANDINGPAD: [ty,val,num,id0,val0...]
  541. FUNC_CODE_INST_CLEANUPRET = 48, // CLEANUPRET: [val] or [val,bb#]
  542. FUNC_CODE_INST_CATCHRET = 49, // CATCHRET: [val,bb#]
  543. FUNC_CODE_INST_CATCHPAD = 50, // CATCHPAD: [bb#,bb#,num,args...]
  544. FUNC_CODE_INST_CLEANUPPAD = 51, // CLEANUPPAD: [num,args...]
  545. FUNC_CODE_INST_CATCHSWITCH =
  546. 52, // CATCHSWITCH: [num,args...] or [num,args...,bb]
  547. // 53 is unused.
  548. // 54 is unused.
  549. FUNC_CODE_OPERAND_BUNDLE = 55, // OPERAND_BUNDLE: [tag#, value...]
  550. FUNC_CODE_INST_UNOP = 56, // UNOP: [opcode, ty, opval]
  551. FUNC_CODE_INST_CALLBR = 57, // CALLBR: [attr, cc, norm, transfs,
  552. // fnty, fnid, args...]
  553. FUNC_CODE_INST_FREEZE = 58, // FREEZE: [opty, opval]
  554. FUNC_CODE_INST_ATOMICRMW = 59, // ATOMICRMW: [ptrty, ptr, valty, val,
  555. // operation, align, vol,
  556. // ordering, synchscope]
  557. FUNC_CODE_BLOCKADDR_USERS = 60, // BLOCKADDR_USERS: [value...]
  558. };
  559. enum UseListCodes {
  560. USELIST_CODE_DEFAULT = 1, // DEFAULT: [index..., value-id]
  561. USELIST_CODE_BB = 2 // BB: [index..., bb-id]
  562. };
  563. enum AttributeKindCodes {
  564. // = 0 is unused
  565. ATTR_KIND_ALIGNMENT = 1,
  566. ATTR_KIND_ALWAYS_INLINE = 2,
  567. ATTR_KIND_BY_VAL = 3,
  568. ATTR_KIND_INLINE_HINT = 4,
  569. ATTR_KIND_IN_REG = 5,
  570. ATTR_KIND_MIN_SIZE = 6,
  571. ATTR_KIND_NAKED = 7,
  572. ATTR_KIND_NEST = 8,
  573. ATTR_KIND_NO_ALIAS = 9,
  574. ATTR_KIND_NO_BUILTIN = 10,
  575. ATTR_KIND_NO_CAPTURE = 11,
  576. ATTR_KIND_NO_DUPLICATE = 12,
  577. ATTR_KIND_NO_IMPLICIT_FLOAT = 13,
  578. ATTR_KIND_NO_INLINE = 14,
  579. ATTR_KIND_NON_LAZY_BIND = 15,
  580. ATTR_KIND_NO_RED_ZONE = 16,
  581. ATTR_KIND_NO_RETURN = 17,
  582. ATTR_KIND_NO_UNWIND = 18,
  583. ATTR_KIND_OPTIMIZE_FOR_SIZE = 19,
  584. ATTR_KIND_READ_NONE = 20,
  585. ATTR_KIND_READ_ONLY = 21,
  586. ATTR_KIND_RETURNED = 22,
  587. ATTR_KIND_RETURNS_TWICE = 23,
  588. ATTR_KIND_S_EXT = 24,
  589. ATTR_KIND_STACK_ALIGNMENT = 25,
  590. ATTR_KIND_STACK_PROTECT = 26,
  591. ATTR_KIND_STACK_PROTECT_REQ = 27,
  592. ATTR_KIND_STACK_PROTECT_STRONG = 28,
  593. ATTR_KIND_STRUCT_RET = 29,
  594. ATTR_KIND_SANITIZE_ADDRESS = 30,
  595. ATTR_KIND_SANITIZE_THREAD = 31,
  596. ATTR_KIND_SANITIZE_MEMORY = 32,
  597. ATTR_KIND_UW_TABLE = 33,
  598. ATTR_KIND_Z_EXT = 34,
  599. ATTR_KIND_BUILTIN = 35,
  600. ATTR_KIND_COLD = 36,
  601. ATTR_KIND_OPTIMIZE_NONE = 37,
  602. ATTR_KIND_IN_ALLOCA = 38,
  603. ATTR_KIND_NON_NULL = 39,
  604. ATTR_KIND_JUMP_TABLE = 40,
  605. ATTR_KIND_DEREFERENCEABLE = 41,
  606. ATTR_KIND_DEREFERENCEABLE_OR_NULL = 42,
  607. ATTR_KIND_CONVERGENT = 43,
  608. ATTR_KIND_SAFESTACK = 44,
  609. ATTR_KIND_ARGMEMONLY = 45,
  610. ATTR_KIND_SWIFT_SELF = 46,
  611. ATTR_KIND_SWIFT_ERROR = 47,
  612. ATTR_KIND_NO_RECURSE = 48,
  613. ATTR_KIND_INACCESSIBLEMEM_ONLY = 49,
  614. ATTR_KIND_INACCESSIBLEMEM_OR_ARGMEMONLY = 50,
  615. ATTR_KIND_ALLOC_SIZE = 51,
  616. ATTR_KIND_WRITEONLY = 52,
  617. ATTR_KIND_SPECULATABLE = 53,
  618. ATTR_KIND_STRICT_FP = 54,
  619. ATTR_KIND_SANITIZE_HWADDRESS = 55,
  620. ATTR_KIND_NOCF_CHECK = 56,
  621. ATTR_KIND_OPT_FOR_FUZZING = 57,
  622. ATTR_KIND_SHADOWCALLSTACK = 58,
  623. ATTR_KIND_SPECULATIVE_LOAD_HARDENING = 59,
  624. ATTR_KIND_IMMARG = 60,
  625. ATTR_KIND_WILLRETURN = 61,
  626. ATTR_KIND_NOFREE = 62,
  627. ATTR_KIND_NOSYNC = 63,
  628. ATTR_KIND_SANITIZE_MEMTAG = 64,
  629. ATTR_KIND_PREALLOCATED = 65,
  630. ATTR_KIND_NO_MERGE = 66,
  631. ATTR_KIND_NULL_POINTER_IS_VALID = 67,
  632. ATTR_KIND_NOUNDEF = 68,
  633. ATTR_KIND_BYREF = 69,
  634. ATTR_KIND_MUSTPROGRESS = 70,
  635. ATTR_KIND_NO_CALLBACK = 71,
  636. ATTR_KIND_HOT = 72,
  637. ATTR_KIND_NO_PROFILE = 73,
  638. ATTR_KIND_VSCALE_RANGE = 74,
  639. ATTR_KIND_SWIFT_ASYNC = 75,
  640. ATTR_KIND_NO_SANITIZE_COVERAGE = 76,
  641. ATTR_KIND_ELEMENTTYPE = 77,
  642. ATTR_KIND_DISABLE_SANITIZER_INSTRUMENTATION = 78,
  643. ATTR_KIND_NO_SANITIZE_BOUNDS = 79,
  644. ATTR_KIND_ALLOC_ALIGN = 80,
  645. ATTR_KIND_ALLOCATED_POINTER = 81,
  646. ATTR_KIND_ALLOC_KIND = 82,
  647. ATTR_KIND_PRESPLIT_COROUTINE = 83,
  648. ATTR_KIND_FNRETTHUNK_EXTERN = 84,
  649. ATTR_KIND_SKIP_PROFILE = 85,
  650. ATTR_KIND_MEMORY = 86,
  651. };
  652. enum ComdatSelectionKindCodes {
  653. COMDAT_SELECTION_KIND_ANY = 1,
  654. COMDAT_SELECTION_KIND_EXACT_MATCH = 2,
  655. COMDAT_SELECTION_KIND_LARGEST = 3,
  656. COMDAT_SELECTION_KIND_NO_DUPLICATES = 4,
  657. COMDAT_SELECTION_KIND_SAME_SIZE = 5,
  658. };
  659. enum StrtabCodes {
  660. STRTAB_BLOB = 1,
  661. };
  662. enum SymtabCodes {
  663. SYMTAB_BLOB = 1,
  664. };
  665. } // End bitc namespace
  666. } // End llvm namespace
  667. #endif
  668. #ifdef __GNUC__
  669. #pragma GCC diagnostic pop
  670. #endif