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 }; 76 77 /// PARAMATTR blocks have code for defining a parameter attribute set. 78 enum AttributeCodes { 79 // FIXME: Remove `PARAMATTR_CODE_ENTRY_OLD' in 4.0 80 PARAMATTR_CODE_ENTRY_OLD = 1, // ENTRY: [paramidx0, attr0, 81 // paramidx1, attr1...] 82 PARAMATTR_CODE_ENTRY = 2, // ENTRY: [paramidx0, attrgrp0, 83 // paramidx1, attrgrp1, ...] 84 PARAMATTR_GRP_CODE_ENTRY = 3 // ENTRY: [id, attr0, att1, ...] 85 }; 86 87 /// TYPE blocks have codes for each type primitive they use. 88 enum TypeCodes { 89 TYPE_CODE_NUMENTRY = 1, // NUMENTRY: [numentries] 90 91 // Type Codes 92 TYPE_CODE_VOID = 2, // VOID 93 TYPE_CODE_FLOAT = 3, // FLOAT 94 TYPE_CODE_DOUBLE = 4, // DOUBLE 95 TYPE_CODE_LABEL = 5, // LABEL 96 TYPE_CODE_OPAQUE = 6, // OPAQUE 97 TYPE_CODE_INTEGER = 7, // INTEGER: [width] 98 TYPE_CODE_POINTER = 8, // POINTER: [pointee type] 99 100 TYPE_CODE_FUNCTION_OLD = 9, // FUNCTION: [vararg, attrid, retty, 101 // paramty x N] 102 103 TYPE_CODE_HALF = 10, // HALF 104 105 TYPE_CODE_ARRAY = 11, // ARRAY: [numelts, eltty] 106 TYPE_CODE_VECTOR = 12, // VECTOR: [numelts, eltty] 107 108 // These are not with the other floating point types because they're 109 // a late addition, and putting them in the right place breaks 110 // binary compatibility. 111 TYPE_CODE_X86_FP80 = 13, // X86 LONG DOUBLE 112 TYPE_CODE_FP128 = 14, // LONG DOUBLE (112 bit mantissa) 113 TYPE_CODE_PPC_FP128= 15, // PPC LONG DOUBLE (2 doubles) 114 115 TYPE_CODE_METADATA = 16, // METADATA 116 117 TYPE_CODE_X86_MMX = 17, // X86 MMX 118 119 TYPE_CODE_STRUCT_ANON = 18, // STRUCT_ANON: [ispacked, eltty x N] 120 TYPE_CODE_STRUCT_NAME = 19, // STRUCT_NAME: [strchr x N] 121 TYPE_CODE_STRUCT_NAMED = 20,// STRUCT_NAMED: [ispacked, eltty x N] 122 123 TYPE_CODE_FUNCTION = 21 // FUNCTION: [vararg, retty, paramty x N] 124 }; 125 126 // The type symbol table only has one code (TST_ENTRY_CODE). 127 enum TypeSymtabCodes { 128 TST_CODE_ENTRY = 1 // TST_ENTRY: [typeid, namechar x N] 129 }; 130 131 // The value symbol table only has one code (VST_ENTRY_CODE). 132 enum ValueSymtabCodes { 133 VST_CODE_ENTRY = 1, // VST_ENTRY: [valid, namechar x N] 134 VST_CODE_BBENTRY = 2 // VST_BBENTRY: [bbid, namechar x N] 135 }; 136 137 enum MetadataCodes { 138 METADATA_STRING = 1, // MDSTRING: [values] 139 // 2 is unused. 140 // 3 is unused. 141 METADATA_NAME = 4, // STRING: [values] 142 // 5 is unused. 143 METADATA_KIND = 6, // [n x [id, name]] 144 // 7 is unused. 145 METADATA_NODE = 8, // NODE: [n x (type num, value num)] 146 METADATA_FN_NODE = 9, // FN_NODE: [n x (type num, value num)] 147 METADATA_NAMED_NODE = 10, // NAMED_NODE: [n x mdnodes] 148 METADATA_ATTACHMENT = 11 // [m x [value, [n x [id, mdnode]]] 149 }; 150 151 // The constants block (CONSTANTS_BLOCK_ID) describes emission for each 152 // constant and maintains an implicit current type value. 153 enum ConstantsCodes { 154 CST_CODE_SETTYPE = 1, // SETTYPE: [typeid] 155 CST_CODE_NULL = 2, // NULL 156 CST_CODE_UNDEF = 3, // UNDEF 157 CST_CODE_INTEGER = 4, // INTEGER: [intval] 158 CST_CODE_WIDE_INTEGER = 5, // WIDE_INTEGER: [n x intval] 159 CST_CODE_FLOAT = 6, // FLOAT: [fpval] 160 CST_CODE_AGGREGATE = 7, // AGGREGATE: [n x value number] 161 CST_CODE_STRING = 8, // STRING: [values] 162 CST_CODE_CSTRING = 9, // CSTRING: [values] 163 CST_CODE_CE_BINOP = 10, // CE_BINOP: [opcode, opval, opval] 164 CST_CODE_CE_CAST = 11, // CE_CAST: [opcode, opty, opval] 165 CST_CODE_CE_GEP = 12, // CE_GEP: [n x operands] 166 CST_CODE_CE_SELECT = 13, // CE_SELECT: [opval, opval, opval] 167 CST_CODE_CE_EXTRACTELT = 14, // CE_EXTRACTELT: [opty, opval, opval] 168 CST_CODE_CE_INSERTELT = 15, // CE_INSERTELT: [opval, opval, opval] 169 CST_CODE_CE_SHUFFLEVEC = 16, // CE_SHUFFLEVEC: [opval, opval, opval] 170 CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred] 171 CST_CODE_INLINEASM_OLD = 18, // INLINEASM: [sideeffect|alignstack, 172 // asmstr,conststr] 173 CST_CODE_CE_SHUFVEC_EX = 19, // SHUFVEC_EX: [opty, opval, opval, opval] 174 CST_CODE_CE_INBOUNDS_GEP = 20,// INBOUNDS_GEP: [n x operands] 175 CST_CODE_BLOCKADDRESS = 21, // CST_CODE_BLOCKADDRESS [fnty, fnval, bb#] 176 CST_CODE_DATA = 22, // DATA: [n x elements] 177 CST_CODE_INLINEASM = 23 // INLINEASM: [sideeffect|alignstack| 178 // asmdialect,asmstr,conststr] 179 }; 180 181 /// CastOpcodes - These are values used in the bitcode files to encode which 182 /// cast a CST_CODE_CE_CAST or a XXX refers to. The values of these enums 183 /// have no fixed relation to the LLVM IR enum values. Changing these will 184 /// break compatibility with old files. 185 enum CastOpcodes { 186 CAST_TRUNC = 0, 187 CAST_ZEXT = 1, 188 CAST_SEXT = 2, 189 CAST_FPTOUI = 3, 190 CAST_FPTOSI = 4, 191 CAST_UITOFP = 5, 192 CAST_SITOFP = 6, 193 CAST_FPTRUNC = 7, 194 CAST_FPEXT = 8, 195 CAST_PTRTOINT = 9, 196 CAST_INTTOPTR = 10, 197 CAST_BITCAST = 11 198 }; 199 200 /// BinaryOpcodes - These are values used in the bitcode files to encode which 201 /// binop a CST_CODE_CE_BINOP or a XXX refers to. The values of these enums 202 /// have no fixed relation to the LLVM IR enum values. Changing these will 203 /// break compatibility with old files. 204 enum BinaryOpcodes { 205 BINOP_ADD = 0, 206 BINOP_SUB = 1, 207 BINOP_MUL = 2, 208 BINOP_UDIV = 3, 209 BINOP_SDIV = 4, // overloaded for FP 210 BINOP_UREM = 5, 211 BINOP_SREM = 6, // overloaded for FP 212 BINOP_SHL = 7, 213 BINOP_LSHR = 8, 214 BINOP_ASHR = 9, 215 BINOP_AND = 10, 216 BINOP_OR = 11, 217 BINOP_XOR = 12 218 }; 219 220 /// These are values used in the bitcode files to encode AtomicRMW operations. 221 /// The values of these enums have no fixed relation to the LLVM IR enum 222 /// values. Changing these will break compatibility with old files. 223 enum RMWOperations { 224 RMW_XCHG = 0, 225 RMW_ADD = 1, 226 RMW_SUB = 2, 227 RMW_AND = 3, 228 RMW_NAND = 4, 229 RMW_OR = 5, 230 RMW_XOR = 6, 231 RMW_MAX = 7, 232 RMW_MIN = 8, 233 RMW_UMAX = 9, 234 RMW_UMIN = 10 235 }; 236 237 /// OverflowingBinaryOperatorOptionalFlags - Flags for serializing 238 /// OverflowingBinaryOperator's SubclassOptionalData contents. 239 enum OverflowingBinaryOperatorOptionalFlags { 240 OBO_NO_UNSIGNED_WRAP = 0, 241 OBO_NO_SIGNED_WRAP = 1 242 }; 243 244 /// PossiblyExactOperatorOptionalFlags - Flags for serializing 245 /// PossiblyExactOperator's SubclassOptionalData contents. 246 enum PossiblyExactOperatorOptionalFlags { 247 PEO_EXACT = 0 248 }; 249 250 /// Encoded AtomicOrdering values. 251 enum AtomicOrderingCodes { 252 ORDERING_NOTATOMIC = 0, 253 ORDERING_UNORDERED = 1, 254 ORDERING_MONOTONIC = 2, 255 ORDERING_ACQUIRE = 3, 256 ORDERING_RELEASE = 4, 257 ORDERING_ACQREL = 5, 258 ORDERING_SEQCST = 6 259 }; 260 261 /// Encoded SynchronizationScope values. 262 enum AtomicSynchScopeCodes { 263 SYNCHSCOPE_SINGLETHREAD = 0, 264 SYNCHSCOPE_CROSSTHREAD = 1 265 }; 266 267 // The function body block (FUNCTION_BLOCK_ID) describes function bodies. It 268 // can contain a constant block (CONSTANTS_BLOCK_ID). 269 enum FunctionCodes { 270 FUNC_CODE_DECLAREBLOCKS = 1, // DECLAREBLOCKS: [n] 271 272 FUNC_CODE_INST_BINOP = 2, // BINOP: [opcode, ty, opval, opval] 273 FUNC_CODE_INST_CAST = 3, // CAST: [opcode, ty, opty, opval] 274 FUNC_CODE_INST_GEP = 4, // GEP: [n x operands] 275 FUNC_CODE_INST_SELECT = 5, // SELECT: [ty, opval, opval, opval] 276 FUNC_CODE_INST_EXTRACTELT = 6, // EXTRACTELT: [opty, opval, opval] 277 FUNC_CODE_INST_INSERTELT = 7, // INSERTELT: [ty, opval, opval, opval] 278 FUNC_CODE_INST_SHUFFLEVEC = 8, // SHUFFLEVEC: [ty, opval, opval, opval] 279 FUNC_CODE_INST_CMP = 9, // CMP: [opty, opval, opval, pred] 280 281 FUNC_CODE_INST_RET = 10, // RET: [opty,opval<both optional>] 282 FUNC_CODE_INST_BR = 11, // BR: [bb#, bb#, cond] or [bb#] 283 FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, op0, op1, ...] 284 FUNC_CODE_INST_INVOKE = 13, // INVOKE: [attr, fnty, op0,op1, ...] 285 // 14 is unused. 286 FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE 287 288 FUNC_CODE_INST_PHI = 16, // PHI: [ty, val0,bb0, ...] 289 // 17 is unused. 290 // 18 is unused. 291 FUNC_CODE_INST_ALLOCA = 19, // ALLOCA: [instty, op, align] 292 FUNC_CODE_INST_LOAD = 20, // LOAD: [opty, op, align, vol] 293 // 21 is unused. 294 // 22 is unused. 295 FUNC_CODE_INST_VAARG = 23, // VAARG: [valistty, valist, instty] 296 // This store code encodes the pointer type, rather than the value type 297 // this is so information only available in the pointer type (e.g. address 298 // spaces) is retained. 299 FUNC_CODE_INST_STORE = 24, // STORE: [ptrty,ptr,val, align, vol] 300 // 25 is unused. 301 FUNC_CODE_INST_EXTRACTVAL = 26, // EXTRACTVAL: [n x operands] 302 FUNC_CODE_INST_INSERTVAL = 27, // INSERTVAL: [n x operands] 303 // fcmp/icmp returning Int1TY or vector of Int1Ty. Same as CMP, exists to 304 // support legacy vicmp/vfcmp instructions. 305 FUNC_CODE_INST_CMP2 = 28, // CMP2: [opty, opval, opval, pred] 306 // new select on i1 or [N x i1] 307 FUNC_CODE_INST_VSELECT = 29, // VSELECT: [ty,opval,opval,predty,pred] 308 FUNC_CODE_INST_INBOUNDS_GEP= 30, // INBOUNDS_GEP: [n x operands] 309 FUNC_CODE_INST_INDIRECTBR = 31, // INDIRECTBR: [opty, op0, op1, ...] 310 // 32 is unused. 311 FUNC_CODE_DEBUG_LOC_AGAIN = 33, // DEBUG_LOC_AGAIN 312 313 FUNC_CODE_INST_CALL = 34, // CALL: [attr, fnty, fnid, args...] 314 315 FUNC_CODE_DEBUG_LOC = 35, // DEBUG_LOC: [Line,Col,ScopeVal, IAVal] 316 FUNC_CODE_INST_FENCE = 36, // FENCE: [ordering, synchscope] 317 FUNC_CODE_INST_CMPXCHG = 37, // CMPXCHG: [ptrty,ptr,cmp,new, align, vol, 318 // ordering, synchscope] 319 FUNC_CODE_INST_ATOMICRMW = 38, // ATOMICRMW: [ptrty,ptr,val, operation, 320 // align, vol, 321 // ordering, synchscope] 322 FUNC_CODE_INST_RESUME = 39, // RESUME: [opval] 323 FUNC_CODE_INST_LANDINGPAD = 40, // LANDINGPAD: [ty,val,val,num,id0,val0...] 324 FUNC_CODE_INST_LOADATOMIC = 41, // LOAD: [opty, op, align, vol, 325 // ordering, synchscope] 326 FUNC_CODE_INST_STOREATOMIC = 42 // STORE: [ptrty,ptr,val, align, vol 327 // ordering, synchscope] 328 }; 329 330 enum UseListCodes { 331 USELIST_CODE_ENTRY = 1 // USELIST_CODE_ENTRY: TBD. 332 }; 333 334 enum AttributeKindCodes { 335 // = 0 is unused 336 ATTR_KIND_ALIGNMENT = 1, 337 ATTR_KIND_ALWAYS_INLINE = 2, 338 ATTR_KIND_BY_VAL = 3, 339 ATTR_KIND_INLINE_HINT = 4, 340 ATTR_KIND_IN_REG = 5, 341 ATTR_KIND_MIN_SIZE = 6, 342 ATTR_KIND_NAKED = 7, 343 ATTR_KIND_NEST = 8, 344 ATTR_KIND_NO_ALIAS = 9, 345 ATTR_KIND_NO_BUILTIN = 10, 346 ATTR_KIND_NO_CAPTURE = 11, 347 ATTR_KIND_NO_DUPLICATE = 12, 348 ATTR_KIND_NO_IMPLICIT_FLOAT = 13, 349 ATTR_KIND_NO_INLINE = 14, 350 ATTR_KIND_NON_LAZY_BIND = 15, 351 ATTR_KIND_NO_RED_ZONE = 16, 352 ATTR_KIND_NO_RETURN = 17, 353 ATTR_KIND_NO_UNWIND = 18, 354 ATTR_KIND_OPTIMIZE_FOR_SIZE = 19, 355 ATTR_KIND_READ_NONE = 20, 356 ATTR_KIND_READ_ONLY = 21, 357 ATTR_KIND_RETURNED = 22, 358 ATTR_KIND_RETURNS_TWICE = 23, 359 ATTR_KIND_S_EXT = 24, 360 ATTR_KIND_STACK_ALIGNMENT = 25, 361 ATTR_KIND_STACK_PROTECT = 26, 362 ATTR_KIND_STACK_PROTECT_REQ = 27, 363 ATTR_KIND_STACK_PROTECT_STRONG = 28, 364 ATTR_KIND_STRUCT_RET = 29, 365 ATTR_KIND_SANITIZE_ADDRESS = 30, 366 ATTR_KIND_SANITIZE_THREAD = 31, 367 ATTR_KIND_SANITIZE_MEMORY = 32, 368 ATTR_KIND_UW_TABLE = 33, 369 ATTR_KIND_Z_EXT = 34, 370 ATTR_KIND_BUILTIN = 35, 371 ATTR_KIND_COLD = 36 372 }; 373 374 } // End bitc namespace 375 } // End llvm namespace 376 377 #endif 378