Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

336 lines
13 KiB

  1. //===- LLVMBitCodes.h - Enum values for the LLVM bitcode format -*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This header defines Bitcode enum values for LLVM IR bitcode files.
  11. //
  12. // The enum values defined in this file should be considered permanent. If
  13. // new features are added, they should have values added at the end of the
  14. // respective lists.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_BITCODE_LLVMBITCODES_H
  18. #define LLVM_BITCODE_LLVMBITCODES_H
  19. #include "llvm/Bitcode/BitCodes.h"
  20. namespace llvm {
  21. namespace bitc {
  22. // The only top-level block type defined is for a module.
  23. enum BlockIDs {
  24. // Blocks
  25. MODULE_BLOCK_ID = FIRST_APPLICATION_BLOCKID,
  26. // Module sub-block id's.
  27. PARAMATTR_BLOCK_ID,
  28. PARAMATTR_GROUP_BLOCK_ID,
  29. CONSTANTS_BLOCK_ID,
  30. FUNCTION_BLOCK_ID,
  31. UNUSED_ID1,
  32. VALUE_SYMTAB_BLOCK_ID,
  33. METADATA_BLOCK_ID,
  34. METADATA_ATTACHMENT_ID,
  35. TYPE_BLOCK_ID_NEW,
  36. USELIST_BLOCK_ID
  37. };
  38. /// MODULE blocks have a number of optional fields and subblocks.
  39. enum ModuleCodes {
  40. MODULE_CODE_VERSION = 1, // VERSION: [version#]
  41. MODULE_CODE_TRIPLE = 2, // TRIPLE: [strchr x N]
  42. MODULE_CODE_DATALAYOUT = 3, // DATALAYOUT: [strchr x N]
  43. MODULE_CODE_ASM = 4, // ASM: [strchr x N]
  44. MODULE_CODE_SECTIONNAME = 5, // SECTIONNAME: [strchr x N]
  45. // FIXME: Remove DEPLIB in 4.0.
  46. MODULE_CODE_DEPLIB = 6, // DEPLIB: [strchr x N]
  47. // GLOBALVAR: [pointer type, isconst, initid,
  48. // linkage, alignment, section, visibility, threadlocal]
  49. MODULE_CODE_GLOBALVAR = 7,
  50. // FUNCTION: [type, callingconv, isproto, linkage, paramattrs, alignment,
  51. // section, visibility, gc, unnamed_addr]
  52. MODULE_CODE_FUNCTION = 8,
  53. // ALIAS: [alias type, aliasee val#, linkage, visibility]
  54. MODULE_CODE_ALIAS = 9,
  55. // MODULE_CODE_PURGEVALS: [numvals]
  56. MODULE_CODE_PURGEVALS = 10,
  57. MODULE_CODE_GCNAME = 11 // GCNAME: [strchr x N]
  58. };
  59. /// PARAMATTR blocks have code for defining a parameter attribute set.
  60. enum AttributeCodes {
  61. // FIXME: Remove `PARAMATTR_CODE_ENTRY_OLD' in 4.0
  62. PARAMATTR_CODE_ENTRY_OLD = 1, // ENTRY: [paramidx0, attr0,
  63. // paramidx1, attr1...]
  64. PARAMATTR_CODE_ENTRY = 2, // ENTRY: [paramidx0, attrgrp0,
  65. // paramidx1, attrgrp1, ...]
  66. PARAMATTR_GRP_CODE_ENTRY = 3 // ENTRY: [id, attr0, att1, ...]
  67. };
  68. /// TYPE blocks have codes for each type primitive they use.
  69. enum TypeCodes {
  70. TYPE_CODE_NUMENTRY = 1, // NUMENTRY: [numentries]
  71. // Type Codes
  72. TYPE_CODE_VOID = 2, // VOID
  73. TYPE_CODE_FLOAT = 3, // FLOAT
  74. TYPE_CODE_DOUBLE = 4, // DOUBLE
  75. TYPE_CODE_LABEL = 5, // LABEL
  76. TYPE_CODE_OPAQUE = 6, // OPAQUE
  77. TYPE_CODE_INTEGER = 7, // INTEGER: [width]
  78. TYPE_CODE_POINTER = 8, // POINTER: [pointee type]
  79. TYPE_CODE_FUNCTION_OLD = 9, // FUNCTION: [vararg, attrid, retty,
  80. // paramty x N]
  81. TYPE_CODE_HALF = 10, // HALF
  82. TYPE_CODE_ARRAY = 11, // ARRAY: [numelts, eltty]
  83. TYPE_CODE_VECTOR = 12, // VECTOR: [numelts, eltty]
  84. // These are not with the other floating point types because they're
  85. // a late addition, and putting them in the right place breaks
  86. // binary compatibility.
  87. TYPE_CODE_X86_FP80 = 13, // X86 LONG DOUBLE
  88. TYPE_CODE_FP128 = 14, // LONG DOUBLE (112 bit mantissa)
  89. TYPE_CODE_PPC_FP128= 15, // PPC LONG DOUBLE (2 doubles)
  90. TYPE_CODE_METADATA = 16, // METADATA
  91. TYPE_CODE_X86_MMX = 17, // X86 MMX
  92. TYPE_CODE_STRUCT_ANON = 18, // STRUCT_ANON: [ispacked, eltty x N]
  93. TYPE_CODE_STRUCT_NAME = 19, // STRUCT_NAME: [strchr x N]
  94. TYPE_CODE_STRUCT_NAMED = 20,// STRUCT_NAMED: [ispacked, eltty x N]
  95. TYPE_CODE_FUNCTION = 21 // FUNCTION: [vararg, retty, paramty x N]
  96. };
  97. // The type symbol table only has one code (TST_ENTRY_CODE).
  98. enum TypeSymtabCodes {
  99. TST_CODE_ENTRY = 1 // TST_ENTRY: [typeid, namechar x N]
  100. };
  101. // The value symbol table only has one code (VST_ENTRY_CODE).
  102. enum ValueSymtabCodes {
  103. VST_CODE_ENTRY = 1, // VST_ENTRY: [valid, namechar x N]
  104. VST_CODE_BBENTRY = 2 // VST_BBENTRY: [bbid, namechar x N]
  105. };
  106. enum MetadataCodes {
  107. METADATA_STRING = 1, // MDSTRING: [values]
  108. // 2 is unused.
  109. // 3 is unused.
  110. METADATA_NAME = 4, // STRING: [values]
  111. // 5 is unused.
  112. METADATA_KIND = 6, // [n x [id, name]]
  113. // 7 is unused.
  114. METADATA_NODE = 8, // NODE: [n x (type num, value num)]
  115. METADATA_FN_NODE = 9, // FN_NODE: [n x (type num, value num)]
  116. METADATA_NAMED_NODE = 10, // NAMED_NODE: [n x mdnodes]
  117. METADATA_ATTACHMENT = 11 // [m x [value, [n x [id, mdnode]]]
  118. };
  119. // The constants block (CONSTANTS_BLOCK_ID) describes emission for each
  120. // constant and maintains an implicit current type value.
  121. enum ConstantsCodes {
  122. CST_CODE_SETTYPE = 1, // SETTYPE: [typeid]
  123. CST_CODE_NULL = 2, // NULL
  124. CST_CODE_UNDEF = 3, // UNDEF
  125. CST_CODE_INTEGER = 4, // INTEGER: [intval]
  126. CST_CODE_WIDE_INTEGER = 5, // WIDE_INTEGER: [n x intval]
  127. CST_CODE_FLOAT = 6, // FLOAT: [fpval]
  128. CST_CODE_AGGREGATE = 7, // AGGREGATE: [n x value number]
  129. CST_CODE_STRING = 8, // STRING: [values]
  130. CST_CODE_CSTRING = 9, // CSTRING: [values]
  131. CST_CODE_CE_BINOP = 10, // CE_BINOP: [opcode, opval, opval]
  132. CST_CODE_CE_CAST = 11, // CE_CAST: [opcode, opty, opval]
  133. CST_CODE_CE_GEP = 12, // CE_GEP: [n x operands]
  134. CST_CODE_CE_SELECT = 13, // CE_SELECT: [opval, opval, opval]
  135. CST_CODE_CE_EXTRACTELT = 14, // CE_EXTRACTELT: [opty, opval, opval]
  136. CST_CODE_CE_INSERTELT = 15, // CE_INSERTELT: [opval, opval, opval]
  137. CST_CODE_CE_SHUFFLEVEC = 16, // CE_SHUFFLEVEC: [opval, opval, opval]
  138. CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred]
  139. CST_CODE_INLINEASM_OLD = 18, // INLINEASM: [sideeffect|alignstack,
  140. // asmstr,conststr]
  141. CST_CODE_CE_SHUFVEC_EX = 19, // SHUFVEC_EX: [opty, opval, opval, opval]
  142. CST_CODE_CE_INBOUNDS_GEP = 20,// INBOUNDS_GEP: [n x operands]
  143. CST_CODE_BLOCKADDRESS = 21, // CST_CODE_BLOCKADDRESS [fnty, fnval, bb#]
  144. CST_CODE_DATA = 22, // DATA: [n x elements]
  145. CST_CODE_INLINEASM = 23 // INLINEASM: [sideeffect|alignstack|
  146. // asmdialect,asmstr,conststr]
  147. };
  148. /// CastOpcodes - These are values used in the bitcode files to encode which
  149. /// cast a CST_CODE_CE_CAST or a XXX refers to. The values of these enums
  150. /// have no fixed relation to the LLVM IR enum values. Changing these will
  151. /// break compatibility with old files.
  152. enum CastOpcodes {
  153. CAST_TRUNC = 0,
  154. CAST_ZEXT = 1,
  155. CAST_SEXT = 2,
  156. CAST_FPTOUI = 3,
  157. CAST_FPTOSI = 4,
  158. CAST_UITOFP = 5,
  159. CAST_SITOFP = 6,
  160. CAST_FPTRUNC = 7,
  161. CAST_FPEXT = 8,
  162. CAST_PTRTOINT = 9,
  163. CAST_INTTOPTR = 10,
  164. CAST_BITCAST = 11
  165. };
  166. /// BinaryOpcodes - These are values used in the bitcode files to encode which
  167. /// binop a CST_CODE_CE_BINOP or a XXX refers to. The values of these enums
  168. /// have no fixed relation to the LLVM IR enum values. Changing these will
  169. /// break compatibility with old files.
  170. enum BinaryOpcodes {
  171. BINOP_ADD = 0,
  172. BINOP_SUB = 1,
  173. BINOP_MUL = 2,
  174. BINOP_UDIV = 3,
  175. BINOP_SDIV = 4, // overloaded for FP
  176. BINOP_UREM = 5,
  177. BINOP_SREM = 6, // overloaded for FP
  178. BINOP_SHL = 7,
  179. BINOP_LSHR = 8,
  180. BINOP_ASHR = 9,
  181. BINOP_AND = 10,
  182. BINOP_OR = 11,
  183. BINOP_XOR = 12
  184. };
  185. /// These are values used in the bitcode files to encode AtomicRMW operations.
  186. /// The values of these enums have no fixed relation to the LLVM IR enum
  187. /// values. Changing these will break compatibility with old files.
  188. enum RMWOperations {
  189. RMW_XCHG = 0,
  190. RMW_ADD = 1,
  191. RMW_SUB = 2,
  192. RMW_AND = 3,
  193. RMW_NAND = 4,
  194. RMW_OR = 5,
  195. RMW_XOR = 6,
  196. RMW_MAX = 7,
  197. RMW_MIN = 8,
  198. RMW_UMAX = 9,
  199. RMW_UMIN = 10
  200. };
  201. /// OverflowingBinaryOperatorOptionalFlags - Flags for serializing
  202. /// OverflowingBinaryOperator's SubclassOptionalData contents.
  203. enum OverflowingBinaryOperatorOptionalFlags {
  204. OBO_NO_UNSIGNED_WRAP = 0,
  205. OBO_NO_SIGNED_WRAP = 1
  206. };
  207. /// PossiblyExactOperatorOptionalFlags - Flags for serializing
  208. /// PossiblyExactOperator's SubclassOptionalData contents.
  209. enum PossiblyExactOperatorOptionalFlags {
  210. PEO_EXACT = 0
  211. };
  212. /// Encoded AtomicOrdering values.
  213. enum AtomicOrderingCodes {
  214. ORDERING_NOTATOMIC = 0,
  215. ORDERING_UNORDERED = 1,
  216. ORDERING_MONOTONIC = 2,
  217. ORDERING_ACQUIRE = 3,
  218. ORDERING_RELEASE = 4,
  219. ORDERING_ACQREL = 5,
  220. ORDERING_SEQCST = 6
  221. };
  222. /// Encoded SynchronizationScope values.
  223. enum AtomicSynchScopeCodes {
  224. SYNCHSCOPE_SINGLETHREAD = 0,
  225. SYNCHSCOPE_CROSSTHREAD = 1
  226. };
  227. // The function body block (FUNCTION_BLOCK_ID) describes function bodies. It
  228. // can contain a constant block (CONSTANTS_BLOCK_ID).
  229. enum FunctionCodes {
  230. FUNC_CODE_DECLAREBLOCKS = 1, // DECLAREBLOCKS: [n]
  231. FUNC_CODE_INST_BINOP = 2, // BINOP: [opcode, ty, opval, opval]
  232. FUNC_CODE_INST_CAST = 3, // CAST: [opcode, ty, opty, opval]
  233. FUNC_CODE_INST_GEP = 4, // GEP: [n x operands]
  234. FUNC_CODE_INST_SELECT = 5, // SELECT: [ty, opval, opval, opval]
  235. FUNC_CODE_INST_EXTRACTELT = 6, // EXTRACTELT: [opty, opval, opval]
  236. FUNC_CODE_INST_INSERTELT = 7, // INSERTELT: [ty, opval, opval, opval]
  237. FUNC_CODE_INST_SHUFFLEVEC = 8, // SHUFFLEVEC: [ty, opval, opval, opval]
  238. FUNC_CODE_INST_CMP = 9, // CMP: [opty, opval, opval, pred]
  239. FUNC_CODE_INST_RET = 10, // RET: [opty,opval<both optional>]
  240. FUNC_CODE_INST_BR = 11, // BR: [bb#, bb#, cond] or [bb#]
  241. FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, op0, op1, ...]
  242. FUNC_CODE_INST_INVOKE = 13, // INVOKE: [attr, fnty, op0,op1, ...]
  243. // 14 is unused.
  244. FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE
  245. FUNC_CODE_INST_PHI = 16, // PHI: [ty, val0,bb0, ...]
  246. // 17 is unused.
  247. // 18 is unused.
  248. FUNC_CODE_INST_ALLOCA = 19, // ALLOCA: [instty, op, align]
  249. FUNC_CODE_INST_LOAD = 20, // LOAD: [opty, op, align, vol]
  250. // 21 is unused.
  251. // 22 is unused.
  252. FUNC_CODE_INST_VAARG = 23, // VAARG: [valistty, valist, instty]
  253. // This store code encodes the pointer type, rather than the value type
  254. // this is so information only available in the pointer type (e.g. address
  255. // spaces) is retained.
  256. FUNC_CODE_INST_STORE = 24, // STORE: [ptrty,ptr,val, align, vol]
  257. // 25 is unused.
  258. FUNC_CODE_INST_EXTRACTVAL = 26, // EXTRACTVAL: [n x operands]
  259. FUNC_CODE_INST_INSERTVAL = 27, // INSERTVAL: [n x operands]
  260. // fcmp/icmp returning Int1TY or vector of Int1Ty. Same as CMP, exists to
  261. // support legacy vicmp/vfcmp instructions.
  262. FUNC_CODE_INST_CMP2 = 28, // CMP2: [opty, opval, opval, pred]
  263. // new select on i1 or [N x i1]
  264. FUNC_CODE_INST_VSELECT = 29, // VSELECT: [ty,opval,opval,predty,pred]
  265. FUNC_CODE_INST_INBOUNDS_GEP= 30, // INBOUNDS_GEP: [n x operands]
  266. FUNC_CODE_INST_INDIRECTBR = 31, // INDIRECTBR: [opty, op0, op1, ...]
  267. // 32 is unused.
  268. FUNC_CODE_DEBUG_LOC_AGAIN = 33, // DEBUG_LOC_AGAIN
  269. FUNC_CODE_INST_CALL = 34, // CALL: [attr, fnty, fnid, args...]
  270. FUNC_CODE_DEBUG_LOC = 35, // DEBUG_LOC: [Line,Col,ScopeVal, IAVal]
  271. FUNC_CODE_INST_FENCE = 36, // FENCE: [ordering, synchscope]
  272. FUNC_CODE_INST_CMPXCHG = 37, // CMPXCHG: [ptrty,ptr,cmp,new, align, vol,
  273. // ordering, synchscope]
  274. FUNC_CODE_INST_ATOMICRMW = 38, // ATOMICRMW: [ptrty,ptr,val, operation,
  275. // align, vol,
  276. // ordering, synchscope]
  277. FUNC_CODE_INST_RESUME = 39, // RESUME: [opval]
  278. FUNC_CODE_INST_LANDINGPAD = 40, // LANDINGPAD: [ty,val,val,num,id0,val0...]
  279. FUNC_CODE_INST_LOADATOMIC = 41, // LOAD: [opty, op, align, vol,
  280. // ordering, synchscope]
  281. FUNC_CODE_INST_STOREATOMIC = 42 // STORE: [ptrty,ptr,val, align, vol
  282. // ordering, synchscope]
  283. };
  284. enum UseListCodes {
  285. USELIST_CODE_ENTRY = 1 // USELIST_CODE_ENTRY: TBD.
  286. };
  287. } // End bitc namespace
  288. } // End llvm namespace
  289. #endif