Switch the bitcode reader interface to take a MemoryBuffer instead of knowing
[oota-llvm.git] / include / llvm / Bitcode / LLVMBitCodes.h
index 27fbd2ce96888f9e345c7669d86409979a2debf1..9f790f45b6aa85edb6f3baa3c5bf2541657a83ba 100644 (file)
@@ -29,11 +29,10 @@ namespace bitc {
   
     // Module sub-block id's
     TYPE_BLOCK_ID            = 1,
-    MODULEINFO_BLOCK_ID      = 2,
-    CONSTANTS_BLOCK_ID       = 3,
-    FUNCTION_BLOCK_ID        = 4,
-    TYPE_SYMTAB_BLOCK_ID     = 5,
-    VALUE_SYMTAB_BLOCK_ID    = 6
+    CONSTANTS_BLOCK_ID       = 2,
+    FUNCTION_BLOCK_ID        = 3,
+    TYPE_SYMTAB_BLOCK_ID     = 4,
+    VALUE_SYMTAB_BLOCK_ID    = 5
   };
   
   
@@ -52,7 +51,13 @@ namespace bitc {
 
     // FUNCTION:  [type, callingconv, isproto, linkage, alignment, section,
     //             visibility]
-    MODULE_CODE_FUNCTION    = 8
+    MODULE_CODE_FUNCTION    = 8,
+    
+    // ALIAS: [alias type, aliasee val#, linkage]
+    MODULE_CODE_ALIAS       = 9,
+    
+    /// MODULE_CODE_PURGEVALS: [numvals]
+    MODULE_CODE_PURGEVALS   = 10
   };
   
   /// TYPE blocks have codes for each type primitive they use.
@@ -75,7 +80,6 @@ namespace bitc {
     // Any other type code is assumed to be an unknown type.
   };
   
-  
   // The type symbol table only has one code (TST_ENTRY_CODE).
   enum TypeSymtabCodes {
     TST_CODE_ENTRY = 1     // TST_ENTRY: [typeid, namelen, namechar x N]
@@ -106,6 +110,10 @@ namespace bitc {
     CST_CODE_CE_CMP        = 15   // CE_CMP:        [opty, opval, opval, pred]
   };
   
+  /// CastOpcodes - These are values used in the bitcode files to encode which
+  /// cast a CST_CODE_CE_CAST or a XXX refers to.  The values of these enums
+  /// have no fixed relation to the LLVM IR enum values.  Changing these will
+  /// break compatibility with old files.
   enum CastOpcodes {
     CAST_TRUNC    =  0,
     CAST_ZEXT     =  1,
@@ -121,6 +129,10 @@ namespace bitc {
     CAST_BITCAST  = 11
   };
   
+  /// BinaryOpcodes - These are values used in the bitcode files to encode which
+  /// binop a CST_CODE_CE_BINOP or a XXX refers to.  The values of these enums
+  /// have no fixed relation to the LLVM IR enum values.  Changing these will
+  /// break compatibility with old files.
   enum BinaryOpcodes {
     BINOP_ADD  =  0,
     BINOP_SUB  =  1,
@@ -137,6 +149,36 @@ namespace bitc {
     BINOP_XOR  = 12
   };
   
+  
+  // The function body block (FUNCTION_BLOCK_ID) describes function bodies.  It
+  // can contain a constant block (CONSTANTS_BLOCK_ID).
+  enum FunctionCodes {
+    FUNC_CODE_DECLAREBLOCKS    =  1, // DECLAREBLOCKS: [n]
+    
+    FUNC_CODE_INST_BINOP       =  2, // BINOP:      [opcode, ty, opval, opval]
+    FUNC_CODE_INST_CAST        =  3, // CAST:       [opcode, ty, opty, opval]
+    FUNC_CODE_INST_GEP         =  4, // GEP:        [n, n x operands]
+    FUNC_CODE_INST_SELECT      =  5, // SELECT:     [ty, opval, opval, opval]
+    FUNC_CODE_INST_EXTRACTELT  =  6, // EXTRACTELT: [opty, opval, opval]
+    FUNC_CODE_INST_INSERTELT   =  7, // INSERTELT:  [ty, opval, opval, opval]
+    FUNC_CODE_INST_SHUFFLEVEC  =  8, // SHUFFLEVEC: [ty, opval, opval, opval]
+    FUNC_CODE_INST_CMP         =  9, // CMP:        [opty, opval, opval, pred]
+    
+    FUNC_CODE_INST_RET         = 10, // RET:        [opval<optional>]
+    FUNC_CODE_INST_BR          = 11, // BR:         [opval, bb#, bb#] or [bb#]
+    FUNC_CODE_INST_SWITCH      = 12, // SWITCH:     [opty, opval, n, n x ops]
+    FUNC_CODE_INST_INVOKE      = 13, // INVOKE:
+    FUNC_CODE_INST_UNWIND      = 14, // UNWIND
+    FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE
+    
+    FUNC_CODE_INST_MALLOC      = 16, // MALLOC: ..
+    FUNC_CODE_INST_FREE        = 17, // FREE: ..
+    FUNC_CODE_INST_ALLOCA      = 18, // ALLOCA: ..
+    FUNC_CODE_INST_LOAD        = 19, // LOAD: ..
+    FUNC_CODE_INST_STORE       = 20, // STORE: ..
+    FUNC_CODE_INST_CALL        = 21, // CALL: ..
+    FUNC_CODE_INST_VAARG       = 22  // VAARG: ..
+  };
 } // End bitc namespace
 } // End llvm namespace