blob: bdabc2e77e31281fd8b2a2378af39a5fdbec36be [file] [log] [blame]
Chris Lattnerb9707d52007-04-22 07:03:00 +00001//===- LLVMBitCodes.h - Enum values for the LLVM bitcode format -*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// the University of Illinois Open Source 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
23namespace llvm {
24namespace bitc {
25 // The only top-level block type defined is for a module.
26 enum BlockIDs {
27 // Blocks
28 MODULE_BLOCK_ID = 0,
29
30 // Module sub-block id's
31 TYPE_BLOCK_ID = 1,
32 MODULEINFO_BLOCK_ID = 2,
33 GLOBALCONSTANTS_BLOCK_ID = 3,
34 FUNCTION_BLOCK_ID = 4,
35 TYPE_SYMTAB_BLOCK_ID = 5,
36 GLOBAL_SYMTAB_BLOCK_ID = 6
37 };
38
39
40 /// MODULE blocks have a number of optional fields and subblocks.
41 enum ModuleCodes {
42 MODULE_CODE_VERSION = 1, // VERSION: [version#]
43 MODULE_CODE_TRIPLE = 2, // TRIPLE: [strlen, strchr x N]
44 MODULE_CODE_DATALAYOUT = 3, // DATALAYOUT: [strlen, strchr x N]
45 MODULE_CODE_ASM = 4, // ASM: [strlen, strchr x N]
46 MODULE_CODE_SECTIONNAME = 5, // SECTIONNAME: [strlen, strchr x N]
47 MODULE_CODE_DEPLIB = 6, // DEPLIB: [strlen, strchr x N]
48
49 // GLOBALVAR: [type, isconst, initid,
50 // linkage, alignment, section, visibility, threadlocal]
51 MODULE_CODE_GLOBALVAR = 7,
52
53 // FUNCTION: [type, callingconv, isproto, linkage, alignment, section,
54 // visibility]
55 MODULE_CODE_FUNCTION = 8
56 };
57
58 /// TYPE blocks have codes for each type primitive they use.
59 enum TypeCodes {
60 TYPE_CODE_NUMENTRY = 1, // TYPE_CODE_NUMENTRY: [numentries]
61 TYPE_CODE_META = 2, // TYPE_CODE_META: [metacode]... - Future use
62
63 // Type Codes
64 TYPE_CODE_VOID = 3, // VOID
65 TYPE_CODE_FLOAT = 4, // FLOAT
66 TYPE_CODE_DOUBLE = 5, // DOUBLE
67 TYPE_CODE_LABEL = 6, // LABEL
68 TYPE_CODE_OPAQUE = 7, // OPAQUE
69 TYPE_CODE_INTEGER = 8, // INTEGER: [width]
70 TYPE_CODE_POINTER = 9, // POINTER: [pointee type]
71 TYPE_CODE_FUNCTION = 10, // FUNCTION: [vararg, retty, #pararms, paramty N]
72 TYPE_CODE_STRUCT = 11, // STRUCT: [ispacked, #elts, eltty x N]
73 TYPE_CODE_ARRAY = 12, // ARRAY: [numelts, eltty]
74 TYPE_CODE_VECTOR = 13 // VECTOR: [numelts, eltty]
75 // Any other type code is assumed to be an unknown type.
76 };
77
78
79 // The type symbol table only has one code (TST_ENTRY_CODE).
80 enum TypeSymtabCodes {
81 TST_ENTRY_CODE = 1 // TST_ENTRY: [typeid, namelen, namechar x N]
82 };
83
84} // End bitc namespace
85} // End llvm namespace
86
87#endif