LLVM  4.0.0
LLVMBitCodes.h
Go to the documentation of this file.
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
29 
30  // Module sub-block id's.
33 
36 
37  // Block intended to contains information on the bitcode versioning.
38  // Can be used to provide better error messages when we fail to parse a
39  // bitcode file.
41 
45 
47 
49 
52 
54 
56 };
57 
58 /// Identification block contains a string that describes the producer details,
59 /// and an epoch that defines the auto-upgrade capability.
61  IDENTIFICATION_CODE_STRING = 1, // IDENTIFICATION: [strchr x N]
62  IDENTIFICATION_CODE_EPOCH = 2, // EPOCH: [epoch#]
63 };
64 
65 /// The epoch that defines the auto-upgrade compatibility for the bitcode.
66 ///
67 /// LLVM guarantees in a major release that a minor release can read bitcode
68 /// generated by previous minor releases. We translate this by making the reader
69 /// accepting only bitcode with the same epoch, except for the X.0 release which
70 /// also accepts N-1.
71 enum { BITCODE_CURRENT_EPOCH = 0 };
72 
73 /// MODULE blocks have a number of optional fields and subblocks.
75  MODULE_CODE_VERSION = 1, // VERSION: [version#]
76  MODULE_CODE_TRIPLE = 2, // TRIPLE: [strchr x N]
77  MODULE_CODE_DATALAYOUT = 3, // DATALAYOUT: [strchr x N]
78  MODULE_CODE_ASM = 4, // ASM: [strchr x N]
79  MODULE_CODE_SECTIONNAME = 5, // SECTIONNAME: [strchr x N]
80 
81  // FIXME: Remove DEPLIB in 4.0.
82  MODULE_CODE_DEPLIB = 6, // DEPLIB: [strchr x N]
83 
84  // GLOBALVAR: [pointer type, isconst, initid,
85  // linkage, alignment, section, visibility, threadlocal]
87 
88  // FUNCTION: [type, callingconv, isproto, linkage, paramattrs, alignment,
89  // section, visibility, gc, unnamed_addr]
91 
92  // ALIAS: [alias type, aliasee val#, linkage, visibility]
94 
95  // MODULE_CODE_PURGEVALS: [numvals]
97 
98  MODULE_CODE_GCNAME = 11, // GCNAME: [strchr x N]
99  MODULE_CODE_COMDAT = 12, // COMDAT: [selection_kind, name]
100 
101  MODULE_CODE_VSTOFFSET = 13, // VSTOFFSET: [offset]
102 
103  // ALIAS: [alias value type, addrspace, aliasee val#, linkage, visibility]
105 
107 
108  // SOURCE_FILENAME: [namechar x N]
110 
111  // HASH: [5*i32]
113 
114  // IFUNC: [ifunc value type, addrspace, resolver val#, linkage, visibility]
116 };
117 
118 /// PARAMATTR blocks have code for defining a parameter attribute set.
120  // FIXME: Remove `PARAMATTR_CODE_ENTRY_OLD' in 4.0
121  PARAMATTR_CODE_ENTRY_OLD = 1, // ENTRY: [paramidx0, attr0,
122  // paramidx1, attr1...]
123  PARAMATTR_CODE_ENTRY = 2, // ENTRY: [attrgrp0, attrgrp1, ...]
124  PARAMATTR_GRP_CODE_ENTRY = 3 // ENTRY: [grpid, idx, attr0, attr1, ...]
125 };
126 
127 /// TYPE blocks have codes for each type primitive they use.
128 enum TypeCodes {
129  TYPE_CODE_NUMENTRY = 1, // NUMENTRY: [numentries]
130 
131  // Type Codes
132  TYPE_CODE_VOID = 2, // VOID
133  TYPE_CODE_FLOAT = 3, // FLOAT
134  TYPE_CODE_DOUBLE = 4, // DOUBLE
135  TYPE_CODE_LABEL = 5, // LABEL
136  TYPE_CODE_OPAQUE = 6, // OPAQUE
137  TYPE_CODE_INTEGER = 7, // INTEGER: [width]
138  TYPE_CODE_POINTER = 8, // POINTER: [pointee type]
139 
140  TYPE_CODE_FUNCTION_OLD = 9, // FUNCTION: [vararg, attrid, retty,
141  // paramty x N]
142 
143  TYPE_CODE_HALF = 10, // HALF
144 
145  TYPE_CODE_ARRAY = 11, // ARRAY: [numelts, eltty]
146  TYPE_CODE_VECTOR = 12, // VECTOR: [numelts, eltty]
147 
148  // These are not with the other floating point types because they're
149  // a late addition, and putting them in the right place breaks
150  // binary compatibility.
151  TYPE_CODE_X86_FP80 = 13, // X86 LONG DOUBLE
152  TYPE_CODE_FP128 = 14, // LONG DOUBLE (112 bit mantissa)
153  TYPE_CODE_PPC_FP128 = 15, // PPC LONG DOUBLE (2 doubles)
154 
155  TYPE_CODE_METADATA = 16, // METADATA
156 
157  TYPE_CODE_X86_MMX = 17, // X86 MMX
158 
159  TYPE_CODE_STRUCT_ANON = 18, // STRUCT_ANON: [ispacked, eltty x N]
160  TYPE_CODE_STRUCT_NAME = 19, // STRUCT_NAME: [strchr x N]
161  TYPE_CODE_STRUCT_NAMED = 20, // STRUCT_NAMED: [ispacked, eltty x N]
162 
163  TYPE_CODE_FUNCTION = 21, // FUNCTION: [vararg, retty, paramty x N]
164 
165  TYPE_CODE_TOKEN = 22 // TOKEN
166 };
167 
169  OPERAND_BUNDLE_TAG = 1, // TAG: [strchr x N]
170 };
171 
172 // Value symbol table codes.
174  VST_CODE_ENTRY = 1, // VST_ENTRY: [valueid, namechar x N]
175  VST_CODE_BBENTRY = 2, // VST_BBENTRY: [bbid, namechar x N]
176  VST_CODE_FNENTRY = 3, // VST_FNENTRY: [valueid, offset, namechar x N]
177  // VST_COMBINED_ENTRY: [valueid, refguid]
179 };
180 
181 // The module path symbol table only has one code (MST_CODE_ENTRY).
183  MST_CODE_ENTRY = 1, // MST_ENTRY: [modid, namechar x N]
184  MST_CODE_HASH = 2, // MST_HASH: [5*i32]
185 };
186 
187 // The summary section uses different codes in the per-module
188 // and combined index cases.
190  // PERMODULE: [valueid, flags, instcount, numrefs, numrefs x valueid,
191  // n x (valueid)]
193  // PERMODULE_PROFILE: [valueid, flags, instcount, numrefs,
194  // numrefs x valueid,
195  // n x (valueid, hotness)]
197  // PERMODULE_GLOBALVAR_INIT_REFS: [valueid, flags, n x valueid]
199  // COMBINED: [valueid, modid, flags, instcount, numrefs, numrefs x valueid,
200  // n x (valueid)]
202  // COMBINED_PROFILE: [valueid, modid, flags, instcount, numrefs,
203  // numrefs x valueid,
204  // n x (valueid, hotness)]
206  // COMBINED_GLOBALVAR_INIT_REFS: [valueid, modid, flags, n x valueid]
208  // ALIAS: [valueid, flags, valueid]
209  FS_ALIAS = 7,
210  // COMBINED_ALIAS: [valueid, modid, flags, valueid]
212  // COMBINED_ORIGINAL_NAME: [original_name_hash]
214  // VERSION of the summary, bumped when adding flags for instance.
216  // The list of llvm.type.test type identifiers used by the following function.
218 };
219 
221  METADATA_STRING_OLD = 1, // MDSTRING: [values]
222  METADATA_VALUE = 2, // VALUE: [type num, value num]
223  METADATA_NODE = 3, // NODE: [n x md num]
224  METADATA_NAME = 4, // STRING: [values]
225  METADATA_DISTINCT_NODE = 5, // DISTINCT_NODE: [n x md num]
226  METADATA_KIND = 6, // [n x [id, name]]
227  METADATA_LOCATION = 7, // [distinct, line, col, scope, inlined-at?]
228  METADATA_OLD_NODE = 8, // OLD_NODE: [n x (type num, value num)]
229  METADATA_OLD_FN_NODE = 9, // OLD_FN_NODE: [n x (type num, value num)]
230  METADATA_NAMED_NODE = 10, // NAMED_NODE: [n x mdnodes]
231  METADATA_ATTACHMENT = 11, // [m x [value, [n x [id, mdnode]]]
232  METADATA_GENERIC_DEBUG = 12, // [distinct, tag, vers, header, n x md num]
233  METADATA_SUBRANGE = 13, // [distinct, count, lo]
234  METADATA_ENUMERATOR = 14, // [distinct, value, name]
235  METADATA_BASIC_TYPE = 15, // [distinct, tag, name, size, align, enc]
236  METADATA_FILE = 16, // [distinct, filename, directory, checksumkind, checksum]
237  METADATA_DERIVED_TYPE = 17, // [distinct, ...]
238  METADATA_COMPOSITE_TYPE = 18, // [distinct, ...]
239  METADATA_SUBROUTINE_TYPE = 19, // [distinct, flags, types, cc]
240  METADATA_COMPILE_UNIT = 20, // [distinct, ...]
241  METADATA_SUBPROGRAM = 21, // [distinct, ...]
242  METADATA_LEXICAL_BLOCK = 22, // [distinct, scope, file, line, column]
243  METADATA_LEXICAL_BLOCK_FILE = 23, //[distinct, scope, file, discriminator]
244  METADATA_NAMESPACE = 24, // [distinct, scope, file, name, line, exportSymbols]
245  METADATA_TEMPLATE_TYPE = 25, // [distinct, scope, name, type, ...]
246  METADATA_TEMPLATE_VALUE = 26, // [distinct, scope, name, type, value, ...]
247  METADATA_GLOBAL_VAR = 27, // [distinct, ...]
248  METADATA_LOCAL_VAR = 28, // [distinct, ...]
249  METADATA_EXPRESSION = 29, // [distinct, n x element]
250  METADATA_OBJC_PROPERTY = 30, // [distinct, name, file, line, ...]
251  METADATA_IMPORTED_ENTITY = 31, // [distinct, tag, scope, entity, line, name]
252  METADATA_MODULE = 32, // [distinct, scope, name, ...]
253  METADATA_MACRO = 33, // [distinct, macinfo, line, name, value]
254  METADATA_MACRO_FILE = 34, // [distinct, macinfo, line, file, ...]
255  METADATA_STRINGS = 35, // [count, offset] blob([lengths][chars])
256  METADATA_GLOBAL_DECL_ATTACHMENT = 36, // [valueid, n x [id, mdnode]]
257  METADATA_GLOBAL_VAR_EXPR = 37, // [distinct, var, expr]
258  METADATA_INDEX_OFFSET = 38, // [offset]
259  METADATA_INDEX = 39, // [bitpos]
260 };
261 
262 // The constants block (CONSTANTS_BLOCK_ID) describes emission for each
263 // constant and maintains an implicit current type value.
265  CST_CODE_SETTYPE = 1, // SETTYPE: [typeid]
266  CST_CODE_NULL = 2, // NULL
267  CST_CODE_UNDEF = 3, // UNDEF
268  CST_CODE_INTEGER = 4, // INTEGER: [intval]
269  CST_CODE_WIDE_INTEGER = 5, // WIDE_INTEGER: [n x intval]
270  CST_CODE_FLOAT = 6, // FLOAT: [fpval]
271  CST_CODE_AGGREGATE = 7, // AGGREGATE: [n x value number]
272  CST_CODE_STRING = 8, // STRING: [values]
273  CST_CODE_CSTRING = 9, // CSTRING: [values]
274  CST_CODE_CE_BINOP = 10, // CE_BINOP: [opcode, opval, opval]
275  CST_CODE_CE_CAST = 11, // CE_CAST: [opcode, opty, opval]
276  CST_CODE_CE_GEP = 12, // CE_GEP: [n x operands]
277  CST_CODE_CE_SELECT = 13, // CE_SELECT: [opval, opval, opval]
278  CST_CODE_CE_EXTRACTELT = 14, // CE_EXTRACTELT: [opty, opval, opval]
279  CST_CODE_CE_INSERTELT = 15, // CE_INSERTELT: [opval, opval, opval]
280  CST_CODE_CE_SHUFFLEVEC = 16, // CE_SHUFFLEVEC: [opval, opval, opval]
281  CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred]
282  CST_CODE_INLINEASM_OLD = 18, // INLINEASM: [sideeffect|alignstack,
283  // asmstr,conststr]
284  CST_CODE_CE_SHUFVEC_EX = 19, // SHUFVEC_EX: [opty, opval, opval, opval]
285  CST_CODE_CE_INBOUNDS_GEP = 20, // INBOUNDS_GEP: [n x operands]
286  CST_CODE_BLOCKADDRESS = 21, // CST_CODE_BLOCKADDRESS [fnty, fnval, bb#]
287  CST_CODE_DATA = 22, // DATA: [n x elements]
288  CST_CODE_INLINEASM = 23, // INLINEASM: [sideeffect|alignstack|
289  // asmdialect,asmstr,conststr]
290  CST_CODE_CE_GEP_WITH_INRANGE_INDEX = 24, // [opty, flags, n x operands]
291 };
292 
293 /// CastOpcodes - These are values used in the bitcode files to encode which
294 /// cast a CST_CODE_CE_CAST or a XXX refers to. The values of these enums
295 /// have no fixed relation to the LLVM IR enum values. Changing these will
296 /// break compatibility with old files.
311 };
312 
313 /// BinaryOpcodes - These are values used in the bitcode files to encode which
314 /// binop a CST_CODE_CE_BINOP or a XXX refers to. The values of these enums
315 /// have no fixed relation to the LLVM IR enum values. Changing these will
316 /// break compatibility with old files.
322  BINOP_SDIV = 4, // overloaded for FP
324  BINOP_SREM = 6, // overloaded for FP
328  BINOP_AND = 10,
329  BINOP_OR = 11,
331 };
332 
333 /// These are values used in the bitcode files to encode AtomicRMW operations.
334 /// The values of these enums have no fixed relation to the LLVM IR enum
335 /// values. Changing these will break compatibility with old files.
337  RMW_XCHG = 0,
338  RMW_ADD = 1,
339  RMW_SUB = 2,
340  RMW_AND = 3,
341  RMW_NAND = 4,
342  RMW_OR = 5,
343  RMW_XOR = 6,
344  RMW_MAX = 7,
345  RMW_MIN = 8,
346  RMW_UMAX = 9,
347  RMW_UMIN = 10
348 };
349 
350 /// OverflowingBinaryOperatorOptionalFlags - Flags for serializing
351 /// OverflowingBinaryOperator's SubclassOptionalData contents.
355 };
356 
357 /// PossiblyExactOperatorOptionalFlags - Flags for serializing
358 /// PossiblyExactOperator's SubclassOptionalData contents.
360 
361 /// Encoded AtomicOrdering values.
370 };
371 
372 /// Encoded SynchronizationScope values.
376 };
377 
378 /// Markers and flags for call instruction.
385  CALL_FMF = 17 // Call has optional fast-math-flags.
386 };
387 
388 // The function body block (FUNCTION_BLOCK_ID) describes function bodies. It
389 // can contain a constant block (CONSTANTS_BLOCK_ID).
391  FUNC_CODE_DECLAREBLOCKS = 1, // DECLAREBLOCKS: [n]
392 
393  FUNC_CODE_INST_BINOP = 2, // BINOP: [opcode, ty, opval, opval]
394  FUNC_CODE_INST_CAST = 3, // CAST: [opcode, ty, opty, opval]
395  FUNC_CODE_INST_GEP_OLD = 4, // GEP: [n x operands]
396  FUNC_CODE_INST_SELECT = 5, // SELECT: [ty, opval, opval, opval]
397  FUNC_CODE_INST_EXTRACTELT = 6, // EXTRACTELT: [opty, opval, opval]
398  FUNC_CODE_INST_INSERTELT = 7, // INSERTELT: [ty, opval, opval, opval]
399  FUNC_CODE_INST_SHUFFLEVEC = 8, // SHUFFLEVEC: [ty, opval, opval, opval]
400  FUNC_CODE_INST_CMP = 9, // CMP: [opty, opval, opval, pred]
401 
402  FUNC_CODE_INST_RET = 10, // RET: [opty,opval<both optional>]
403  FUNC_CODE_INST_BR = 11, // BR: [bb#, bb#, cond] or [bb#]
404  FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, op0, op1, ...]
405  FUNC_CODE_INST_INVOKE = 13, // INVOKE: [attr, fnty, op0,op1, ...]
406  // 14 is unused.
407  FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE
408 
409  FUNC_CODE_INST_PHI = 16, // PHI: [ty, val0,bb0, ...]
410  // 17 is unused.
411  // 18 is unused.
412  FUNC_CODE_INST_ALLOCA = 19, // ALLOCA: [instty, opty, op, align]
413  FUNC_CODE_INST_LOAD = 20, // LOAD: [opty, op, align, vol]
414  // 21 is unused.
415  // 22 is unused.
416  FUNC_CODE_INST_VAARG = 23, // VAARG: [valistty, valist, instty]
417  // This store code encodes the pointer type, rather than the value type
418  // this is so information only available in the pointer type (e.g. address
419  // spaces) is retained.
420  FUNC_CODE_INST_STORE_OLD = 24, // STORE: [ptrty,ptr,val, align, vol]
421  // 25 is unused.
422  FUNC_CODE_INST_EXTRACTVAL = 26, // EXTRACTVAL: [n x operands]
423  FUNC_CODE_INST_INSERTVAL = 27, // INSERTVAL: [n x operands]
424  // fcmp/icmp returning Int1TY or vector of Int1Ty. Same as CMP, exists to
425  // support legacy vicmp/vfcmp instructions.
426  FUNC_CODE_INST_CMP2 = 28, // CMP2: [opty, opval, opval, pred]
427  // new select on i1 or [N x i1]
428  FUNC_CODE_INST_VSELECT = 29, // VSELECT: [ty,opval,opval,predty,pred]
429  FUNC_CODE_INST_INBOUNDS_GEP_OLD = 30, // INBOUNDS_GEP: [n x operands]
430  FUNC_CODE_INST_INDIRECTBR = 31, // INDIRECTBR: [opty, op0, op1, ...]
431  // 32 is unused.
432  FUNC_CODE_DEBUG_LOC_AGAIN = 33, // DEBUG_LOC_AGAIN
433 
434  FUNC_CODE_INST_CALL = 34, // CALL: [attr, cc, fnty, fnid, args...]
435 
436  FUNC_CODE_DEBUG_LOC = 35, // DEBUG_LOC: [Line,Col,ScopeVal, IAVal]
437  FUNC_CODE_INST_FENCE = 36, // FENCE: [ordering, synchscope]
438  FUNC_CODE_INST_CMPXCHG_OLD = 37, // CMPXCHG: [ptrty,ptr,cmp,new, align, vol,
439  // ordering, synchscope]
440  FUNC_CODE_INST_ATOMICRMW = 38, // ATOMICRMW: [ptrty,ptr,val, operation,
441  // align, vol,
442  // ordering, synchscope]
443  FUNC_CODE_INST_RESUME = 39, // RESUME: [opval]
445  40, // LANDINGPAD: [ty,val,val,num,id0,val0...]
446  FUNC_CODE_INST_LOADATOMIC = 41, // LOAD: [opty, op, align, vol,
447  // ordering, synchscope]
448  FUNC_CODE_INST_STOREATOMIC_OLD = 42, // STORE: [ptrty,ptr,val, align, vol
449  // ordering, synchscope]
450  FUNC_CODE_INST_GEP = 43, // GEP: [inbounds, n x operands]
451  FUNC_CODE_INST_STORE = 44, // STORE: [ptrty,ptr,valty,val, align, vol]
452  FUNC_CODE_INST_STOREATOMIC = 45, // STORE: [ptrty,ptr,val, align, vol
453  FUNC_CODE_INST_CMPXCHG = 46, // CMPXCHG: [ptrty,ptr,valty,cmp,new, align,
454  // vol,ordering,synchscope]
455  FUNC_CODE_INST_LANDINGPAD = 47, // LANDINGPAD: [ty,val,num,id0,val0...]
456  FUNC_CODE_INST_CLEANUPRET = 48, // CLEANUPRET: [val] or [val,bb#]
457  FUNC_CODE_INST_CATCHRET = 49, // CATCHRET: [val,bb#]
458  FUNC_CODE_INST_CATCHPAD = 50, // CATCHPAD: [bb#,bb#,num,args...]
459  FUNC_CODE_INST_CLEANUPPAD = 51, // CLEANUPPAD: [num,args...]
461  52, // CATCHSWITCH: [num,args...] or [num,args...,bb]
462  // 53 is unused.
463  // 54 is unused.
464  FUNC_CODE_OPERAND_BUNDLE = 55, // OPERAND_BUNDLE: [tag#, value...]
465 };
466 
468  USELIST_CODE_DEFAULT = 1, // DEFAULT: [index..., value-id]
469  USELIST_CODE_BB = 2 // BB: [index..., bb-id]
470 };
471 
473  // = 0 is unused
526 };
527 
534 };
535 
536 } // End bitc namespace
537 } // End llvm namespace
538 
539 #endif
PossiblyExactOperatorOptionalFlags
PossiblyExactOperatorOptionalFlags - Flags for serializing PossiblyExactOperator's SubclassOptionalDa...
Definition: LLVMBitCodes.h:359
CastOpcodes
CastOpcodes - These are values used in the bitcode files to encode which cast a CST_CODE_CE_CAST or a...
Definition: LLVMBitCodes.h:297
AtomicSynchScopeCodes
Encoded SynchronizationScope values.
Definition: LLVMBitCodes.h:373
GlobalValueSummarySymtabCodes
Definition: LLVMBitCodes.h:189
CallMarkersFlags
Markers and flags for call instruction.
Definition: LLVMBitCodes.h:379
BinaryOpcodes
BinaryOpcodes - These are values used in the bitcode files to encode which binop a CST_CODE_CE_BINOP ...
Definition: LLVMBitCodes.h:317
AttributeCodes
PARAMATTR blocks have code for defining a parameter attribute set.
Definition: LLVMBitCodes.h:119
ComdatSelectionKindCodes
Definition: LLVMBitCodes.h:528
OverflowingBinaryOperatorOptionalFlags
OverflowingBinaryOperatorOptionalFlags - Flags for serializing OverflowingBinaryOperator's SubclassOp...
Definition: LLVMBitCodes.h:352
IdentificationCodes
Identification block contains a string that describes the producer details, and an epoch that defines...
Definition: LLVMBitCodes.h:60
ModuleCodes
MODULE blocks have a number of optional fields and subblocks.
Definition: LLVMBitCodes.h:74
AtomicOrderingCodes
Encoded AtomicOrdering values.
Definition: LLVMBitCodes.h:362
TypeCodes
TYPE blocks have codes for each type primitive they use.
Definition: LLVMBitCodes.h:128
RMWOperations
These are values used in the bitcode files to encode AtomicRMW operations.
Definition: LLVMBitCodes.h:336