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 18 #ifndef LLVM_BITCODE_LLVMBITCODES_H 19 #define LLVM_BITCODE_LLVMBITCODES_H 20 21 #include "llvm/Bitcode/BitCodes.h" 22 23 namespace llvm { 24 namespace bitc { 25 // The only top-level block type defined is for a module. 26 enum BlockIDs { 27 // Blocks 28 MODULE_BLOCK_ID = FIRST_APPLICATION_BLOCKID, 29 30 // Module sub-block id's. 31 PARAMATTR_BLOCK_ID, 32 PARAMATTR_GROUP_BLOCK_ID, 33 34 CONSTANTS_BLOCK_ID, 35 FUNCTION_BLOCK_ID, 36 37 UNUSED_ID1, 38 39 VALUE_SYMTAB_BLOCK_ID, 40 METADATA_BLOCK_ID, 41 METADATA_ATTACHMENT_ID, 42 43 TYPE_BLOCK_ID_NEW, 44 45 USELIST_BLOCK_ID 46 }; 47 48 49 /// MODULE blocks have a number of optional fields and subblocks. 50 enum ModuleCodes { 51 MODULE_CODE_VERSION = 1, // VERSION: [version#] 52 MODULE_CODE_TRIPLE = 2, // TRIPLE: [strchr x N] 53 MODULE_CODE_DATALAYOUT = 3, // DATALAYOUT: [strchr x N] 54 MODULE_CODE_ASM = 4, // ASM: [strchr x N] 55 MODULE_CODE_SECTIONNAME = 5, // SECTIONNAME: [strchr x N] 56 57 // FIXME: Remove DEPLIB in 4.0. 58 MODULE_CODE_DEPLIB = 6, // DEPLIB: [strchr x N] 59 60 // GLOBALVAR: [pointer type, isconst, initid, 61 // linkage, alignment, section, visibility, threadlocal] 62 MODULE_CODE_GLOBALVAR = 7, 63 64 // FUNCTION: [type, callingconv, isproto, linkage, paramattrs, alignment, 65 // section, visibility, gc, unnamed_addr] 66 MODULE_CODE_FUNCTION = 8, 67 68 // ALIAS: [alias type, aliasee val#, linkage, visibility] 69 MODULE_CODE_ALIAS = 9, 70 71 // MODULE_CODE_PURGEVALS: [numvals] 72 MODULE_CODE_PURGEVALS = 10, 73 74 MODULE_CODE_GCNAME = 11, // GCNAME: [strchr x N] 75 MODULE_CODE_COMDAT = 12, // COMDAT: [selection_kind, name] 76 }; 77 78 /// PARAMATTR blocks have code for defining a parameter attribute set. 79 enum AttributeCodes { 80 // FIXME: Remove `PARAMATTR_CODE_ENTRY_OLD' in 4.0 81 PARAMATTR_CODE_ENTRY_OLD = 1, // ENTRY: [paramidx0, attr0, 82 // paramidx1, attr1...] 83 PARAMATTR_CODE_ENTRY = 2, // ENTRY: [paramidx0, attrgrp0, 84 // paramidx1, attrgrp1, ...] 85 PARAMATTR_GRP_CODE_ENTRY = 3 // ENTRY: [id, attr0, att1, ...] 86 }; 87 88 /// TYPE blocks have codes for each type primitive they use. 89 enum TypeCodes { 90 TYPE_CODE_NUMENTRY = 1, // NUMENTRY: [numentries] 91 92 // Type Codes 93 TYPE_CODE_VOID = 2, // VOID 94 TYPE_CODE_FLOAT = 3, // FLOAT 95 TYPE_CODE_DOUBLE = 4, // DOUBLE 96 TYPE_CODE_LABEL = 5, // LABEL 97 TYPE_CODE_OPAQUE = 6, // OPAQUE 98 TYPE_CODE_INTEGER = 7, // INTEGER: [width] 99 TYPE_CODE_POINTER = 8, // POINTER: [pointee type] 100 101 TYPE_CODE_FUNCTION_OLD = 9, // FUNCTION: [vararg, attrid, retty, 102 // paramty x N] 103 104 TYPE_CODE_HALF = 10, // HALF 105 106 TYPE_CODE_ARRAY = 11, // ARRAY: [numelts, eltty] 107 TYPE_CODE_VECTOR = 12, // VECTOR: [numelts, eltty] 108 109 // These are not with the other floating point types because they're 110 // a late addition, and putting them in the right place breaks 111 // binary compatibility. 112 TYPE_CODE_X86_FP80 = 13, // X86 LONG DOUBLE 113 TYPE_CODE_FP128 = 14, // LONG DOUBLE (112 bit mantissa) 114 TYPE_CODE_PPC_FP128= 15, // PPC LONG DOUBLE (2 doubles) 115 116 TYPE_CODE_METADATA = 16, // METADATA 117 118 TYPE_CODE_X86_MMX = 17, // X86 MMX 119 120 TYPE_CODE_STRUCT_ANON = 18, // STRUCT_ANON: [ispacked, eltty x N] 121 TYPE_CODE_STRUCT_NAME = 19, // STRUCT_NAME: [strchr x N] 122 TYPE_CODE_STRUCT_NAMED = 20,// STRUCT_NAMED: [ispacked, eltty x N] 123 124 TYPE_CODE_FUNCTION = 21 // FUNCTION: [vararg, retty, paramty x N] 125 }; 126 127 // The type symbol table only has one code (TST_ENTRY_CODE). 128 enum TypeSymtabCodes { 129 TST_CODE_ENTRY = 1 // TST_ENTRY: [typeid, namechar x N] 130 }; 131 132 // The value symbol table only has one code (VST_ENTRY_CODE). 133 enum ValueSymtabCodes { 134 VST_CODE_ENTRY = 1, // VST_ENTRY: [valid, namechar x N] 135 VST_CODE_BBENTRY = 2 // VST_BBENTRY: [bbid, namechar x N] 136 }; 137 138 enum MetadataCodes { 139 METADATA_STRING = 1, // MDSTRING: [values] 140 METADATA_VALUE = 2, // VALUE: [type num, value num] 141 METADATA_NODE = 3, // NODE: [n x md num] 142 METADATA_NAME = 4, // STRING: [values] 143 METADATA_DISTINCT_NODE = 5, // DISTINCT_NODE: [n x md num] 144 METADATA_KIND = 6, // [n x [id, name]] 145 METADATA_LOCATION = 7, // [distinct, line, col, scope, inlined-at?] 146 METADATA_OLD_NODE = 8, // OLD_NODE: [n x (type num, value num)] 147 METADATA_OLD_FN_NODE = 9, // OLD_FN_NODE: [n x (type num, value num)] 148 METADATA_NAMED_NODE = 10, // NAMED_NODE: [n x mdnodes] 149 METADATA_ATTACHMENT = 11, // [m x [value, [n x [id, mdnode]]] 150 METADATA_GENERIC_DEBUG = 12, // [distinct, tag, vers, header, n x md num] 151 METADATA_SUBRANGE = 13, // [distinct, count, lo] 152 METADATA_ENUMERATOR = 14, // [distinct, value, name] 153 METADATA_BASIC_TYPE = 15, // [distinct, tag, name, size, align, enc] 154 METADATA_FILE = 16, // [distinct, filename, directory] 155 METADATA_DERIVED_TYPE = 17, // [distinct, ...] 156 METADATA_COMPOSITE_TYPE= 18, // [distinct, ...] 157 METADATA_SUBROUTINE_TYPE=19, // [distinct, flags, types] 158 METADATA_COMPILE_UNIT = 20, // [distinct, ...] 159 METADATA_SUBPROGRAM = 21, // [distinct, ...] 160 METADATA_LEXICAL_BLOCK = 22, // [distinct, scope, file, line, column] 161 METADATA_LEXICAL_BLOCK_FILE=23,//[distinct, scope, file, discriminator] 162 METADATA_NAMESPACE = 24, // [distinct, scope, file, name, line] 163 METADATA_TEMPLATE_TYPE = 25, // [distinct, scope, name, type, ...] 164 METADATA_TEMPLATE_VALUE= 26, // [distinct, scope, name, type, value, ...] 165 METADATA_GLOBAL_VAR = 27, // [distinct, ...] 166 METADATA_LOCAL_VAR = 28, // [distinct, ...] 167 METADATA_EXPRESSION = 29, // [distinct, n x element] 168 METADATA_OBJC_PROPERTY = 30, // [distinct, name, file, line, ...] 169 METADATA_IMPORTED_ENTITY=31, // [distinct, tag, scope, entity, line, name] 170 }; 171 172 // The constants block (CONSTANTS_BLOCK_ID) describes emission for each 173 // constant and maintains an implicit current type value. 174 enum ConstantsCodes { 175 CST_CODE_SETTYPE = 1, // SETTYPE: [typeid] 176 CST_CODE_NULL = 2, // NULL 177 CST_CODE_UNDEF = 3, // UNDEF 178 CST_CODE_INTEGER = 4, // INTEGER: [intval] 179 CST_CODE_WIDE_INTEGER = 5, // WIDE_INTEGER: [n x intval] 180 CST_CODE_FLOAT = 6, // FLOAT: [fpval] 181 CST_CODE_AGGREGATE = 7, // AGGREGATE: [n x value number] 182 CST_CODE_STRING = 8, // STRING: [values] 183 CST_CODE_CSTRING = 9, // CSTRING: [values] 184 CST_CODE_CE_BINOP = 10, // CE_BINOP: [opcode, opval, opval] 185 CST_CODE_CE_CAST = 11, // CE_CAST: [opcode, opty, opval] 186 CST_CODE_CE_GEP = 12, // CE_GEP: [n x operands] 187 CST_CODE_CE_SELECT = 13, // CE_SELECT: [opval, opval, opval] 188 CST_CODE_CE_EXTRACTELT = 14, // CE_EXTRACTELT: [opty, opval, opval] 189 CST_CODE_CE_INSERTELT = 15, // CE_INSERTELT: [opval, opval, opval] 190 CST_CODE_CE_SHUFFLEVEC = 16, // CE_SHUFFLEVEC: [opval, opval, opval] 191 CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred] 192 CST_CODE_INLINEASM_OLD = 18, // INLINEASM: [sideeffect|alignstack, 193 // asmstr,conststr] 194 CST_CODE_CE_SHUFVEC_EX = 19, // SHUFVEC_EX: [opty, opval, opval, opval] 195 CST_CODE_CE_INBOUNDS_GEP = 20,// INBOUNDS_GEP: [n x operands] 196 CST_CODE_BLOCKADDRESS = 21, // CST_CODE_BLOCKADDRESS [fnty, fnval, bb#] 197 CST_CODE_DATA = 22, // DATA: [n x elements] 198 CST_CODE_INLINEASM = 23 // INLINEASM: [sideeffect|alignstack| 199 // asmdialect,asmstr,conststr] 200 }; 201 202 /// CastOpcodes - These are values used in the bitcode files to encode which 203 /// cast a CST_CODE_CE_CAST or a XXX refers to. The values of these enums 204 /// have no fixed relation to the LLVM IR enum values. Changing these will 205 /// break compatibility with old files. 206 enum CastOpcodes { 207 CAST_TRUNC = 0, 208 CAST_ZEXT = 1, 209 CAST_SEXT = 2, 210 CAST_FPTOUI = 3, 211 CAST_FPTOSI = 4, 212 CAST_UITOFP = 5, 213 CAST_SITOFP = 6, 214 CAST_FPTRUNC = 7, 215 CAST_FPEXT = 8, 216 CAST_PTRTOINT = 9, 217 CAST_INTTOPTR = 10, 218 CAST_BITCAST = 11, 219 CAST_ADDRSPACECAST = 12 220 }; 221 222 /// BinaryOpcodes - These are values used in the bitcode files to encode which 223 /// binop a CST_CODE_CE_BINOP or a XXX refers to. The values of these enums 224 /// have no fixed relation to the LLVM IR enum values. Changing these will 225 /// break compatibility with old files. 226 enum BinaryOpcodes { 227 BINOP_ADD = 0, 228 BINOP_SUB = 1, 229 BINOP_MUL = 2, 230 BINOP_UDIV = 3, 231 BINOP_SDIV = 4, // overloaded for FP 232 BINOP_UREM = 5, 233 BINOP_SREM = 6, // overloaded for FP 234 BINOP_SHL = 7, 235 BINOP_LSHR = 8, 236 BINOP_ASHR = 9, 237 BINOP_AND = 10, 238 BINOP_OR = 11, 239 BINOP_XOR = 12 240 }; 241 242 /// These are values used in the bitcode files to encode AtomicRMW operations. 243 /// The values of these enums have no fixed relation to the LLVM IR enum 244 /// values. Changing these will break compatibility with old files. 245 enum RMWOperations { 246 RMW_XCHG = 0, 247 RMW_ADD = 1, 248 RMW_SUB = 2, 249 RMW_AND = 3, 250 RMW_NAND = 4, 251 RMW_OR = 5, 252 RMW_XOR = 6, 253 RMW_MAX = 7, 254 RMW_MIN = 8, 255 RMW_UMAX = 9, 256 RMW_UMIN = 10 257 }; 258 259 /// OverflowingBinaryOperatorOptionalFlags - Flags for serializing 260 /// OverflowingBinaryOperator's SubclassOptionalData contents. 261 enum OverflowingBinaryOperatorOptionalFlags { 262 OBO_NO_UNSIGNED_WRAP = 0, 263 OBO_NO_SIGNED_WRAP = 1 264 }; 265 266 /// PossiblyExactOperatorOptionalFlags - Flags for serializing 267 /// PossiblyExactOperator's SubclassOptionalData contents. 268 enum PossiblyExactOperatorOptionalFlags { 269 PEO_EXACT = 0 270 }; 271 272 /// Encoded AtomicOrdering values. 273 enum AtomicOrderingCodes { 274 ORDERING_NOTATOMIC = 0, 275 ORDERING_UNORDERED = 1, 276 ORDERING_MONOTONIC = 2, 277 ORDERING_ACQUIRE = 3, 278 ORDERING_RELEASE = 4, 279 ORDERING_ACQREL = 5, 280 ORDERING_SEQCST = 6 281 }; 282 283 /// Encoded SynchronizationScope values. 284 enum AtomicSynchScopeCodes { 285 SYNCHSCOPE_SINGLETHREAD = 0, 286 SYNCHSCOPE_CROSSTHREAD = 1 287 }; 288 289 // The function body block (FUNCTION_BLOCK_ID) describes function bodies. It 290 // can contain a constant block (CONSTANTS_BLOCK_ID). 291 enum FunctionCodes { 292 FUNC_CODE_DECLAREBLOCKS = 1, // DECLAREBLOCKS: [n] 293 294 FUNC_CODE_INST_BINOP = 2, // BINOP: [opcode, ty, opval, opval] 295 FUNC_CODE_INST_CAST = 3, // CAST: [opcode, ty, opty, opval] 296 FUNC_CODE_INST_GEP_OLD = 4, // GEP: [n x operands] 297 FUNC_CODE_INST_SELECT = 5, // SELECT: [ty, opval, opval, opval] 298 FUNC_CODE_INST_EXTRACTELT = 6, // EXTRACTELT: [opty, opval, opval] 299 FUNC_CODE_INST_INSERTELT = 7, // INSERTELT: [ty, opval, opval, opval] 300 FUNC_CODE_INST_SHUFFLEVEC = 8, // SHUFFLEVEC: [ty, opval, opval, opval] 301 FUNC_CODE_INST_CMP = 9, // CMP: [opty, opval, opval, pred] 302 303 FUNC_CODE_INST_RET = 10, // RET: [opty,opval<both optional>] 304 FUNC_CODE_INST_BR = 11, // BR: [bb#, bb#, cond] or [bb#] 305 FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, op0, op1, ...] 306 FUNC_CODE_INST_INVOKE = 13, // INVOKE: [attr, fnty, op0,op1, ...] 307 // 14 is unused. 308 FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE 309 310 FUNC_CODE_INST_PHI = 16, // PHI: [ty, val0,bb0, ...] 311 // 17 is unused. 312 // 18 is unused. 313 FUNC_CODE_INST_ALLOCA = 19, // ALLOCA: [instty, opty, op, align] 314 FUNC_CODE_INST_LOAD = 20, // LOAD: [opty, op, align, vol] 315 // 21 is unused. 316 // 22 is unused. 317 FUNC_CODE_INST_VAARG = 23, // VAARG: [valistty, valist, instty] 318 // This store code encodes the pointer type, rather than the value type 319 // this is so information only available in the pointer type (e.g. address 320 // spaces) is retained. 321 FUNC_CODE_INST_STORE = 24, // STORE: [ptrty,ptr,val, align, vol] 322 // 25 is unused. 323 FUNC_CODE_INST_EXTRACTVAL = 26, // EXTRACTVAL: [n x operands] 324 FUNC_CODE_INST_INSERTVAL = 27, // INSERTVAL: [n x operands] 325 // fcmp/icmp returning Int1TY or vector of Int1Ty. Same as CMP, exists to 326 // support legacy vicmp/vfcmp instructions. 327 FUNC_CODE_INST_CMP2 = 28, // CMP2: [opty, opval, opval, pred] 328 // new select on i1 or [N x i1] 329 FUNC_CODE_INST_VSELECT = 29, // VSELECT: [ty,opval,opval,predty,pred] 330 FUNC_CODE_INST_INBOUNDS_GEP_OLD = 30, // INBOUNDS_GEP: [n x operands] 331 FUNC_CODE_INST_INDIRECTBR = 31, // INDIRECTBR: [opty, op0, op1, ...] 332 // 32 is unused. 333 FUNC_CODE_DEBUG_LOC_AGAIN = 33, // DEBUG_LOC_AGAIN 334 335 FUNC_CODE_INST_CALL = 34, // CALL: [attr, cc, fnty, fnid, args...] 336 337 FUNC_CODE_DEBUG_LOC = 35, // DEBUG_LOC: [Line,Col,ScopeVal, IAVal] 338 FUNC_CODE_INST_FENCE = 36, // FENCE: [ordering, synchscope] 339 FUNC_CODE_INST_CMPXCHG = 37, // CMPXCHG: [ptrty,ptr,cmp,new, align, vol, 340 // ordering, synchscope] 341 FUNC_CODE_INST_ATOMICRMW = 38, // ATOMICRMW: [ptrty,ptr,val, operation, 342 // align, vol, 343 // ordering, synchscope] 344 FUNC_CODE_INST_RESUME = 39, // RESUME: [opval] 345 FUNC_CODE_INST_LANDINGPAD = 40, // LANDINGPAD: [ty,val,val,num,id0,val0...] 346 FUNC_CODE_INST_LOADATOMIC = 41, // LOAD: [opty, op, align, vol, 347 // ordering, synchscope] 348 FUNC_CODE_INST_STOREATOMIC = 42, // STORE: [ptrty,ptr,val, align, vol 349 // ordering, synchscope] 350 FUNC_CODE_INST_GEP = 43, // GEP: [inbounds, n x operands] 351 }; 352 353 enum UseListCodes { 354 USELIST_CODE_DEFAULT = 1, // DEFAULT: [index..., value-id] 355 USELIST_CODE_BB = 2 // BB: [index..., bb-id] 356 }; 357 358 enum AttributeKindCodes { 359 // = 0 is unused 360 ATTR_KIND_ALIGNMENT = 1, 361 ATTR_KIND_ALWAYS_INLINE = 2, 362 ATTR_KIND_BY_VAL = 3, 363 ATTR_KIND_INLINE_HINT = 4, 364 ATTR_KIND_IN_REG = 5, 365 ATTR_KIND_MIN_SIZE = 6, 366 ATTR_KIND_NAKED = 7, 367 ATTR_KIND_NEST = 8, 368 ATTR_KIND_NO_ALIAS = 9, 369 ATTR_KIND_NO_BUILTIN = 10, 370 ATTR_KIND_NO_CAPTURE = 11, 371 ATTR_KIND_NO_DUPLICATE = 12, 372 ATTR_KIND_NO_IMPLICIT_FLOAT = 13, 373 ATTR_KIND_NO_INLINE = 14, 374 ATTR_KIND_NON_LAZY_BIND = 15, 375 ATTR_KIND_NO_RED_ZONE = 16, 376 ATTR_KIND_NO_RETURN = 17, 377 ATTR_KIND_NO_UNWIND = 18, 378 ATTR_KIND_OPTIMIZE_FOR_SIZE = 19, 379 ATTR_KIND_READ_NONE = 20, 380 ATTR_KIND_READ_ONLY = 21, 381 ATTR_KIND_RETURNED = 22, 382 ATTR_KIND_RETURNS_TWICE = 23, 383 ATTR_KIND_S_EXT = 24, 384 ATTR_KIND_STACK_ALIGNMENT = 25, 385 ATTR_KIND_STACK_PROTECT = 26, 386 ATTR_KIND_STACK_PROTECT_REQ = 27, 387 ATTR_KIND_STACK_PROTECT_STRONG = 28, 388 ATTR_KIND_STRUCT_RET = 29, 389 ATTR_KIND_SANITIZE_ADDRESS = 30, 390 ATTR_KIND_SANITIZE_THREAD = 31, 391 ATTR_KIND_SANITIZE_MEMORY = 32, 392 ATTR_KIND_UW_TABLE = 33, 393 ATTR_KIND_Z_EXT = 34, 394 ATTR_KIND_BUILTIN = 35, 395 ATTR_KIND_COLD = 36, 396 ATTR_KIND_OPTIMIZE_NONE = 37, 397 ATTR_KIND_IN_ALLOCA = 38, 398 ATTR_KIND_NON_NULL = 39, 399 ATTR_KIND_JUMP_TABLE = 40, 400 ATTR_KIND_DEREFERENCEABLE = 41, 401 ATTR_KIND_DEREFERENCEABLE_OR_NULL = 42 402 }; 403 404 enum ComdatSelectionKindCodes { 405 COMDAT_SELECTION_KIND_ANY = 1, 406 COMDAT_SELECTION_KIND_EXACT_MATCH = 2, 407 COMDAT_SELECTION_KIND_LARGEST = 3, 408 COMDAT_SELECTION_KIND_NO_DUPLICATES = 4, 409 COMDAT_SELECTION_KIND_SAME_SIZE = 5, 410 }; 411 412 } // End bitc namespace 413 } // End llvm namespace 414 415 #endif 416