LLVM API Documentation
00001 //===- LLVMBitCodes.h - Enum values for the LLVM bitcode format -*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This header defines Bitcode enum values for LLVM IR bitcode files. 00011 // 00012 // The enum values defined in this file should be considered permanent. If 00013 // new features are added, they should have values added at the end of the 00014 // respective lists. 00015 // 00016 //===----------------------------------------------------------------------===// 00017 00018 #ifndef LLVM_BITCODE_LLVMBITCODES_H 00019 #define LLVM_BITCODE_LLVMBITCODES_H 00020 00021 #include "llvm/Bitcode/BitCodes.h" 00022 00023 namespace llvm { 00024 namespace bitc { 00025 // The only top-level block type defined is for a module. 00026 enum BlockIDs { 00027 // Blocks 00028 MODULE_BLOCK_ID = FIRST_APPLICATION_BLOCKID, 00029 00030 // Module sub-block id's. 00031 PARAMATTR_BLOCK_ID, 00032 PARAMATTR_GROUP_BLOCK_ID, 00033 00034 CONSTANTS_BLOCK_ID, 00035 FUNCTION_BLOCK_ID, 00036 00037 UNUSED_ID1, 00038 00039 VALUE_SYMTAB_BLOCK_ID, 00040 METADATA_BLOCK_ID, 00041 METADATA_ATTACHMENT_ID, 00042 00043 TYPE_BLOCK_ID_NEW, 00044 00045 USELIST_BLOCK_ID 00046 }; 00047 00048 00049 /// MODULE blocks have a number of optional fields and subblocks. 00050 enum ModuleCodes { 00051 MODULE_CODE_VERSION = 1, // VERSION: [version#] 00052 MODULE_CODE_TRIPLE = 2, // TRIPLE: [strchr x N] 00053 MODULE_CODE_DATALAYOUT = 3, // DATALAYOUT: [strchr x N] 00054 MODULE_CODE_ASM = 4, // ASM: [strchr x N] 00055 MODULE_CODE_SECTIONNAME = 5, // SECTIONNAME: [strchr x N] 00056 00057 // FIXME: Remove DEPLIB in 4.0. 00058 MODULE_CODE_DEPLIB = 6, // DEPLIB: [strchr x N] 00059 00060 // GLOBALVAR: [pointer type, isconst, initid, 00061 // linkage, alignment, section, visibility, threadlocal] 00062 MODULE_CODE_GLOBALVAR = 7, 00063 00064 // FUNCTION: [type, callingconv, isproto, linkage, paramattrs, alignment, 00065 // section, visibility, gc, unnamed_addr] 00066 MODULE_CODE_FUNCTION = 8, 00067 00068 // ALIAS: [alias type, aliasee val#, linkage, visibility] 00069 MODULE_CODE_ALIAS = 9, 00070 00071 // MODULE_CODE_PURGEVALS: [numvals] 00072 MODULE_CODE_PURGEVALS = 10, 00073 00074 MODULE_CODE_GCNAME = 11, // GCNAME: [strchr x N] 00075 MODULE_CODE_COMDAT = 12, // COMDAT: [selection_kind, name] 00076 }; 00077 00078 /// PARAMATTR blocks have code for defining a parameter attribute set. 00079 enum AttributeCodes { 00080 // FIXME: Remove `PARAMATTR_CODE_ENTRY_OLD' in 4.0 00081 PARAMATTR_CODE_ENTRY_OLD = 1, // ENTRY: [paramidx0, attr0, 00082 // paramidx1, attr1...] 00083 PARAMATTR_CODE_ENTRY = 2, // ENTRY: [paramidx0, attrgrp0, 00084 // paramidx1, attrgrp1, ...] 00085 PARAMATTR_GRP_CODE_ENTRY = 3 // ENTRY: [id, attr0, att1, ...] 00086 }; 00087 00088 /// TYPE blocks have codes for each type primitive they use. 00089 enum TypeCodes { 00090 TYPE_CODE_NUMENTRY = 1, // NUMENTRY: [numentries] 00091 00092 // Type Codes 00093 TYPE_CODE_VOID = 2, // VOID 00094 TYPE_CODE_FLOAT = 3, // FLOAT 00095 TYPE_CODE_DOUBLE = 4, // DOUBLE 00096 TYPE_CODE_LABEL = 5, // LABEL 00097 TYPE_CODE_OPAQUE = 6, // OPAQUE 00098 TYPE_CODE_INTEGER = 7, // INTEGER: [width] 00099 TYPE_CODE_POINTER = 8, // POINTER: [pointee type] 00100 00101 TYPE_CODE_FUNCTION_OLD = 9, // FUNCTION: [vararg, attrid, retty, 00102 // paramty x N] 00103 00104 TYPE_CODE_HALF = 10, // HALF 00105 00106 TYPE_CODE_ARRAY = 11, // ARRAY: [numelts, eltty] 00107 TYPE_CODE_VECTOR = 12, // VECTOR: [numelts, eltty] 00108 00109 // These are not with the other floating point types because they're 00110 // a late addition, and putting them in the right place breaks 00111 // binary compatibility. 00112 TYPE_CODE_X86_FP80 = 13, // X86 LONG DOUBLE 00113 TYPE_CODE_FP128 = 14, // LONG DOUBLE (112 bit mantissa) 00114 TYPE_CODE_PPC_FP128= 15, // PPC LONG DOUBLE (2 doubles) 00115 00116 TYPE_CODE_METADATA = 16, // METADATA 00117 00118 TYPE_CODE_X86_MMX = 17, // X86 MMX 00119 00120 TYPE_CODE_STRUCT_ANON = 18, // STRUCT_ANON: [ispacked, eltty x N] 00121 TYPE_CODE_STRUCT_NAME = 19, // STRUCT_NAME: [strchr x N] 00122 TYPE_CODE_STRUCT_NAMED = 20,// STRUCT_NAMED: [ispacked, eltty x N] 00123 00124 TYPE_CODE_FUNCTION = 21 // FUNCTION: [vararg, retty, paramty x N] 00125 }; 00126 00127 // The type symbol table only has one code (TST_ENTRY_CODE). 00128 enum TypeSymtabCodes { 00129 TST_CODE_ENTRY = 1 // TST_ENTRY: [typeid, namechar x N] 00130 }; 00131 00132 // The value symbol table only has one code (VST_ENTRY_CODE). 00133 enum ValueSymtabCodes { 00134 VST_CODE_ENTRY = 1, // VST_ENTRY: [valid, namechar x N] 00135 VST_CODE_BBENTRY = 2 // VST_BBENTRY: [bbid, namechar x N] 00136 }; 00137 00138 enum MetadataCodes { 00139 METADATA_STRING = 1, // MDSTRING: [values] 00140 // 2 is unused. 00141 // 3 is unused. 00142 METADATA_NAME = 4, // STRING: [values] 00143 // 5 is unused. 00144 METADATA_KIND = 6, // [n x [id, name]] 00145 // 7 is unused. 00146 METADATA_NODE = 8, // NODE: [n x (type num, value num)] 00147 METADATA_FN_NODE = 9, // FN_NODE: [n x (type num, value num)] 00148 METADATA_NAMED_NODE = 10, // NAMED_NODE: [n x mdnodes] 00149 METADATA_ATTACHMENT = 11 // [m x [value, [n x [id, mdnode]]] 00150 }; 00151 00152 // The constants block (CONSTANTS_BLOCK_ID) describes emission for each 00153 // constant and maintains an implicit current type value. 00154 enum ConstantsCodes { 00155 CST_CODE_SETTYPE = 1, // SETTYPE: [typeid] 00156 CST_CODE_NULL = 2, // NULL 00157 CST_CODE_UNDEF = 3, // UNDEF 00158 CST_CODE_INTEGER = 4, // INTEGER: [intval] 00159 CST_CODE_WIDE_INTEGER = 5, // WIDE_INTEGER: [n x intval] 00160 CST_CODE_FLOAT = 6, // FLOAT: [fpval] 00161 CST_CODE_AGGREGATE = 7, // AGGREGATE: [n x value number] 00162 CST_CODE_STRING = 8, // STRING: [values] 00163 CST_CODE_CSTRING = 9, // CSTRING: [values] 00164 CST_CODE_CE_BINOP = 10, // CE_BINOP: [opcode, opval, opval] 00165 CST_CODE_CE_CAST = 11, // CE_CAST: [opcode, opty, opval] 00166 CST_CODE_CE_GEP = 12, // CE_GEP: [n x operands] 00167 CST_CODE_CE_SELECT = 13, // CE_SELECT: [opval, opval, opval] 00168 CST_CODE_CE_EXTRACTELT = 14, // CE_EXTRACTELT: [opty, opval, opval] 00169 CST_CODE_CE_INSERTELT = 15, // CE_INSERTELT: [opval, opval, opval] 00170 CST_CODE_CE_SHUFFLEVEC = 16, // CE_SHUFFLEVEC: [opval, opval, opval] 00171 CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred] 00172 CST_CODE_INLINEASM_OLD = 18, // INLINEASM: [sideeffect|alignstack, 00173 // asmstr,conststr] 00174 CST_CODE_CE_SHUFVEC_EX = 19, // SHUFVEC_EX: [opty, opval, opval, opval] 00175 CST_CODE_CE_INBOUNDS_GEP = 20,// INBOUNDS_GEP: [n x operands] 00176 CST_CODE_BLOCKADDRESS = 21, // CST_CODE_BLOCKADDRESS [fnty, fnval, bb#] 00177 CST_CODE_DATA = 22, // DATA: [n x elements] 00178 CST_CODE_INLINEASM = 23 // INLINEASM: [sideeffect|alignstack| 00179 // asmdialect,asmstr,conststr] 00180 }; 00181 00182 /// CastOpcodes - These are values used in the bitcode files to encode which 00183 /// cast a CST_CODE_CE_CAST or a XXX refers to. The values of these enums 00184 /// have no fixed relation to the LLVM IR enum values. Changing these will 00185 /// break compatibility with old files. 00186 enum CastOpcodes { 00187 CAST_TRUNC = 0, 00188 CAST_ZEXT = 1, 00189 CAST_SEXT = 2, 00190 CAST_FPTOUI = 3, 00191 CAST_FPTOSI = 4, 00192 CAST_UITOFP = 5, 00193 CAST_SITOFP = 6, 00194 CAST_FPTRUNC = 7, 00195 CAST_FPEXT = 8, 00196 CAST_PTRTOINT = 9, 00197 CAST_INTTOPTR = 10, 00198 CAST_BITCAST = 11, 00199 CAST_ADDRSPACECAST = 12 00200 }; 00201 00202 /// BinaryOpcodes - These are values used in the bitcode files to encode which 00203 /// binop a CST_CODE_CE_BINOP or a XXX refers to. The values of these enums 00204 /// have no fixed relation to the LLVM IR enum values. Changing these will 00205 /// break compatibility with old files. 00206 enum BinaryOpcodes { 00207 BINOP_ADD = 0, 00208 BINOP_SUB = 1, 00209 BINOP_MUL = 2, 00210 BINOP_UDIV = 3, 00211 BINOP_SDIV = 4, // overloaded for FP 00212 BINOP_UREM = 5, 00213 BINOP_SREM = 6, // overloaded for FP 00214 BINOP_SHL = 7, 00215 BINOP_LSHR = 8, 00216 BINOP_ASHR = 9, 00217 BINOP_AND = 10, 00218 BINOP_OR = 11, 00219 BINOP_XOR = 12 00220 }; 00221 00222 /// These are values used in the bitcode files to encode AtomicRMW operations. 00223 /// The values of these enums have no fixed relation to the LLVM IR enum 00224 /// values. Changing these will break compatibility with old files. 00225 enum RMWOperations { 00226 RMW_XCHG = 0, 00227 RMW_ADD = 1, 00228 RMW_SUB = 2, 00229 RMW_AND = 3, 00230 RMW_NAND = 4, 00231 RMW_OR = 5, 00232 RMW_XOR = 6, 00233 RMW_MAX = 7, 00234 RMW_MIN = 8, 00235 RMW_UMAX = 9, 00236 RMW_UMIN = 10 00237 }; 00238 00239 /// OverflowingBinaryOperatorOptionalFlags - Flags for serializing 00240 /// OverflowingBinaryOperator's SubclassOptionalData contents. 00241 enum OverflowingBinaryOperatorOptionalFlags { 00242 OBO_NO_UNSIGNED_WRAP = 0, 00243 OBO_NO_SIGNED_WRAP = 1 00244 }; 00245 00246 /// PossiblyExactOperatorOptionalFlags - Flags for serializing 00247 /// PossiblyExactOperator's SubclassOptionalData contents. 00248 enum PossiblyExactOperatorOptionalFlags { 00249 PEO_EXACT = 0 00250 }; 00251 00252 /// Encoded AtomicOrdering values. 00253 enum AtomicOrderingCodes { 00254 ORDERING_NOTATOMIC = 0, 00255 ORDERING_UNORDERED = 1, 00256 ORDERING_MONOTONIC = 2, 00257 ORDERING_ACQUIRE = 3, 00258 ORDERING_RELEASE = 4, 00259 ORDERING_ACQREL = 5, 00260 ORDERING_SEQCST = 6 00261 }; 00262 00263 /// Encoded SynchronizationScope values. 00264 enum AtomicSynchScopeCodes { 00265 SYNCHSCOPE_SINGLETHREAD = 0, 00266 SYNCHSCOPE_CROSSTHREAD = 1 00267 }; 00268 00269 // The function body block (FUNCTION_BLOCK_ID) describes function bodies. It 00270 // can contain a constant block (CONSTANTS_BLOCK_ID). 00271 enum FunctionCodes { 00272 FUNC_CODE_DECLAREBLOCKS = 1, // DECLAREBLOCKS: [n] 00273 00274 FUNC_CODE_INST_BINOP = 2, // BINOP: [opcode, ty, opval, opval] 00275 FUNC_CODE_INST_CAST = 3, // CAST: [opcode, ty, opty, opval] 00276 FUNC_CODE_INST_GEP = 4, // GEP: [n x operands] 00277 FUNC_CODE_INST_SELECT = 5, // SELECT: [ty, opval, opval, opval] 00278 FUNC_CODE_INST_EXTRACTELT = 6, // EXTRACTELT: [opty, opval, opval] 00279 FUNC_CODE_INST_INSERTELT = 7, // INSERTELT: [ty, opval, opval, opval] 00280 FUNC_CODE_INST_SHUFFLEVEC = 8, // SHUFFLEVEC: [ty, opval, opval, opval] 00281 FUNC_CODE_INST_CMP = 9, // CMP: [opty, opval, opval, pred] 00282 00283 FUNC_CODE_INST_RET = 10, // RET: [opty,opval<both optional>] 00284 FUNC_CODE_INST_BR = 11, // BR: [bb#, bb#, cond] or [bb#] 00285 FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, op0, op1, ...] 00286 FUNC_CODE_INST_INVOKE = 13, // INVOKE: [attr, fnty, op0,op1, ...] 00287 // 14 is unused. 00288 FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE 00289 00290 FUNC_CODE_INST_PHI = 16, // PHI: [ty, val0,bb0, ...] 00291 // 17 is unused. 00292 // 18 is unused. 00293 FUNC_CODE_INST_ALLOCA = 19, // ALLOCA: [instty, opty, op, align] 00294 FUNC_CODE_INST_LOAD = 20, // LOAD: [opty, op, align, vol] 00295 // 21 is unused. 00296 // 22 is unused. 00297 FUNC_CODE_INST_VAARG = 23, // VAARG: [valistty, valist, instty] 00298 // This store code encodes the pointer type, rather than the value type 00299 // this is so information only available in the pointer type (e.g. address 00300 // spaces) is retained. 00301 FUNC_CODE_INST_STORE = 24, // STORE: [ptrty,ptr,val, align, vol] 00302 // 25 is unused. 00303 FUNC_CODE_INST_EXTRACTVAL = 26, // EXTRACTVAL: [n x operands] 00304 FUNC_CODE_INST_INSERTVAL = 27, // INSERTVAL: [n x operands] 00305 // fcmp/icmp returning Int1TY or vector of Int1Ty. Same as CMP, exists to 00306 // support legacy vicmp/vfcmp instructions. 00307 FUNC_CODE_INST_CMP2 = 28, // CMP2: [opty, opval, opval, pred] 00308 // new select on i1 or [N x i1] 00309 FUNC_CODE_INST_VSELECT = 29, // VSELECT: [ty,opval,opval,predty,pred] 00310 FUNC_CODE_INST_INBOUNDS_GEP= 30, // INBOUNDS_GEP: [n x operands] 00311 FUNC_CODE_INST_INDIRECTBR = 31, // INDIRECTBR: [opty, op0, op1, ...] 00312 // 32 is unused. 00313 FUNC_CODE_DEBUG_LOC_AGAIN = 33, // DEBUG_LOC_AGAIN 00314 00315 FUNC_CODE_INST_CALL = 34, // CALL: [attr, cc, fnty, fnid, args...] 00316 00317 FUNC_CODE_DEBUG_LOC = 35, // DEBUG_LOC: [Line,Col,ScopeVal, IAVal] 00318 FUNC_CODE_INST_FENCE = 36, // FENCE: [ordering, synchscope] 00319 FUNC_CODE_INST_CMPXCHG = 37, // CMPXCHG: [ptrty,ptr,cmp,new, align, vol, 00320 // ordering, synchscope] 00321 FUNC_CODE_INST_ATOMICRMW = 38, // ATOMICRMW: [ptrty,ptr,val, operation, 00322 // align, vol, 00323 // ordering, synchscope] 00324 FUNC_CODE_INST_RESUME = 39, // RESUME: [opval] 00325 FUNC_CODE_INST_LANDINGPAD = 40, // LANDINGPAD: [ty,val,val,num,id0,val0...] 00326 FUNC_CODE_INST_LOADATOMIC = 41, // LOAD: [opty, op, align, vol, 00327 // ordering, synchscope] 00328 FUNC_CODE_INST_STOREATOMIC = 42 // STORE: [ptrty,ptr,val, align, vol 00329 // ordering, synchscope] 00330 }; 00331 00332 enum UseListCodes { 00333 USELIST_CODE_DEFAULT = 1, // DEFAULT: [index..., value-id] 00334 USELIST_CODE_BB = 2 // BB: [index..., bb-id] 00335 }; 00336 00337 enum AttributeKindCodes { 00338 // = 0 is unused 00339 ATTR_KIND_ALIGNMENT = 1, 00340 ATTR_KIND_ALWAYS_INLINE = 2, 00341 ATTR_KIND_BY_VAL = 3, 00342 ATTR_KIND_INLINE_HINT = 4, 00343 ATTR_KIND_IN_REG = 5, 00344 ATTR_KIND_MIN_SIZE = 6, 00345 ATTR_KIND_NAKED = 7, 00346 ATTR_KIND_NEST = 8, 00347 ATTR_KIND_NO_ALIAS = 9, 00348 ATTR_KIND_NO_BUILTIN = 10, 00349 ATTR_KIND_NO_CAPTURE = 11, 00350 ATTR_KIND_NO_DUPLICATE = 12, 00351 ATTR_KIND_NO_IMPLICIT_FLOAT = 13, 00352 ATTR_KIND_NO_INLINE = 14, 00353 ATTR_KIND_NON_LAZY_BIND = 15, 00354 ATTR_KIND_NO_RED_ZONE = 16, 00355 ATTR_KIND_NO_RETURN = 17, 00356 ATTR_KIND_NO_UNWIND = 18, 00357 ATTR_KIND_OPTIMIZE_FOR_SIZE = 19, 00358 ATTR_KIND_READ_NONE = 20, 00359 ATTR_KIND_READ_ONLY = 21, 00360 ATTR_KIND_RETURNED = 22, 00361 ATTR_KIND_RETURNS_TWICE = 23, 00362 ATTR_KIND_S_EXT = 24, 00363 ATTR_KIND_STACK_ALIGNMENT = 25, 00364 ATTR_KIND_STACK_PROTECT = 26, 00365 ATTR_KIND_STACK_PROTECT_REQ = 27, 00366 ATTR_KIND_STACK_PROTECT_STRONG = 28, 00367 ATTR_KIND_STRUCT_RET = 29, 00368 ATTR_KIND_SANITIZE_ADDRESS = 30, 00369 ATTR_KIND_SANITIZE_THREAD = 31, 00370 ATTR_KIND_SANITIZE_MEMORY = 32, 00371 ATTR_KIND_UW_TABLE = 33, 00372 ATTR_KIND_Z_EXT = 34, 00373 ATTR_KIND_BUILTIN = 35, 00374 ATTR_KIND_COLD = 36, 00375 ATTR_KIND_OPTIMIZE_NONE = 37, 00376 ATTR_KIND_IN_ALLOCA = 38, 00377 ATTR_KIND_NON_NULL = 39, 00378 ATTR_KIND_JUMP_TABLE = 40, 00379 ATTR_KIND_DEREFERENCEABLE = 41 00380 }; 00381 00382 enum ComdatSelectionKindCodes { 00383 COMDAT_SELECTION_KIND_ANY = 1, 00384 COMDAT_SELECTION_KIND_EXACT_MATCH = 2, 00385 COMDAT_SELECTION_KIND_LARGEST = 3, 00386 COMDAT_SELECTION_KIND_NO_DUPLICATES = 4, 00387 COMDAT_SELECTION_KIND_SAME_SIZE = 5, 00388 }; 00389 00390 } // End bitc namespace 00391 } // End llvm namespace 00392 00393 #endif