| OLD | NEW |
| 1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
| 2 | 2 |
| 3 <section id="pnacl-bitcode-reference-manual"> | 3 <section id="pnacl-bitcode-reference-manual"> |
| 4 <h1 id="pnacl-bitcode-reference-manual">PNaCl Bitcode Reference Manual</h1> | 4 <h1 id="pnacl-bitcode-reference-manual">PNaCl Bitcode Reference Manual</h1> |
| 5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
| 6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
| 7 <li><a class="reference internal" href="#introduction" id="id1">Introduction</a>
</li> | 7 <li><a class="reference internal" href="#introduction" id="id1">Introduction</a>
</li> |
| 8 <li><p class="first"><a class="reference internal" href="#high-level-structure"
id="id2">High Level Structure</a></p> | 8 <li><p class="first"><a class="reference internal" href="#high-level-structure"
id="id2">High Level Structure</a></p> |
| 9 <ul class="small-gap"> | 9 <ul class="small-gap"> |
| 10 <li><a class="reference internal" href="#data-model" id="id3">Data Model</a></li
> | 10 <li><a class="reference internal" href="#data-model" id="id3">Data Model</a></li
> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 <li><p class="first"><a class="reference internal" href="#intrinsic-functions" i
d="id29">Intrinsic Functions</a></p> | 47 <li><p class="first"><a class="reference internal" href="#intrinsic-functions" i
d="id29">Intrinsic Functions</a></p> |
| 48 <ul class="small-gap"> | 48 <ul class="small-gap"> |
| 49 <li><a class="reference internal" href="#list-of-allowed-intrinsics" id="id30">L
ist of allowed intrinsics</a></li> | 49 <li><a class="reference internal" href="#list-of-allowed-intrinsics" id="id30">L
ist of allowed intrinsics</a></li> |
| 50 <li><a class="reference internal" href="#thread-pointer-related-intrinsics" id="
id31">Thread pointer related intrinsics</a></li> | 50 <li><a class="reference internal" href="#thread-pointer-related-intrinsics" id="
id31">Thread pointer related intrinsics</a></li> |
| 51 <li><a class="reference internal" href="#setjmp-and-longjmp" id="id32">Setjmp an
d Longjmp</a></li> | 51 <li><a class="reference internal" href="#setjmp-and-longjmp" id="id32">Setjmp an
d Longjmp</a></li> |
| 52 <li><a class="reference internal" href="#atomic-intrinsics" id="id33">Atomic int
rinsics</a></li> | 52 <li><a class="reference internal" href="#atomic-intrinsics" id="id33">Atomic int
rinsics</a></li> |
| 53 </ul> | 53 </ul> |
| 54 </li> | 54 </li> |
| 55 </ul> | 55 </ul> |
| 56 | 56 |
| 57 </div><section id="introduction"> | 57 </div><h2 id="introduction">Introduction</h2> |
| 58 <h2 id="introduction">Introduction</h2> | |
| 59 <p>This document is a reference manual for the PNaCl bitcode format. It describe
s | 58 <p>This document is a reference manual for the PNaCl bitcode format. It describe
s |
| 60 the bitcode on a <em>semantic</em> level; the physical encoding level will be de
scribed | 59 the bitcode on a <em>semantic</em> level; the physical encoding level will be de
scribed |
| 61 elsewhere. For the purpose of this document, the textual form of LLVM IR is | 60 elsewhere. For the purpose of this document, the textual form of LLVM IR is |
| 62 used to describe instructions and other bitcode constructs.</p> | 61 used to describe instructions and other bitcode constructs.</p> |
| 63 <p>Since the PNaCl bitcode is based to a large extent on LLVM IR as of | 62 <p>Since the PNaCl bitcode is based to a large extent on LLVM IR as of |
| 64 version 3.3, many sections in this document point to a relevant section | 63 version 3.3, many sections in this document point to a relevant section |
| 65 of the LLVM language reference manual. Only the changes, restrictions | 64 of the LLVM language reference manual. Only the changes, restrictions |
| 66 and variations specific to PNaCl are described—full semantic | 65 and variations specific to PNaCl are described—full semantic |
| 67 descriptions are not duplicated from the LLVM reference manual.</p> | 66 descriptions are not duplicated from the LLVM reference manual.</p> |
| 68 </section><section id="high-level-structure"> | |
| 69 <h2 id="high-level-structure">High Level Structure</h2> | 67 <h2 id="high-level-structure">High Level Structure</h2> |
| 70 <p>A PNaCl portable executable (<strong>pexe</strong> in short) is a single LLVM
IR module.</p> | 68 <p>A PNaCl portable executable (<strong>pexe</strong> in short) is a single LLVM
IR module.</p> |
| 71 <section id="data-model"> | |
| 72 <h3 id="data-model">Data Model</h3> | 69 <h3 id="data-model">Data Model</h3> |
| 73 <p>The data model for PNaCl bitcode is fixed at little-endian ILP32: pointers ar
e | 70 <p>The data model for PNaCl bitcode is fixed at little-endian ILP32: pointers ar
e |
| 74 32 bits in size. 64-bit integer types are also supported natively via the i64 | 71 32 bits in size. 64-bit integer types are also supported natively via the i64 |
| 75 type (for example, a front-end can generate these from the C/C++ type | 72 type (for example, a front-end can generate these from the C/C++ type |
| 76 <code>long long</code>).</p> | 73 <code>long long</code>).</p> |
| 77 <p>Floating point support is fixed at IEEE 754 32-bit and 64-bit values (f32 and | 74 <p>Floating point support is fixed at IEEE 754 32-bit and 64-bit values (f32 and |
| 78 f64, respectively).</p> | 75 f64, respectively).</p> |
| 79 </section><section id="linkage-types"> | 76 <h3 id="linkage-types"><span id="bitcode-linkagetypes"></span>Linkage Types</h3> |
| 80 <span id="bitcode-linkagetypes"></span><h3 id="linkage-types"><span id="bitcode-
linkagetypes"></span>Linkage Types</h3> | |
| 81 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#linkage">LLVM LangRef: Linkage Types</a></p> | 77 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#linkage">LLVM LangRef: Linkage Types</a></p> |
| 82 <p>The linkage types supported by PNaCl bitcode are <code>internal</code> and <c
ode>external</code>. | 78 <p>The linkage types supported by PNaCl bitcode are <code>internal</code> and <c
ode>external</code>. |
| 83 A single function in the pexe, named <code>_start</code>, has the linkage type | 79 A single function in the pexe, named <code>_start</code>, has the linkage type |
| 84 <code>external</code>. All the other functions and globals have the linkage type | 80 <code>external</code>. All the other functions and globals have the linkage type |
| 85 <code>internal</code>.</p> | 81 <code>internal</code>.</p> |
| 86 </section><section id="calling-conventions"> | |
| 87 <h3 id="calling-conventions">Calling Conventions</h3> | 82 <h3 id="calling-conventions">Calling Conventions</h3> |
| 88 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#callingconv">LLVM LangRef: Calling Conventions</a></p> | 83 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#callingconv">LLVM LangRef: Calling Conventions</a></p> |
| 89 <p>The only calling convention supported by PNaCl bitcode is <code>ccc</code> -
the C | 84 <p>The only calling convention supported by PNaCl bitcode is <code>ccc</code> -
the C |
| 90 calling convention.</p> | 85 calling convention.</p> |
| 91 </section><section id="visibility-styles"> | |
| 92 <h3 id="visibility-styles">Visibility Styles</h3> | 86 <h3 id="visibility-styles">Visibility Styles</h3> |
| 93 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#visibility-styles">LLVM LangRef: Visibility Styles</a></p> | 87 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#visibility-styles">LLVM LangRef: Visibility Styles</a></p> |
| 94 <p>PNaCl bitcode does not support visibility styles.</p> | 88 <p>PNaCl bitcode does not support visibility styles.</p> |
| 95 </section><section id="global-variables"> | 89 <h3 id="global-variables"><span id="bitcode-globalvariables"></span>Global Varia
bles</h3> |
| 96 <span id="bitcode-globalvariables"></span><h3 id="global-variables"><span id="bi
tcode-globalvariables"></span>Global Variables</h3> | |
| 97 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#globalvars">LLVM LangRef: Global Variables</a></p> | 90 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#globalvars">LLVM LangRef: Global Variables</a></p> |
| 98 <p>Restrictions on global variables:</p> | 91 <p>Restrictions on global variables:</p> |
| 99 <ul class="small-gap"> | 92 <ul class="small-gap"> |
| 100 <li>PNaCl bitcode does not support LLVM IR TLS models. See | 93 <li>PNaCl bitcode does not support LLVM IR TLS models. See |
| 101 <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-languag
e-support.html#language-support-threading"><em>Threading</em></a> for more detai
ls.</li> | 94 <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-languag
e-support.html#language-support-threading"><em>Threading</em></a> for more detai
ls.</li> |
| 102 <li>Restrictions on <a class="reference internal" href="#bitcode-linkagetypes"><
em>linkage types</em></a>.</li> | 95 <li>Restrictions on <a class="reference internal" href="#bitcode-linkagetypes"><
em>linkage types</em></a>.</li> |
| 103 <li>The <code>addrspace</code>, <code>section</code>, <code>unnamed_addr</code>
and | 96 <li>The <code>addrspace</code>, <code>section</code>, <code>unnamed_addr</code>
and |
| 104 <code>externally_initialized</code> attributes are not supported.</li> | 97 <code>externally_initialized</code> attributes are not supported.</li> |
| 105 </ul> | 98 </ul> |
| 106 <p>Every global variable must have an initializer. Each initializer must be | 99 <p>Every global variable must have an initializer. Each initializer must be |
| (...skipping 10 matching lines...) Expand all Loading... |
| 117 <li>A reference to a <em>GlobalValue</em> (a function or global variable) with a
n | 110 <li>A reference to a <em>GlobalValue</em> (a function or global variable) with a
n |
| 118 optional 32-bit byte offset added to it (the addend, which may be | 111 optional 32-bit byte offset added to it (the addend, which may be |
| 119 negative):</li> | 112 negative):</li> |
| 120 </ol> | 113 </ol> |
| 121 <pre> | 114 <pre> |
| 122 ptrtoint (TYPE* @GLOBAL to i32) | 115 ptrtoint (TYPE* @GLOBAL to i32) |
| 123 add (i32 ptrtoint (TYPE* @GLOBAL to i32), i32 ADDEND) | 116 add (i32 ptrtoint (TYPE* @GLOBAL to i32), i32 ADDEND) |
| 124 </pre> | 117 </pre> |
| 125 <p>A <em>CompoundElement</em> is a unnamed, packed struct containing more than o
ne | 118 <p>A <em>CompoundElement</em> is a unnamed, packed struct containing more than o
ne |
| 126 <em>SimpleElement</em>.</p> | 119 <em>SimpleElement</em>.</p> |
| 127 </section><section id="functions"> | |
| 128 <h3 id="functions">Functions</h3> | 120 <h3 id="functions">Functions</h3> |
| 129 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#functionstructure">LLVM LangRef: Functions</a></p> | 121 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#functionstructure">LLVM LangRef: Functions</a></p> |
| 130 <p>The restrictions on <a class="reference internal" href="#bitcode-linkagetypes
"><em>linkage types</em></a>, calling | 122 <p>The restrictions on <a class="reference internal" href="#bitcode-linkagetypes
"><em>linkage types</em></a>, calling |
| 131 conventions and visibility styles apply to functions. In addition, the following | 123 conventions and visibility styles apply to functions. In addition, the following |
| 132 are not supported for functions:</p> | 124 are not supported for functions:</p> |
| 133 <ul class="small-gap"> | 125 <ul class="small-gap"> |
| 134 <li>Function attributes (either for the the function itself, its parameters or i
ts | 126 <li>Function attributes (either for the the function itself, its parameters or i
ts |
| 135 return type).</li> | 127 return type).</li> |
| 136 <li>Garbage collector name (<code>gc</code>).</li> | 128 <li>Garbage collector name (<code>gc</code>).</li> |
| 137 <li>Functions with a variable number of arguments (<em>vararg</em>).</li> | 129 <li>Functions with a variable number of arguments (<em>vararg</em>).</li> |
| 138 <li>Alignment (<code>align</code>).</li> | 130 <li>Alignment (<code>align</code>).</li> |
| 139 </ul> | 131 </ul> |
| 140 </section><section id="aliases"> | |
| 141 <h3 id="aliases">Aliases</h3> | 132 <h3 id="aliases">Aliases</h3> |
| 142 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#aliases">LLVM LangRef: Aliases</a></p> | 133 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#aliases">LLVM LangRef: Aliases</a></p> |
| 143 <p>PNaCl bitcode does not support aliases.</p> | 134 <p>PNaCl bitcode does not support aliases.</p> |
| 144 </section><section id="named-metadata"> | |
| 145 <h3 id="named-metadata">Named Metadata</h3> | 135 <h3 id="named-metadata">Named Metadata</h3> |
| 146 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#namedmetadatastructure">LLVM LangRef: Named Metadata</a></p> | 136 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#namedmetadatastructure">LLVM LangRef: Named Metadata</a></p> |
| 147 <p>While PNaCl bitcode has provisions for debugging metadata, it is not consider
ed | 137 <p>While PNaCl bitcode has provisions for debugging metadata, it is not consider
ed |
| 148 part of the stable ABI. It exists for tool support and should not appear in | 138 part of the stable ABI. It exists for tool support and should not appear in |
| 149 distributed pexes.</p> | 139 distributed pexes.</p> |
| 150 <p>Other kinds of LLVM metadata are not supported.</p> | 140 <p>Other kinds of LLVM metadata are not supported.</p> |
| 151 </section><section id="module-level-inline-assembly"> | |
| 152 <h3 id="module-level-inline-assembly">Module-Level Inline Assembly</h3> | 141 <h3 id="module-level-inline-assembly">Module-Level Inline Assembly</h3> |
| 153 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#moduleasm">LLVM LangRef: Module-Level Inline Assembly</a></p> | 142 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#moduleasm">LLVM LangRef: Module-Level Inline Assembly</a></p> |
| 154 <p>PNaCl bitcode does not support inline assembly.</p> | 143 <p>PNaCl bitcode does not support inline assembly.</p> |
| 155 </section><section id="volatile-memory-accesses"> | |
| 156 <h3 id="volatile-memory-accesses">Volatile Memory Accesses</h3> | 144 <h3 id="volatile-memory-accesses">Volatile Memory Accesses</h3> |
| 157 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#volatile">LLVM LangRef: Volatile Memory Accesses</a></p> | 145 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#volatile">LLVM LangRef: Volatile Memory Accesses</a></p> |
| 158 <p>PNaCl bitcode does not support volatile memory accesses. The | 146 <p>PNaCl bitcode does not support volatile memory accesses. The |
| 159 <code>volatile</code> attribute on loads and stores is not supported. See the | 147 <code>volatile</code> attribute on loads and stores is not supported. See the |
| 160 <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-languag
e-support.html"><em>PNaCl C/C++ Language Support</em></a> for more details.</p> | 148 <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-languag
e-support.html"><em>PNaCl C/C++ Language Support</em></a> for more details.</p> |
| 161 </section><section id="memory-model-for-concurrent-operations"> | |
| 162 <h3 id="memory-model-for-concurrent-operations">Memory Model for Concurrent Oper
ations</h3> | 149 <h3 id="memory-model-for-concurrent-operations">Memory Model for Concurrent Oper
ations</h3> |
| 163 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#memmodel">LLVM LangRef: Memory Model for Concurrent Operations</a></p> | 150 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#memmodel">LLVM LangRef: Memory Model for Concurrent Operations</a></p> |
| 164 <p>See the <a class="reference external" href="PNaClDeveloperGuide.html">PNaCl D
eveloper’s Guide</a> for more | 151 <p>See the <a class="reference external" href="PNaClDeveloperGuide.html">PNaCl D
eveloper’s Guide</a> for more |
| 165 details.</p> | 152 details.</p> |
| 166 </section><section id="fast-math-flags"> | |
| 167 <h3 id="fast-math-flags">Fast-Math Flags</h3> | 153 <h3 id="fast-math-flags">Fast-Math Flags</h3> |
| 168 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#fastmath">LLVM LangRef: Fast-Math Flags</a></p> | 154 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#fastmath">LLVM LangRef: Fast-Math Flags</a></p> |
| 169 <p>Fast-math mode is not currently supported by the PNaCl bitcode.</p> | 155 <p>Fast-math mode is not currently supported by the PNaCl bitcode.</p> |
| 170 </section></section><section id="type-system"> | |
| 171 <h2 id="type-system">Type System</h2> | 156 <h2 id="type-system">Type System</h2> |
| 172 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#typesystem">LLVM LangRef: Type System</a></p> | 157 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#typesystem">LLVM LangRef: Type System</a></p> |
| 173 <p>The LLVM types allowed in PNaCl bitcode are restricted, as follows:</p> | 158 <p>The LLVM types allowed in PNaCl bitcode are restricted, as follows:</p> |
| 174 <section id="scalar-types"> | |
| 175 <h3 id="scalar-types">Scalar types</h3> | 159 <h3 id="scalar-types">Scalar types</h3> |
| 176 <ul class="small-gap"> | 160 <ul class="small-gap"> |
| 177 <li><p class="first">The only scalar types allowed are integer, float (32-bit fl
oating point), | 161 <li><p class="first">The only scalar types allowed are integer, float (32-bit fl
oating point), |
| 178 double (64-bit floating point) and void.</p> | 162 double (64-bit floating point) and void.</p> |
| 179 <ul class="small-gap"> | 163 <ul class="small-gap"> |
| 180 <li>The only integer sizes allowed are i1, i8, i16, i32 and i64.</li> | 164 <li>The only integer sizes allowed are i1, i8, i16, i32 and i64.</li> |
| 181 <li>The only integer sizes allowed for function arguments and function return | 165 <li>The only integer sizes allowed for function arguments and function return |
| 182 values are i32 and i64.</li> | 166 values are i32 and i64.</li> |
| 183 </ul> | 167 </ul> |
| 184 </li> | 168 </li> |
| 185 </ul> | 169 </ul> |
| 186 </section><section id="vector-types"> | |
| 187 <h3 id="vector-types">Vector types</h3> | 170 <h3 id="vector-types">Vector types</h3> |
| 188 <p>The only vector types allowed are:</p> | 171 <p>The only vector types allowed are:</p> |
| 189 <ul class="small-gap"> | 172 <ul class="small-gap"> |
| 190 <li>128-bit vectors integers of elements size i8, i16, i32.</li> | 173 <li>128-bit vectors integers of elements size i8, i16, i32.</li> |
| 191 <li>128-bit vectors of float elements.</li> | 174 <li>128-bit vectors of float elements.</li> |
| 192 <li>Vectors of i1 type with element counts corresponding to the allowed | 175 <li>Vectors of i1 type with element counts corresponding to the allowed |
| 193 element counts listed previously (their width is therefore not | 176 element counts listed previously (their width is therefore not |
| 194 128-bits).</li> | 177 128-bits).</li> |
| 195 </ul> | 178 </ul> |
| 196 </section><section id="array-and-struct-types"> | |
| 197 <h3 id="array-and-struct-types">Array and struct types</h3> | 179 <h3 id="array-and-struct-types">Array and struct types</h3> |
| 198 <p>Array and struct types are only allowed in | 180 <p>Array and struct types are only allowed in |
| 199 <a class="reference internal" href="#bitcode-globalvariables"><em>global variabl
e initializers</em></a>.</p> | 181 <a class="reference internal" href="#bitcode-globalvariables"><em>global variabl
e initializers</em></a>.</p> |
| 200 </section><section id="pointer-types"> | 182 <h3 id="pointer-types"><span id="bitcode-pointertypes"></span>Pointer types</h3> |
| 201 <span id="bitcode-pointertypes"></span><h3 id="pointer-types"><span id="bitcode-
pointertypes"></span>Pointer types</h3> | |
| 202 <p>Only the following pointer types are allowed:</p> | 183 <p>Only the following pointer types are allowed:</p> |
| 203 <ul class="small-gap"> | 184 <ul class="small-gap"> |
| 204 <li>Pointers to valid PNaCl bitcode scalar types, as specified above, except for | 185 <li>Pointers to valid PNaCl bitcode scalar types, as specified above, except for |
| 205 <code>i1</code>.</li> | 186 <code>i1</code>.</li> |
| 206 <li>Pointers to valid PNaCl bitcode vector types, as specified above, except for | 187 <li>Pointers to valid PNaCl bitcode vector types, as specified above, except for |
| 207 <code><? x i1></code>.</li> | 188 <code><? x i1></code>.</li> |
| 208 <li>Pointers to functions.</li> | 189 <li>Pointers to functions.</li> |
| 209 </ul> | 190 </ul> |
| 210 <p>In addition, the address space for all pointers must be 0.</p> | 191 <p>In addition, the address space for all pointers must be 0.</p> |
| 211 <p>A pointer is <em>inherent</em> when it represents the return value of an <cod
e>alloca</code> | 192 <p>A pointer is <em>inherent</em> when it represents the return value of an <cod
e>alloca</code> |
| 212 instruction, or is an address of a global value.</p> | 193 instruction, or is an address of a global value.</p> |
| 213 <p>A pointer is <em>normalized</em> if it’s either:</p> | 194 <p>A pointer is <em>normalized</em> if it’s either:</p> |
| 214 <ul class="small-gap"> | 195 <ul class="small-gap"> |
| 215 <li><em>inherent</em></li> | 196 <li><em>inherent</em></li> |
| 216 <li>Is the return value of a <code>bitcast</code> instruction.</li> | 197 <li>Is the return value of a <code>bitcast</code> instruction.</li> |
| 217 <li>Is the return value of a <code>inttoptr</code> instruction.</li> | 198 <li>Is the return value of a <code>inttoptr</code> instruction.</li> |
| 218 </ul> | 199 </ul> |
| 219 </section><section id="undefined-values"> | |
| 220 <h3 id="undefined-values">Undefined Values</h3> | 200 <h3 id="undefined-values">Undefined Values</h3> |
| 221 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#undefvalues">LLVM LangRef: Undefined Values</a></p> | 201 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#undefvalues">LLVM LangRef: Undefined Values</a></p> |
| 222 <p><code>undef</code> is only allowed within functions, not in global variable i
nitializers.</p> | 202 <p><code>undef</code> is only allowed within functions, not in global variable i
nitializers.</p> |
| 223 </section><section id="constant-expressions"> | |
| 224 <h3 id="constant-expressions">Constant Expressions</h3> | 203 <h3 id="constant-expressions">Constant Expressions</h3> |
| 225 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#constant-expressions">LLVM LangRef: Constant Expressions</a></p> | 204 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#constant-expressions">LLVM LangRef: Constant Expressions</a></p> |
| 226 <p>Constant expressions are only allowed in | 205 <p>Constant expressions are only allowed in |
| 227 <a class="reference internal" href="#bitcode-globalvariables"><em>global variabl
e initializers</em></a>.</p> | 206 <a class="reference internal" href="#bitcode-globalvariables"><em>global variabl
e initializers</em></a>.</p> |
| 228 </section></section><section id="other-values"> | |
| 229 <h2 id="other-values">Other Values</h2> | 207 <h2 id="other-values">Other Values</h2> |
| 230 <section id="metadata-nodes-and-metadata-strings"> | |
| 231 <h3 id="metadata-nodes-and-metadata-strings">Metadata Nodes and Metadata Strings
</h3> | 208 <h3 id="metadata-nodes-and-metadata-strings">Metadata Nodes and Metadata Strings
</h3> |
| 232 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#metadata">LLVM LangRef: Metadata Nodes and Metadata Strings</a></p> | 209 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#metadata">LLVM LangRef: Metadata Nodes and Metadata Strings</a></p> |
| 233 <p>While PNaCl bitcode has provisions for debugging metadata, it is not consider
ed | 210 <p>While PNaCl bitcode has provisions for debugging metadata, it is not consider
ed |
| 234 part of the stable ABI. It exists for tool support and should not appear in | 211 part of the stable ABI. It exists for tool support and should not appear in |
| 235 distributed pexes.</p> | 212 distributed pexes.</p> |
| 236 <p>Other kinds of LLVM metadata are not supported.</p> | 213 <p>Other kinds of LLVM metadata are not supported.</p> |
| 237 </section></section><section id="intrinsic-global-variables"> | |
| 238 <h2 id="intrinsic-global-variables">Intrinsic Global Variables</h2> | 214 <h2 id="intrinsic-global-variables">Intrinsic Global Variables</h2> |
| 239 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#intrinsic-global-variables">LLVM LangRef: Intrinsic Global Variables</a></
p> | 215 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#intrinsic-global-variables">LLVM LangRef: Intrinsic Global Variables</a></
p> |
| 240 <p>PNaCl bitcode does not support intrinsic global variables.</p> | 216 <p>PNaCl bitcode does not support intrinsic global variables.</p> |
| 241 </section><section id="errno-and-errors-in-arithmetic-instructions"> | 217 <h2 id="errno-and-errors-in-arithmetic-instructions"><span id="ir-and-errno"></s
pan>Errno and errors in arithmetic instructions</h2> |
| 242 <span id="ir-and-errno"></span><h2 id="errno-and-errors-in-arithmetic-instructio
ns"><span id="ir-and-errno"></span>Errno and errors in arithmetic instructions</
h2> | |
| 243 <p>Some arithmetic instructions and intrinsics have the similar semantics to | 218 <p>Some arithmetic instructions and intrinsics have the similar semantics to |
| 244 libc math functions, but differ in the treatment of <code>errno</code>. While th
e | 219 libc math functions, but differ in the treatment of <code>errno</code>. While th
e |
| 245 libc functions may set <code>errno</code> for domain errors, the instructions an
d | 220 libc functions may set <code>errno</code> for domain errors, the instructions an
d |
| 246 intrinsics do not. This is because the variable <code>errno</code> is not specia
l | 221 intrinsics do not. This is because the variable <code>errno</code> is not specia
l |
| 247 and is not required to be part of the program.</p> | 222 and is not required to be part of the program.</p> |
| 248 </section><section id="instruction-reference"> | |
| 249 <h2 id="instruction-reference">Instruction Reference</h2> | 223 <h2 id="instruction-reference">Instruction Reference</h2> |
| 250 <section id="list-of-allowed-instructions"> | |
| 251 <h3 id="list-of-allowed-instructions">List of allowed instructions</h3> | 224 <h3 id="list-of-allowed-instructions">List of allowed instructions</h3> |
| 252 <p>This is a list of LLVM instructions supported by PNaCl bitcode. Where | 225 <p>This is a list of LLVM instructions supported by PNaCl bitcode. Where |
| 253 applicable, PNaCl-specific restrictions are provided.</p> | 226 applicable, PNaCl-specific restrictions are provided.</p> |
| 254 <p>The following attributes are disallowed for all instructions:</p> | 227 <p>The following attributes are disallowed for all instructions:</p> |
| 255 <ul class="small-gap"> | 228 <ul class="small-gap"> |
| 256 <li><code>nsw</code> and <code>nuw</code></li> | 229 <li><code>nsw</code> and <code>nuw</code></li> |
| 257 <li><code>exact</code></li> | 230 <li><code>exact</code></li> |
| 258 </ul> | 231 </ul> |
| 259 <p>Only the LLVM instructions listed here are supported by PNaCl bitcode.</p> | 232 <p>Only the LLVM instructions listed here are supported by PNaCl bitcode.</p> |
| 260 <ul class="small-gap"> | 233 <ul class="small-gap"> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 </li> | 297 </li> |
| 325 <li><code>icmp</code></li> | 298 <li><code>icmp</code></li> |
| 326 <li><code>fcmp</code></li> | 299 <li><code>fcmp</code></li> |
| 327 <li><code>phi</code></li> | 300 <li><code>phi</code></li> |
| 328 <li><code>select</code></li> | 301 <li><code>select</code></li> |
| 329 <li><code>call</code></li> | 302 <li><code>call</code></li> |
| 330 <li><code>unreachable</code></li> | 303 <li><code>unreachable</code></li> |
| 331 <li><code>insertelement</code></li> | 304 <li><code>insertelement</code></li> |
| 332 <li><code>extractelement</code></li> | 305 <li><code>extractelement</code></li> |
| 333 </ul> | 306 </ul> |
| 334 </section><section id="alloca"> | 307 <h3 id="alloca"><span id="bitcode-allocainst"></span><code>alloca</code></h3> |
| 335 <span id="bitcode-allocainst"></span><h3 id="alloca"><span id="bitcode-allocains
t"></span><code>alloca</code></h3> | |
| 336 <p>The only allowed type for <code>alloca</code> instructions in PNaCl bitcode i
s i8. The | 308 <p>The only allowed type for <code>alloca</code> instructions in PNaCl bitcode i
s i8. The |
| 337 size argument must be an i32. For example:</p> | 309 size argument must be an i32. For example:</p> |
| 338 <pre> | 310 <pre> |
| 339 %buf = alloca i8, i32 8, align 4 | 311 %buf = alloca i8, i32 8, align 4 |
| 340 </pre> | 312 </pre> |
| 341 </section></section><section id="intrinsic-functions"> | |
| 342 <h2 id="intrinsic-functions">Intrinsic Functions</h2> | 313 <h2 id="intrinsic-functions">Intrinsic Functions</h2> |
| 343 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#intrinsics">LLVM LangRef: Intrinsic Functions</a></p> | 314 <p><a class="reference external" href="http://llvm.org/releases/3.3/docs/LangRef
.html#intrinsics">LLVM LangRef: Intrinsic Functions</a></p> |
| 344 <section id="list-of-allowed-intrinsics"> | |
| 345 <h3 id="list-of-allowed-intrinsics">List of allowed intrinsics</h3> | 315 <h3 id="list-of-allowed-intrinsics">List of allowed intrinsics</h3> |
| 346 <p>The only intrinsics supported by PNaCl bitcode are the following.</p> | 316 <p>The only intrinsics supported by PNaCl bitcode are the following.</p> |
| 347 <ul class="small-gap"> | 317 <ul class="small-gap"> |
| 348 <li><code>llvm.memcpy</code></li> | 318 <li><code>llvm.memcpy</code></li> |
| 349 <li><code>llvm.memmove</code></li> | 319 <li><code>llvm.memmove</code></li> |
| 350 <li><p class="first"><code>llvm.memset</code></p> | 320 <li><p class="first"><code>llvm.memset</code></p> |
| 351 <p>These intrinsics are only supported with an i32 <code>len</code> argument.</p
> | 321 <p>These intrinsics are only supported with an i32 <code>len</code> argument.</p
> |
| 352 </li> | 322 </li> |
| 353 <li><p class="first"><code>llvm.bswap</code></p> | 323 <li><p class="first"><code>llvm.bswap</code></p> |
| 354 <p>The overloaded <code>llvm.bswap</code> intrinsic is only supported with the f
ollowing | 324 <p>The overloaded <code>llvm.bswap</code> intrinsic is only supported with the f
ollowing |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 <li><code>llvm.nacl.atomic.store</code></li> | 360 <li><code>llvm.nacl.atomic.store</code></li> |
| 391 <li><code>llvm.nacl.atomic.load</code></li> | 361 <li><code>llvm.nacl.atomic.load</code></li> |
| 392 <li><code>llvm.nacl.atomic.rmw</code></li> | 362 <li><code>llvm.nacl.atomic.rmw</code></li> |
| 393 <li><code>llvm.nacl.atomic.cmpxchg</code></li> | 363 <li><code>llvm.nacl.atomic.cmpxchg</code></li> |
| 394 <li><code>llvm.nacl.atomic.fence</code></li> | 364 <li><code>llvm.nacl.atomic.fence</code></li> |
| 395 <li><code>llvm.nacl.atomic.fence.all</code></li> | 365 <li><code>llvm.nacl.atomic.fence.all</code></li> |
| 396 <li><p class="first"><code>llvm.nacl.atomic.is.lock.free</code></p> | 366 <li><p class="first"><code>llvm.nacl.atomic.is.lock.free</code></p> |
| 397 <p>See <a class="reference internal" href="#bitcode-atomicintrinsics"><em>atomic
intrinsics</em></a>.</p> | 367 <p>See <a class="reference internal" href="#bitcode-atomicintrinsics"><em>atomic
intrinsics</em></a>.</p> |
| 398 </li> | 368 </li> |
| 399 </ul> | 369 </ul> |
| 400 </section><section id="thread-pointer-related-intrinsics"> | 370 <h3 id="thread-pointer-related-intrinsics"><span id="bitcode-threadpointerintrin
sics"></span>Thread pointer related intrinsics</h3> |
| 401 <span id="bitcode-threadpointerintrinsics"></span><h3 id="thread-pointer-related
-intrinsics"><span id="bitcode-threadpointerintrinsics"></span>Thread pointer re
lated intrinsics</h3> | |
| 402 <pre> | 371 <pre> |
| 403 declare i8* @llvm.nacl.read.tp() | 372 declare i8* @llvm.nacl.read.tp() |
| 404 </pre> | 373 </pre> |
| 405 <p>Returns a read-only thread pointer. The value is controlled by the embedding | 374 <p>Returns a read-only thread pointer. The value is controlled by the embedding |
| 406 sandbox’s runtime.</p> | 375 sandbox’s runtime.</p> |
| 407 </section><section id="setjmp-and-longjmp"> | 376 <h3 id="setjmp-and-longjmp"><span id="bitcode-setjmplongjmp"></span>Setjmp and L
ongjmp</h3> |
| 408 <span id="bitcode-setjmplongjmp"></span><h3 id="setjmp-and-longjmp"><span id="bi
tcode-setjmplongjmp"></span>Setjmp and Longjmp</h3> | |
| 409 <pre> | 377 <pre> |
| 410 declare void @llvm.nacl.longjmp(i8* %jmpbuf, i32) | 378 declare void @llvm.nacl.longjmp(i8* %jmpbuf, i32) |
| 411 declare i32 @llvm.nacl.setjmp(i8* %jmpbuf) | 379 declare i32 @llvm.nacl.setjmp(i8* %jmpbuf) |
| 412 </pre> | 380 </pre> |
| 413 <p>These intrinsics implement the semantics of C11 <code>setjmp</code> and <code
>longjmp</code>. The | 381 <p>These intrinsics implement the semantics of C11 <code>setjmp</code> and <code
>longjmp</code>. The |
| 414 <code>jmpbuf</code> pointer must be 64-bit aligned and point to at least 1024 by
tes of | 382 <code>jmpbuf</code> pointer must be 64-bit aligned and point to at least 1024 by
tes of |
| 415 allocated memory.</p> | 383 allocated memory.</p> |
| 416 </section><section id="atomic-intrinsics"> | 384 <h3 id="atomic-intrinsics"><span id="bitcode-atomicintrinsics"></span>Atomic int
rinsics</h3> |
| 417 <span id="bitcode-atomicintrinsics"></span><h3 id="atomic-intrinsics"><span id="
bitcode-atomicintrinsics"></span>Atomic intrinsics</h3> | |
| 418 <pre> | 385 <pre> |
| 419 declare iN @llvm.nacl.atomic.load.<size>( | 386 declare iN @llvm.nacl.atomic.load.<size>( |
| 420 iN* <source>, i32 <memory_order>) | 387 iN* <source>, i32 <memory_order>) |
| 421 declare void @llvm.nacl.atomic.store.<size>( | 388 declare void @llvm.nacl.atomic.store.<size>( |
| 422 iN <operand>, iN* <destination>, i32 <memory_order>) | 389 iN <operand>, iN* <destination>, i32 <memory_order>) |
| 423 declare iN @llvm.nacl.atomic.rmw.<size>( | 390 declare iN @llvm.nacl.atomic.rmw.<size>( |
| 424 i32 <computation>, iN* <object>, iN <operand>, i32 &
lt;memory_order>) | 391 i32 <computation>, iN* <object>, iN <operand>, i32 &
lt;memory_order>) |
| 425 declare iN @llvm.nacl.atomic.cmpxchg.<size>( | 392 declare iN @llvm.nacl.atomic.cmpxchg.<size>( |
| 426 iN* <object>, iN <expected>, iN <desired>, | 393 iN* <object>, iN <expected>, iN <desired>, |
| 427 i32 <memory_order_success>, i32 <memory_order_failure>) | 394 i32 <memory_order_success>, i32 <memory_order_failure>) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 <pre> | 433 <pre> |
| 467 declare i1 @llvm.nacl.atomic.is.lock.free(i32 <byte_size>, i8* <a
ddress>) | 434 declare i1 @llvm.nacl.atomic.is.lock.free(i32 <byte_size>, i8* <a
ddress>) |
| 468 </pre> | 435 </pre> |
| 469 <p>The <code>llvm.nacl.atomic.is.lock.free</code> intrinsic is designed to | 436 <p>The <code>llvm.nacl.atomic.is.lock.free</code> intrinsic is designed to |
| 470 determine at translation time whether atomic operations of a certain | 437 determine at translation time whether atomic operations of a certain |
| 471 <code>byte_size</code> (a compile-time constant), at a particular <code>address<
/code>, | 438 <code>byte_size</code> (a compile-time constant), at a particular <code>address<
/code>, |
| 472 are lock-free or not. This reflects the C11 <code>atomic_is_lock_free</code> | 439 are lock-free or not. This reflects the C11 <code>atomic_is_lock_free</code> |
| 473 function from header <code><stdatomic.h></code> and the C++11 <code>is_loc
k_free</code> | 440 function from header <code><stdatomic.h></code> and the C++11 <code>is_loc
k_free</code> |
| 474 member function in header <code><atomic></code>. It can be used through th
e | 441 member function in header <code><atomic></code>. It can be used through th
e |
| 475 <code>__nacl_atomic_is_lock_free</code> builtin.</p> | 442 <code>__nacl_atomic_is_lock_free</code> builtin.</p> |
| 476 </section></section></section> | 443 </section> |
| 477 | 444 |
| 478 {{/partials.standard_nacl_article}} | 445 {{/partials.standard_nacl_article}} |
| OLD | NEW |