From f97fa593131eb6e818570d91865f3a54e6501620 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 5 Nov 2005 22:20:06 +0000 Subject: [PATCH] rearrange some info about the instruction encoding git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24204 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/BytecodeFormat.html | 228 +++++++++++++++++++++++++---------------------- 1 file changed, 123 insertions(+), 105 deletions(-) diff --git a/docs/BytecodeFormat.html b/docs/BytecodeFormat.html index 67ed8ba7c4a..5c22530f958 100644 --- a/docs/BytecodeFormat.html +++ b/docs/BytecodeFormat.html @@ -39,8 +39,8 @@
  • Global Constant Pool
  • Function Definition
  • Compaction Table
  • -
  • Instruction List
  • -
  • Instruction Opcodes
  • +
  • Instructions List
  • +
  • Instructions
  • Symbol Table
  • @@ -1363,8 +1363,125 @@ of formats. See Instructions for details. + + +
    Instructions
    + +
    +

    Instructions are written out one at a time as distinct units. Each +instruction +record contains at least an opcode and a type field, +and may contain a list of operands (whose interpretation depends on the opcode). +Based on the number of operands, the +instruction is encoded in a +dense format that tries to encoded each instruction into 32-bits if +possible.

    +
    + + +
    Instruction Opcodes
    +
    +

    Instructions encode an opcode that identifies the kind of instruction. + Opcodes are an enumerated integer value. The specific values used depend on + the version of LLVM you're using. The opcode values are defined in the + + include/llvm/Instruction.def file. You should check there for the + most recent definitions. The table below provides the opcodes defined as of + the writing of this document. The table associates each opcode mnemonic with + its enumeration value and the bytecode and LLVM version numbers in which the + opcode was introduced.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    OpcodeNumberBytecode VersionLLVM Version
    Terminator Instructions
    Ret111.0
    Br211.0
    Switch311.0
    Invoke411.0
    Unwind511.0
    Unreachable611.4
    Binary Operators
    Add711.0
    Sub811.0
    Mul911.0
    Div1011.0
    Rem1111.0
    Logical Operators
    And1211.0
    Or1311.0
    Xor1411.0
    Binary Comparison Operators
    SetEQ1511.0
    SetNE1611.0
    SetLE1711.0
    SetGE1811.0
    SetLT1911.0
    SetGT2011.0
    Memory Operators
    Malloc2111.0
    Free2211.0
    Alloca2311.0
    Load2411.0
    Store2511.0
    GetElementPtr2611.0
    Other Operators
    PHI2711.0
    Cast2811.0
    Call2911.0
    Shl3011.0
    Shr3111.0
    VANext3211.0
    VAArg3311.0
    Select3421.2
    + Pseudo Instructions* +
    Invoke+CC 5651.5
    Invoke+FastCC5751.5
    Call+CC5851.5
    Call+FastCC+TailCall5951.5
    Call+FastCC6051.5
    Call+CCC+TailCall6151.5
    Load+Volatile6231.3
    Store+Volatile6331.3
    + +

    * Note: +These aren't really opcodes from an LLVM language perspective. They encode +information into other opcodes without reserving space for that information. +For example, opcode=63 is a Volatile Store. The opcode for this +instruction is 25 (Store) but we encode it as 63 to indicate that is a Volatile +Store. The same is done for the calling conventions and tail calls. +In each of these entries in range 56-63, the opcode is documented as the base +opcode (Invoke, Call, Store) plus some set of modifiers, as follows:

    +
    +
    CC
    +
    This means an arbitrary calling convention is specified + in a VBR that follows the opcode. This is used when the instruction cannot + be encoded with one of the more compact forms. +
    +
    FastCC
    +
    This indicates that the Call or Invoke is using the FastCC calling + convention.
    +
    CCC
    +
    This indicates that the Call or Invoke is using the native "C" calling + convention.
    +
    TailCall
    +
    This indicates that the Call has the 'tail' modifier.
    +
    +
    + + -
    Instructions
    +
    Instruction +Encoding
    +

    For brevity, instructions are written in one of four formats, depending on the number of operands to the instruction. Each @@ -1430,7 +1547,7 @@ single uint32_vbr as follows:

    2-7 - opcode + opcode Specifies the opcode of the instruction. Note that the maximum opcode value is 63. @@ -1467,7 +1584,7 @@ single uint32_vbr as follows:

    2-7 - opcode + opcode Specifies the opcode of the instruction. Note that the maximum opcode value is 63. @@ -1509,7 +1626,7 @@ single uint32_vbr as follows:

    2-7 - opcode + opcode Specifies the opcode of the instruction. Note that the maximum opcode value is 63. @@ -1542,105 +1659,6 @@ single uint32_vbr as follows:

    -
    Instruction Opcodes
    -
    -

    Instructions encode an opcode that identifies the kind of instruction. - Opcodes are an enumerated integer value. The specific values used depend on - the version of LLVM you're using. The opcode values are defined in the - - include/llvm/Instruction.def file. You should check there for the - most recent definitions. The table below provides the opcodes defined as of - the writing of this document. The table associates each opcode mnemonic with - its enumeration value and the bytecode and LLVM version numbers in which the - opcode was introduced.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    OpcodeNumberBytecode VersionLLVM Version
    Terminator Instructions
    Ret111.0
    Br211.0
    Switch311.0
    Invoke411.0
    Unwind511.0
    Unreachable611.4
    Binary Operators
    Add711.0
    Sub811.0
    Mul911.0
    Div1011.0
    Rem1111.0
    Logical Operators
    And1211.0
    Or1311.0
    Xor1411.0
    Binary Comparison Operators
    SetEQ1511.0
    SetNE1611.0
    SetLE1711.0
    SetGE1811.0
    SetLT1911.0
    SetGT2011.0
    Memory Operators
    Malloc2111.0
    Free2211.0
    Alloca2311.0
    Load2411.0
    Store2511.0
    GetElementPtr2611.0
    Other Operators
    PHI2711.0
    Cast2811.0
    Call2911.0
    Shl3011.0
    Shr3111.0
    VANext3211.0
    VAArg3311.0
    Select3421.2
    - Pseudo Instructions* -
    Invoke+CC 5651.5
    Invoke+FastCC5751.5
    Call+CC5851.5
    Call+FastCC+TailCall5951.5
    Call+FastCC6051.5
    Call+CCC+TailCall6151.5
    Load+Volatile6231.3
    Store+Volatile6331.3
    -
    - -

    * Note: -These aren't really opcodes from an LLVM language prespeective. They encode -information into other opcodes without reserving space for that information. -For example, opcode=63 is a Volatile Store. The opcode for this -instruction is 25 (Store) but we encode it as 63 to indicate that is a Volatile -Store. The same is done for the calling conventions and tail calls. -In each of these entries in range 56-63, the opcode is documented as the base -opcode (Invoke, Call, Store) plus some set of modifiers, as follows:

    -
    -
    CC
    -
    This means an arbitrary calling convention is specified - in a VBR that follows the opcode. This is used when the instruction cannot - be encoded with one of the more compact forms. -
    -
    FastCC
    -
    This indicates that the Call or Invoke is using the FastCC calling - convention.
    -
    CCC
    -
    This indicates that the Call or Invoke is using the native "C" calling - convention.
    -
    TailCall
    -
    This indicates that the Call has the 'tail' modifier.
    -
    - -
    Symbol Table

    A symbol table can be put out in conjunction with a module or a function. A -- 2.11.0