</li>
<li><a href="#bitwiseops">Bitwise Binary Operations</a>
<ol>
- <li><a href="#i_and">'<tt>and</tt>' Instruction</a></li>
- <li><a href="#i_or">'<tt>or</tt>' Instruction</a></li>
- <li><a href="#i_xor">'<tt>xor</tt>' Instruction</a></li>
<li><a href="#i_shl">'<tt>shl</tt>' Instruction</a></li>
<li><a href="#i_lshr">'<tt>lshr</tt>' Instruction</a></li>
<li><a href="#i_ashr">'<tt>ashr</tt>' Instruction</a></li>
+ <li><a href="#i_and">'<tt>and</tt>' Instruction</a></li>
+ <li><a href="#i_or">'<tt>or</tt>' Instruction</a></li>
+ <li><a href="#i_xor">'<tt>xor</tt>' Instruction</a></li>
</ol>
</li>
<li><a href="#vectorops">Vector Operations</a>
prototype and implemented declaration of the function (as does normal C).
</dd>
- <dt><b>"<tt>csretcc</tt>" - The C struct return calling convention</b>:</dt>
-
- <dd>This calling convention matches the target C calling conventions, except
- that functions with this convention are required to take a pointer as their
- first argument, and the return type of the function must be void. This is
- used for C functions that return aggregates by-value. In this case, the
- function has been transformed to take a pointer to the struct as the first
- argument to the function. For targets where the ABI specifies specific
- behavior for structure-return calls, the calling convention can be used to
- distinguish between struct return functions and other functions that take a
- pointer to a struct as the first argument.
- </dd>
-
<dt><b>"<tt>fastcc</tt>" - The fast calling convention</b>:</dt>
<dd>This calling convention attempts to make calls as fast as possible
</div>
+<!-- ======================================================================= -->
+<div class="doc_subsection">
+ <a name="visibility">Visibility Styles</a>
+</div>
+
+<div class="doc_text">
+
+<p>
+All Global Variables and Functions have one of the following visibility styles:
+</p>
+
+<dl>
+ <dt><b>"<tt>default</tt>" - Default style</b>:</dt>
+
+ <dd>On ELF, default visibility means that the declaration is visible to other
+ modules and, in shared libraries, means that the declared entity may be
+ overridden. On Darwin, default visibility means that the declaration is
+ visible to other modules. Default visibility corresponds to "external
+ linkage" in the language.
+ </dd>
+
+ <dt><b>"<tt>hidden</tt>" - Hidden style</b>:</dt>
+
+ <dd>Two declarations of an object with hidden visibility refer to the same
+ object if they are in the same shared object. Usually, hidden visibility
+ indicates that the symbol will not be placed into the dynamic symbol table,
+ so no other module (executable or shared library) can reference it
+ directly.
+ </dd>
+
+</dl>
+
+</div>
+
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="globalvars">Global Variables</a>
<p>LLVM function definitions consist of the "<tt>define</tt>" keyord,
an optional <a href="#linkage">linkage type</a>, an optional
+<a href="#visibility">visibility style</a>, an optional
<a href="#callingconv">calling convention</a>, a return type, an optional
<a href="#paramattrs">parameter attribute</a> for the return type, a function
name, a (possibly empty) argument list (each with optional
-<a href="#paramattrs">parameter attributes</a>), an optional section, an
-optional alignment, an opening curly brace, a list of basic blocks, and a
-closing curly brace. LLVM function declarations
-consist of the "<tt>declare</tt>" keyword, an optional <a
- href="#callingconv">calling convention</a>, a return type, an optional
+<a href="#paramattrs">parameter attributes</a>), an optional section, an
+optional alignment, an opening curly brace, a list of basic blocks, and a
+closing curly brace.
+
+LLVM function declarations consist of the "<tt>declare</tt>" keyword, an
+optional <a href="#linkage">linkage type</a>, an optional
+<a href="#visibility">visibility style</a>, an optional
+<a href="#callingconv">calling convention</a>, a return type, an optional
<a href="#paramattrs">parameter attribute</a> for the return type, a function
name, a possibly empty list of arguments, and an optional alignment.</p>
type so two functions types that differ only by the parameter attributes
are different function types.</p>
- <p>Parameter attributes consist of an at sign (@) followed by either a single
- keyword or a comma separate list of keywords enclosed in parentheses. For
+ <p>Parameter attributes are simple keywords that follow the type specified. If
+ multiple parameter attributes are needed, they are space separated. For
example:</p><pre>
- %someFunc = i16 @zext (i8 @(sext) %someParam)
- %someFunc = i16 @zext (i8 @zext %someParam)</pre>
+ %someFunc = i16 (i8 sext %someParam) zext
+ %someFunc = i16 (i8 zext %someParam) zext</pre>
<p>Note that the two function types above are unique because the parameter has
- a different attribute (@sext in the first one, @zext in the second).</p>
+ a different attribute (sext in the first one, zext in the second). Also note
+ that the attribute for the function result (zext) comes immediately after the
+ argument list.</p>
<p>Currently, only the following parameter attributes are defined:</p>
<dl>
- <dt><tt>@zext</tt></dt>
+ <dt><tt>zext</tt></dt>
<dd>This indicates that the parameter should be zero extended just before
a call to this function.</dd>
- <dt><tt>@sext</tt></dt>
+ <dt><tt>sext</tt></dt>
<dd>This indicates that the parameter should be sign extended just before
a call to this function.</dd>
+ <dt><tt>inreg</tt></dt>
+ <dd>This indicates that the parameter should be placed in register (if
+ possible) during assembling function call. Support for this attribute is
+ target-specific</dd>
+ <dt><tt>sret</tt></dt>
+ <dd>This indicates that the parameter specifies the address of a structure
+ that is the return value of the function in the source program.
+ </dd>
</dl>
- <p>The current motivation for parameter attributes is to enable the sign and
- zero extend information necessary for the C calling convention to be passed
- from the front end to LLVM. The <tt>@zext</tt> and <tt>@sext</tt> attributes
- are used by the code generator to perform the required extension. However,
- parameter attributes are an orthogonal feature to calling conventions and
- may be used for other purposes in the future.</p>
</div>
<!-- ======================================================================= -->
<td class="left">function taking an <tt>i32</tt>, returning an <tt>i32</tt>
</td>
</tr><tr class="layout">
- <td class="left"><tt>float (i16 @sext, i32 *) *
+ <td class="left"><tt>float (i16 sext, i32 *) *
</tt></td>
<td class="left"><a href="#t_pointer">Pointer</a> to a function that takes
an <tt>i16</tt> that should be sign extended and a
and produce a single value. The resulting value of the bitwise binary
operators is always the same type as its first operand.</p>
</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="i_shl">'<tt>shl</tt>'
+Instruction</a> </div>
+<div class="doc_text">
+<h5>Syntax:</h5>
+<pre> <result> = shl <ty> <var1>, <var2> <i>; yields {ty}:result</i>
+</pre>
+<h5>Overview:</h5>
+<p>The '<tt>shl</tt>' instruction returns the first operand shifted to
+the left a specified number of bits.</p>
+<h5>Arguments:</h5>
+<p>Both arguments to the '<tt>shl</tt>' instruction must be the same <a
+ href="#t_integer">integer</a> type.</p>
+<h5>Semantics:</h5>
+<p>The value produced is <tt>var1</tt> * 2<sup><tt>var2</tt></sup>.</p>
+<h5>Example:</h5><pre>
+ <result> = shl i32 4, %var <i>; yields {i32}: 4 << %var</i>
+ <result> = shl i32 4, 2 <i>; yields {i32}: 16</i>
+ <result> = shl i32 1, 10 <i>; yields {i32}: 1024</i>
+</pre>
+</div>
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="i_lshr">'<tt>lshr</tt>'
+Instruction</a> </div>
+<div class="doc_text">
+<h5>Syntax:</h5>
+<pre> <result> = lshr <ty> <var1>, <var2> <i>; yields {ty}:result</i>
+</pre>
+
+<h5>Overview:</h5>
+<p>The '<tt>lshr</tt>' instruction (logical shift right) returns the first
+operand shifted to the right a specified number of bits.</p>
+
+<h5>Arguments:</h5>
+<p>Both arguments to the '<tt>lshr</tt>' instruction must be the same
+<a href="#t_integer">integer</a> type.</p>
+
+<h5>Semantics:</h5>
+<p>This instruction always performs a logical shift right operation. The most
+significant bits of the result will be filled with zero bits after the
+shift.</p>
+
+<h5>Example:</h5>
+<pre>
+ <result> = lshr i32 4, 1 <i>; yields {i32}:result = 2</i>
+ <result> = lshr i32 4, 2 <i>; yields {i32}:result = 1</i>
+ <result> = lshr i8 4, 3 <i>; yields {i8}:result = 0</i>
+ <result> = lshr i8 -2, 1 <i>; yields {i8}:result = 0x7FFFFFFF </i>
+</pre>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="i_ashr">'<tt>ashr</tt>'
+Instruction</a> </div>
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+<pre> <result> = ashr <ty> <var1>, <var2> <i>; yields {ty}:result</i>
+</pre>
+
+<h5>Overview:</h5>
+<p>The '<tt>ashr</tt>' instruction (arithmetic shift right) returns the first
+operand shifted to the right a specified number of bits.</p>
+
+<h5>Arguments:</h5>
+<p>Both arguments to the '<tt>ashr</tt>' instruction must be the same
+<a href="#t_integer">integer</a> type.</p>
+
+<h5>Semantics:</h5>
+<p>This instruction always performs an arithmetic shift right operation,
+The most significant bits of the result will be filled with the sign bit
+of <tt>var1</tt>.</p>
+
+<h5>Example:</h5>
+<pre>
+ <result> = ashr i32 4, 1 <i>; yields {i32}:result = 2</i>
+ <result> = ashr i32 4, 2 <i>; yields {i32}:result = 1</i>
+ <result> = ashr i8 4, 3 <i>; yields {i8}:result = 0</i>
+ <result> = ashr i8 -2, 1 <i>; yields {i8}:result = -1</i>
+</pre>
+</div>
+
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="i_and">'<tt>and</tt>'
Instruction</a> </div>
<result> = xor i32 %V, -1 <i>; yields {i32}:result = ~%V</i>
</pre>
</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_shl">'<tt>shl</tt>'
-Instruction</a> </div>
-<div class="doc_text">
-<h5>Syntax:</h5>
-<pre> <result> = shl <ty> <var1>, i8 <var2> <i>; yields {ty}:result</i>
-</pre>
-<h5>Overview:</h5>
-<p>The '<tt>shl</tt>' instruction returns the first operand shifted to
-the left a specified number of bits.</p>
-<h5>Arguments:</h5>
-<p>The first argument to the '<tt>shl</tt>' instruction must be an <a
- href="#t_integer">integer</a> type. The second argument must be an '<tt>i8</tt>'
-type.</p>
-<h5>Semantics:</h5>
-<p>The value produced is <tt>var1</tt> * 2<sup><tt>var2</tt></sup>.</p>
-<h5>Example:</h5>
-<pre> <result> = shl i32 4, i8 %var <i>; yields {i32}:result = 4 << %var</i>
- <result> = shl i32 4, i8 2 <i>; yields {i32}:result = 16</i>
- <result> = shl i32 1, i8 10 <i>; yields {i32}:result = 1024</i>
-</pre>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_lshr">'<tt>lshr</tt>'
-Instruction</a> </div>
-<div class="doc_text">
-<h5>Syntax:</h5>
-<pre> <result> = lshr <ty> <var1>, i8 <var2> <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>lshr</tt>' instruction (logical shift right) returns the first
-operand shifted to the right a specified number of bits.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument to the '<tt>lshr</tt>' instruction must be an <a
- href="#t_integer">integer</a> type. The second argument must be an '<tt>i8</tt>' type.</p>
-
-<h5>Semantics:</h5>
-<p>This instruction always performs a logical shift right operation. The
-<tt>var2</tt> most significant bits will be filled with zero bits after the
-shift.</p>
-
-<h5>Example:</h5>
-<pre>
- <result> = lshr i32 4, i8 1 <i>; yields {i32}:result = 2</i>
- <result> = lshr i32 4, i8 2 <i>; yields {i32}:result = 1</i>
- <result> = lshr i8 4, i8 3 <i>; yields {i8 }:result = 0</i>
- <result> = lshr i8 -2, i8 1 <i>; yields {i8 }:result = 0x7FFFFFFF </i>
-</pre>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"> <a name="i_ashr">'<tt>ashr</tt>'
-Instruction</a> </div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre> <result> = ashr <ty> <var1>, i8 <var2> <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>ashr</tt>' instruction (arithmetic shift right) returns the first
-operand shifted to the right a specified number of bits.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument to the '<tt>ashr</tt>' instruction must be an
-<a href="#t_integer">integer</a> type. The second argument must be an
-'<tt>i8</tt>' type.</p>
-
-<h5>Semantics:</h5>
-<p>This instruction always performs an arithmetic shift right operation,
-regardless of whether the arguments are signed or not. The <tt>var2</tt> most
-significant bits will be filled with the sign bit of <tt>var1</tt>.</p>
-
-<h5>Example:</h5>
-<pre>
- <result> = ashr i32 4, i8 1 <i>; yields {i32}:result = 2</i>
- <result> = ashr i32 4, i8 2 <i>; yields {i32}:result = 1</i>
- <result> = ashr i8 4, i8 3 <i>; yields {i8}:result = 0</i>
- <result> = ashr i8 -2, i8 1 <i>; yields {i8 }:result = -1</i>
-</pre>
-</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
- <a name="i_fp2uint">'<tt>fptoui .. to</tt>' Instruction</a>
+ <a name="i_fptoui">'<tt>fptoui .. to</tt>' Instruction</a>
</div>
<div class="doc_text">
</ol>
<p>If the operands are <a href="#t_pointer">pointer</a> typed, the pointer
values are treated as integers and then compared.</p>
-<p>If the operands are <a href="#t_packed">packed</a> typed, the elements of
-the vector are compared in turn and the predicate must hold for all
-elements.</p>
<h5>Example:</h5>
<pre> <result> = icmp eq i32 4, 5 <i>; yields: result=false</i>
<li><tt>uno</tt>: yields <tt>true</tt> if either operand is a QNAN.</li>
<li><tt>true</tt>: always yields <tt>true</tt>, regardless of operands.</li>
</ol>
-<p>If the operands are <a href="#t_packed">packed</a> typed, the elements of
-the vector are compared in turn and the predicate must hold for all elements.
-</p>
<h5>Example:</h5>
<pre> <result> = fcmp oeq float 4.0, 5.0 <i>; yields: result=false</i>