Clang format a few prior patches (NFC)
[oota-llvm.git] / include / llvm / Bitcode / LLVMBitCodes.h
index f387ba36b13b240375db23f400c7249f51156e45..a4ba05216adf68658d890ea5ff5a79d49f94db58 100644 (file)
 namespace llvm {
 namespace bitc {
   // The only top-level block type defined is for a module.
-  enum BlockIDs {
-    // Blocks
-    MODULE_BLOCK_ID          = FIRST_APPLICATION_BLOCKID,
+enum BlockIDs {
+  // Blocks
+  MODULE_BLOCK_ID = FIRST_APPLICATION_BLOCKID,
 
-    // Module sub-block id's.
-    PARAMATTR_BLOCK_ID,
-    PARAMATTR_GROUP_BLOCK_ID,
+  // Module sub-block id's.
+  PARAMATTR_BLOCK_ID,
+  PARAMATTR_GROUP_BLOCK_ID,
 
-    CONSTANTS_BLOCK_ID,
-    FUNCTION_BLOCK_ID,
+  CONSTANTS_BLOCK_ID,
+  FUNCTION_BLOCK_ID,
 
-    UNUSED_ID1,
+  // Block intended to contains information on the bitcode versioning.
+  // Can be used to provide better error messages when we fail to parse a
+  // bitcode file.
+  IDENTIFICATION_BLOCK_ID,
 
-    VALUE_SYMTAB_BLOCK_ID,
-    METADATA_BLOCK_ID,
-    METADATA_ATTACHMENT_ID,
+  VALUE_SYMTAB_BLOCK_ID,
+  METADATA_BLOCK_ID,
+  METADATA_ATTACHMENT_ID,
 
-    TYPE_BLOCK_ID_NEW,
+  TYPE_BLOCK_ID_NEW,
 
-    USELIST_BLOCK_ID,
+  USELIST_BLOCK_ID,
 
-    MODULE_STRTAB_BLOCK_ID,
-    FUNCTION_SUMMARY_BLOCK_ID
-  };
+  MODULE_STRTAB_BLOCK_ID,
+  FUNCTION_SUMMARY_BLOCK_ID,
+
+  OPERAND_BUNDLE_TAGS_BLOCK_ID
+};
+
+/// Idenfitication block contains a string that describes the producer details,
+/// and an epoch that defines the auto-upgrade capability.
+enum IdentificationCodes {
+  IDENTIFICATION_CODE_STRING = 1, // IDENTIFICATION:      [strchr x N]
+  IDENTIFICATION_CODE_EPOCH = 2,  // EPOCH:               [epoch#]
+};
 
+/// The epoch that defines the auto-upgrade compatibility for the bitcode.
+///
+/// LLVM guarantees in a major release that a minor release can read bitcode
+/// generated by previous minor releases. We translate this by making the reader
+/// accepting only bitcode with the same epoch, except for the X.0 release which
+/// also accepts N-1.
+enum { BITCODE_CURRENT_EPOCH = 0 };
 
   /// MODULE blocks have a number of optional fields and subblocks.
   enum ModuleCodes {
@@ -69,7 +88,7 @@ namespace bitc {
     MODULE_CODE_FUNCTION    = 8,
 
     // ALIAS: [alias type, aliasee val#, linkage, visibility]
-    MODULE_CODE_ALIAS       = 9,
+    MODULE_CODE_ALIAS_OLD   = 9,
 
     // MODULE_CODE_PURGEVALS: [numvals]
     MODULE_CODE_PURGEVALS   = 10,
@@ -78,6 +97,9 @@ namespace bitc {
     MODULE_CODE_COMDAT      = 12,  // COMDAT: [selection_kind, name]
 
     MODULE_CODE_VSTOFFSET   = 13,  // VSTOFFSET: [offset]
+
+    // ALIAS: [alias value type, addrspace, aliasee val#, linkage, visibility]
+    MODULE_CODE_ALIAS       = 14,
   };
 
   /// PARAMATTR blocks have code for defining a parameter attribute set.
@@ -131,6 +153,10 @@ namespace bitc {
     TYPE_CODE_TOKEN = 22        // TOKEN
   };
 
+  enum OperandBundleTagCode {
+    OPERAND_BUNDLE_TAG = 1,     // TAG: [strchr x N]
+  };
+
   // The type symbol table only has one code (TST_ENTRY_CODE).
   enum TypeSymtabCodes {
     TST_CODE_ENTRY = 1     // TST_ENTRY: [typeid, namechar x N]
@@ -141,6 +167,20 @@ namespace bitc {
     VST_CODE_ENTRY   = 1,   // VST_ENTRY: [valueid, namechar x N]
     VST_CODE_BBENTRY = 2,   // VST_BBENTRY: [bbid, namechar x N]
     VST_CODE_FNENTRY = 3,   // VST_FNENTRY: [valueid, offset, namechar x N]
+    // VST_COMBINED_FNENTRY: [offset, namechar x N]
+    VST_CODE_COMBINED_FNENTRY = 4
+  };
+
+  // The module path symbol table only has one code (MST_CODE_ENTRY).
+  enum ModulePathSymtabCodes {
+    MST_CODE_ENTRY   = 1,  // MST_ENTRY: [modid, namechar x N]
+  };
+
+  // The function summary section uses different codes in the per-module
+  // and combined index cases.
+  enum FunctionSummarySymtabCodes {
+    FS_CODE_PERMODULE_ENTRY = 1,  // FS_ENTRY: [valueid, islocal, instcount]
+    FS_CODE_COMBINED_ENTRY  = 2,  // FS_ENTRY: [modid, instcount]
   };
 
   enum MetadataCodes {
@@ -369,6 +409,8 @@ namespace bitc {
     FUNC_CODE_INST_CLEANUPPAD = 52, // CLEANUPPAD: [num,args...]
     FUNC_CODE_INST_CATCHENDPAD = 53, // CATCHENDPAD: [] or [bb#]
     FUNC_CODE_INST_CLEANUPENDPAD = 54, // CLEANUPENDPAD: [val] or [val,bb#]
+
+    FUNC_CODE_OPERAND_BUNDLE = 55, // OPERAND_BUNDLE: [tag#, value...]
   };
 
   enum UseListCodes {