aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Bitcode
diff options
context:
space:
mode:
authorKarl Schimpf <kschimpf@google.com>2013-07-02 14:36:36 -0700
committerKarl Schimpf <kschimpf@google.com>2013-07-02 14:36:36 -0700
commit4390b1a9ac86937b9f9886119b5fa0ffc77295eb (patch)
tree0ed3cbe3018c87f90bb55627066f6bdd5cfae9e0 /include/llvm/Bitcode
parentbdad02d55969b0963ac23e05578d28def5636ebd (diff)
Simplify globals in PNaCl wire format based on normalized constants.
Generates simple global variable records, followed by list of records defining byte initialization and relocations. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3504 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18111002
Diffstat (limited to 'include/llvm/Bitcode')
-rw-r--r--include/llvm/Bitcode/NaCl/NaClLLVMBitCodes.h34
1 files changed, 30 insertions, 4 deletions
diff --git a/include/llvm/Bitcode/NaCl/NaClLLVMBitCodes.h b/include/llvm/Bitcode/NaCl/NaClLLVMBitCodes.h
index f4fc4b8e6f..7d270cd98c 100644
--- a/include/llvm/Bitcode/NaCl/NaClLLVMBitCodes.h
+++ b/include/llvm/Bitcode/NaCl/NaClLLVMBitCodes.h
@@ -43,7 +43,8 @@ namespace naclbitc {
TYPE_BLOCK_ID_NEW,
- USELIST_BLOCK_ID
+ USELIST_BLOCK_ID,
+ GLOBALVAR_BLOCK_ID
};
@@ -58,9 +59,7 @@ namespace naclbitc {
// FIXME: Remove DEPLIB in 4.0.
MODULE_CODE_DEPLIB = 6, // DEPLIB: [strchr x N]
- // GLOBALVAR: [pointer type, isconst, initid,
- // linkage, alignment, section, visibility, threadlocal]
- MODULE_CODE_GLOBALVAR = 7,
+ MODULE_CODE_GLOBALVAR = 7, // Not used in PNaCl.
// FUNCTION: [type, callingconv, isproto, linkage]
MODULE_CODE_FUNCTION = 8,
@@ -179,6 +178,33 @@ namespace naclbitc {
// asmdialect,asmstr,conststr]
};
+ /// GlobalVarOpcodes - These are values used in the bitcode files to
+ /// encode records defining global variables.
+ ///
+ /// The structure of global variables can be summarized as follows:
+ ///
+ /// The global variable block begins with a GLOBALVAR_COUNT, defining
+ /// the number of global variables in the bitcode file. After that,
+ /// each global variable is defined.
+ ///
+ /// Global variables are defined by a GLOBALVAR_VAR record, followed
+ /// by 1 or more records defining its initial value. Simple
+ /// variables have a single initializer. Structured variables are
+ /// defined by an initial GLOBALVAR_COMPOUND record defining the
+ /// number of fields in the structure, followed by an initializer
+ /// for each of its fields. In this context, a field is either data,
+ /// or a relocation. A data field is defined by a
+ /// GLOBALVAR_ZEROFILL or GLOBALVAR_DATA record. A relocation field
+ /// is defined by a GLOBALVAR_RELOC record.
+ enum NaClGlobalVarOpcodes {
+ GLOBALVAR_VAR = 0, // VAR: [align, isconst]
+ GLOBALVAR_COMPOUND = 1, // COMPOUND: [size]
+ GLOBALVAR_ZEROFILL = 2, // ZEROFILL: [size]
+ GLOBALVAR_DATA = 3, // DATA: [b0, b1, ...]
+ GLOBALVAR_RELOC = 4, // RELOC: [val, [addend]]
+ GLOBALVAR_COUNT = 5, // COUNT: [n]
+ };
+
/// 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