From f5af6ada3b0570db1afc19029cad8fb8320676ef Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sat, 23 Apr 2011 00:30:22 +0000 Subject: docs: Introduce cascading style
and

continued on .

Section Example

Section preamble.

Subsection Example

Subsection body

FIXME: Care H5 better. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130040 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/BitCodeFormat.html | 171 ++++++++++++++++++++++++------------------------ 1 file changed, 85 insertions(+), 86 deletions(-) (limited to 'docs/BitCodeFormat.html') diff --git a/docs/BitCodeFormat.html b/docs/BitCodeFormat.html index 396904a3d6..d2088487aa 100644 --- a/docs/BitCodeFormat.html +++ b/docs/BitCodeFormat.html @@ -50,7 +50,7 @@

Abstract

-
+

This document describes the LLVM bitstream file format and the encoding of the LLVM IR into it.

@@ -61,7 +61,7 @@ the LLVM IR into it.

Overview

-
+

What is commonly known as the LLVM bitcode file format (also, sometimes @@ -91,7 +91,7 @@ wrapper format, then describes the record structure used by LLVM IR files.

Bitstream Format

-
+

The bitstream format is literally a stream of bits, with a very simple @@ -114,14 +114,12 @@ href="CommandGuide/html/llvm-bcanalyzer.html">llvm-bcanalyzer tool can be used to dump and inspect arbitrary bitstreams, which is very useful for understanding the encoding.

-
-

Magic Numbers

-
+

The first two bytes of a bitcode file are 'BC' (0x42, 0x43). The second two bytes are an application-specific magic number. Generic @@ -135,7 +133,7 @@ bitcode, while application-specific programs will want to look at all four.

Primitives -
+

A bitstream literally consists of a stream of bits, which are read in order @@ -146,14 +144,12 @@ Width Integers or as Variable Width Integers.

-
-

Fixed Width Integers

-
+

Fixed-width integer values have their low bits emitted directly to the file. For example, a 3-bit integer value encodes 1 as 001. Fixed width integers @@ -168,7 +164,7 @@ Integers. Variable Width Integers -

+

Variable-width integer (VBR) values encode values of arbitrary size, optimizing for the case where the values are small. Given a 4-bit VBR field, @@ -188,7 +184,7 @@ value of 24 (011 << 3) with no continuation. The sum (3+24) yields the value

6-bit characters

-
+

6-bit characters encode common characters into a fixed 6-bit field. They represent the following characters with the following 6-bit values:

@@ -212,7 +208,7 @@ characters not in the set.

Word Alignment

-
+

Occasionally, it is useful to emit zero bits until the bitstream is a multiple of 32 bits. This ensures that the bit position in the stream can be @@ -220,13 +216,14 @@ represented as a multiple of 32-bit words.

+

Abbreviation IDs

-
+

A bitstream is a sequential series of Blocks and @@ -262,7 +259,7 @@ an abbreviated record encoding.

Blocks -
+

Blocks in a bitstream denote nested regions of the stream, and are identified by @@ -303,12 +300,10 @@ its own set of abbreviations, and its own abbrev id width. When a sub-block is popped, the saved values are restored.

-
-

ENTER_SUBBLOCK Encoding

-
+

[ENTER_SUBBLOCK, blockidvbr8, newabbrevlenvbr4, <align32bits>, blocklen32]

@@ -329,7 +324,7 @@ reader to skip over the entire block in one jump.

END_BLOCK Encoding

-
+

[END_BLOCK, <align32bits>]

@@ -341,14 +336,14 @@ an even multiple of 32-bits.
- +

Data Records

-
+

Data records consist of a record code and a number of (up to) 64-bit integer values. The interpretation of the code and values is @@ -360,12 +355,10 @@ which encodes the target triple of a module. The code is ASCII codes for the characters in the string.

-
-

UNABBREV_RECORD Encoding

-
+

[UNABBREV_RECORD, codevbr6, numopsvbr6, op0vbr6, op1vbr6, ...]

@@ -391,7 +384,7 @@ bits. This is not an efficient encoding, but it is fully general.

Abbreviated Record Encoding

-
+

[<abbrevid>, fields...]

@@ -412,12 +405,14 @@ operand value).

+
+

Abbreviations

-
+

Abbreviations are an important form of compression for bitstreams. The idea is to specify a dense encoding for a class of records once, then use that encoding @@ -435,12 +430,11 @@ As a concrete example, LLVM IR files usually emit an abbreviation for binary operators. If a specific LLVM module contained no or few binary operators, the abbreviation does not need to be emitted.

-

DEFINE_ABBREV Encoding

-
+

[DEFINE_ABBREV, numabbrevopsvbr5, abbrevop0, abbrevop1, ...]

@@ -555,12 +549,14 @@ used for any other string value.
+
+

Standard Blocks

-
+

In addition to the basic block structure and record encodings, the bitstream @@ -569,12 +565,10 @@ stream is to be decoded or other metadata. In the future, new standard blocks may be added. Block IDs 0-7 are reserved for standard blocks.

-
-

#0 - BLOCKINFO Block

-
+

The BLOCKINFO block allows the description of metadata for other @@ -623,11 +617,15 @@ from the corresponding blocks. It is not safe to skip them.

+
+ +
+

Bitcode Wrapper Format

-
+

Bitcode files for LLVM IR may optionally be wrapped in a simple wrapper @@ -658,7 +656,7 @@ value that can be used to encode the CPU of the target.

LLVM IR Encoding

-
+

LLVM IR is encoded into a bitstream by defining blocks and records. It uses @@ -669,17 +667,17 @@ that the writer uses, as these are fully self-described in the file, and the reader is not allowed to build in any knowledge of this.

-
-

Basics

+
+

LLVM IR Magic Number

-
+

The magic number for LLVM IR files is: @@ -701,7 +699,7 @@ When combined with the bitcode magic number and viewed as bytes, this is

Signed VBRs

-
+

Variable Width Integer encoding is an efficient way to @@ -734,7 +732,7 @@ within CONSTANTS_BLOCK blocks.

LLVM IR Blocks

-
+

LLVM IR is defined with the following blocks: @@ -762,12 +760,14 @@ LLVM IR is defined with the following blocks:

+
+

MODULE_BLOCK Contents

-
+

The MODULE_BLOCK block (id 8) is the top-level block for LLVM bitcode files, and each bitcode file must contain exactly one. In @@ -787,12 +787,10 @@ following sub-blocks:

  • METADATA_BLOCK
  • -
    -

    MODULE_CODE_VERSION Record

    -
    +

    [VERSION, version#]

    @@ -804,7 +802,7 @@ time.

    MODULE_CODE_TRIPLE Record

    -
    +

    [TRIPLE, ...string...]

    The TRIPLE record (code 2) contains a variable number of @@ -815,7 +813,7 @@ specification string.

    MODULE_CODE_DATALAYOUT Record

    -
    +

    [DATALAYOUT, ...string...]

    The DATALAYOUT record (code 3) contains a variable number of @@ -826,7 +824,7 @@ specification string.

    MODULE_CODE_ASM Record

    -
    +

    [ASM, ...string...]

    The ASM record (code 4) contains a variable number of @@ -837,7 +835,7 @@ individual assembly blocks separated by newline (ASCII 10) characters.

    MODULE_CODE_SECTIONNAME Record

    -
    +

    [SECTIONNAME, ...string...]

    The SECTIONNAME record (code 5) contains a variable number @@ -852,7 +850,7 @@ referenced by the 1-based index in the section fields of

    MODULE_CODE_DEPLIB Record

    -
    +

    [DEPLIB, ...string...]

    The DEPLIB record (code 6) contains a variable number of @@ -865,7 +863,7 @@ library name referenced.

    MODULE_CODE_GLOBALVAR Record

    -
    +

    [GLOBALVAR, pointer type, isconst, initid, linkage, alignment, section, visibility, threadlocal]

    The GLOBALVAR record (code 7) marks the declaration or @@ -929,7 +927,7 @@ has unnamed_addr

    MODULE_CODE_FUNCTION Record

    -
    +

    [FUNCTION, type, callingconv, isproto, linkage, paramattr, alignment, section, visibility, gc]

    @@ -985,7 +983,7 @@ has unnamed_addr

    MODULE_CODE_ALIAS Record

    -
    +

    [ALIAS, alias type, aliasee val#, linkage, visibility]

    @@ -1009,7 +1007,7 @@ for this alias

    MODULE_CODE_PURGEVALS Record

    -
    +

    [PURGEVALS, numvals]

    The PURGEVALS record (code 10) resets the module-level @@ -1022,7 +1020,7 @@ new value indices will start from the given numvals value.

    MODULE_CODE_GCNAME Record

    -
    +

    [GCNAME, ...string...]

    The GCNAME record (code 11) contains a variable number of @@ -1033,12 +1031,14 @@ the module. These records can be referenced by 1-based index in the gc fields of FUNCTION records.

    +
    +

    PARAMATTR_BLOCK Contents

    -
    +

    The PARAMATTR_BLOCK block (id 9) contains a table of entries describing the attributes of function parameters. These @@ -1052,13 +1052,10 @@ href="#FUNC_CODE_INST_CALL">INST_CALL records.

    that each is unique (i.e., no two indicies represent equivalent attribute lists).

    -
    - -

    PARAMATTR_CODE_ENTRY Record

    -
    +

    [ENTRY, paramidx0, attr0, paramidx1, attr1...]

    @@ -1099,12 +1096,14 @@ the logarithm base 2 of the requested alignment, plus 1
    +
    +

    TYPE_BLOCK Contents

    -
    +

    The TYPE_BLOCK block (id 10) contains records which constitute a table of type operator entries used to represent types @@ -1119,12 +1118,10 @@ type operator records. each entry is unique (i.e., no two indicies represent structurally equivalent types).

    -
    -

    TYPE_CODE_NUMENTRY Record

    -
    +

    [NUMENTRY, numentries]

    @@ -1138,7 +1135,7 @@ in the block.

    TYPE_CODE_VOID Record

    -
    +

    [VOID]

    @@ -1150,7 +1147,7 @@ type table.

    TYPE_CODE_FLOAT Record

    -
    +

    [FLOAT]

    @@ -1162,7 +1159,7 @@ floating point) type to the type table.

    TYPE_CODE_DOUBLE Record

    -
    +

    [DOUBLE]

    @@ -1174,7 +1171,7 @@ floating point) type to the type table.

    TYPE_CODE_LABEL Record

    -
    +

    [LABEL]

    @@ -1186,7 +1183,7 @@ the type table.

    TYPE_CODE_OPAQUE Record

    -
    +

    [OPAQUE]

    @@ -1199,7 +1196,7 @@ unified.

    TYPE_CODE_INTEGER Record

    -
    +

    [INTEGER, width]

    @@ -1212,7 +1209,7 @@ integer type.

    TYPE_CODE_POINTER Record

    -
    +

    [POINTER, pointee type, address space]

    @@ -1232,7 +1229,7 @@ default address space is zero.

    TYPE_CODE_FUNCTION Record

    -
    +

    [FUNCTION, vararg, ignored, retty, ...paramty... ]

    @@ -1256,7 +1253,7 @@ parameter types of the function

    TYPE_CODE_STRUCT Record

    -
    +

    [STRUCT, ispacked, ...eltty...]

    @@ -1274,7 +1271,7 @@ types of the structure

    TYPE_CODE_ARRAY Record

    -
    +

    [ARRAY, numelts, eltty]

    @@ -1291,7 +1288,7 @@ table. The operand fields are

    TYPE_CODE_VECTOR Record

    -
    +

    [VECTOR, numelts, eltty]

    @@ -1308,7 +1305,7 @@ table. The operand fields are

    TYPE_CODE_X86_FP80 Record

    -
    +

    [X86_FP80]

    @@ -1320,7 +1317,7 @@ floating point) type to the type table.

    TYPE_CODE_FP128 Record

    -
    +

    [FP128]

    @@ -1332,7 +1329,7 @@ floating point) type to the type table.

    TYPE_CODE_PPC_FP128 Record

    -
    +

    [PPC_FP128]

    @@ -1344,7 +1341,7 @@ floating point) type to the type table.

    TYPE_CODE_METADATA Record

    -
    +

    [METADATA]

    @@ -1353,12 +1350,14 @@ type to the type table.

    +
    +

    CONSTANTS_BLOCK Contents

    -
    +

    The CONSTANTS_BLOCK block (id 11) ...

    @@ -1371,7 +1370,7 @@ type to the type table. FUNCTION_BLOCK Contents -
    +

    The FUNCTION_BLOCK block (id 12) ...

    @@ -1394,19 +1393,17 @@ type to the type table. TYPE_SYMTAB_BLOCK Contents -
    +

    The TYPE_SYMTAB_BLOCK block (id 13) contains entries which map between module-level named types and their corresponding type indices.

    -
    -

    TST_CODE_ENTRY Record

    -
    +

    [ENTRY, typeid, ...string...]

    @@ -1417,13 +1414,14 @@ name. Each entry corresponds to a single named type.

    +

    VALUE_SYMTAB_BLOCK Contents

    -
    +

    The VALUE_SYMTAB_BLOCK block (id 14) ...

    @@ -1436,7 +1434,7 @@ name. Each entry corresponds to a single named type. METADATA_BLOCK Contents -
    +

    The METADATA_BLOCK block (id 15) ...

    @@ -1449,13 +1447,14 @@ name. Each entry corresponds to a single named type. METADATA_ATTACHMENT Contents -
    +

    The METADATA_ATTACHMENT block (id 16) ...

    +

    -- cgit v1.2.3