2003-09-30 18:37:50 +00:00
|
|
|
//===-- llvm/Bytecode/Format.h - VM bytecode file format info ---*- C++ -*-===//
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-21 20:39:54 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2001-06-06 20:29:01 +00:00
|
|
|
//
|
2005-04-21 20:39:54 +00:00
|
|
|
// This header defines intrinsic constants that are useful to libraries that
|
2001-06-06 20:29:01 +00:00
|
|
|
// need to hack on bytecode files directly, like the reader and writer.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_BYTECODE_FORMAT_H
|
|
|
|
#define LLVM_BYTECODE_FORMAT_H
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
class BytecodeFormat { // Throw the constants into a poorman's namespace...
|
|
|
|
BytecodeFormat(); // do not implement
|
|
|
|
public:
|
|
|
|
|
|
|
|
// ID Numbers that are used in bytecode files...
|
|
|
|
enum FileBlockIDs {
|
|
|
|
// File level identifiers...
|
|
|
|
Module = 0x01,
|
|
|
|
|
|
|
|
// Module subtypes:
|
2002-03-29 03:51:11 +00:00
|
|
|
Function = 0x11,
|
2001-06-06 20:29:01 +00:00
|
|
|
ConstantPool,
|
|
|
|
SymbolTable,
|
|
|
|
ModuleGlobalInfo,
|
2003-03-19 20:48:27 +00:00
|
|
|
GlobalTypePlane,
|
2004-07-25 17:50:00 +00:00
|
|
|
DependentLibs,
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2003-09-30 18:37:50 +00:00
|
|
|
// Function subtypes:
|
2001-06-06 20:29:01 +00:00
|
|
|
// Can also have ConstantPool block
|
|
|
|
// Can also have SymbolTable block
|
2004-01-18 21:09:23 +00:00
|
|
|
BasicBlock = 0x31,// May contain many basic blocks (obsolete since LLVM 1.1)
|
2003-12-01 07:08:06 +00:00
|
|
|
|
|
|
|
// InstructionList - The instructions in the body of a function. This
|
2004-01-18 21:09:23 +00:00
|
|
|
// superceeds the old BasicBlock node used in LLVM 1.0.
|
2003-12-01 07:08:06 +00:00
|
|
|
InstructionList = 0x32,
|
2004-01-18 21:09:23 +00:00
|
|
|
|
|
|
|
// CompactionTable - blocks with this id are used to define local remapping
|
|
|
|
// tables for a function, allowing the indices used within the function to
|
|
|
|
// be as small as possible. This often allows the instructions to be
|
|
|
|
// encoded more efficiently.
|
2006-02-22 16:23:43 +00:00
|
|
|
CompactionTable = 0x33
|
2001-06-06 20:29:01 +00:00
|
|
|
};
|
2004-07-25 17:50:00 +00:00
|
|
|
|
|
|
|
/// In LLVM 1.3 format, the identifier and the size of the block are
|
2005-04-21 20:39:54 +00:00
|
|
|
/// encoded into a single vbr_uint32 with 5 bits for the block identifier
|
|
|
|
/// and 27-bits for block length. This limits blocks to a maximum of
|
|
|
|
/// 128MBytes of data, and block types to 31 which should be sufficient
|
2004-07-25 17:50:00 +00:00
|
|
|
/// for the foreseeable usage. Because the values of block identifiers MUST
|
|
|
|
/// fit within 5 bits (values 1-31), this enumeration is used to ensure
|
|
|
|
/// smaller values are used for 1.3 and subsequent bytecode versions.
|
|
|
|
/// @brief The block number identifiers used in LLVM 1.3 bytecode
|
|
|
|
/// format.
|
|
|
|
enum CompressedBytecodeBlockIdentifiers {
|
|
|
|
|
|
|
|
// Zero value ist verbotten!
|
|
|
|
Reserved_DoNotUse = 0x00, ///< Don't use this!
|
|
|
|
|
|
|
|
// This is the uber block that contains the rest of the blocks.
|
|
|
|
ModuleBlockID = 0x01, ///< 1.3 identifier for modules
|
|
|
|
|
|
|
|
// Module subtypes:
|
|
|
|
|
|
|
|
// This is the identifier for a function
|
|
|
|
FunctionBlockID = 0x02, ///< 1.3 identifier for Functions
|
|
|
|
ConstantPoolBlockID = 0x03, ///< 1.3 identifier for constant pool
|
|
|
|
SymbolTableBlockID = 0x04, ///< 1.3 identifier for symbol table
|
|
|
|
ModuleGlobalInfoBlockID = 0x05,///< 1.3 identifier for module globals
|
|
|
|
GlobalTypePlaneBlockID = 0x06, ///< 1.3 identifier for global types
|
|
|
|
|
|
|
|
// Function subtypes:
|
|
|
|
|
|
|
|
// InstructionList - The instructions in the body of a function. This
|
|
|
|
// superceeds the old BasicBlock node used in LLVM 1.0.
|
2005-04-21 20:39:54 +00:00
|
|
|
InstructionListBlockID = 0x07, ///< 1.3 identifier for insruction list
|
2004-07-25 17:50:00 +00:00
|
|
|
|
|
|
|
// CompactionTable - blocks with this id are used to define local remapping
|
|
|
|
// tables for a function, allowing the indices used within the function to
|
|
|
|
// be as small as possible. This often allows the instructions to be
|
|
|
|
// encoded more efficiently.
|
|
|
|
CompactionTableBlockID = 0x08, ///< 1.3 identifier for compaction tables
|
|
|
|
|
2004-08-21 20:42:28 +00:00
|
|
|
// Not a block id, just used to count them
|
|
|
|
NumberOfBlockIDs
|
2004-07-25 17:50:00 +00:00
|
|
|
};
|
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
};
|
2003-11-11 22:41:34 +00:00
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
#endif
|