diff options
Diffstat (limited to 'devdocs/gcc~13')
385 files changed, 25870 insertions, 0 deletions
diff --git a/devdocs/gcc~13/_0040encode.html b/devdocs/gcc~13/_0040encode.html new file mode 100644 index 00000000..8718619f --- /dev/null +++ b/devdocs/gcc~13/_0040encode.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="g_t_0040encode"> <div class="nav-panel"> <p> Next: <a href="method-signatures" accesskey="n" rel="next">Method Signatures</a>, Previous: <a href="legacy-type-encoding" accesskey="p" rel="prev">Legacy Type Encoding</a>, Up: <a href="type-encoding" accesskey="u" rel="up">Type Encoding</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="g_t_0040encode-1"><span>8.3.2 @encode<a class="copiable-link" href="#g_t_0040encode-1"> ¶</a></span></h1> <p>GNU Objective-C supports the <code class="code">@encode</code> syntax that allows you to create a type encoding from a C/Objective-C type. For example, <code class="code">@encode(int)</code> is compiled by the compiler into <code class="code">"i"</code>. </p> <p><code class="code">@encode</code> does not support type qualifiers other than <code class="code">const</code>. For example, <code class="code">@encode(const char*)</code> is valid and is compiled into <code class="code">"r*"</code>, while <code class="code">@encode(bycopy char *)</code> is invalid and will cause a compilation error. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/_0040encode.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/_0040encode.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/_005f_005fatomic-builtins.html b/devdocs/gcc~13/_005f_005fatomic-builtins.html new file mode 100644 index 00000000..0824f12d --- /dev/null +++ b/devdocs/gcc~13/_005f_005fatomic-builtins.html @@ -0,0 +1,90 @@ +<div class="section-level-extent" id="g_t_005f_005fatomic-Builtins"> <div class="nav-panel"> <p> Next: <a href="integer-overflow-builtins" accesskey="n" rel="next">Built-in Functions to Perform Arithmetic with Overflow Checking</a>, Previous: <a href="_005f_005fsync-builtins" accesskey="p" rel="prev">Legacy <code class="code">__sync</code> Built-in Functions for Atomic Memory Access</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Built-in-Functions-for-Memory-Model-Aware-Atomic-Operations"><span>6.55 Built-in Functions for Memory Model Aware Atomic Operations<a class="copiable-link" href="#Built-in-Functions-for-Memory-Model-Aware-Atomic-Operations"> ¶</a></span></h1> <p>The following built-in functions approximately match the requirements for the C++11 memory model. They are all identified by being prefixed with ‘<samp class="samp">__atomic</samp>’ and most are overloaded so that they work with multiple types. </p> <p>These functions are intended to replace the legacy ‘<samp class="samp">__sync</samp>’ builtins. The main difference is that the memory order that is requested is a parameter to the functions. New code should always use the ‘<samp class="samp">__atomic</samp>’ builtins rather than the ‘<samp class="samp">__sync</samp>’ builtins. </p> <p>Note that the ‘<samp class="samp">__atomic</samp>’ builtins assume that programs will conform to the C++11 memory model. In particular, they assume that programs are free of data races. See the C++11 standard for detailed requirements. </p> <p>The ‘<samp class="samp">__atomic</samp>’ builtins can be used with any integral scalar or pointer type that is 1, 2, 4, or 8 bytes in length. 16-byte integral types are also allowed if ‘<samp class="samp">__int128</samp>’ (see <a class="pxref" href="_005f_005fint128">128-bit Integers</a>) is supported by the architecture. </p> <p>The four non-arithmetic functions (load, store, exchange, and compare_exchange) all have a generic version as well. This generic version works on any data type. It uses the lock-free built-in function if the specific data type size makes that possible; otherwise, an external call is left to be resolved at run time. This external call is the same format with the addition of a ‘<samp class="samp">size_t</samp>’ parameter inserted as the first parameter indicating the size of the object being pointed to. All objects must be the same size. </p> <p>There are 6 different memory orders that can be specified. These map to the C++11 memory orders with the same names, see the C++11 standard or the <a class="uref" href="https://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync">GCC wiki on atomic synchronization</a> for detailed definitions. Individual targets may also support additional memory orders for use on specific architectures. Refer to the target documentation for details of these. </p> <p>An atomic operation can both constrain code motion and be mapped to hardware instructions for synchronization between threads (e.g., a fence). To which extent this happens is controlled by the memory orders, which are listed here in approximately ascending order of strength. The description of each memory order is only meant to roughly illustrate the effects and is not a specification; see the C++11 memory model for precise semantics. </p> <dl class="table"> <dt><code class="code">__ATOMIC_RELAXED</code></dt> <dd><p>Implies no inter-thread ordering constraints. </p></dd> <dt><code class="code">__ATOMIC_CONSUME</code></dt> <dd><p>This is currently implemented using the stronger <code class="code">__ATOMIC_ACQUIRE</code> memory order because of a deficiency in C++11’s semantics for <code class="code">memory_order_consume</code>. </p></dd> <dt><code class="code">__ATOMIC_ACQUIRE</code></dt> <dd><p>Creates an inter-thread happens-before constraint from the release (or stronger) semantic store to this acquire load. Can prevent hoisting of code to before the operation. </p></dd> <dt><code class="code">__ATOMIC_RELEASE</code></dt> <dd><p>Creates an inter-thread happens-before constraint to acquire (or stronger) semantic loads that read from this release store. Can prevent sinking of code to after the operation. </p></dd> <dt><code class="code">__ATOMIC_ACQ_REL</code></dt> <dd><p>Combines the effects of both <code class="code">__ATOMIC_ACQUIRE</code> and <code class="code">__ATOMIC_RELEASE</code>. </p></dd> <dt><code class="code">__ATOMIC_SEQ_CST</code></dt> <dd><p>Enforces total ordering with all other <code class="code">__ATOMIC_SEQ_CST</code> operations. </p></dd> </dl> <p>Note that in the C++11 memory model, <em class="emph">fences</em> (e.g., ‘<samp class="samp">__atomic_thread_fence</samp>’) take effect in combination with other atomic operations on specific memory locations (e.g., atomic loads); operations on specific memory locations do not necessarily affect other operations in the same way. </p> <p>Target architectures are encouraged to provide their own patterns for each of the atomic built-in functions. If no target is provided, the original non-memory model set of ‘<samp class="samp">__sync</samp>’ atomic built-in functions are used, along with any required synchronization fences surrounding it in order to achieve the proper behavior. Execution in this case is subject to the same restrictions as those built-in functions. </p> <p>If there is no pattern or mechanism to provide a lock-free instruction sequence, a call is made to an external routine with the same parameters to be resolved at run time. </p> <p>When implementing patterns for these built-in functions, the memory order parameter can be ignored as long as the pattern implements the most restrictive <code class="code">__ATOMIC_SEQ_CST</code> memory order. Any of the other memory orders execute correctly with this memory order but they may not execute as efficiently as they could with a more appropriate implementation of the relaxed requirements. </p> <p>Note that the C++11 standard allows for the memory order parameter to be determined at run time rather than at compile time. These built-in functions map any run-time value to <code class="code">__ATOMIC_SEQ_CST</code> rather than invoke a runtime library call or inline a switch statement. This is standard compliant, safe, and the simplest approach for now. </p> <p>The memory order parameter is a signed int, but only the lower 16 bits are reserved for the memory order. The remainder of the signed int is reserved for target use and should be 0. Use of the predefined atomic values ensures proper usage. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fload_005fn"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_load_n</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fload_005fn"> ¶</a></span> +</dt> <dd> +<p>This built-in function implements an atomic load operation. It returns the contents of <code class="code">*<var class="var">ptr</var></code>. </p> <p>The valid memory order variants are <code class="code">__ATOMIC_RELAXED</code>, <code class="code">__ATOMIC_SEQ_CST</code>, <code class="code">__ATOMIC_ACQUIRE</code>, and <code class="code">__ATOMIC_CONSUME</code>. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fload"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__atomic_load</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> *ret, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fload"> ¶</a></span> +</dt> <dd> +<p>This is the generic version of an atomic load. It returns the contents of <code class="code">*<var class="var">ptr</var></code> in <code class="code">*<var class="var">ret</var></code>. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fstore_005fn"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__atomic_store_n</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fstore_005fn"> ¶</a></span> +</dt> <dd> +<p>This built-in function implements an atomic store operation. It writes <code class="code"><var class="var">val</var></code> into <code class="code">*<var class="var">ptr</var></code>. </p> <p>The valid memory order variants are <code class="code">__ATOMIC_RELAXED</code>, <code class="code">__ATOMIC_SEQ_CST</code>, and <code class="code">__ATOMIC_RELEASE</code>. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fstore"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__atomic_store</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> *val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fstore"> ¶</a></span> +</dt> <dd> +<p>This is the generic version of an atomic store. It stores the value of <code class="code">*<var class="var">val</var></code> into <code class="code">*<var class="var">ptr</var></code>. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fexchange_005fn"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_exchange_n</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fexchange_005fn"> ¶</a></span> +</dt> <dd> +<p>This built-in function implements an atomic exchange operation. It writes <var class="var">val</var> into <code class="code">*<var class="var">ptr</var></code>, and returns the previous contents of <code class="code">*<var class="var">ptr</var></code>. </p> <p>All memory order variants are valid. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fexchange"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__atomic_exchange</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> *val, <var class="var">type</var> *ret, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fexchange"> ¶</a></span> +</dt> <dd> +<p>This is the generic version of an atomic exchange. It stores the contents of <code class="code">*<var class="var">val</var></code> into <code class="code">*<var class="var">ptr</var></code>. The original value of <code class="code">*<var class="var">ptr</var></code> is copied into <code class="code">*<var class="var">ret</var></code>. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fcompare_005fexchange_005fn"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__atomic_compare_exchange_n</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> *expected, <var class="var">type</var> desired, bool weak, int success_memorder, int failure_memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fcompare_005fexchange_005fn"> ¶</a></span> +</dt> <dd> +<p>This built-in function implements an atomic compare and exchange operation. This compares the contents of <code class="code">*<var class="var">ptr</var></code> with the contents of <code class="code">*<var class="var">expected</var></code>. If equal, the operation is a <em class="emph">read-modify-write</em> operation that writes <var class="var">desired</var> into <code class="code">*<var class="var">ptr</var></code>. If they are not equal, the operation is a <em class="emph">read</em> and the current contents of <code class="code">*<var class="var">ptr</var></code> are written into <code class="code">*<var class="var">expected</var></code>. <var class="var">weak</var> is <code class="code">true</code> for weak compare_exchange, which may fail spuriously, and <code class="code">false</code> for the strong variation, which never fails spuriously. Many targets only offer the strong variation and ignore the parameter. When in doubt, use the strong variation. </p> <p>If <var class="var">desired</var> is written into <code class="code">*<var class="var">ptr</var></code> then <code class="code">true</code> is returned and memory is affected according to the memory order specified by <var class="var">success_memorder</var>. There are no restrictions on what memory order can be used here. </p> <p>Otherwise, <code class="code">false</code> is returned and memory is affected according to <var class="var">failure_memorder</var>. This memory order cannot be <code class="code">__ATOMIC_RELEASE</code> nor <code class="code">__ATOMIC_ACQ_REL</code>. It also cannot be a stronger order than that specified by <var class="var">success_memorder</var>. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fcompare_005fexchange"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__atomic_compare_exchange</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> *expected, <var class="var">type</var> *desired, bool weak, int success_memorder, int failure_memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fcompare_005fexchange"> ¶</a></span> +</dt> <dd> +<p>This built-in function implements the generic version of <code class="code">__atomic_compare_exchange</code>. The function is virtually identical to <code class="code">__atomic_compare_exchange_n</code>, except the desired value is also a pointer. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fadd_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_add_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fadd_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005fsub_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_sub_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fsub_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005fand_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_and_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fand_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005fxor_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_xor_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fxor_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005for_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_or_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005for_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005fnand_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_nand_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fnand_005ffetch"> ¶</a></span> +</dt> <dd> +<p>These built-in functions perform the operation suggested by the name, and return the result of the operation. Operations on pointer arguments are performed as if the operands were of the <code class="code">uintptr_t</code> type. That is, they are not scaled by the size of the type to which the pointer points. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ *ptr <var class="var">op</var>= val; return *ptr; } +{ *ptr = ~(*ptr & val); return *ptr; } // nand</pre> +</div> <p>The object pointed to by the first argument must be of integer or pointer type. It must not be a boolean type. All memory orders are valid. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005ffetch_005fadd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_fetch_add</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005ffetch_005fadd"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005ffetch_005fsub"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_fetch_sub</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005ffetch_005fsub"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005ffetch_005fand"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_fetch_and</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005ffetch_005fand"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005ffetch_005fxor"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_fetch_xor</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005ffetch_005fxor"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005ffetch_005for"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_fetch_or</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005ffetch_005for"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fatomic_005ffetch_005fnand"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__atomic_fetch_nand</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> val, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005ffetch_005fnand"> ¶</a></span> +</dt> <dd> +<p>These built-in functions perform the operation suggested by the name, and return the value that had previously been in <code class="code">*<var class="var">ptr</var></code>. Operations on pointer arguments are performed as if the operands were of the <code class="code">uintptr_t</code> type. That is, they are not scaled by the size of the type to which the pointer points. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ tmp = *ptr; *ptr <var class="var">op</var>= val; return tmp; } +{ tmp = *ptr; *ptr = ~(*ptr & val); return tmp; } // nand</pre> +</div> <p>The same constraints on arguments apply as for the corresponding <code class="code">__atomic_op_fetch</code> built-in functions. All memory orders are valid. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005ftest_005fand_005fset"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__atomic_test_and_set</strong> <code class="def-code-arguments">(void *ptr, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005ftest_005fand_005fset"> ¶</a></span> +</dt> <dd> <p>This built-in function performs an atomic test-and-set operation on the byte at <code class="code">*<var class="var">ptr</var></code>. The byte is set to some implementation defined nonzero “set” value and the return value is <code class="code">true</code> if and only if the previous contents were “set”. It should be only used for operands of type <code class="code">bool</code> or <code class="code">char</code>. For other types only part of the value may be set. </p> <p>All memory orders are valid. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fclear"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__atomic_clear</strong> <code class="def-code-arguments">(bool *ptr, int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fclear"> ¶</a></span> +</dt> <dd> <p>This built-in function performs an atomic clear operation on <code class="code">*<var class="var">ptr</var></code>. After the operation, <code class="code">*<var class="var">ptr</var></code> contains 0. It should be only used for operands of type <code class="code">bool</code> or <code class="code">char</code> and in conjunction with <code class="code">__atomic_test_and_set</code>. For other types it may only clear partially. If the type is not <code class="code">bool</code> prefer using <code class="code">__atomic_store</code>. </p> <p>The valid memory order variants are <code class="code">__ATOMIC_RELAXED</code>, <code class="code">__ATOMIC_SEQ_CST</code>, and <code class="code">__ATOMIC_RELEASE</code>. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fthread_005ffence"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__atomic_thread_fence</strong> <code class="def-code-arguments">(int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fthread_005ffence"> ¶</a></span> +</dt> <dd> <p>This built-in function acts as a synchronization fence between threads based on the specified memory order. </p> <p>All memory orders are valid. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fsignal_005ffence"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__atomic_signal_fence</strong> <code class="def-code-arguments">(int memorder)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fsignal_005ffence"> ¶</a></span> +</dt> <dd> <p>This built-in function acts as a synchronization fence between a thread and signal handlers based in the same thread. </p> <p>All memory orders are valid. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005falways_005flock_005ffree"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__atomic_always_lock_free</strong> <code class="def-code-arguments">(size_t size, void *ptr)</code><a class="copiable-link" href="#index-_005f_005fatomic_005falways_005flock_005ffree"> ¶</a></span> +</dt> <dd> <p>This built-in function returns <code class="code">true</code> if objects of <var class="var">size</var> bytes always generate lock-free atomic instructions for the target architecture. <var class="var">size</var> must resolve to a compile-time constant and the result also resolves to a compile-time constant. </p> <p><var class="var">ptr</var> is an optional pointer to the object that may be used to determine alignment. A value of 0 indicates typical alignment should be used. The compiler may also ignore this parameter. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (__atomic_always_lock_free (sizeof (long long), 0))</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fatomic_005fis_005flock_005ffree"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__atomic_is_lock_free</strong> <code class="def-code-arguments">(size_t size, void *ptr)</code><a class="copiable-link" href="#index-_005f_005fatomic_005fis_005flock_005ffree"> ¶</a></span> +</dt> <dd> <p>This built-in function returns <code class="code">true</code> if objects of <var class="var">size</var> bytes always generate lock-free atomic instructions for the target architecture. If the built-in function is not known to be lock-free, a call is made to a runtime routine named <code class="code">__atomic_is_lock_free</code>. </p> <p><var class="var">ptr</var> is an optional pointer to the object that may be used to determine alignment. A value of 0 indicates typical alignment should be used. The compiler may also ignore this parameter. </p> +</dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="integer-overflow-builtins">Built-in Functions to Perform Arithmetic with Overflow Checking</a>, Previous: <a href="_005f_005fsync-builtins">Legacy <code class="code">__sync</code> Built-in Functions for Atomic Memory Access</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/_005f_005fatomic-Builtins.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/_005f_005fatomic-Builtins.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/_005f_005fint128.html b/devdocs/gcc~13/_005f_005fint128.html new file mode 100644 index 00000000..5cb8db69 --- /dev/null +++ b/devdocs/gcc~13/_005f_005fint128.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="g_t_005f_005fint128"> <div class="nav-panel"> <p> Next: <a href="long-long" accesskey="n" rel="next">Double-Word Integers</a>, Previous: <a href="conditionals" accesskey="p" rel="prev">Conditionals with Omitted Operands</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="g_t128-bit-Integers"><span>6.9 128-bit Integers<a class="copiable-link" href="#g_t128-bit-Integers"> ¶</a></span></h1> <p>As an extension the integer scalar type <code class="code">__int128</code> is supported for targets which have an integer mode wide enough to hold 128 bits. Simply write <code class="code">__int128</code> for a signed 128-bit integer, or <code class="code">unsigned __int128</code> for an unsigned 128-bit integer. There is no support in GCC for expressing an integer constant of type <code class="code">__int128</code> for targets with <code class="code">long long</code> integer less than 128 bits wide. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/_005f_005fint128.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/_005f_005fint128.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/_005f_005fsync-builtins.html b/devdocs/gcc~13/_005f_005fsync-builtins.html new file mode 100644 index 00000000..6cb10d77 --- /dev/null +++ b/devdocs/gcc~13/_005f_005fsync-builtins.html @@ -0,0 +1,60 @@ +<div class="section-level-extent" id="g_t_005f_005fsync-Builtins"> <div class="nav-panel"> <p> Next: <a href="_005f_005fatomic-builtins" accesskey="n" rel="next">Built-in Functions for Memory Model Aware Atomic Operations</a>, Previous: <a href="offsetof" accesskey="p" rel="prev">Support for <code class="code">offsetof</code></a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Legacy-_005f_005fsync-Built-in-Functions-for-Atomic-Memory-Access"><span>6.54 Legacy __sync Built-in Functions for Atomic Memory Access<a class="copiable-link" href="#Legacy-_005f_005fsync-Built-in-Functions-for-Atomic-Memory-Access"> ¶</a></span></h1> <p>The following built-in functions are intended to be compatible with those described in the Intel Itanium Processor-specific Application Binary Interface, section 7.4. As such, they depart from normal GCC practice by not using the ‘<samp class="samp">__builtin_</samp>’ prefix and also by being overloaded so that they work on multiple types. </p> <p>The definition given in the Intel documentation allows only for the use of the types <code class="code">int</code>, <code class="code">long</code>, <code class="code">long long</code> or their unsigned counterparts. GCC allows any scalar type that is 1, 2, 4 or 8 bytes in size other than the C type <code class="code">_Bool</code> or the C++ type <code class="code">bool</code>. Operations on pointer arguments are performed as if the operands were of the <code class="code">uintptr_t</code> type. That is, they are not scaled by the size of the type to which the pointer points. </p> <p>These functions are implemented in terms of the ‘<samp class="samp">__atomic</samp>’ builtins (see <a class="pxref" href="_005f_005fatomic-builtins">Built-in Functions for Memory Model Aware Atomic Operations</a>). They should not be used for new code which should use the ‘<samp class="samp">__atomic</samp>’ builtins instead. </p> <p>Not all operations are supported by all target processors. If a particular operation cannot be implemented on the target processor, a warning is generated and a call to an external function is generated. The external function carries the same name as the built-in version, with an additional suffix ‘<samp class="samp">_<var class="var">n</var></samp>’ where <var class="var">n</var> is the size of the data type. </p> <p>In most cases, these built-in functions are considered a <em class="dfn">full barrier</em>. That is, no memory operand is moved across the operation, either forward or backward. Further, instructions are issued as necessary to prevent the processor from speculating loads across the operation and from queuing stores after the operation. </p> <p>All of the routines are described in the Intel documentation to take “an optional list of variables protected by the memory barrier”. It’s not clear what is meant by that; it could mean that <em class="emph">only</em> the listed variables are protected, or it could mean a list of additional variables to be protected. The list is ignored by GCC which treats it as empty. GCC interprets an empty list as meaning that all globally accessible variables should be protected. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fsync_005ffetch_005fand_005fadd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_fetch_and_add</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005ffetch_005fand_005fadd"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005ffetch_005fand_005fsub"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_fetch_and_sub</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005ffetch_005fand_005fsub"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005ffetch_005fand_005for"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_fetch_and_or</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005ffetch_005fand_005for"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005ffetch_005fand_005fand"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_fetch_and_and</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005ffetch_005fand_005fand"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005ffetch_005fand_005fxor"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_fetch_and_xor</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005ffetch_005fand_005fxor"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005ffetch_005fand_005fnand"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_fetch_and_nand</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005ffetch_005fand_005fnand"> ¶</a></span> +</dt> <dd> +<p>These built-in functions perform the operation suggested by the name, and returns the value that had previously been in memory. That is, operations on integer operands have the following semantics. Operations on pointer arguments are performed as if the operands were of the <code class="code">uintptr_t</code> type. That is, they are not scaled by the size of the type to which the pointer points. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ tmp = *ptr; *ptr <var class="var">op</var>= value; return tmp; } +{ tmp = *ptr; *ptr = ~(tmp & value); return tmp; } // nand</pre> +</div> <p>The object pointed to by the first argument must be of integer or pointer type. It must not be a boolean type. </p> <p><em class="emph">Note:</em> GCC 4.4 and later implement <code class="code">__sync_fetch_and_nand</code> as <code class="code">*ptr = ~(tmp & value)</code> instead of <code class="code">*ptr = ~tmp & value</code>. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fsync_005fadd_005fand_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_add_and_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005fadd_005fand_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005fsub_005fand_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_sub_and_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005fsub_005fand_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005for_005fand_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_or_and_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005for_005fand_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005fand_005fand_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_and_and_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005fand_005fand_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005fxor_005fand_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_xor_and_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005fxor_005fand_005ffetch"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005fnand_005fand_005ffetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_nand_and_fetch</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005fnand_005fand_005ffetch"> ¶</a></span> +</dt> <dd> +<p>These built-in functions perform the operation suggested by the name, and return the new value. That is, operations on integer operands have the following semantics. Operations on pointer operands are performed as if the operand’s type were <code class="code">uintptr_t</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ *ptr <var class="var">op</var>= value; return *ptr; } +{ *ptr = ~(*ptr & value); return *ptr; } // nand</pre> +</div> <p>The same constraints on arguments apply as for the corresponding <code class="code">__sync_op_and_fetch</code> built-in functions. </p> <p><em class="emph">Note:</em> GCC 4.4 and later implement <code class="code">__sync_nand_and_fetch</code> as <code class="code">*ptr = ~(*ptr & value)</code> instead of <code class="code">*ptr = ~*ptr & value</code>. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fsync_005fbool_005fcompare_005fand_005fswap"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__sync_bool_compare_and_swap</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> oldval, <var class="var">type</var> newval, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005fbool_005fcompare_005fand_005fswap"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fsync_005fval_005fcompare_005fand_005fswap"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_val_compare_and_swap</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> oldval, <var class="var">type</var> newval, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005fval_005fcompare_005fand_005fswap"> ¶</a></span> +</dt> <dd> +<p>These built-in functions perform an atomic compare and swap. That is, if the current value of <code class="code">*<var class="var">ptr</var></code> is <var class="var">oldval</var>, then write <var class="var">newval</var> into <code class="code">*<var class="var">ptr</var></code>. </p> <p>The “bool” version returns <code class="code">true</code> if the comparison is successful and <var class="var">newval</var> is written. The “val” version returns the contents of <code class="code">*<var class="var">ptr</var></code> before the operation. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fsync_005fsynchronize"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__sync_synchronize</strong> <code class="def-code-arguments">(...)</code><a class="copiable-link" href="#index-_005f_005fsync_005fsynchronize"> ¶</a></span> +</dt> <dd><p>This built-in function issues a full memory barrier. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fsync_005flock_005ftest_005fand_005fset"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__sync_lock_test_and_set</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, <var class="var">type</var> value, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005flock_005ftest_005fand_005fset"> ¶</a></span> +</dt> <dd> +<p>This built-in function, as described by Intel, is not a traditional test-and-set operation, but rather an atomic exchange operation. It writes <var class="var">value</var> into <code class="code">*<var class="var">ptr</var></code>, and returns the previous contents of <code class="code">*<var class="var">ptr</var></code>. </p> <p>Many targets have only minimal support for such locks, and do not support a full exchange operation. In this case, a target may support reduced functionality here by which the <em class="emph">only</em> valid value to store is the immediate constant 1. The exact value actually stored in <code class="code">*<var class="var">ptr</var></code> is implementation defined. </p> <p>This built-in function is not a full barrier, but rather an <em class="dfn">acquire barrier</em>. This means that references after the operation cannot move to (or be speculated to) before the operation, but previous memory stores may not be globally visible yet, and previous memory loads may not yet be satisfied. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fsync_005flock_005frelease"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__sync_lock_release</strong> <code class="def-code-arguments">(<var class="var">type</var> *ptr, ...)</code><a class="copiable-link" href="#index-_005f_005fsync_005flock_005frelease"> ¶</a></span> +</dt> <dd> +<p>This built-in function releases the lock acquired by <code class="code">__sync_lock_test_and_set</code>. Normally this means writing the constant 0 to <code class="code">*<var class="var">ptr</var></code>. </p> <p>This built-in function is not a full barrier, but rather a <em class="dfn">release barrier</em>. This means that all previous memory stores are globally visible, and all previous memory loads have been satisfied, but following memory reads are not prevented from being speculated to before the barrier. </p> +</dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="_005f_005fatomic-builtins">Built-in Functions for Memory Model Aware Atomic Operations</a>, Previous: <a href="offsetof">Support for <code class="code">offsetof</code></a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/_005f_005fsync-Builtins.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/_005f_005fsync-Builtins.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/aarch64-built-in-functions.html b/devdocs/gcc~13/aarch64-built-in-functions.html new file mode 100644 index 00000000..ff8bba8c --- /dev/null +++ b/devdocs/gcc~13/aarch64-built-in-functions.html @@ -0,0 +1,16 @@ +<div class="subsection-level-extent" id="AArch64-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="alpha-built-in-functions" accesskey="n" rel="next">Alpha Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AArch64-Built-in-Functions-1"><span>6.60.1 AArch64 Built-in Functions<a class="copiable-link" href="#AArch64-Built-in-Functions-1"> ¶</a></span></h1> <p>These built-in functions are available for the AArch64 family of processors. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_aarch64_get_fpcr (); +void __builtin_aarch64_set_fpcr (unsigned int); +unsigned int __builtin_aarch64_get_fpsr (); +void __builtin_aarch64_set_fpsr (unsigned int); + +unsigned long long __builtin_aarch64_get_fpcr64 (); +void __builtin_aarch64_set_fpcr64 (unsigned long long); +unsigned long long __builtin_aarch64_get_fpsr64 (); +void __builtin_aarch64_set_fpsr64 (unsigned long long);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/aarch64-function-attributes.html b/devdocs/gcc~13/aarch64-function-attributes.html new file mode 100644 index 00000000..714cc378 --- /dev/null +++ b/devdocs/gcc~13/aarch64-function-attributes.html @@ -0,0 +1,61 @@ +<div class="subsection-level-extent" id="AArch64-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="amd-gcn-function-attributes" accesskey="n" rel="next">AMD GCN Function Attributes</a>, Previous: <a href="common-function-attributes" accesskey="p" rel="prev">Common Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AArch64-Function-Attributes-1"><span>6.33.2 AArch64 Function Attributes<a class="copiable-link" href="#AArch64-Function-Attributes-1"> ¶</a></span></h1> <p>The following target-specific function attributes are available for the AArch64 target. For the most part, these options mirror the behavior of similar command-line options (see <a class="pxref" href="aarch64-options">AArch64 Options</a>), but on a per-function basis. </p> <dl class="table"> <dt> +<span><code class="code">general-regs-only</code><a class="copiable-link" href="#index-general-regs-only-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Indicates that no floating-point or Advanced SIMD registers should be used when generating code for this function. If the function explicitly uses floating-point code, then the compiler gives an error. This is the same behavior as that of the command-line option <samp class="option">-mgeneral-regs-only</samp>. </p> </dd> <dt> +<span><code class="code">fix-cortex-a53-835769</code><a class="copiable-link" href="#index-fix-cortex-a53-835769-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Indicates that the workaround for the Cortex-A53 erratum 835769 should be applied to this function. To explicitly disable the workaround for this function specify the negated form: <code class="code">no-fix-cortex-a53-835769</code>. This corresponds to the behavior of the command line options <samp class="option">-mfix-cortex-a53-835769</samp> and <samp class="option">-mno-fix-cortex-a53-835769</samp>. </p> </dd> <dt> +<span><code class="code">cmodel=</code><a class="copiable-link" href="#index-cmodel_003d-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Indicates that code should be generated for a particular code model for this function. The behavior and permissible arguments are the same as for the command line option <samp class="option">-mcmodel=</samp>. </p> </dd> <dt> +<span><code class="code">strict-align</code><a class="copiable-link" href="#index-strict-align-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dt><code class="code">no-strict-align</code></dt> <dd> +<p><code class="code">strict-align</code> indicates that the compiler should not assume that unaligned memory references are handled by the system. To allow the compiler to assume that aligned memory references are handled by the system, the inverse attribute <code class="code">no-strict-align</code> can be specified. The behavior is same as for the command-line option <samp class="option">-mstrict-align</samp> and <samp class="option">-mno-strict-align</samp>. </p> </dd> <dt> +<span><code class="code">omit-leaf-frame-pointer</code><a class="copiable-link" href="#index-omit-leaf-frame-pointer-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Indicates that the frame pointer should be omitted for a leaf function call. To keep the frame pointer, the inverse attribute <code class="code">no-omit-leaf-frame-pointer</code> can be specified. These attributes have the same behavior as the command-line options <samp class="option">-momit-leaf-frame-pointer</samp> and <samp class="option">-mno-omit-leaf-frame-pointer</samp>. </p> </dd> <dt> +<span><code class="code">tls-dialect=</code><a class="copiable-link" href="#index-tls-dialect_003d-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Specifies the TLS dialect to use for this function. The behavior and permissible arguments are the same as for the command-line option <samp class="option">-mtls-dialect=</samp>. </p> </dd> <dt> +<span><code class="code">arch=</code><a class="copiable-link" href="#index-arch_003d-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Specifies the architecture version and architectural extensions to use for this function. The behavior and permissible arguments are the same as for the <samp class="option">-march=</samp> command-line option. </p> </dd> <dt> +<span><code class="code">tune=</code><a class="copiable-link" href="#index-tune_003d-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Specifies the core for which to tune the performance of this function. The behavior and permissible arguments are the same as for the <samp class="option">-mtune=</samp> command-line option. </p> </dd> <dt> +<span><code class="code">cpu=</code><a class="copiable-link" href="#index-cpu_003d-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Specifies the core for which to tune the performance of this function and also whose architectural features to use. The behavior and valid arguments are the same as for the <samp class="option">-mcpu=</samp> command-line option. </p> </dd> <dt> +<span><code class="code">sign-return-address</code><a class="copiable-link" href="#index-sign-return-address-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Select the function scope on which return address signing will be applied. The behavior and permissible arguments are the same as for the command-line option <samp class="option">-msign-return-address=</samp>. The default value is <code class="code">none</code>. This attribute is deprecated. The <code class="code">branch-protection</code> attribute should be used instead. </p> </dd> <dt> +<span><code class="code">branch-protection</code><a class="copiable-link" href="#index-branch-protection-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Select the function scope on which branch protection will be applied. The behavior and permissible arguments are the same as for the command-line option <samp class="option">-mbranch-protection=</samp>. The default value is <code class="code">none</code>. </p> </dd> <dt> +<span><code class="code">outline-atomics</code><a class="copiable-link" href="#index-outline-atomics-function-attribute_002c-AArch64"> ¶</a></span> +</dt> <dd> +<p>Enable or disable calls to out-of-line helpers to implement atomic operations. This corresponds to the behavior of the command line options <samp class="option">-moutline-atomics</samp> and <samp class="option">-mno-outline-atomics</samp>. </p> </dd> </dl> <p>The above target attributes can be specified as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__((target("<var class="var">attr-string</var>"))) +int +f (int a) +{ + return a + 5; +}</pre> +</div> <p>where <code class="code"><var class="var">attr-string</var></code> is one of the attribute strings specified above. </p> <p>Additionally, the architectural extension string may be specified on its own. This can be used to turn on and off particular architectural extensions without having to specify a particular architecture version or core. Example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__((target("+crc+nocrypto"))) +int +foo (int a) +{ + return a + 5; +}</pre> +</div> <p>In this example <code class="code">target("+crc+nocrypto")</code> enables the <code class="code">crc</code> extension and disables the <code class="code">crypto</code> extension for the function <code class="code">foo</code> without modifying an existing <samp class="option">-march=</samp> or <samp class="option">-mcpu</samp> option. </p> <p>Multiple target function attributes can be specified by separating them with a comma. For example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__((target("arch=armv8-a+crc+crypto,tune=cortex-a53"))) +int +foo (int a) +{ + return a + 5; +}</pre> +</div> <p>is valid and compiles function <code class="code">foo</code> for ARMv8-A with <code class="code">crc</code> and <code class="code">crypto</code> extensions and tunes it for <code class="code">cortex-a53</code>. </p> <ul class="mini-toc"> <li><a href="#Inlining-rules" accesskey="1">Inlining rules</a></li> </ul> <div class="subsubsection-level-extent" id="Inlining-rules"> <h1 class="subsubsection"><span>6.33.2.1 Inlining rules<a class="copiable-link" href="#Inlining-rules"> ¶</a></span></h1> <p>Specifying target attributes on individual functions or performing link-time optimization across translation units compiled with different target options can affect function inlining rules: </p> <p>In particular, a caller function can inline a callee function only if the architectural features available to the callee are a subset of the features available to the caller. For example: A function <code class="code">foo</code> compiled with <samp class="option">-march=armv8-a+crc</samp>, or tagged with the equivalent <code class="code">arch=armv8-a+crc</code> attribute, can inline a function <code class="code">bar</code> compiled with <samp class="option">-march=armv8-a+nocrc</samp> because the all the architectural features that function <code class="code">bar</code> requires are available to function <code class="code">foo</code>. Conversely, function <code class="code">bar</code> cannot inline function <code class="code">foo</code>. </p> <p>Additionally inlining a function compiled with <samp class="option">-mstrict-align</samp> into a function compiled without <code class="code">-mstrict-align</code> is not allowed. However, inlining a function compiled without <samp class="option">-mstrict-align</samp> into a function compiled with <samp class="option">-mstrict-align</samp> is allowed. </p> <p>Note that CPU tuning options and attributes such as the <samp class="option">-mcpu=</samp>, <samp class="option">-mtune=</samp> do not inhibit inlining unless the CPU specified by the <samp class="option">-mcpu=</samp> option or the <code class="code">cpu=</code> attribute conflicts with the architectural feature rules specified above. </p> </div> </div> <div class="nav-panel"> <p> Next: <a href="amd-gcn-function-attributes">AMD GCN Function Attributes</a>, Previous: <a href="common-function-attributes">Common Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/aarch64-options.html b/devdocs/gcc~13/aarch64-options.html new file mode 100644 index 00000000..786d3fd7 --- /dev/null +++ b/devdocs/gcc~13/aarch64-options.html @@ -0,0 +1,158 @@ +<div class="subsection-level-extent" id="AArch64-Options"> <div class="nav-panel"> <p> Next: <a href="adapteva-epiphany-options" accesskey="n" rel="next">Adapteva Epiphany Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AArch64-Options-1"><span>3.19.1 AArch64 Options<a class="copiable-link" href="#AArch64-Options-1"> ¶</a></span></h1> <p>These options are defined for AArch64 implementations: </p> <dl class="table"> <dt> +<span><code class="code">-mabi=<var class="var">name</var></code><a class="copiable-link" href="#index-mabi"> ¶</a></span> +</dt> <dd> +<p>Generate code for the specified data model. Permissible values are ‘<samp class="samp">ilp32</samp>’ for SysV-like data model where int, long int and pointers are 32 bits, and ‘<samp class="samp">lp64</samp>’ for SysV-like data model where int is 32 bits, but long int and pointers are 64 bits. </p> <p>The default depends on the specific target configuration. Note that the LP64 and ILP32 ABIs are not link-compatible; you must compile your entire program with the same ABI, and link with a compatible set of libraries. </p> </dd> <dt> +<span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian"> ¶</a></span> +</dt> <dd> +<p>Generate big-endian code. This is the default when GCC is configured for an ‘<samp class="samp">aarch64_be-*-*</samp>’ target. </p> </dd> <dt> +<span><code class="code">-mgeneral-regs-only</code><a class="copiable-link" href="#index-mgeneral-regs-only"> ¶</a></span> +</dt> <dd> +<p>Generate code which uses only the general-purpose registers. This will prevent the compiler from using floating-point and Advanced SIMD registers but will not impose any restrictions on the assembler. </p> </dd> <dt> +<span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian"> ¶</a></span> +</dt> <dd> +<p>Generate little-endian code. This is the default when GCC is configured for an ‘<samp class="samp">aarch64-*-*</samp>’ but not an ‘<samp class="samp">aarch64_be-*-*</samp>’ target. </p> </dd> <dt> +<span><code class="code">-mcmodel=tiny</code><a class="copiable-link" href="#index-mcmodel_003dtiny"> ¶</a></span> +</dt> <dd> +<p>Generate code for the tiny code model. The program and its statically defined symbols must be within 1MB of each other. Programs can be statically or dynamically linked. </p> </dd> <dt> +<span><code class="code">-mcmodel=small</code><a class="copiable-link" href="#index-mcmodel_003dsmall"> ¶</a></span> +</dt> <dd> +<p>Generate code for the small code model. The program and its statically defined symbols must be within 4GB of each other. Programs can be statically or dynamically linked. This is the default code model. </p> </dd> <dt> +<span><code class="code">-mcmodel=large</code><a class="copiable-link" href="#index-mcmodel_003dlarge"> ¶</a></span> +</dt> <dd> +<p>Generate code for the large code model. This makes no assumptions about addresses and sizes of sections. Programs can be statically linked only. The <samp class="option">-mcmodel=large</samp> option is incompatible with <samp class="option">-mabi=ilp32</samp>, <samp class="option">-fpic</samp> and <samp class="option">-fPIC</samp>. </p> </dd> <dt> + <span><code class="code">-mstrict-align</code><a class="copiable-link" href="#index-mstrict-align"> ¶</a></span> +</dt> <dt><code class="code">-mno-strict-align</code></dt> <dd> +<p>Avoid or allow generating memory accesses that may not be aligned on a natural object boundary as described in the architecture specification. </p> </dd> <dt> + <span><code class="code">-momit-leaf-frame-pointer</code><a class="copiable-link" href="#index-momit-leaf-frame-pointer"> ¶</a></span> +</dt> <dt><code class="code">-mno-omit-leaf-frame-pointer</code></dt> <dd> +<p>Omit or keep the frame pointer in leaf functions. The former behavior is the default. </p> </dd> <dt> + <span><code class="code">-mstack-protector-guard=<var class="var">guard</var></code><a class="copiable-link" href="#index-mstack-protector-guard"> ¶</a></span> +</dt> <dt><code class="code">-mstack-protector-guard-reg=<var class="var">reg</var></code></dt> <dt><code class="code">-mstack-protector-guard-offset=<var class="var">offset</var></code></dt> <dd> +<p>Generate stack protection code using canary at <var class="var">guard</var>. Supported locations are ‘<samp class="samp">global</samp>’ for a global canary or ‘<samp class="samp">sysreg</samp>’ for a canary in an appropriate system register. </p> <p>With the latter choice the options <samp class="option">-mstack-protector-guard-reg=<var class="var">reg</var></samp> and <samp class="option">-mstack-protector-guard-offset=<var class="var">offset</var></samp> furthermore specify which system register to use as base register for reading the canary, and from what offset from that base register. There is no default register or offset as this is entirely for use within the Linux kernel. </p> </dd> <dt> +<span><code class="code">-mtls-dialect=desc</code><a class="copiable-link" href="#index-mtls-dialect_003ddesc"> ¶</a></span> +</dt> <dd> +<p>Use TLS descriptors as the thread-local storage mechanism for dynamic accesses of TLS variables. This is the default. </p> </dd> <dt> +<span><code class="code">-mtls-dialect=traditional</code><a class="copiable-link" href="#index-mtls-dialect_003dtraditional"> ¶</a></span> +</dt> <dd> +<p>Use traditional TLS as the thread-local storage mechanism for dynamic accesses of TLS variables. </p> </dd> <dt> +<span><code class="code">-mtls-size=<var class="var">size</var></code><a class="copiable-link" href="#index-mtls-size"> ¶</a></span> +</dt> <dd> +<p>Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48. This option requires binutils 2.26 or newer. </p> </dd> <dt> + <span><code class="code">-mfix-cortex-a53-835769</code><a class="copiable-link" href="#index-mfix-cortex-a53-835769"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-cortex-a53-835769</code></dt> <dd> +<p>Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. This involves inserting a NOP instruction between memory instructions and 64-bit integer multiply-accumulate instructions. </p> </dd> <dt> + <span><code class="code">-mfix-cortex-a53-843419</code><a class="copiable-link" href="#index-mfix-cortex-a53-843419"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-cortex-a53-843419</code></dt> <dd> +<p>Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419. This erratum workaround is made at link time and this will only pass the corresponding flag to the linker. </p> </dd> <dt> + <span><code class="code">-mlow-precision-recip-sqrt</code><a class="copiable-link" href="#index-mlow-precision-recip-sqrt"> ¶</a></span> +</dt> <dt><code class="code">-mno-low-precision-recip-sqrt</code></dt> <dd> +<p>Enable or disable the reciprocal square root approximation. This option only has an effect if <samp class="option">-ffast-math</samp> or <samp class="option">-funsafe-math-optimizations</samp> is used as well. Enabling this reduces precision of reciprocal square root results to about 16 bits for single precision and to 32 bits for double precision. </p> </dd> <dt> + <span><code class="code">-mlow-precision-sqrt</code><a class="copiable-link" href="#index-mlow-precision-sqrt"> ¶</a></span> +</dt> <dt><code class="code">-mno-low-precision-sqrt</code></dt> <dd> +<p>Enable or disable the square root approximation. This option only has an effect if <samp class="option">-ffast-math</samp> or <samp class="option">-funsafe-math-optimizations</samp> is used as well. Enabling this reduces precision of square root results to about 16 bits for single precision and to 32 bits for double precision. If enabled, it implies <samp class="option">-mlow-precision-recip-sqrt</samp>. </p> </dd> <dt> + <span><code class="code">-mlow-precision-div</code><a class="copiable-link" href="#index-mlow-precision-div"> ¶</a></span> +</dt> <dt><code class="code">-mno-low-precision-div</code></dt> <dd> +<p>Enable or disable the division approximation. This option only has an effect if <samp class="option">-ffast-math</samp> or <samp class="option">-funsafe-math-optimizations</samp> is used as well. Enabling this reduces precision of division results to about 16 bits for single precision and to 32 bits for double precision. </p> </dd> <dt><code class="code">-mtrack-speculation</code></dt> <dt><code class="code">-mno-track-speculation</code></dt> <dd> +<p>Enable or disable generation of additional code to track speculative execution through conditional branches. The tracking state can then be used by the compiler when expanding calls to <code class="code">__builtin_speculation_safe_copy</code> to permit a more efficient code sequence to be generated. </p> </dd> <dt><code class="code">-moutline-atomics</code></dt> <dt><code class="code">-mno-outline-atomics</code></dt> <dd> +<p>Enable or disable calls to out-of-line helpers to implement atomic operations. These helpers will, at runtime, determine if the LSE instructions from ARMv8.1-A can be used; if not, they will use the load/store-exclusive instructions that are present in the base ARMv8.0 ISA. </p> <p>This option is only applicable when compiling for the base ARMv8.0 instruction set. If using a later revision, e.g. <samp class="option">-march=armv8.1-a</samp> or <samp class="option">-march=armv8-a+lse</samp>, the ARMv8.1-Atomics instructions will be used directly. The same applies when using <samp class="option">-mcpu=</samp> when the selected cpu supports the ‘<samp class="samp">lse</samp>’ feature. This option is on by default. </p> </dd> <dt> +<span><code class="code">-march=<var class="var">name</var></code><a class="copiable-link" href="#index-march"> ¶</a></span> +</dt> <dd> +<p>Specify the name of the target architecture and, optionally, one or more feature modifiers. This option has the form <samp class="option">-march=<var class="var">arch</var><span class="r">{</span>+<span class="r">[</span>no<span class="r">]</span><var class="var">feature</var><span class="r">}*</span></samp>. </p> <p>The table below summarizes the permissible values for <var class="var">arch</var> and the features that they enable by default: </p> <table class="multitable"> <thead><tr> +<th width="20%"> +<var class="var">arch</var> value</th> +<th width="20%">Architecture</th> +<th width="60%">Includes by default</th> +</tr></thead> <tbody> +<tr> +<td width="20%">‘<samp class="samp">armv8-a</samp>’</td> +<td width="20%">Armv8-A</td> +<td width="60%">‘<samp class="samp">+fp</samp>’, ‘<samp class="samp">+simd</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv8.1-a</samp>’</td> +<td width="20%">Armv8.1-A</td> +<td width="60%">‘<samp class="samp">armv8-a</samp>’, ‘<samp class="samp">+crc</samp>’, ‘<samp class="samp">+lse</samp>’, ‘<samp class="samp">+rdma</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv8.2-a</samp>’</td> +<td width="20%">Armv8.2-A</td> +<td width="60%">‘<samp class="samp">armv8.1-a</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv8.3-a</samp>’</td> +<td width="20%">Armv8.3-A</td> +<td width="60%">‘<samp class="samp">armv8.2-a</samp>’, ‘<samp class="samp">+pauth</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv8.4-a</samp>’</td> +<td width="20%">Armv8.4-A</td> +<td width="60%">‘<samp class="samp">armv8.3-a</samp>’, ‘<samp class="samp">+flagm</samp>’, ‘<samp class="samp">+fp16fml</samp>’, ‘<samp class="samp">+dotprod</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv8.5-a</samp>’</td> +<td width="20%">Armv8.5-A</td> +<td width="60%">‘<samp class="samp">armv8.4-a</samp>’, ‘<samp class="samp">+sb</samp>’, ‘<samp class="samp">+ssbs</samp>’, ‘<samp class="samp">+predres</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv8.6-a</samp>’</td> +<td width="20%">Armv8.6-A</td> +<td width="60%">‘<samp class="samp">armv8.5-a</samp>’, ‘<samp class="samp">+bf16</samp>’, ‘<samp class="samp">+i8mm</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv8.7-a</samp>’</td> +<td width="20%">Armv8.7-A</td> +<td width="60%">‘<samp class="samp">armv8.6-a</samp>’, ‘<samp class="samp">+ls64</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv8.8-a</samp>’</td> +<td width="20%">Armv8.8-a</td> +<td width="60%">‘<samp class="samp">armv8.7-a</samp>’, ‘<samp class="samp">+mops</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv9-a</samp>’</td> +<td width="20%">Armv9-A</td> +<td width="60%">‘<samp class="samp">armv8.5-a</samp>’, ‘<samp class="samp">+sve</samp>’, ‘<samp class="samp">+sve2</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv9.1-a</samp>’</td> +<td width="20%">Armv9.1-A</td> +<td width="60%">‘<samp class="samp">armv9-a</samp>’, ‘<samp class="samp">+bf16</samp>’, ‘<samp class="samp">+i8mm</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv9.2-a</samp>’</td> +<td width="20%">Armv9.2-A</td> +<td width="60%">‘<samp class="samp">armv9.1-a</samp>’, ‘<samp class="samp">+ls64</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv9.3-a</samp>’</td> +<td width="20%">Armv9.3-A</td> +<td width="60%">‘<samp class="samp">armv9.2-a</samp>’, ‘<samp class="samp">+mops</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">armv8-r</samp>’</td> +<td width="20%">Armv8-R</td> +<td width="60%">‘<samp class="samp">armv8-r</samp>’</td> +</tr> </tbody> </table> <p>The value ‘<samp class="samp">native</samp>’ is available on native AArch64 GNU/Linux and causes the compiler to pick the architecture of the host system. This option has no effect if the compiler is unable to recognize the architecture of the host system, </p> <p>The permissible values for <var class="var">feature</var> are listed in the sub-section on <a class="ref" href="#aarch64-feature-modifiers"><samp class="option">-march</samp> and <samp class="option">-mcpu</samp> Feature Modifiers</a>. Where conflicting feature modifiers are specified, the right-most feature is used. </p> <p>GCC uses <var class="var">name</var> to determine what kind of instructions it can emit when generating assembly code. If <samp class="option">-march</samp> is specified without either of <samp class="option">-mtune</samp> or <samp class="option">-mcpu</samp> also being specified, the code is tuned to perform well across a range of target processors implementing the target architecture. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">name</var></code><a class="copiable-link" href="#index-mtune"> ¶</a></span> +</dt> <dd> +<p>Specify the name of the target processor for which GCC should tune the performance of the code. Permissible values for this option are: ‘<samp class="samp">generic</samp>’, ‘<samp class="samp">cortex-a35</samp>’, ‘<samp class="samp">cortex-a53</samp>’, ‘<samp class="samp">cortex-a55</samp>’, ‘<samp class="samp">cortex-a57</samp>’, ‘<samp class="samp">cortex-a72</samp>’, ‘<samp class="samp">cortex-a73</samp>’, ‘<samp class="samp">cortex-a75</samp>’, ‘<samp class="samp">cortex-a76</samp>’, ‘<samp class="samp">cortex-a76ae</samp>’, ‘<samp class="samp">cortex-a77</samp>’, ‘<samp class="samp">cortex-a65</samp>’, ‘<samp class="samp">cortex-a65ae</samp>’, ‘<samp class="samp">cortex-a34</samp>’, ‘<samp class="samp">cortex-a78</samp>’, ‘<samp class="samp">cortex-a78ae</samp>’, ‘<samp class="samp">cortex-a78c</samp>’, ‘<samp class="samp">ares</samp>’, ‘<samp class="samp">exynos-m1</samp>’, ‘<samp class="samp">emag</samp>’, ‘<samp class="samp">falkor</samp>’, ‘<samp class="samp">neoverse-512tvb</samp>’, ‘<samp class="samp">neoverse-e1</samp>’, ‘<samp class="samp">neoverse-n1</samp>’, ‘<samp class="samp">neoverse-n2</samp>’, ‘<samp class="samp">neoverse-v1</samp>’, ‘<samp class="samp">neoverse-v2</samp>’, ‘<samp class="samp">qdf24xx</samp>’, ‘<samp class="samp">saphira</samp>’, ‘<samp class="samp">phecda</samp>’, ‘<samp class="samp">xgene1</samp>’, ‘<samp class="samp">vulcan</samp>’, ‘<samp class="samp">octeontx</samp>’, ‘<samp class="samp">octeontx81</samp>’, ‘<samp class="samp">octeontx83</samp>’, ‘<samp class="samp">octeontx2</samp>’, ‘<samp class="samp">octeontx2t98</samp>’, ‘<samp class="samp">octeontx2t96</samp>’ ‘<samp class="samp">octeontx2t93</samp>’, ‘<samp class="samp">octeontx2f95</samp>’, ‘<samp class="samp">octeontx2f95n</samp>’, ‘<samp class="samp">octeontx2f95mm</samp>’, ‘<samp class="samp">a64fx</samp>’, ‘<samp class="samp">thunderx</samp>’, ‘<samp class="samp">thunderxt88</samp>’, ‘<samp class="samp">thunderxt88p1</samp>’, ‘<samp class="samp">thunderxt81</samp>’, ‘<samp class="samp">tsv110</samp>’, ‘<samp class="samp">thunderxt83</samp>’, ‘<samp class="samp">thunderx2t99</samp>’, ‘<samp class="samp">thunderx3t110</samp>’, ‘<samp class="samp">zeus</samp>’, ‘<samp class="samp">cortex-a57.cortex-a53</samp>’, ‘<samp class="samp">cortex-a72.cortex-a53</samp>’, ‘<samp class="samp">cortex-a73.cortex-a35</samp>’, ‘<samp class="samp">cortex-a73.cortex-a53</samp>’, ‘<samp class="samp">cortex-a75.cortex-a55</samp>’, ‘<samp class="samp">cortex-a76.cortex-a55</samp>’, ‘<samp class="samp">cortex-r82</samp>’, ‘<samp class="samp">cortex-x1</samp>’, ‘<samp class="samp">cortex-x1c</samp>’, ‘<samp class="samp">cortex-x2</samp>’, ‘<samp class="samp">cortex-x3</samp>’, ‘<samp class="samp">cortex-a510</samp>’, ‘<samp class="samp">cortex-a710</samp>’, ‘<samp class="samp">cortex-a715</samp>’, ‘<samp class="samp">ampere1</samp>’, ‘<samp class="samp">ampere1a</samp>’, and ‘<samp class="samp">native</samp>’. </p> <p>The values ‘<samp class="samp">cortex-a57.cortex-a53</samp>’, ‘<samp class="samp">cortex-a72.cortex-a53</samp>’, ‘<samp class="samp">cortex-a73.cortex-a35</samp>’, ‘<samp class="samp">cortex-a73.cortex-a53</samp>’, ‘<samp class="samp">cortex-a75.cortex-a55</samp>’, ‘<samp class="samp">cortex-a76.cortex-a55</samp>’ specify that GCC should tune for a big.LITTLE system. </p> <p>The value ‘<samp class="samp">neoverse-512tvb</samp>’ specifies that GCC should tune for Neoverse cores that (a) implement SVE and (b) have a total vector bandwidth of 512 bits per cycle. In other words, the option tells GCC to tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic instructions a cycle and that can execute an equivalent number of SVE arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning for a specific core like Neoverse V1 but is more specific than the default tuning described below. </p> <p>Additionally on native AArch64 GNU/Linux systems the value ‘<samp class="samp">native</samp>’ tunes performance to the host system. This option has no effect if the compiler is unable to recognize the processor of the host system. </p> <p>Where none of <samp class="option">-mtune=</samp>, <samp class="option">-mcpu=</samp> or <samp class="option">-march=</samp> are specified, the code is tuned to perform well across a range of target processors. </p> <p>This option cannot be suffixed by feature modifiers. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">name</var></code><a class="copiable-link" href="#index-mcpu"> ¶</a></span> +</dt> <dd> +<p>Specify the name of the target processor, optionally suffixed by one or more feature modifiers. This option has the form <samp class="option">-mcpu=<var class="var">cpu</var><span class="r">{</span>+<span class="r">[</span>no<span class="r">]</span><var class="var">feature</var><span class="r">}*</span></samp>, where the permissible values for <var class="var">cpu</var> are the same as those available for <samp class="option">-mtune</samp>. The permissible values for <var class="var">feature</var> are documented in the sub-section on <a class="ref" href="#aarch64-feature-modifiers"><samp class="option">-march</samp> and <samp class="option">-mcpu</samp> Feature Modifiers</a>. Where conflicting feature modifiers are specified, the right-most feature is used. </p> <p>GCC uses <var class="var">name</var> to determine what kind of instructions it can emit when generating assembly code (as if by <samp class="option">-march</samp>) and to determine the target processor for which to tune for performance (as if by <samp class="option">-mtune</samp>). Where this option is used in conjunction with <samp class="option">-march</samp> or <samp class="option">-mtune</samp>, those options take precedence over the appropriate part of this option. </p> <p><samp class="option">-mcpu=neoverse-512tvb</samp> is special in that it does not refer to a specific core, but instead refers to all Neoverse cores that (a) implement SVE and (b) have a total vector bandwidth of 512 bits a cycle. Unless overridden by <samp class="option">-march</samp>, <samp class="option">-mcpu=neoverse-512tvb</samp> generates code that can run on a Neoverse V1 core, since Neoverse V1 is the first Neoverse core with these properties. Unless overridden by <samp class="option">-mtune</samp>, <samp class="option">-mcpu=neoverse-512tvb</samp> tunes code in the same way as for <samp class="option">-mtune=neoverse-512tvb</samp>. </p> </dd> <dt> +<span><code class="code">-moverride=<var class="var">string</var></code><a class="copiable-link" href="#index-moverride"> ¶</a></span> +</dt> <dd> +<p>Override tuning decisions made by the back-end in response to a <samp class="option">-mtune=</samp> switch. The syntax, semantics, and accepted values for <var class="var">string</var> in this option are not guaranteed to be consistent across releases. </p> <p>This option is only intended to be useful when developing GCC. </p> </dd> <dt> +<span><code class="code">-mverbose-cost-dump</code><a class="copiable-link" href="#index-mverbose-cost-dump"> ¶</a></span> +</dt> <dd> +<p>Enable verbose cost model dumping in the debug dump files. This option is provided for use in debugging the compiler. </p> </dd> <dt> + <span><code class="code">-mpc-relative-literal-loads</code><a class="copiable-link" href="#index-mpc-relative-literal-loads"> ¶</a></span> +</dt> <dt><code class="code">-mno-pc-relative-literal-loads</code></dt> <dd> +<p>Enable or disable PC-relative literal loads. With this option literal pools are accessed using a single instruction and emitted after each function. This limits the maximum size of functions to 1MB. This is enabled by default for <samp class="option">-mcmodel=tiny</samp>. </p> </dd> <dt> +<span><code class="code">-msign-return-address=<var class="var">scope</var></code><a class="copiable-link" href="#index-msign-return-address"> ¶</a></span> +</dt> <dd> +<p>Select the function scope on which return address signing will be applied. Permissible values are ‘<samp class="samp">none</samp>’, which disables return address signing, ‘<samp class="samp">non-leaf</samp>’, which enables pointer signing for functions which are not leaf functions, and ‘<samp class="samp">all</samp>’, which enables pointer signing for all functions. The default value is ‘<samp class="samp">none</samp>’. This option has been deprecated by -mbranch-protection. </p> </dd> <dt> +<span><code class="code">-mbranch-protection=<var class="var">none</var>|<var class="var">standard</var>|<var class="var">pac-ret</var>[+<var class="var">leaf</var>+<var class="var">b-key</var>]|<var class="var">bti</var></code><a class="copiable-link" href="#index-mbranch-protection"> ¶</a></span> +</dt> <dd> +<p>Select the branch protection features to use. ‘<samp class="samp">none</samp>’ is the default and turns off all types of branch protection. ‘<samp class="samp">standard</samp>’ turns on all types of branch protection features. If a feature has additional tuning options, then ‘<samp class="samp">standard</samp>’ sets it to its standard level. ‘<samp class="samp">pac-ret[+<var class="var">leaf</var>]</samp>’ turns on return address signing to its standard level: signing functions that save the return address to memory (non-leaf functions will practically always do this) using the a-key. The optional argument ‘<samp class="samp">leaf</samp>’ can be used to extend the signing to include leaf functions. The optional argument ‘<samp class="samp">b-key</samp>’ can be used to sign the functions with the B-key instead of the A-key. ‘<samp class="samp">bti</samp>’ turns on branch target identification mechanism. </p> </dd> <dt> +<span><code class="code">-mharden-sls=<var class="var">opts</var></code><a class="copiable-link" href="#index-mharden-sls"> ¶</a></span> +</dt> <dd> +<p>Enable compiler hardening against straight line speculation (SLS). <var class="var">opts</var> is a comma-separated list of the following options: </p> +<dl class="table"> <dt>‘<samp class="samp">retbr</samp>’</dt> <dt>‘<samp class="samp">blr</samp>’</dt> </dl> <p>In addition, ‘<samp class="samp">-mharden-sls=all</samp>’ enables all SLS hardening while ‘<samp class="samp">-mharden-sls=none</samp>’ disables all SLS hardening. </p> </dd> <dt> +<span><code class="code">-msve-vector-bits=<var class="var">bits</var></code><a class="copiable-link" href="#index-msve-vector-bits"> ¶</a></span> +</dt> <dd> +<p>Specify the number of bits in an SVE vector register. This option only has an effect when SVE is enabled. </p> <p>GCC supports two forms of SVE code generation: “vector-length agnostic” output that works with any size of vector register and “vector-length specific” output that allows GCC to make assumptions about the vector length when it is useful for optimization reasons. The possible values of ‘<samp class="samp">bits</samp>’ are: ‘<samp class="samp">scalable</samp>’, ‘<samp class="samp">128</samp>’, ‘<samp class="samp">256</samp>’, ‘<samp class="samp">512</samp>’, ‘<samp class="samp">1024</samp>’ and ‘<samp class="samp">2048</samp>’. Specifying ‘<samp class="samp">scalable</samp>’ selects vector-length agnostic output. At present ‘<samp class="samp">-msve-vector-bits=128</samp>’ also generates vector-length agnostic output for big-endian targets. All other values generate vector-length specific code. The behavior of these values may change in future releases and no value except ‘<samp class="samp">scalable</samp>’ should be relied on for producing code that is portable across different hardware SVE vector lengths. </p> <p>The default is ‘<samp class="samp">-msve-vector-bits=scalable</samp>’, which produces vector-length agnostic code. </p> +</dd> </dl> <ul class="mini-toc"> <li><a href="#g_t-march-and--mcpu-Feature-Modifiers" accesskey="1"><samp class="option">-march</samp> and <samp class="option">-mcpu</samp> Feature Modifiers</a></li> </ul> <div class="subsubsection-level-extent" id="g_t-march-and--mcpu-Feature-Modifiers"> <h1 class="subsubsection"><span>3.19.1.1 <samp class="option">-march</samp> and <samp class="option">-mcpu</samp> Feature Modifiers<a class="copiable-link" href="#g_t-march-and--mcpu-Feature-Modifiers"> ¶</a></span></h1> <p>Feature modifiers used with <samp class="option">-march</samp> and <samp class="option">-mcpu</samp> can be any of the following and their inverses <samp class="option">no<var class="var">feature</var></samp>: </p> <dl class="table"> <dt>‘<samp class="samp">crc</samp>’</dt> <dd><p>Enable CRC extension. This is on by default for <samp class="option">-march=armv8.1-a</samp>. </p></dd> <dt>‘<samp class="samp">crypto</samp>’</dt> <dd><p>Enable Crypto extension. This also enables Advanced SIMD and floating-point instructions. </p></dd> <dt>‘<samp class="samp">fp</samp>’</dt> <dd><p>Enable floating-point instructions. This is on by default for all possible values for options <samp class="option">-march</samp> and <samp class="option">-mcpu</samp>. </p></dd> <dt>‘<samp class="samp">simd</samp>’</dt> <dd><p>Enable Advanced SIMD instructions. This also enables floating-point instructions. This is on by default for all possible values for options <samp class="option">-march</samp> and <samp class="option">-mcpu</samp>. </p></dd> <dt>‘<samp class="samp">sve</samp>’</dt> <dd><p>Enable Scalable Vector Extension instructions. This also enables Advanced SIMD and floating-point instructions. </p></dd> <dt>‘<samp class="samp">lse</samp>’</dt> <dd><p>Enable Large System Extension instructions. This is on by default for <samp class="option">-march=armv8.1-a</samp>. </p></dd> <dt>‘<samp class="samp">rdma</samp>’</dt> <dd><p>Enable Round Double Multiply Accumulate instructions. This is on by default for <samp class="option">-march=armv8.1-a</samp>. </p></dd> <dt>‘<samp class="samp">fp16</samp>’</dt> <dd><p>Enable FP16 extension. This also enables floating-point instructions. </p></dd> <dt>‘<samp class="samp">fp16fml</samp>’</dt> <dd> +<p>Enable FP16 fmla extension. This also enables FP16 extensions and floating-point instructions. This option is enabled by default for <samp class="option">-march=armv8.4-a</samp>. Use of this option with architectures prior to Armv8.2-A is not supported. </p> </dd> <dt>‘<samp class="samp">rcpc</samp>’</dt> <dd><p>Enable the RCpc extension. This enables the use of the LDAPR instructions for load-acquire atomic semantics, and passes it on to the assembler, enabling inline asm statements to use instructions from the RCpc extension. </p></dd> <dt>‘<samp class="samp">dotprod</samp>’</dt> <dd><p>Enable the Dot Product extension. This also enables Advanced SIMD instructions. </p></dd> <dt>‘<samp class="samp">aes</samp>’</dt> <dd><p>Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced SIMD instructions. </p></dd> <dt>‘<samp class="samp">sha2</samp>’</dt> <dd><p>Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions. </p></dd> <dt>‘<samp class="samp">sha3</samp>’</dt> <dd><p>Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD instructions. Use of this option with architectures prior to Armv8.2-A is not supported. </p></dd> <dt>‘<samp class="samp">sm4</samp>’</dt> <dd><p>Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions. Use of this option with architectures prior to Armv8.2-A is not supported. </p></dd> <dt>‘<samp class="samp">profile</samp>’</dt> <dd><p>Enable the Statistical Profiling extension. This option is only to enable the extension at the assembler level and does not affect code generation. </p></dd> <dt>‘<samp class="samp">rng</samp>’</dt> <dd><p>Enable the Armv8.5-a Random Number instructions. This option is only to enable the extension at the assembler level and does not affect code generation. </p></dd> <dt>‘<samp class="samp">memtag</samp>’</dt> <dd><p>Enable the Armv8.5-a Memory Tagging Extensions. Use of this option with architectures prior to Armv8.5-A is not supported. </p></dd> <dt>‘<samp class="samp">sb</samp>’</dt> <dd><p>Enable the Armv8-a Speculation Barrier instruction. This option is only to enable the extension at the assembler level and does not affect code generation. This option is enabled by default for <samp class="option">-march=armv8.5-a</samp>. </p></dd> <dt>‘<samp class="samp">ssbs</samp>’</dt> <dd><p>Enable the Armv8-a Speculative Store Bypass Safe instruction. This option is only to enable the extension at the assembler level and does not affect code generation. This option is enabled by default for <samp class="option">-march=armv8.5-a</samp>. </p></dd> <dt>‘<samp class="samp">predres</samp>’</dt> <dd><p>Enable the Armv8-a Execution and Data Prediction Restriction instructions. This option is only to enable the extension at the assembler level and does not affect code generation. This option is enabled by default for <samp class="option">-march=armv8.5-a</samp>. </p></dd> <dt>‘<samp class="samp">sve2</samp>’</dt> <dd><p>Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE instructions. </p></dd> <dt>‘<samp class="samp">sve2-bitperm</samp>’</dt> <dd><p>Enable SVE2 bitperm instructions. This also enables SVE2 instructions. </p></dd> <dt>‘<samp class="samp">sve2-sm4</samp>’</dt> <dd><p>Enable SVE2 sm4 instructions. This also enables SVE2 instructions. </p></dd> <dt>‘<samp class="samp">sve2-aes</samp>’</dt> <dd><p>Enable SVE2 aes instructions. This also enables SVE2 instructions. </p></dd> <dt>‘<samp class="samp">sve2-sha3</samp>’</dt> <dd><p>Enable SVE2 sha3 instructions. This also enables SVE2 instructions. </p></dd> <dt>‘<samp class="samp">tme</samp>’</dt> <dd><p>Enable the Transactional Memory Extension. </p></dd> <dt>‘<samp class="samp">i8mm</samp>’</dt> <dd><p>Enable 8-bit Integer Matrix Multiply instructions. This also enables Advanced SIMD and floating-point instructions. This option is enabled by default for <samp class="option">-march=armv8.6-a</samp>. Use of this option with architectures prior to Armv8.2-A is not supported. </p></dd> <dt>‘<samp class="samp">f32mm</samp>’</dt> <dd><p>Enable 32-bit Floating point Matrix Multiply instructions. This also enables SVE instructions. Use of this option with architectures prior to Armv8.2-A is not supported. </p></dd> <dt>‘<samp class="samp">f64mm</samp>’</dt> <dd><p>Enable 64-bit Floating point Matrix Multiply instructions. This also enables SVE instructions. Use of this option with architectures prior to Armv8.2-A is not supported. </p></dd> <dt>‘<samp class="samp">bf16</samp>’</dt> <dd><p>Enable brain half-precision floating-point instructions. This also enables Advanced SIMD and floating-point instructions. This option is enabled by default for <samp class="option">-march=armv8.6-a</samp>. Use of this option with architectures prior to Armv8.2-A is not supported. </p></dd> <dt>‘<samp class="samp">ls64</samp>’</dt> <dd><p>Enable the 64-byte atomic load and store instructions for accelerators. This option is enabled by default for <samp class="option">-march=armv8.7-a</samp>. </p></dd> <dt>‘<samp class="samp">mops</samp>’</dt> <dd><p>Enable the instructions to accelerate memory operations like <code class="code">memcpy</code>, <code class="code">memmove</code>, <code class="code">memset</code>. This option is enabled by default for <samp class="option">-march=armv8.8-a</samp> </p></dd> <dt>‘<samp class="samp">flagm</samp>’</dt> <dd><p>Enable the Flag Manipulation instructions Extension. </p></dd> <dt>‘<samp class="samp">pauth</samp>’</dt> <dd><p>Enable the Pointer Authentication Extension. </p></dd> <dt>‘<samp class="samp">cssc</samp>’</dt> <dd> +<p>Enable the Common Short Sequence Compression instructions. </p> </dd> </dl> <p>Feature <samp class="option">crypto</samp> implies <samp class="option">aes</samp>, <samp class="option">sha2</samp>, and <samp class="option">simd</samp>, which implies <samp class="option">fp</samp>. Conversely, <samp class="option">nofp</samp> implies <samp class="option">nosimd</samp>, which implies <samp class="option">nocrypto</samp>, <samp class="option">noaes</samp> and <samp class="option">nosha2</samp>. </p> </div> </div> <div class="nav-panel"> <p> Next: <a href="adapteva-epiphany-options">Adapteva Epiphany Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/aarch64-pragmas.html b/devdocs/gcc~13/aarch64-pragmas.html new file mode 100644 index 00000000..58a19fce --- /dev/null +++ b/devdocs/gcc~13/aarch64-pragmas.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="AArch64-Pragmas"> <div class="nav-panel"> <p> Next: <a href="arm-pragmas" accesskey="n" rel="next">ARM Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AArch64-Pragmas-1"><span>6.62.1 AArch64 Pragmas<a class="copiable-link" href="#AArch64-Pragmas-1"> ¶</a></span></h1> <p>The pragmas defined by the AArch64 target correspond to the AArch64 target function attributes. They can be specified as below: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#pragma GCC target("string")</pre> +</div> <p>where <code class="code"><var class="var">string</var></code> can be any string accepted as an AArch64 target attribute. See <a class="xref" href="aarch64-function-attributes">AArch64 Function Attributes</a>, for more details on the permissible values of <code class="code">string</code>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/actual-bugs.html b/devdocs/gcc~13/actual-bugs.html new file mode 100644 index 00000000..fdaa7656 --- /dev/null +++ b/devdocs/gcc~13/actual-bugs.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Actual-Bugs"> <div class="nav-panel"> <p> Next: <a href="interoperation" accesskey="n" rel="next">Interoperation</a>, Up: <a href="trouble" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Actual-Bugs-We-Haven_0027t-Fixed-Yet"><span>14.1 Actual Bugs We Haven’t Fixed Yet<a class="copiable-link" href="#Actual-Bugs-We-Haven_0027t-Fixed-Yet"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>The <code class="code">fixincludes</code> script interacts badly with automounters; if the directory of system header files is automounted, it tends to be unmounted while <code class="code">fixincludes</code> is running. This would seem to be a bug in the automounter. We don’t know any good way to work around it. </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Actual-Bugs.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Actual-Bugs.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/adapteva-epiphany-options.html b/devdocs/gcc~13/adapteva-epiphany-options.html new file mode 100644 index 00000000..68b1d1a2 --- /dev/null +++ b/devdocs/gcc~13/adapteva-epiphany-options.html @@ -0,0 +1,60 @@ +<div class="subsection-level-extent" id="Adapteva-Epiphany-Options"> <div class="nav-panel"> <p> Next: <a href="amd-gcn-options" accesskey="n" rel="next">AMD GCN Options</a>, Previous: <a href="aarch64-options" accesskey="p" rel="prev">AArch64 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Adapteva-Epiphany-Options-1"><span>3.19.2 Adapteva Epiphany Options<a class="copiable-link" href="#Adapteva-Epiphany-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for Adapteva Epiphany: </p> <dl class="table"> <dt> +<span><code class="code">-mhalf-reg-file</code><a class="copiable-link" href="#index-mhalf-reg-file"> ¶</a></span> +</dt> <dd> +<p>Don’t allocate any register in the range <code class="code">r32</code>…<code class="code">r63</code>. That allows code to run on hardware variants that lack these registers. </p> </dd> <dt> +<span><code class="code">-mprefer-short-insn-regs</code><a class="copiable-link" href="#index-mprefer-short-insn-regs"> ¶</a></span> +</dt> <dd> +<p>Preferentially allocate registers that allow short instruction generation. This can result in increased instruction count, so this may either reduce or increase overall code size. </p> </dd> <dt> +<span><code class="code">-mbranch-cost=<var class="var">num</var></code><a class="copiable-link" href="#index-mbranch-cost"> ¶</a></span> +</dt> <dd> +<p>Set the cost of branches to roughly <var class="var">num</var> “simple” instructions. This cost is only a heuristic and is not guaranteed to produce consistent results across releases. </p> </dd> <dt> +<span><code class="code">-mcmove</code><a class="copiable-link" href="#index-mcmove"> ¶</a></span> +</dt> <dd> +<p>Enable the generation of conditional moves. </p> </dd> <dt> +<span><code class="code">-mnops=<var class="var">num</var></code><a class="copiable-link" href="#index-mnops"> ¶</a></span> +</dt> <dd> +<p>Emit <var class="var">num</var> NOPs before every other generated instruction. </p> </dd> <dt> + <span><code class="code">-mno-soft-cmpsf</code><a class="copiable-link" href="#index-mno-soft-cmpsf"> ¶</a></span> +</dt> <dd> +<p>For single-precision floating-point comparisons, emit an <code class="code">fsub</code> instruction and test the flags. This is faster than a software comparison, but can get incorrect results in the presence of NaNs, or when two different small numbers are compared such that their difference is calculated as zero. The default is <samp class="option">-msoft-cmpsf</samp>, which uses slower, but IEEE-compliant, software comparisons. </p> </dd> <dt> +<span><code class="code">-mstack-offset=<var class="var">num</var></code><a class="copiable-link" href="#index-mstack-offset"> ¶</a></span> +</dt> <dd> +<p>Set the offset between the top of the stack and the stack pointer. E.g., a value of 8 means that the eight bytes in the range <code class="code">sp+0…sp+7</code> can be used by leaf functions without stack allocation. Values other than ‘<samp class="samp">8</samp>’ or ‘<samp class="samp">16</samp>’ are untested and unlikely to work. Note also that this option changes the ABI; compiling a program with a different stack offset than the libraries have been compiled with generally does not work. This option can be useful if you want to evaluate if a different stack offset would give you better code, but to actually use a different stack offset to build working programs, it is recommended to configure the toolchain with the appropriate <samp class="option">--with-stack-offset=<var class="var">num</var></samp> option. </p> </dd> <dt> + <span><code class="code">-mno-round-nearest</code><a class="copiable-link" href="#index-mno-round-nearest"> ¶</a></span> +</dt> <dd> +<p>Make the scheduler assume that the rounding mode has been set to truncating. The default is <samp class="option">-mround-nearest</samp>. </p> </dd> <dt> +<span><code class="code">-mlong-calls</code><a class="copiable-link" href="#index-mlong-calls"> ¶</a></span> +</dt> <dd> +<p>If not otherwise specified by an attribute, assume all calls might be beyond the offset range of the <code class="code">b</code> / <code class="code">bl</code> instructions, and therefore load the function address into a register before performing a (otherwise direct) call. This is the default. </p> </dd> <dt> +<span><code class="code">-mshort-calls</code><a class="copiable-link" href="#index-short-calls"> ¶</a></span> +</dt> <dd> +<p>If not otherwise specified by an attribute, assume all direct calls are in the range of the <code class="code">b</code> / <code class="code">bl</code> instructions, so use these instructions for direct calls. The default is <samp class="option">-mlong-calls</samp>. </p> </dd> <dt> +<span><code class="code">-msmall16</code><a class="copiable-link" href="#index-msmall16"> ¶</a></span> +</dt> <dd> +<p>Assume addresses can be loaded as 16-bit unsigned values. This does not apply to function addresses for which <samp class="option">-mlong-calls</samp> semantics are in effect. </p> </dd> <dt> +<span><code class="code">-mfp-mode=<var class="var">mode</var></code><a class="copiable-link" href="#index-mfp-mode"> ¶</a></span> +</dt> <dd> +<p>Set the prevailing mode of the floating-point unit. This determines the floating-point mode that is provided and expected at function call and return time. Making this mode match the mode you predominantly need at function start can make your programs smaller and faster by avoiding unnecessary mode switches. </p> <p><var class="var">mode</var> can be set to one the following values: </p> <dl class="table"> <dt>‘<samp class="samp">caller</samp>’</dt> <dd> +<p>Any mode at function entry is valid, and retained or restored when the function returns, and when it calls other functions. This mode is useful for compiling libraries or other compilation units you might want to incorporate into different programs with different prevailing FPU modes, and the convenience of being able to use a single object file outweighs the size and speed overhead for any extra mode switching that might be needed, compared with what would be needed with a more specific choice of prevailing FPU mode. </p> </dd> <dt>‘<samp class="samp">truncate</samp>’</dt> <dd> +<p>This is the mode used for floating-point calculations with truncating (i.e. round towards zero) rounding mode. That includes conversion from floating point to integer. </p> </dd> <dt>‘<samp class="samp">round-nearest</samp>’</dt> <dd> +<p>This is the mode used for floating-point calculations with round-to-nearest-or-even rounding mode. </p> </dd> <dt>‘<samp class="samp">int</samp>’</dt> <dd><p>This is the mode used to perform integer calculations in the FPU, e.g. integer multiply, or integer multiply-and-accumulate. </p></dd> </dl> <p>The default is <samp class="option">-mfp-mode=caller</samp> </p> </dd> <dt> + <span><code class="code">-mno-split-lohi</code><a class="copiable-link" href="#index-mno-split-lohi"> ¶</a></span> +</dt> <dt><code class="code">-mno-postinc</code></dt> <dt><code class="code">-mno-postmodify</code></dt> <dd> +<p>Code generation tweaks that disable, respectively, splitting of 32-bit loads, generation of post-increment addresses, and generation of post-modify addresses. The defaults are <samp class="option">msplit-lohi</samp>, <samp class="option">-mpost-inc</samp>, and <samp class="option">-mpost-modify</samp>. </p> </dd> <dt> + <span><code class="code">-mnovect-double</code><a class="copiable-link" href="#index-mno-vect-double"> ¶</a></span> +</dt> <dd> +<p>Change the preferred SIMD mode to SImode. The default is <samp class="option">-mvect-double</samp>, which uses DImode as preferred SIMD mode. </p> </dd> <dt> +<span><code class="code">-max-vect-align=<var class="var">num</var></code><a class="copiable-link" href="#index-max-vect-align"> ¶</a></span> +</dt> <dd> +<p>The maximum alignment for SIMD vector mode types. <var class="var">num</var> may be 4 or 8. The default is 8. Note that this is an ABI change, even though many library function interfaces are unaffected if they don’t use SIMD vector modes in places that affect size and/or alignment of relevant types. </p> </dd> <dt> +<span><code class="code">-msplit-vecmove-early</code><a class="copiable-link" href="#index-msplit-vecmove-early"> ¶</a></span> +</dt> <dd> +<p>Split vector moves into single word moves before reload. In theory this can give better register allocation, but so far the reverse seems to be generally the case. </p> </dd> <dt> +<span><code class="code">-m1reg-<var class="var">reg</var></code><a class="copiable-link" href="#index-m1reg-"> ¶</a></span> +</dt> <dd> +<p>Specify a register to hold the constant −1, which makes loading small negative constants and certain bitmasks faster. Allowable values for <var class="var">reg</var> are ‘<samp class="samp">r43</samp>’ and ‘<samp class="samp">r63</samp>’, which specify use of that register as a fixed register, and ‘<samp class="samp">none</samp>’, which means that no register is used for this purpose. The default is <samp class="option">-m1reg-none</samp>. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="amd-gcn-options">AMD GCN Options</a>, Previous: <a href="aarch64-options">AArch64 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Adapteva-Epiphany-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Adapteva-Epiphany-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/alignment.html b/devdocs/gcc~13/alignment.html new file mode 100644 index 00000000..803274df --- /dev/null +++ b/devdocs/gcc~13/alignment.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Alignment"> <div class="nav-panel"> <p> Next: <a href="inline" accesskey="n" rel="next">An Inline Function is As Fast As a Macro</a>, Previous: <a href="character-escapes" accesskey="p" rel="prev">The Character <kbd class="key">ESC</kbd> in Constants</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Determining-the-Alignment-of-Functions_002c-Types-or-Variables"><span>6.44 Determining the Alignment of Functions, Types or Variables<a class="copiable-link" href="#Determining-the-Alignment-of-Functions_002c-Types-or-Variables"> ¶</a></span></h1> <p>The keyword <code class="code">__alignof__</code> determines the alignment requirement of a function, object, or a type, or the minimum alignment usually required by a type. Its syntax is just like <code class="code">sizeof</code> and C11 <code class="code">_Alignof</code>. </p> <p>For example, if the target machine requires a <code class="code">double</code> value to be aligned on an 8-byte boundary, then <code class="code">__alignof__ (double)</code> is 8. This is true on many RISC machines. On more traditional machine designs, <code class="code">__alignof__ (double)</code> is 4 or even 2. </p> <p>Some machines never actually require alignment; they allow references to any data type even at an odd address. For these machines, <code class="code">__alignof__</code> reports the smallest alignment that GCC gives the data type, usually as mandated by the target ABI. </p> <p>If the operand of <code class="code">__alignof__</code> is an lvalue rather than a type, its value is the required alignment for its type, taking into account any minimum alignment specified by attribute <code class="code">aligned</code> (see <a class="pxref" href="common-variable-attributes">Common Variable Attributes</a>). For example, after this declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct foo { int x; char y; } foo1;</pre> +</div> <p>the value of <code class="code">__alignof__ (foo1.y)</code> is 1, even though its actual alignment is probably 2 or 4, the same as <code class="code">__alignof__ (int)</code>. It is an error to ask for the alignment of an incomplete type other than <code class="code">void</code>. </p> <p>If the operand of the <code class="code">__alignof__</code> expression is a function, the expression evaluates to the alignment of the function which may be specified by attribute <code class="code">aligned</code> (see <a class="pxref" href="common-function-attributes">Common Function Attributes</a>). </p> </div> <div class="nav-panel"> <p> Next: <a href="inline">An Inline Function is As Fast As a Macro</a>, Previous: <a href="character-escapes">The Character <kbd class="key">ESC</kbd> in Constants</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Alignment.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Alignment.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/alpha-built-in-functions.html b/devdocs/gcc~13/alpha-built-in-functions.html new file mode 100644 index 00000000..026b91d2 --- /dev/null +++ b/devdocs/gcc~13/alpha-built-in-functions.html @@ -0,0 +1,52 @@ +<div class="subsection-level-extent" id="Alpha-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="altera-nios-ii-built-in-functions" accesskey="n" rel="next">Altera Nios II Built-in Functions</a>, Previous: <a href="aarch64-built-in-functions" accesskey="p" rel="prev">AArch64 Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Alpha-Built-in-Functions-1"><span>6.60.2 Alpha Built-in Functions<a class="copiable-link" href="#Alpha-Built-in-Functions-1"> ¶</a></span></h1> <p>These built-in functions are available for the Alpha family of processors, depending on the command-line switches used. </p> <p>The following built-in functions are always available. They all generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">long __builtin_alpha_implver (void); +long __builtin_alpha_rpcc (void); +long __builtin_alpha_amask (long); +long __builtin_alpha_cmpbge (long, long); +long __builtin_alpha_extbl (long, long); +long __builtin_alpha_extwl (long, long); +long __builtin_alpha_extll (long, long); +long __builtin_alpha_extql (long, long); +long __builtin_alpha_extwh (long, long); +long __builtin_alpha_extlh (long, long); +long __builtin_alpha_extqh (long, long); +long __builtin_alpha_insbl (long, long); +long __builtin_alpha_inswl (long, long); +long __builtin_alpha_insll (long, long); +long __builtin_alpha_insql (long, long); +long __builtin_alpha_inswh (long, long); +long __builtin_alpha_inslh (long, long); +long __builtin_alpha_insqh (long, long); +long __builtin_alpha_mskbl (long, long); +long __builtin_alpha_mskwl (long, long); +long __builtin_alpha_mskll (long, long); +long __builtin_alpha_mskql (long, long); +long __builtin_alpha_mskwh (long, long); +long __builtin_alpha_msklh (long, long); +long __builtin_alpha_mskqh (long, long); +long __builtin_alpha_umulh (long, long); +long __builtin_alpha_zap (long, long); +long __builtin_alpha_zapnot (long, long);</pre> +</div> <p>The following built-in functions are always with <samp class="option">-mmax</samp> or <samp class="option">-mcpu=<var class="var">cpu</var></samp> where <var class="var">cpu</var> is <code class="code">pca56</code> or later. They all generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">long __builtin_alpha_pklb (long); +long __builtin_alpha_pkwb (long); +long __builtin_alpha_unpkbl (long); +long __builtin_alpha_unpkbw (long); +long __builtin_alpha_minub8 (long, long); +long __builtin_alpha_minsb8 (long, long); +long __builtin_alpha_minuw4 (long, long); +long __builtin_alpha_minsw4 (long, long); +long __builtin_alpha_maxub8 (long, long); +long __builtin_alpha_maxsb8 (long, long); +long __builtin_alpha_maxuw4 (long, long); +long __builtin_alpha_maxsw4 (long, long); +long __builtin_alpha_perr (long, long);</pre> +</div> <p>The following built-in functions are always with <samp class="option">-mcix</samp> or <samp class="option">-mcpu=<var class="var">cpu</var></samp> where <var class="var">cpu</var> is <code class="code">ev67</code> or later. They all generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">long __builtin_alpha_cttz (long); +long __builtin_alpha_ctlz (long); +long __builtin_alpha_ctpop (long);</pre> +</div> <p>The following built-in functions are available on systems that use the OSF/1 PALcode. Normally they invoke the <code class="code">rduniq</code> and <code class="code">wruniq</code> PAL calls, but when invoked with <samp class="option">-mtls-kernel</samp>, they invoke <code class="code">rdval</code> and <code class="code">wrval</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void *__builtin_thread_pointer (void); +void __builtin_set_thread_pointer (void *);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="altera-nios-ii-built-in-functions">Altera Nios II Built-in Functions</a>, Previous: <a href="aarch64-built-in-functions">AArch64 Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Alpha-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Alpha-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/altera-nios-ii-built-in-functions.html b/devdocs/gcc~13/altera-nios-ii-built-in-functions.html new file mode 100644 index 00000000..8c8d0095 --- /dev/null +++ b/devdocs/gcc~13/altera-nios-ii-built-in-functions.html @@ -0,0 +1,84 @@ +<div class="subsection-level-extent" id="Altera-Nios-II-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="arc-built-in-functions" accesskey="n" rel="next">ARC Built-in Functions</a>, Previous: <a href="alpha-built-in-functions" accesskey="p" rel="prev">Alpha Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Altera-Nios-II-Built-in-Functions-1"><span>6.60.3 Altera Nios II Built-in Functions<a class="copiable-link" href="#Altera-Nios-II-Built-in-Functions-1"> ¶</a></span></h1> <p>These built-in functions are available for the Altera Nios II family of processors. </p> <p>The following built-in functions are always available. They all generate the machine instruction that is part of the name. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">int __builtin_ldbio (volatile const void *); +int __builtin_ldbuio (volatile const void *); +int __builtin_ldhio (volatile const void *); +int __builtin_ldhuio (volatile const void *); +int __builtin_ldwio (volatile const void *); +void __builtin_stbio (volatile void *, int); +void __builtin_sthio (volatile void *, int); +void __builtin_stwio (volatile void *, int); +void __builtin_sync (void); +int __builtin_rdctl (int); +int __builtin_rdprs (int, int); +void __builtin_wrctl (int, int); +void __builtin_flushd (volatile void *); +void __builtin_flushda (volatile void *); +int __builtin_wrpie (int); +void __builtin_eni (int); +int __builtin_ldex (volatile const void *); +int __builtin_stex (volatile void *, int); +int __builtin_ldsex (volatile const void *); +int __builtin_stsex (volatile void *, int);</pre> +</div> <p>The following built-in functions are always available. They all generate a Nios II Custom Instruction. The name of the function represents the types that the function takes and returns. The letter before the <code class="code">n</code> is the return type or void if absent. The <code class="code">n</code> represents the first parameter to all the custom instructions, the custom instruction number. The two letters after the <code class="code">n</code> represent the up to two parameters to the function. </p> <p>The letters represent the following data types: </p> +<dl class="table"> <dt><code class="code"><no letter></code></dt> <dd> +<p><code class="code">void</code> for return type and no parameter for parameter types. </p> </dd> <dt><code class="code">i</code></dt> <dd> +<p><code class="code">int</code> for return type and parameter type </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p><code class="code">float</code> for return type and parameter type </p> </dd> <dt><code class="code">p</code></dt> <dd> +<p><code class="code">void *</code> for return type and parameter type </p> </dd> </dl> <p>And the function names are: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">void __builtin_custom_n (void); +void __builtin_custom_ni (int); +void __builtin_custom_nf (float); +void __builtin_custom_np (void *); +void __builtin_custom_nii (int, int); +void __builtin_custom_nif (int, float); +void __builtin_custom_nip (int, void *); +void __builtin_custom_nfi (float, int); +void __builtin_custom_nff (float, float); +void __builtin_custom_nfp (float, void *); +void __builtin_custom_npi (void *, int); +void __builtin_custom_npf (void *, float); +void __builtin_custom_npp (void *, void *); +int __builtin_custom_in (void); +int __builtin_custom_ini (int); +int __builtin_custom_inf (float); +int __builtin_custom_inp (void *); +int __builtin_custom_inii (int, int); +int __builtin_custom_inif (int, float); +int __builtin_custom_inip (int, void *); +int __builtin_custom_infi (float, int); +int __builtin_custom_inff (float, float); +int __builtin_custom_infp (float, void *); +int __builtin_custom_inpi (void *, int); +int __builtin_custom_inpf (void *, float); +int __builtin_custom_inpp (void *, void *); +float __builtin_custom_fn (void); +float __builtin_custom_fni (int); +float __builtin_custom_fnf (float); +float __builtin_custom_fnp (void *); +float __builtin_custom_fnii (int, int); +float __builtin_custom_fnif (int, float); +float __builtin_custom_fnip (int, void *); +float __builtin_custom_fnfi (float, int); +float __builtin_custom_fnff (float, float); +float __builtin_custom_fnfp (float, void *); +float __builtin_custom_fnpi (void *, int); +float __builtin_custom_fnpf (void *, float); +float __builtin_custom_fnpp (void *, void *); +void * __builtin_custom_pn (void); +void * __builtin_custom_pni (int); +void * __builtin_custom_pnf (float); +void * __builtin_custom_pnp (void *); +void * __builtin_custom_pnii (int, int); +void * __builtin_custom_pnif (int, float); +void * __builtin_custom_pnip (int, void *); +void * __builtin_custom_pnfi (float, int); +void * __builtin_custom_pnff (float, float); +void * __builtin_custom_pnfp (float, void *); +void * __builtin_custom_pnpi (void *, int); +void * __builtin_custom_pnpf (void *, float); +void * __builtin_custom_pnpp (void *, void *);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="arc-built-in-functions">ARC Built-in Functions</a>, Previous: <a href="alpha-built-in-functions">Alpha Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Altera-Nios-II-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Altera-Nios-II-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/alternate-keywords.html b/devdocs/gcc~13/alternate-keywords.html new file mode 100644 index 00000000..4d35503d --- /dev/null +++ b/devdocs/gcc~13/alternate-keywords.html @@ -0,0 +1,9 @@ +<div class="section-level-extent" id="Alternate-Keywords"> <div class="nav-panel"> <p> Next: <a href="incomplete-enums" accesskey="n" rel="next">Incomplete <code class="code">enum</code> Types</a>, Previous: <a href="using-assembly-language-with-c" accesskey="p" rel="prev">How to Use Inline Assembly Language in C Code</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Alternate-Keywords-1"><span>6.48 Alternate Keywords<a class="copiable-link" href="#Alternate-Keywords-1"> ¶</a></span></h1> <p><samp class="option">-ansi</samp> and the various <samp class="option">-std</samp> options disable certain keywords. This causes trouble when you want to use GNU C extensions, or a general-purpose header file that should be usable by all programs, including ISO C programs. The keywords <code class="code">asm</code>, <code class="code">typeof</code> and <code class="code">inline</code> are not available in programs compiled with <samp class="option">-ansi</samp> or <samp class="option">-std</samp> (although <code class="code">inline</code> can be used in a program compiled with <samp class="option">-std=c99</samp> or a later standard). The ISO C99 keyword <code class="code">restrict</code> is only available when <samp class="option">-std=gnu99</samp> (which will eventually be the default) or <samp class="option">-std=c99</samp> (or the equivalent <samp class="option">-std=iso9899:1999</samp>), or an option for a later standard version, is used. </p> <p>The way to solve these problems is to put ‘<samp class="samp">__</samp>’ at the beginning and end of each problematical keyword. For example, use <code class="code">__asm__</code> instead of <code class="code">asm</code>, and <code class="code">__inline__</code> instead of <code class="code">inline</code>. </p> <p>Other C compilers won’t accept these alternative keywords; if you want to compile with another compiler, you can define the alternate keywords as macros to replace them with the customary keywords. It looks like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#ifndef __GNUC__ +#define __asm__ asm +#endif</pre> +</div> <p><samp class="option">-pedantic</samp> and other options cause warnings for many GNU C extensions. You can prevent such warnings within one expression by writing <code class="code">__extension__</code> before the expression. <code class="code">__extension__</code> has no effect aside from this. </p> </div> <div class="nav-panel"> <p> Next: <a href="incomplete-enums">Incomplete <code class="code">enum</code> Types</a>, Previous: <a href="using-assembly-language-with-c">How to Use Inline Assembly Language in C Code</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Alternate-Keywords.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Alternate-Keywords.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/amd-gcn-function-attributes.html b/devdocs/gcc~13/amd-gcn-function-attributes.html new file mode 100644 index 00000000..2f4dd4be --- /dev/null +++ b/devdocs/gcc~13/amd-gcn-function-attributes.html @@ -0,0 +1,27 @@ +<div class="subsection-level-extent" id="AMD-GCN-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="arc-function-attributes" accesskey="n" rel="next">ARC Function Attributes</a>, Previous: <a href="aarch64-function-attributes" accesskey="p" rel="prev">AArch64 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AMD-GCN-Function-Attributes-1"><span>6.33.3 AMD GCN Function Attributes<a class="copiable-link" href="#AMD-GCN-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the AMD GCN back end: </p> <dl class="table"> <dt> +<span><code class="code">amdgpu_hsa_kernel</code><a class="copiable-link" href="#index-amdgpu_005fhsa_005fkernel-function-attribute_002c-AMD-GCN"> ¶</a></span> +</dt> <dd> +<p>This attribute indicates that the corresponding function should be compiled as a kernel function, that is an entry point that can be invoked from the host via the HSA runtime library. By default functions are only callable only from other GCN functions. </p> <p>This attribute is implicitly applied to any function named <code class="code">main</code>, using default parameters. </p> <p>Kernel functions may return an integer value, which will be written to a conventional place within the HSA "kernargs" region. </p> <p>The attribute parameters configure what values are passed into the kernel function by the GPU drivers, via the initial register state. Some values are used by the compiler, and therefore forced on. Enabling other options may break assumptions in the compiler and/or run-time libraries. </p> <dl class="table"> <dt><code class="code">private_segment_buffer</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_private_segment_buffer</code> flag. Always on (required to locate the stack). </p> </dd> <dt><code class="code">dispatch_ptr</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_dispatch_ptr</code> flag. Always on (required to locate the launch dimensions). </p> </dd> <dt><code class="code">queue_ptr</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_queue_ptr</code> flag. Always on (required to convert address spaces). </p> </dd> <dt><code class="code">kernarg_segment_ptr</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_kernarg_segment_ptr</code> flag. Always on (required to locate the kernel arguments, "kernargs"). </p> </dd> <dt><code class="code">dispatch_id</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_dispatch_id</code> flag. </p> </dd> <dt><code class="code">flat_scratch_init</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_flat_scratch_init</code> flag. </p> </dd> <dt><code class="code">private_segment_size</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_private_segment_size</code> flag. </p> </dd> <dt><code class="code">grid_workgroup_count_X</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_grid_workgroup_count_x</code> flag. Always on (required to use OpenACC/OpenMP). </p> </dd> <dt><code class="code">grid_workgroup_count_Y</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_grid_workgroup_count_y</code> flag. </p> </dd> <dt><code class="code">grid_workgroup_count_Z</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_grid_workgroup_count_z</code> flag. </p> </dd> <dt><code class="code">workgroup_id_X</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_workgroup_id_x</code> flag. </p> </dd> <dt><code class="code">workgroup_id_Y</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_workgroup_id_y</code> flag. </p> </dd> <dt><code class="code">workgroup_id_Z</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_workgroup_id_z</code> flag. </p> </dd> <dt><code class="code">workgroup_info</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_workgroup_info</code> flag. </p> </dd> <dt><code class="code">private_segment_wave_offset</code></dt> <dd> +<p>Set <code class="code">enable_sgpr_private_segment_wave_byte_offset</code> flag. Always on (required to locate the stack). </p> </dd> <dt><code class="code">work_item_id_X</code></dt> <dd> +<p>Set <code class="code">enable_vgpr_workitem_id</code> parameter. Always on (can’t be disabled). </p> </dd> <dt><code class="code">work_item_id_Y</code></dt> <dd> +<p>Set <code class="code">enable_vgpr_workitem_id</code> parameter. Always on (required to enable vectorization.) </p> </dd> <dt><code class="code">work_item_id_Z</code></dt> <dd> +<p>Set <code class="code">enable_vgpr_workitem_id</code> parameter. Always on (required to use OpenACC/OpenMP). </p> </dd> </dl> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="arc-function-attributes">ARC Function Attributes</a>, Previous: <a href="aarch64-function-attributes">AArch64 Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AMD-GCN-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AMD-GCN-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/amd-gcn-options.html b/devdocs/gcc~13/amd-gcn-options.html new file mode 100644 index 00000000..852851e0 --- /dev/null +++ b/devdocs/gcc~13/amd-gcn-options.html @@ -0,0 +1,23 @@ +<div class="subsection-level-extent" id="AMD-GCN-Options"> <div class="nav-panel"> <p> Next: <a href="arc-options" accesskey="n" rel="next">ARC Options</a>, Previous: <a href="adapteva-epiphany-options" accesskey="p" rel="prev">Adapteva Epiphany Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AMD-GCN-Options-1"><span>3.19.3 AMD GCN Options<a class="copiable-link" href="#AMD-GCN-Options-1"> ¶</a></span></h1> <p>These options are defined specifically for the AMD GCN port. </p> <dl class="table"> <dt> + <span><code class="code">-march=<var class="var">gpu</var></code><a class="copiable-link" href="#index-march-1"> ¶</a></span> +</dt> <dt><code class="code">-mtune=<var class="var">gpu</var></code></dt> <dd> +<p>Set architecture type or tuning for <var class="var">gpu</var>. Supported values for <var class="var">gpu</var> are </p> <dl class="table"> <dt>‘<samp class="samp">fiji</samp>’</dt> <dd> +<p>Compile for GCN3 Fiji devices (gfx803). </p> </dd> <dt>‘<samp class="samp">gfx900</samp>’</dt> <dd> +<p>Compile for GCN5 Vega 10 devices (gfx900). </p> </dd> <dt>‘<samp class="samp">gfx906</samp>’</dt> <dd> +<p>Compile for GCN5 Vega 20 devices (gfx906). </p> </dd> <dt>‘<samp class="samp">gfx908</samp>’</dt> <dd> +<p>Compile for CDNA1 Instinct MI100 series devices (gfx908). </p> </dd> <dt>‘<samp class="samp">gfx90a</samp>’</dt> <dd> +<p>Compile for CDNA2 Instinct MI200 series devices (gfx90a). </p> </dd> </dl> </dd> <dt> +<span><code class="code">-msram-ecc=on</code><a class="copiable-link" href="#index-msram-ecc"> ¶</a></span> +</dt> <dt><code class="code">-msram-ecc=off</code></dt> <dt><code class="code">-msram-ecc=any</code></dt> <dd> +<p>Compile binaries suitable for devices with the SRAM-ECC feature enabled, disabled, or either mode. This feature can be enabled per-process on some devices. The compiled code must match the device mode. The default is ‘<samp class="samp">any</samp>’, for devices that support it. </p> </dd> <dt> +<span><code class="code">-mstack-size=<var class="var">bytes</var></code><a class="copiable-link" href="#index-mstack-size"> ¶</a></span> +</dt> <dd> +<p>Specify how many <var class="var">bytes</var> of stack space will be requested for each GPU thread (wave-front). Beware that there may be many threads and limited memory available. The size of the stack allocation may also have an impact on run-time performance. The default is 32KB when using OpenACC or OpenMP, and 1MB otherwise. </p> </dd> <dt> +<span><code class="code">-mxnack</code><a class="copiable-link" href="#index-mxnack"> ¶</a></span> +</dt> <dd> +<p>Compile binaries suitable for devices with the XNACK feature enabled. Some devices always require XNACK and some allow the user to configure XNACK. The compiled code must match the device mode. The default is ‘<samp class="samp">-mno-xnack</samp>’. At present this option is a placeholder for support that is not yet implemented. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="arc-options">ARC Options</a>, Previous: <a href="adapteva-epiphany-options">Adapteva Epiphany Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AMD-GCN-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AMD-GCN-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arc-built-in-functions.html b/devdocs/gcc~13/arc-built-in-functions.html new file mode 100644 index 00000000..71b5e00e --- /dev/null +++ b/devdocs/gcc~13/arc-built-in-functions.html @@ -0,0 +1,142 @@ +<div class="subsection-level-extent" id="ARC-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="arc-simd-built-in-functions" accesskey="n" rel="next">ARC SIMD Built-in Functions</a>, Previous: <a href="altera-nios-ii-built-in-functions" accesskey="p" rel="prev">Altera Nios II Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARC-Built-in-Functions-1"><span>6.60.4 ARC Built-in Functions<a class="copiable-link" href="#ARC-Built-in-Functions-1"> ¶</a></span></h1> <p>The following built-in functions are provided for ARC targets. The built-ins generate the corresponding assembly instructions. In the examples given below, the generated code often requires an operand or result to be in a register. Where necessary further code will be generated to ensure this is true, but for brevity this is not described in each case. </p> <p><em class="emph">Note:</em> Using a built-in to generate an instruction not supported by a target may cause problems. At present the compiler is not guaranteed to detect such misuse, and as a result an internal compiler error may be generated. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005faligned"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_arc_aligned</strong> <code class="def-code-arguments">(void *<var class="var">val</var>, int <var class="var">alignval</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005faligned"> ¶</a></span> +</dt> <dd> +<p>Return 1 if <var class="var">val</var> is known to have the byte alignment given by <var class="var">alignval</var>, otherwise return 0. Note that this is different from </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__alignof__(*(char *)<var class="var">val</var>) >= alignval</pre> +</div> <p>because __alignof__ sees only the type of the dereference, whereas __builtin_arc_align uses alignment information from the pointer as well as from the pointed-to type. The information available will depend on optimization level. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fbrk"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_brk</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fbrk"> ¶</a></span> +</dt> <dd> +<p>Generates </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">brk</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fcore_005fread"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">__builtin_arc_core_read</strong> <code class="def-code-arguments">(unsigned int <var class="var">regno</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fcore_005fread"> ¶</a></span> +</dt> <dd> +<p>The operand is the number of a register to be read. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">mov <var class="var">dest</var>, r<var class="var">regno</var></pre> +</div> <p>where the value in <var class="var">dest</var> will be the result returned from the built-in. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fcore_005fwrite"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_core_write</strong> <code class="def-code-arguments">(unsigned int <var class="var">regno</var>, unsigned int <var class="var">val</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fcore_005fwrite"> ¶</a></span> +</dt> <dd> +<p>The first operand is the number of a register to be written, the second operand is a compile time constant to write into that register. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">mov r<var class="var">regno</var>, <var class="var">val</var></pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fdivaw"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_arc_divaw</strong> <code class="def-code-arguments">(int <var class="var">a</var>, int <var class="var">b</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fdivaw"> ¶</a></span> +</dt> <dd> +<p>Only available if either <samp class="option">-mcpu=ARC700</samp> or <samp class="option">-meA</samp> is set. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">divaw <var class="var">dest</var>, <var class="var">a</var>, <var class="var">b</var></pre> +</div> <p>where the value in <var class="var">dest</var> will be the result returned from the built-in. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fflag"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_flag</strong> <code class="def-code-arguments">(unsigned int <var class="var">a</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fflag"> ¶</a></span> +</dt> <dd> +<p>Generates </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">flag <var class="var">a</var></pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005flr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">__builtin_arc_lr</strong> <code class="def-code-arguments">(unsigned int <var class="var">auxr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005flr"> ¶</a></span> +</dt> <dd> +<p>The operand, <var class="var">auxv</var>, is the address of an auxiliary register and must be a compile time constant. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">lr <var class="var">dest</var>, [<var class="var">auxr</var>]</pre> +</div> <p>Where the value in <var class="var">dest</var> will be the result returned from the built-in. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fmul64"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_mul64</strong> <code class="def-code-arguments">(int <var class="var">a</var>, int <var class="var">b</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fmul64"> ¶</a></span> +</dt> <dd> +<p>Only available with <samp class="option">-mmul64</samp>. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">mul64 <var class="var">a</var>, <var class="var">b</var></pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fmulu64"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_mulu64</strong> <code class="def-code-arguments">(unsigned int <var class="var">a</var>, unsigned int <var class="var">b</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fmulu64"> ¶</a></span> +</dt> <dd> +<p>Only available with <samp class="option">-mmul64</samp>. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">mulu64 <var class="var">a</var>, <var class="var">b</var></pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fnop"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_nop</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fnop"> ¶</a></span> +</dt> <dd> +<p>Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">nop</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fnorm"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_arc_norm</strong> <code class="def-code-arguments">(int <var class="var">src</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fnorm"> ¶</a></span> +</dt> <dd> +<p>Only valid if the ‘<samp class="samp">norm</samp>’ instruction is available through the <samp class="option">-mnorm</samp> option or by default with <samp class="option">-mcpu=ARC700</samp>. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">norm <var class="var">dest</var>, <var class="var">src</var></pre> +</div> <p>Where the value in <var class="var">dest</var> will be the result returned from the built-in. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fnormw"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">short int</code> <strong class="def-name">__builtin_arc_normw</strong> <code class="def-code-arguments">(short int <var class="var">src</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fnormw"> ¶</a></span> +</dt> <dd> +<p>Only valid if the ‘<samp class="samp">normw</samp>’ instruction is available through the <samp class="option">-mnorm</samp> option or by default with <samp class="option">-mcpu=ARC700</samp>. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">normw <var class="var">dest</var>, <var class="var">src</var></pre> +</div> <p>Where the value in <var class="var">dest</var> will be the result returned from the built-in. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005frtie"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_rtie</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005frtie"> ¶</a></span> +</dt> <dd> +<p>Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">rtie</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fsleep"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_sleep</strong> <code class="def-code-arguments">(int <var class="var">a</var></code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fsleep"> ¶</a></span> +</dt> <dd> +<p>Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">sleep <var class="var">a</var></pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fsr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_sr</strong> <code class="def-code-arguments">(unsigned int <var class="var">val</var>, unsigned int <var class="var">auxr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fsr"> ¶</a></span> +</dt> <dd> +<p>The first argument, <var class="var">val</var>, is a compile time constant to be written to the register, the second argument, <var class="var">auxr</var>, is the address of an auxiliary register. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">sr <var class="var">val</var>, [<var class="var">auxr</var>]</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fswap"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_arc_swap</strong> <code class="def-code-arguments">(int <var class="var">src</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fswap"> ¶</a></span> +</dt> <dd> +<p>Only valid with <samp class="option">-mswap</samp>. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">swap <var class="var">dest</var>, <var class="var">src</var></pre> +</div> <p>Where the value in <var class="var">dest</var> will be the result returned from the built-in. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fswi"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_swi</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fswi"> ¶</a></span> +</dt> <dd> +<p>Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">swi</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005fsync"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_sync</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005fsync"> ¶</a></span> +</dt> <dd> +<p>Only available with <samp class="option">-mcpu=ARC700</samp>. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">sync</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005ftrap_005fs"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_trap_s</strong> <code class="def-code-arguments">(unsigned int <var class="var">c</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005ftrap_005fs"> ¶</a></span> +</dt> <dd> +<p>Only available with <samp class="option">-mcpu=ARC700</samp>. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">trap_s <var class="var">c</var></pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005farc_005funimp_005fs"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_arc_unimp_s</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005farc_005funimp_005fs"> ¶</a></span> +</dt> <dd> +<p>Only available with <samp class="option">-mcpu=ARC700</samp>. Generates: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">unimp_s</pre> +</div> </dd> +</dl> <p>The instructions generated by the following builtins are not considered as candidates for scheduling. They are not moved around by the compiler during scheduling, and thus can be expected to appear where they are put in the C code: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">__builtin_arc_brk() +__builtin_arc_core_read() +__builtin_arc_core_write() +__builtin_arc_flag() +__builtin_arc_lr() +__builtin_arc_sleep() +__builtin_arc_sr() +__builtin_arc_swi()</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="arc-simd-built-in-functions">ARC SIMD Built-in Functions</a>, Previous: <a href="altera-nios-ii-built-in-functions">Altera Nios II Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arc-function-attributes.html b/devdocs/gcc~13/arc-function-attributes.html new file mode 100644 index 00000000..066bcc78 --- /dev/null +++ b/devdocs/gcc~13/arc-function-attributes.html @@ -0,0 +1,25 @@ +<div class="subsection-level-extent" id="ARC-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="arm-function-attributes" accesskey="n" rel="next">ARM Function Attributes</a>, Previous: <a href="amd-gcn-function-attributes" accesskey="p" rel="prev">AMD GCN Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARC-Function-Attributes-1"><span>6.33.4 ARC Function Attributes<a class="copiable-link" href="#ARC-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the ARC back end: </p> <dl class="table"> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-ARC"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> <p>On the ARC, you must specify the kind of interrupt to be handled in a parameter to the interrupt attribute like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f () __attribute__ ((interrupt ("ilink1")));</pre> +</div> <p>Permissible values for this parameter are: <code class="code">ilink1</code> and <code class="code">ilink2</code> for ARCv1 architecture, and <code class="code">ilink</code> and <code class="code">firq</code> for ARCv2 architecture. </p> </dd> <dt> + <span><code class="code">long_call</code><a class="copiable-link" href="#index-long_005fcall-function-attribute_002c-ARC"> ¶</a></span> +</dt> <dt><code class="code">medium_call</code></dt> <dt><code class="code">short_call</code></dt> <dd> +<p>These attributes specify how a particular function is called. These attributes override the <samp class="option">-mlong-calls</samp> and <samp class="option">-mmedium-calls</samp> (see <a class="pxref" href="arc-options">ARC Options</a>) command-line switches and <code class="code">#pragma long_calls</code> settings. </p> <p>For ARC, a function marked with the <code class="code">long_call</code> attribute is always called using register-indirect jump-and-link instructions, thereby enabling the called function to be placed anywhere within the 32-bit address space. A function marked with the <code class="code">medium_call</code> attribute will always be close enough to be called with an unconditional branch-and-link instruction, which has a 25-bit offset from the call site. A function marked with the <code class="code">short_call</code> attribute will always be close enough to be called with a conditional branch-and-link instruction, which has a 21-bit offset from the call site. </p> </dd> <dt> +<span><code class="code">jli_always</code><a class="copiable-link" href="#index-jli_005falways-function-attribute_002c-ARC"> ¶</a></span> +</dt> <dd> +<p>Forces a particular function to be called using <code class="code">jli</code> instruction. The <code class="code">jli</code> instruction makes use of a table stored into <code class="code">.jlitab</code> section, which holds the location of the functions which are addressed using this instruction. </p> </dd> <dt> +<span><code class="code">jli_fixed</code><a class="copiable-link" href="#index-jli_005ffixed-function-attribute_002c-ARC"> ¶</a></span> +</dt> <dd> +<p>Identical like the above one, but the location of the function in the <code class="code">jli</code> table is known and given as an attribute parameter. </p> </dd> <dt> +<span><code class="code">secure_call</code><a class="copiable-link" href="#index-secure_005fcall-function-attribute_002c-ARC"> ¶</a></span> +</dt> <dd> +<p>This attribute allows one to mark secure-code functions that are callable from normal mode. The location of the secure call function into the <code class="code">sjli</code> table needs to be passed as argument. </p> </dd> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-ARC"> ¶</a></span> +</dt> <dd> +<p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="arm-function-attributes">ARM Function Attributes</a>, Previous: <a href="amd-gcn-function-attributes">AMD GCN Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arc-options.html b/devdocs/gcc~13/arc-options.html new file mode 100644 index 00000000..88eaef02 --- /dev/null +++ b/devdocs/gcc~13/arc-options.html @@ -0,0 +1,328 @@ +<div class="subsection-level-extent" id="ARC-Options"> <div class="nav-panel"> <p> Next: <a href="arm-options" accesskey="n" rel="next">ARM Options</a>, Previous: <a href="amd-gcn-options" accesskey="p" rel="prev">AMD GCN Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARC-Options-1"><span>3.19.4 ARC Options<a class="copiable-link" href="#ARC-Options-1"> ¶</a></span></h1> <p>The following options control the architecture variant for which code is being compiled: </p> <dl class="table"> <dt> +<span><code class="code">-mbarrel-shifter</code><a class="copiable-link" href="#index-mbarrel-shifter"> ¶</a></span> +</dt> <dd> +<p>Generate instructions supported by barrel shifter. This is the default unless <samp class="option">-mcpu=ARC601</samp> or ‘<samp class="samp">-mcpu=ARCEM</samp>’ is in effect. </p> </dd> <dt> +<span><code class="code">-mjli-always</code><a class="copiable-link" href="#index-mjli-always"> ¶</a></span> +</dt> <dd> +<p>Force to call a function using jli_s instruction. This option is valid only for ARCv2 architecture. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu</var></code><a class="copiable-link" href="#index-mcpu-1"> ¶</a></span> +</dt> <dd> +<p>Set architecture type, register usage, and instruction scheduling parameters for <var class="var">cpu</var>. There are also shortcut alias options available for backward compatibility and convenience. Supported values for <var class="var">cpu</var> are </p> <dl class="table"> <dt> + <span>‘<samp class="samp">arc600</samp>’<a class="copiable-link" href="#index-mA6"> ¶</a></span> +</dt> <dd> +<p>Compile for ARC600. Aliases: <samp class="option">-mA6</samp>, <samp class="option">-mARC600</samp>. </p> </dd> <dt> +<span>‘<samp class="samp">arc601</samp>’<a class="copiable-link" href="#index-mARC601"> ¶</a></span> +</dt> <dd> +<p>Compile for ARC601. Alias: <samp class="option">-mARC601</samp>. </p> </dd> <dt> + <span>‘<samp class="samp">arc700</samp>’<a class="copiable-link" href="#index-mA7"> ¶</a></span> +</dt> <dd> +<p>Compile for ARC700. Aliases: <samp class="option">-mA7</samp>, <samp class="option">-mARC700</samp>. This is the default when configured with <samp class="option">--with-cpu=arc700</samp>. </p> </dd> <dt>‘<samp class="samp">arcem</samp>’</dt> <dd> +<p>Compile for ARC EM. </p> </dd> <dt>‘<samp class="samp">archs</samp>’</dt> <dd> +<p>Compile for ARC HS. </p> </dd> <dt>‘<samp class="samp">em</samp>’</dt> <dd> +<p>Compile for ARC EM CPU with no hardware extensions. </p> </dd> <dt>‘<samp class="samp">em4</samp>’</dt> <dd> +<p>Compile for ARC EM4 CPU. </p> </dd> <dt>‘<samp class="samp">em4_dmips</samp>’</dt> <dd> +<p>Compile for ARC EM4 DMIPS CPU. </p> </dd> <dt>‘<samp class="samp">em4_fpus</samp>’</dt> <dd> +<p>Compile for ARC EM4 DMIPS CPU with the single-precision floating-point extension. </p> </dd> <dt>‘<samp class="samp">em4_fpuda</samp>’</dt> <dd> +<p>Compile for ARC EM4 DMIPS CPU with single-precision floating-point and double assist instructions. </p> </dd> <dt>‘<samp class="samp">hs</samp>’</dt> <dd> +<p>Compile for ARC HS CPU with no hardware extensions except the atomic instructions. </p> </dd> <dt>‘<samp class="samp">hs34</samp>’</dt> <dd> +<p>Compile for ARC HS34 CPU. </p> </dd> <dt>‘<samp class="samp">hs38</samp>’</dt> <dd> +<p>Compile for ARC HS38 CPU. </p> </dd> <dt>‘<samp class="samp">hs38_linux</samp>’</dt> <dd> +<p>Compile for ARC HS38 CPU with all hardware extensions on. </p> </dd> <dt>‘<samp class="samp">hs4x</samp>’</dt> <dd> +<p>Compile for ARC HS4x CPU. </p> </dd> <dt>‘<samp class="samp">hs4xd</samp>’</dt> <dd> +<p>Compile for ARC HS4xD CPU. </p> </dd> <dt>‘<samp class="samp">hs4x_rel31</samp>’</dt> <dd> +<p>Compile for ARC HS4x CPU release 3.10a. </p> </dd> <dt>‘<samp class="samp">arc600_norm</samp>’</dt> <dd> +<p>Compile for ARC 600 CPU with <code class="code">norm</code> instructions enabled. </p> </dd> <dt>‘<samp class="samp">arc600_mul32x16</samp>’</dt> <dd> +<p>Compile for ARC 600 CPU with <code class="code">norm</code> and 32x16-bit multiply instructions enabled. </p> </dd> <dt>‘<samp class="samp">arc600_mul64</samp>’</dt> <dd> +<p>Compile for ARC 600 CPU with <code class="code">norm</code> and <code class="code">mul64</code>-family instructions enabled. </p> </dd> <dt>‘<samp class="samp">arc601_norm</samp>’</dt> <dd> +<p>Compile for ARC 601 CPU with <code class="code">norm</code> instructions enabled. </p> </dd> <dt>‘<samp class="samp">arc601_mul32x16</samp>’</dt> <dd> +<p>Compile for ARC 601 CPU with <code class="code">norm</code> and 32x16-bit multiply instructions enabled. </p> </dd> <dt>‘<samp class="samp">arc601_mul64</samp>’</dt> <dd> +<p>Compile for ARC 601 CPU with <code class="code">norm</code> and <code class="code">mul64</code>-family instructions enabled. </p> </dd> <dt>‘<samp class="samp">nps400</samp>’</dt> <dd> +<p>Compile for ARC 700 on NPS400 chip. </p> </dd> <dt>‘<samp class="samp">em_mini</samp>’</dt> <dd> +<p>Compile for ARC EM minimalist configuration featuring reduced register set. </p> </dd> </dl> </dd> <dt> + <span><code class="code">-mdpfp</code><a class="copiable-link" href="#index-mdpfp"> ¶</a></span> +</dt> <dt><code class="code">-mdpfp-compact</code></dt> <dd> +<p>Generate double-precision FPX instructions, tuned for the compact implementation. </p> </dd> <dt> +<span><code class="code">-mdpfp-fast</code><a class="copiable-link" href="#index-mdpfp-fast"> ¶</a></span> +</dt> <dd> +<p>Generate double-precision FPX instructions, tuned for the fast implementation. </p> </dd> <dt> +<span><code class="code">-mno-dpfp-lrsr</code><a class="copiable-link" href="#index-mno-dpfp-lrsr"> ¶</a></span> +</dt> <dd> +<p>Disable <code class="code">lr</code> and <code class="code">sr</code> instructions from using FPX extension aux registers. </p> </dd> <dt> +<span><code class="code">-mea</code><a class="copiable-link" href="#index-mea"> ¶</a></span> +</dt> <dd> +<p>Generate extended arithmetic instructions. Currently only <code class="code">divaw</code>, <code class="code">adds</code>, <code class="code">subs</code>, and <code class="code">sat16</code> are supported. Only valid for <samp class="option">-mcpu=ARC700</samp>. </p> </dd> <dt> + <span><code class="code">-mno-mpy</code><a class="copiable-link" href="#index-mno-mpy"> ¶</a></span> +</dt> <dd> +<p>Do not generate <code class="code">mpy</code>-family instructions for ARC700. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mmul32x16</code><a class="copiable-link" href="#index-mmul32x16"> ¶</a></span> +</dt> <dd> +<p>Generate 32x16-bit multiply and multiply-accumulate instructions. </p> </dd> <dt> +<span><code class="code">-mmul64</code><a class="copiable-link" href="#index-mmul64"> ¶</a></span> +</dt> <dd> +<p>Generate <code class="code">mul64</code> and <code class="code">mulu64</code> instructions. Only valid for <samp class="option">-mcpu=ARC600</samp>. </p> </dd> <dt> +<span><code class="code">-mnorm</code><a class="copiable-link" href="#index-mnorm"> ¶</a></span> +</dt> <dd> +<p>Generate <code class="code">norm</code> instructions. This is the default if <samp class="option">-mcpu=ARC700</samp> is in effect. </p> </dd> <dt> + <span><code class="code">-mspfp</code><a class="copiable-link" href="#index-mspfp"> ¶</a></span> +</dt> <dt><code class="code">-mspfp-compact</code></dt> <dd> +<p>Generate single-precision FPX instructions, tuned for the compact implementation. </p> </dd> <dt> +<span><code class="code">-mspfp-fast</code><a class="copiable-link" href="#index-mspfp-fast"> ¶</a></span> +</dt> <dd> +<p>Generate single-precision FPX instructions, tuned for the fast implementation. </p> </dd> <dt> +<span><code class="code">-msimd</code><a class="copiable-link" href="#index-msimd"> ¶</a></span> +</dt> <dd> +<p>Enable generation of ARC SIMD instructions via target-specific builtins. Only valid for <samp class="option">-mcpu=ARC700</samp>. </p> </dd> <dt> +<span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float"> ¶</a></span> +</dt> <dd> +<p>This option ignored; it is provided for compatibility purposes only. Software floating-point code is emitted by default, and this default can overridden by FPX options; <samp class="option">-mspfp</samp>, <samp class="option">-mspfp-compact</samp>, or <samp class="option">-mspfp-fast</samp> for single precision, and <samp class="option">-mdpfp</samp>, <samp class="option">-mdpfp-compact</samp>, or <samp class="option">-mdpfp-fast</samp> for double precision. </p> </dd> <dt> +<span><code class="code">-mswap</code><a class="copiable-link" href="#index-mswap"> ¶</a></span> +</dt> <dd> +<p>Generate <code class="code">swap</code> instructions. </p> </dd> <dt> +<span><code class="code">-matomic</code><a class="copiable-link" href="#index-matomic"> ¶</a></span> +</dt> <dd> +<p>This enables use of the locked load/store conditional extension to implement atomic memory built-in functions. Not available for ARC 6xx or ARC EM cores. </p> </dd> <dt> +<span><code class="code">-mdiv-rem</code><a class="copiable-link" href="#index-mdiv-rem"> ¶</a></span> +</dt> <dd> +<p>Enable <code class="code">div</code> and <code class="code">rem</code> instructions for ARCv2 cores. </p> </dd> <dt> +<span><code class="code">-mcode-density</code><a class="copiable-link" href="#index-mcode-density"> ¶</a></span> +</dt> <dd> +<p>Enable code density instructions for ARC EM. This option is on by default for ARC HS. </p> </dd> <dt> +<span><code class="code">-mll64</code><a class="copiable-link" href="#index-mll64"> ¶</a></span> +</dt> <dd> +<p>Enable double load/store operations for ARC HS cores. </p> </dd> <dt> +<span><code class="code">-mtp-regno=<var class="var">regno</var></code><a class="copiable-link" href="#index-mtp-regno"> ¶</a></span> +</dt> <dd> +<p>Specify thread pointer register number. </p> </dd> <dt> +<span><code class="code">-mmpy-option=<var class="var">multo</var></code><a class="copiable-link" href="#index-mmpy-option"> ¶</a></span> +</dt> <dd> +<p>Compile ARCv2 code with a multiplier design option. You can specify the option using either a string or numeric value for <var class="var">multo</var>. ‘<samp class="samp">wlh1</samp>’ is the default value. The recognized values are: </p> <dl class="table"> <dt>‘<samp class="samp">0</samp>’</dt> <dt>‘<samp class="samp">none</samp>’</dt> <dd> +<p>No multiplier available. </p> </dd> <dt>‘<samp class="samp">1</samp>’</dt> <dt>‘<samp class="samp">w</samp>’</dt> <dd> +<p>16x16 multiplier, fully pipelined. The following instructions are enabled: <code class="code">mpyw</code> and <code class="code">mpyuw</code>. </p> </dd> <dt>‘<samp class="samp">2</samp>’</dt> <dt>‘<samp class="samp">wlh1</samp>’</dt> <dd> +<p>32x32 multiplier, fully pipelined (1 stage). The following instructions are additionally enabled: <code class="code">mpy</code>, <code class="code">mpyu</code>, <code class="code">mpym</code>, <code class="code">mpymu</code>, and <code class="code">mpy_s</code>. </p> </dd> <dt>‘<samp class="samp">3</samp>’</dt> <dt>‘<samp class="samp">wlh2</samp>’</dt> <dd> +<p>32x32 multiplier, fully pipelined (2 stages). The following instructions are additionally enabled: <code class="code">mpy</code>, <code class="code">mpyu</code>, <code class="code">mpym</code>, <code class="code">mpymu</code>, and <code class="code">mpy_s</code>. </p> </dd> <dt>‘<samp class="samp">4</samp>’</dt> <dt>‘<samp class="samp">wlh3</samp>’</dt> <dd> +<p>Two 16x16 multipliers, blocking, sequential. The following instructions are additionally enabled: <code class="code">mpy</code>, <code class="code">mpyu</code>, <code class="code">mpym</code>, <code class="code">mpymu</code>, and <code class="code">mpy_s</code>. </p> </dd> <dt>‘<samp class="samp">5</samp>’</dt> <dt>‘<samp class="samp">wlh4</samp>’</dt> <dd> +<p>One 16x16 multiplier, blocking, sequential. The following instructions are additionally enabled: <code class="code">mpy</code>, <code class="code">mpyu</code>, <code class="code">mpym</code>, <code class="code">mpymu</code>, and <code class="code">mpy_s</code>. </p> </dd> <dt>‘<samp class="samp">6</samp>’</dt> <dt>‘<samp class="samp">wlh5</samp>’</dt> <dd> +<p>One 32x4 multiplier, blocking, sequential. The following instructions are additionally enabled: <code class="code">mpy</code>, <code class="code">mpyu</code>, <code class="code">mpym</code>, <code class="code">mpymu</code>, and <code class="code">mpy_s</code>. </p> </dd> <dt>‘<samp class="samp">7</samp>’</dt> <dt>‘<samp class="samp">plus_dmpy</samp>’</dt> <dd> +<p>ARC HS SIMD support. </p> </dd> <dt>‘<samp class="samp">8</samp>’</dt> <dt>‘<samp class="samp">plus_macd</samp>’</dt> <dd> +<p>ARC HS SIMD support. </p> </dd> <dt>‘<samp class="samp">9</samp>’</dt> <dt>‘<samp class="samp">plus_qmacw</samp>’</dt> <dd> +<p>ARC HS SIMD support. </p> </dd> </dl> <p>This option is only available for ARCv2 cores. </p> </dd> <dt> +<span><code class="code">-mfpu=<var class="var">fpu</var></code><a class="copiable-link" href="#index-mfpu"> ¶</a></span> +</dt> <dd> +<p>Enables support for specific floating-point hardware extensions for ARCv2 cores. Supported values for <var class="var">fpu</var> are: </p> <dl class="table"> <dt>‘<samp class="samp">fpus</samp>’</dt> <dd> +<p>Enables support for single-precision floating-point hardware extensions. </p> </dd> <dt>‘<samp class="samp">fpud</samp>’</dt> <dd> +<p>Enables support for double-precision floating-point hardware extensions. The single-precision floating-point extension is also enabled. Not available for ARC EM. </p> </dd> <dt>‘<samp class="samp">fpuda</samp>’</dt> <dd> +<p>Enables support for double-precision floating-point hardware extensions using double-precision assist instructions. The single-precision floating-point extension is also enabled. This option is only available for ARC EM. </p> </dd> <dt>‘<samp class="samp">fpuda_div</samp>’</dt> <dd> +<p>Enables support for double-precision floating-point hardware extensions using double-precision assist instructions. The single-precision floating-point, square-root, and divide extensions are also enabled. This option is only available for ARC EM. </p> </dd> <dt>‘<samp class="samp">fpuda_fma</samp>’</dt> <dd> +<p>Enables support for double-precision floating-point hardware extensions using double-precision assist instructions. The single-precision floating-point and fused multiply and add hardware extensions are also enabled. This option is only available for ARC EM. </p> </dd> <dt>‘<samp class="samp">fpuda_all</samp>’</dt> <dd> +<p>Enables support for double-precision floating-point hardware extensions using double-precision assist instructions. All single-precision floating-point hardware extensions are also enabled. This option is only available for ARC EM. </p> </dd> <dt>‘<samp class="samp">fpus_div</samp>’</dt> <dd> +<p>Enables support for single-precision floating-point, square-root and divide hardware extensions. </p> </dd> <dt>‘<samp class="samp">fpud_div</samp>’</dt> <dd> +<p>Enables support for double-precision floating-point, square-root and divide hardware extensions. This option includes option ‘<samp class="samp">fpus_div</samp>’. Not available for ARC EM. </p> </dd> <dt>‘<samp class="samp">fpus_fma</samp>’</dt> <dd> +<p>Enables support for single-precision floating-point and fused multiply and add hardware extensions. </p> </dd> <dt>‘<samp class="samp">fpud_fma</samp>’</dt> <dd> +<p>Enables support for double-precision floating-point and fused multiply and add hardware extensions. This option includes option ‘<samp class="samp">fpus_fma</samp>’. Not available for ARC EM. </p> </dd> <dt>‘<samp class="samp">fpus_all</samp>’</dt> <dd> +<p>Enables support for all single-precision floating-point hardware extensions. </p> </dd> <dt>‘<samp class="samp">fpud_all</samp>’</dt> <dd> +<p>Enables support for all single- and double-precision floating-point hardware extensions. Not available for ARC EM. </p> </dd> </dl> </dd> <dt> +<span><code class="code">-mirq-ctrl-saved=<var class="var">register-range</var>, <var class="var">blink</var>, <var class="var">lp_count</var></code><a class="copiable-link" href="#index-mirq-ctrl-saved"> ¶</a></span> +</dt> <dd> +<p>Specifies general-purposes registers that the processor automatically saves/restores on interrupt entry and exit. <var class="var">register-range</var> is specified as two registers separated by a dash. The register range always starts with <code class="code">r0</code>, the upper limit is <code class="code">fp</code> register. <var class="var">blink</var> and <var class="var">lp_count</var> are optional. This option is only valid for ARC EM and ARC HS cores. </p> </dd> <dt> +<span><code class="code">-mrgf-banked-regs=<var class="var">number</var></code><a class="copiable-link" href="#index-mrgf-banked-regs"> ¶</a></span> +</dt> <dd> +<p>Specifies the number of registers replicated in second register bank on entry to fast interrupt. Fast interrupts are interrupts with the highest priority level P0. These interrupts save only PC and STATUS32 registers to avoid memory transactions during interrupt entry and exit sequences. Use this option when you are using fast interrupts in an ARC V2 family processor. Permitted values are 4, 8, 16, and 32. </p> </dd> <dt> +<span><code class="code">-mlpc-width=<var class="var">width</var></code><a class="copiable-link" href="#index-mlpc-width"> ¶</a></span> +</dt> <dd> +<p>Specify the width of the <code class="code">lp_count</code> register. Valid values for <var class="var">width</var> are 8, 16, 20, 24, 28 and 32 bits. The default width is fixed to 32 bits. If the width is less than 32, the compiler does not attempt to transform loops in your program to use the zero-delay loop mechanism unless it is known that the <code class="code">lp_count</code> register can hold the required loop-counter value. Depending on the width specified, the compiler and run-time library might continue to use the loop mechanism for various needs. This option defines macro <code class="code">__ARC_LPC_WIDTH__</code> with the value of <var class="var">width</var>. </p> </dd> <dt> +<span><code class="code">-mrf16</code><a class="copiable-link" href="#index-mrf16"> ¶</a></span> +</dt> <dd> +<p>This option instructs the compiler to generate code for a 16-entry register file. This option defines the <code class="code">__ARC_RF16__</code> preprocessor macro. </p> </dd> <dt> +<span><code class="code">-mbranch-index</code><a class="copiable-link" href="#index-mbranch-index"> ¶</a></span> +</dt> <dd> +<p>Enable use of <code class="code">bi</code> or <code class="code">bih</code> instructions to implement jump tables. </p> </dd> </dl> <p>The following options are passed through to the assembler, and also define preprocessor macro symbols. </p> <dl class="table"> <dt> +<span><code class="code">-mdsp-packa</code><a class="copiable-link" href="#index-mdsp-packa"> ¶</a></span> +</dt> <dd> +<p>Passed down to the assembler to enable the DSP Pack A extensions. Also sets the preprocessor symbol <code class="code">__Xdsp_packa</code>. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mdvbf</code><a class="copiable-link" href="#index-mdvbf"> ¶</a></span> +</dt> <dd> +<p>Passed down to the assembler to enable the dual Viterbi butterfly extension. Also sets the preprocessor symbol <code class="code">__Xdvbf</code>. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mlock</code><a class="copiable-link" href="#index-mlock"> ¶</a></span> +</dt> <dd> +<p>Passed down to the assembler to enable the locked load/store conditional extension. Also sets the preprocessor symbol <code class="code">__Xlock</code>. </p> </dd> <dt> +<span><code class="code">-mmac-d16</code><a class="copiable-link" href="#index-mmac-d16"> ¶</a></span> +</dt> <dd> +<p>Passed down to the assembler. Also sets the preprocessor symbol <code class="code">__Xxmac_d16</code>. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mmac-24</code><a class="copiable-link" href="#index-mmac-24"> ¶</a></span> +</dt> <dd> +<p>Passed down to the assembler. Also sets the preprocessor symbol <code class="code">__Xxmac_24</code>. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mrtsc</code><a class="copiable-link" href="#index-mrtsc"> ¶</a></span> +</dt> <dd> +<p>Passed down to the assembler to enable the 64-bit time-stamp counter extension instruction. Also sets the preprocessor symbol <code class="code">__Xrtsc</code>. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mswape</code><a class="copiable-link" href="#index-mswape"> ¶</a></span> +</dt> <dd> +<p>Passed down to the assembler to enable the swap byte ordering extension instruction. Also sets the preprocessor symbol <code class="code">__Xswape</code>. </p> </dd> <dt> +<span><code class="code">-mtelephony</code><a class="copiable-link" href="#index-mtelephony"> ¶</a></span> +</dt> <dd> +<p>Passed down to the assembler to enable dual- and single-operand instructions for telephony. Also sets the preprocessor symbol <code class="code">__Xtelephony</code>. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mxy</code><a class="copiable-link" href="#index-mxy"> ¶</a></span> +</dt> <dd> +<p>Passed down to the assembler to enable the XY memory extension. Also sets the preprocessor symbol <code class="code">__Xxy</code>. </p> </dd> </dl> <p>The following options control how the assembly code is annotated: </p> <dl class="table"> <dt> +<span><code class="code">-misize</code><a class="copiable-link" href="#index-misize"> ¶</a></span> +</dt> <dd> +<p>Annotate assembler instructions with estimated addresses. </p> </dd> <dt> +<span><code class="code">-mannotate-align</code><a class="copiable-link" href="#index-mannotate-align"> ¶</a></span> +</dt> <dd> +<p>Explain what alignment considerations lead to the decision to make an instruction short or long. </p> </dd> </dl> <p>The following options are passed through to the linker: </p> <dl class="table"> <dt> +<span><code class="code">-marclinux</code><a class="copiable-link" href="#index-marclinux"> ¶</a></span> +</dt> <dd> +<p>Passed through to the linker, to specify use of the <code class="code">arclinux</code> emulation. This option is enabled by default in tool chains built for <code class="code">arc-linux-uclibc</code> and <code class="code">arceb-linux-uclibc</code> targets when profiling is not requested. </p> </dd> <dt> +<span><code class="code">-marclinux_prof</code><a class="copiable-link" href="#index-marclinux_005fprof"> ¶</a></span> +</dt> <dd> +<p>Passed through to the linker, to specify use of the <code class="code">arclinux_prof</code> emulation. This option is enabled by default in tool chains built for <code class="code">arc-linux-uclibc</code> and <code class="code">arceb-linux-uclibc</code> targets when profiling is requested. </p> </dd> </dl> <p>The following options control the semantics of generated code: </p> <dl class="table"> <dt> +<span><code class="code">-mlong-calls</code><a class="copiable-link" href="#index-mlong-calls-1"> ¶</a></span> +</dt> <dd> +<p>Generate calls as register indirect calls, thus providing access to the full 32-bit address range. </p> </dd> <dt> +<span><code class="code">-mmedium-calls</code><a class="copiable-link" href="#index-mmedium-calls"> ¶</a></span> +</dt> <dd> +<p>Don’t use less than 25-bit addressing range for calls, which is the offset available for an unconditional branch-and-link instruction. Conditional execution of function calls is suppressed, to allow use of the 25-bit range, rather than the 21-bit range with conditional branch-and-link. This is the default for tool chains built for <code class="code">arc-linux-uclibc</code> and <code class="code">arceb-linux-uclibc</code> targets. </p> </dd> <dt> +<span><code class="code">-G <var class="var">num</var></code><a class="copiable-link" href="#index-G"> ¶</a></span> +</dt> <dd> +<p>Put definitions of externally-visible data in a small data section if that data is no bigger than <var class="var">num</var> bytes. The default value of <var class="var">num</var> is 4 for any ARC configuration, or 8 when we have double load/store operations. </p> </dd> <dt> + <span><code class="code">-mno-sdata</code><a class="copiable-link" href="#index-mno-sdata"> ¶</a></span> +</dt> <dd> +<p>Do not generate sdata references. This is the default for tool chains built for <code class="code">arc-linux-uclibc</code> and <code class="code">arceb-linux-uclibc</code> targets. </p> </dd> <dt> +<span><code class="code">-mvolatile-cache</code><a class="copiable-link" href="#index-mvolatile-cache"> ¶</a></span> +</dt> <dd> +<p>Use ordinarily cached memory accesses for volatile references. This is the default. </p> </dd> <dt> + <span><code class="code">-mno-volatile-cache</code><a class="copiable-link" href="#index-mno-volatile-cache"> ¶</a></span> +</dt> <dd> +<p>Enable cache bypass for volatile references. </p> </dd> </dl> <p>The following options fine tune code generation: </p> +<dl class="table"> <dt> +<span><code class="code">-malign-call</code><a class="copiable-link" href="#index-malign-call"> ¶</a></span> +</dt> <dd> +<p>Does nothing. Preserved for backward compatibility. </p> </dd> <dt> +<span><code class="code">-mauto-modify-reg</code><a class="copiable-link" href="#index-mauto-modify-reg"> ¶</a></span> +</dt> <dd> +<p>Enable the use of pre/post modify with register displacement. </p> </dd> <dt> +<span><code class="code">-mbbit-peephole</code><a class="copiable-link" href="#index-mbbit-peephole"> ¶</a></span> +</dt> <dd> +<p>Enable bbit peephole2. </p> </dd> <dt> +<span><code class="code">-mno-brcc</code><a class="copiable-link" href="#index-mno-brcc"> ¶</a></span> +</dt> <dd> +<p>This option disables a target-specific pass in <samp class="file">arc_reorg</samp> to generate compare-and-branch (<code class="code">br<var class="var">cc</var></code>) instructions. It has no effect on generation of these instructions driven by the combiner pass. </p> </dd> <dt> +<span><code class="code">-mcase-vector-pcrel</code><a class="copiable-link" href="#index-mcase-vector-pcrel"> ¶</a></span> +</dt> <dd> +<p>Use PC-relative switch case tables to enable case table shortening. This is the default for <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-mcompact-casesi</code><a class="copiable-link" href="#index-mcompact-casesi"> ¶</a></span> +</dt> <dd> +<p>Enable compact <code class="code">casesi</code> pattern. This is the default for <samp class="option">-Os</samp>, and only available for ARCv1 cores. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mno-cond-exec</code><a class="copiable-link" href="#index-mno-cond-exec"> ¶</a></span> +</dt> <dd> +<p>Disable the ARCompact-specific pass to generate conditional execution instructions. </p> <p>Due to delay slot scheduling and interactions between operand numbers, literal sizes, instruction lengths, and the support for conditional execution, the target-independent pass to generate conditional execution is often lacking, so the ARC port has kept a special pass around that tries to find more conditional execution generation opportunities after register allocation, branch shortening, and delay slot scheduling have been done. This pass generally, but not always, improves performance and code size, at the cost of extra compilation time, which is why there is an option to switch it off. If you have a problem with call instructions exceeding their allowable offset range because they are conditionalized, you should consider using <samp class="option">-mmedium-calls</samp> instead. </p> </dd> <dt> +<span><code class="code">-mearly-cbranchsi</code><a class="copiable-link" href="#index-mearly-cbranchsi"> ¶</a></span> +</dt> <dd> +<p>Enable pre-reload use of the <code class="code">cbranchsi</code> pattern. </p> </dd> <dt> +<span><code class="code">-mexpand-adddi</code><a class="copiable-link" href="#index-mexpand-adddi"> ¶</a></span> +</dt> <dd> +<p>Expand <code class="code">adddi3</code> and <code class="code">subdi3</code> at RTL generation time into <code class="code">add.f</code>, <code class="code">adc</code> etc. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mindexed-loads</code><a class="copiable-link" href="#index-mindexed-loads"> ¶</a></span> +</dt> <dd> +<p>Enable the use of indexed loads. This can be problematic because some optimizers then assume that indexed stores exist, which is not the case. </p> </dd> <dt> +<span><code class="code">-mlra</code><a class="copiable-link" href="#index-mlra"> ¶</a></span> +</dt> <dd> +<p>Enable Local Register Allocation. This is still experimental for ARC, so by default the compiler uses standard reload (i.e. <samp class="option">-mno-lra</samp>). </p> </dd> <dt> +<span><code class="code">-mlra-priority-none</code><a class="copiable-link" href="#index-mlra-priority-none"> ¶</a></span> +</dt> <dd> +<p>Don’t indicate any priority for target registers. </p> </dd> <dt> +<span><code class="code">-mlra-priority-compact</code><a class="copiable-link" href="#index-mlra-priority-compact"> ¶</a></span> +</dt> <dd> +<p>Indicate target register priority for r0..r3 / r12..r15. </p> </dd> <dt> +<span><code class="code">-mlra-priority-noncompact</code><a class="copiable-link" href="#index-mlra-priority-noncompact"> ¶</a></span> +</dt> <dd> +<p>Reduce target register priority for r0..r3 / r12..r15. </p> </dd> <dt> +<span><code class="code">-mmillicode</code><a class="copiable-link" href="#index-mmillicode"> ¶</a></span> +</dt> <dd> +<p>When optimizing for size (using <samp class="option">-Os</samp>), prologues and epilogues that have to save or restore a large number of registers are often shortened by using call to a special function in libgcc; this is referred to as a <em class="emph">millicode</em> call. As these calls can pose performance issues, and/or cause linking issues when linking in a nonstandard way, this option is provided to turn on or off millicode call generation. </p> </dd> <dt> +<span><code class="code">-mcode-density-frame</code><a class="copiable-link" href="#index-mcode-density-frame"> ¶</a></span> +</dt> <dd> +<p>This option enable the compiler to emit <code class="code">enter</code> and <code class="code">leave</code> instructions. These instructions are only valid for CPUs with code-density feature. </p> </dd> <dt> +<span><code class="code">-mmixed-code</code><a class="copiable-link" href="#index-mmixed-code"> ¶</a></span> +</dt> <dd> +<p>Does nothing. Preserved for backward compatibility. </p> </dd> <dt> +<span><code class="code">-mq-class</code><a class="copiable-link" href="#index-mq-class"> ¶</a></span> +</dt> <dd> +<p>Ths option is deprecated. Enable ‘<samp class="samp">q</samp>’ instruction alternatives. This is the default for <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-mRcq</code><a class="copiable-link" href="#index-mRcq"> ¶</a></span> +</dt> <dd> +<p>Does nothing. Preserved for backward compatibility. </p> </dd> <dt> +<span><code class="code">-mRcw</code><a class="copiable-link" href="#index-mRcw"> ¶</a></span> +</dt> <dd> +<p>Does nothing. Preserved for backward compatibility. </p> </dd> <dt> +<span><code class="code">-msize-level=<var class="var">level</var></code><a class="copiable-link" href="#index-msize-level"> ¶</a></span> +</dt> <dd> +<p>Fine-tune size optimization with regards to instruction lengths and alignment. The recognized values for <var class="var">level</var> are: </p> +<dl class="table"> <dt>‘<samp class="samp">0</samp>’</dt> <dd> +<p>No size optimization. This level is deprecated and treated like ‘<samp class="samp">1</samp>’. </p> </dd> <dt>‘<samp class="samp">1</samp>’</dt> <dd> +<p>Short instructions are used opportunistically. </p> </dd> <dt>‘<samp class="samp">2</samp>’</dt> <dd> +<p>In addition, alignment of loops and of code after barriers are dropped. </p> </dd> <dt>‘<samp class="samp">3</samp>’</dt> <dd> +<p>In addition, optional data alignment is dropped, and the option <samp class="option">Os</samp> is enabled. </p> </dd> </dl> <p>This defaults to ‘<samp class="samp">3</samp>’ when <samp class="option">-Os</samp> is in effect. Otherwise, the behavior when this is not set is equivalent to level ‘<samp class="samp">1</samp>’. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu</var></code><a class="copiable-link" href="#index-mtune-2"> ¶</a></span> +</dt> <dd> +<p>Set instruction scheduling parameters for <var class="var">cpu</var>, overriding any implied by <samp class="option">-mcpu=</samp>. </p> <p>Supported values for <var class="var">cpu</var> are </p> <dl class="table"> <dt>‘<samp class="samp">ARC600</samp>’</dt> <dd> +<p>Tune for ARC600 CPU. </p> </dd> <dt>‘<samp class="samp">ARC601</samp>’</dt> <dd> +<p>Tune for ARC601 CPU. </p> </dd> <dt>‘<samp class="samp">ARC700</samp>’</dt> <dd> +<p>Tune for ARC700 CPU with standard multiplier block. </p> </dd> <dt>‘<samp class="samp">ARC700-xmac</samp>’</dt> <dd> +<p>Tune for ARC700 CPU with XMAC block. </p> </dd> <dt>‘<samp class="samp">ARC725D</samp>’</dt> <dd> +<p>Tune for ARC725D CPU. </p> </dd> <dt>‘<samp class="samp">ARC750D</samp>’</dt> <dd> +<p>Tune for ARC750D CPU. </p> </dd> <dt>‘<samp class="samp">core3</samp>’</dt> <dd> +<p>Tune for ARCv2 core3 type CPU. This option enable usage of <code class="code">dbnz</code> instruction. </p> </dd> <dt>‘<samp class="samp">release31a</samp>’</dt> <dd> +<p>Tune for ARC4x release 3.10a. </p> </dd> </dl> </dd> <dt> +<span><code class="code">-mmultcost=<var class="var">num</var></code><a class="copiable-link" href="#index-mmultcost"> ¶</a></span> +</dt> <dd> +<p>Cost to assume for a multiply instruction, with ‘<samp class="samp">4</samp>’ being equal to a normal instruction. </p> </dd> <dt> +<span><code class="code">-munalign-prob-threshold=<var class="var">probability</var></code><a class="copiable-link" href="#index-munalign-prob-threshold"> ¶</a></span> +</dt> <dd> +<p>Does nothing. Preserved for backward compatibility. </p> </dd> </dl> <p>The following options are maintained for backward compatibility, but are now deprecated and will be removed in a future release: </p> <dl class="table"> <dt> +<span><code class="code">-margonaut</code><a class="copiable-link" href="#index-margonaut"> ¶</a></span> +</dt> <dd> +<p>Obsolete FPX. </p> </dd> <dt> + <span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian-1"> ¶</a></span> +</dt> <dt><code class="code">-EB</code></dt> <dd> +<p>Compile code for big-endian targets. Use of these options is now deprecated. Big-endian code is supported by configuring GCC to build <code class="code">arceb-elf32</code> and <code class="code">arceb-linux-uclibc</code> targets, for which big endian is the default. </p> </dd> <dt> + <span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian-1"> ¶</a></span> +</dt> <dt><code class="code">-EL</code></dt> <dd> +<p>Compile code for little-endian targets. Use of these options is now deprecated. Little-endian code is supported by configuring GCC to build <code class="code">arc-elf32</code> and <code class="code">arc-linux-uclibc</code> targets, for which little endian is the default. </p> </dd> <dt> +<span><code class="code">-mbarrel_shifter</code><a class="copiable-link" href="#index-mbarrel_005fshifter"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mbarrel-shifter</samp>. </p> </dd> <dt> +<span><code class="code">-mdpfp_compact</code><a class="copiable-link" href="#index-mdpfp_005fcompact"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mdpfp-compact</samp>. </p> </dd> <dt> +<span><code class="code">-mdpfp_fast</code><a class="copiable-link" href="#index-mdpfp_005ffast"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mdpfp-fast</samp>. </p> </dd> <dt> +<span><code class="code">-mdsp_packa</code><a class="copiable-link" href="#index-mdsp_005fpacka"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mdsp-packa</samp>. </p> </dd> <dt> +<span><code class="code">-mEA</code><a class="copiable-link" href="#index-mEA"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mea</samp>. </p> </dd> <dt> +<span><code class="code">-mmac_24</code><a class="copiable-link" href="#index-mmac_005f24"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mmac-24</samp>. </p> </dd> <dt> +<span><code class="code">-mmac_d16</code><a class="copiable-link" href="#index-mmac_005fd16"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mmac-d16</samp>. </p> </dd> <dt> +<span><code class="code">-mspfp_compact</code><a class="copiable-link" href="#index-mspfp_005fcompact"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mspfp-compact</samp>. </p> </dd> <dt> +<span><code class="code">-mspfp_fast</code><a class="copiable-link" href="#index-mspfp_005ffast"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mspfp-fast</samp>. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu</var></code><a class="copiable-link" href="#index-mtune-3"> ¶</a></span> +</dt> <dd> +<p>Values ‘<samp class="samp">arc600</samp>’, ‘<samp class="samp">arc601</samp>’, ‘<samp class="samp">arc700</samp>’ and ‘<samp class="samp">arc700-xmac</samp>’ for <var class="var">cpu</var> are replaced by ‘<samp class="samp">ARC600</samp>’, ‘<samp class="samp">ARC601</samp>’, ‘<samp class="samp">ARC700</samp>’ and ‘<samp class="samp">ARC700-xmac</samp>’ respectively. </p> </dd> <dt> +<span><code class="code">-multcost=<var class="var">num</var></code><a class="copiable-link" href="#index-multcost"> ¶</a></span> +</dt> <dd> +<p>Replaced by <samp class="option">-mmultcost</samp>. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="arm-options">ARM Options</a>, Previous: <a href="amd-gcn-options">AMD GCN Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arc-simd-built-in-functions.html b/devdocs/gcc~13/arc-simd-built-in-functions.html new file mode 100644 index 00000000..c8f56845 --- /dev/null +++ b/devdocs/gcc~13/arc-simd-built-in-functions.html @@ -0,0 +1,123 @@ +<div class="subsection-level-extent" id="ARC-SIMD-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="arm-iwmmxt-built-in-functions" accesskey="n" rel="next">ARM iWMMXt Built-in Functions</a>, Previous: <a href="arc-built-in-functions" accesskey="p" rel="prev">ARC Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARC-SIMD-Built-in-Functions-1"><span>6.60.5 ARC SIMD Built-in Functions<a class="copiable-link" href="#ARC-SIMD-Built-in-Functions-1"> ¶</a></span></h1> <p>SIMD builtins provided by the compiler can be used to generate the vector instructions. This section describes the available builtins and their usage in programs. With the <samp class="option">-msimd</samp> option, the compiler provides 128-bit vector types, which can be specified using the <code class="code">vector_size</code> attribute. The header file <samp class="file">arc-simd.h</samp> can be included to use the following predefined types: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">typedef int __v4si __attribute__((vector_size(16))); +typedef short __v8hi __attribute__((vector_size(16)));</pre> +</div> <p>These types can be used to define 128-bit variables. The built-in functions listed in the following section can be used on these variables to generate the vector operations. </p> <p>For all builtins, <code class="code">__builtin_arc_<var class="var">someinsn</var></code>, the header file <samp class="file">arc-simd.h</samp> also provides equivalent macros called <code class="code">_<var class="var">someinsn</var></code> that can be used for programming ease and improved readability. The following macros for DMA control are also provided: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">#define _setup_dma_in_channel_reg _vdiwr +#define _setup_dma_out_channel_reg _vdowr</pre> +</div> <p>The following is a complete list of all the SIMD built-ins provided for ARC, grouped by calling signature. </p> <p>The following take two <code class="code">__v8hi</code> arguments and return a <code class="code">__v8hi</code> result: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">__v8hi __builtin_arc_vaddaw (__v8hi, __v8hi); +__v8hi __builtin_arc_vaddw (__v8hi, __v8hi); +__v8hi __builtin_arc_vand (__v8hi, __v8hi); +__v8hi __builtin_arc_vandaw (__v8hi, __v8hi); +__v8hi __builtin_arc_vavb (__v8hi, __v8hi); +__v8hi __builtin_arc_vavrb (__v8hi, __v8hi); +__v8hi __builtin_arc_vbic (__v8hi, __v8hi); +__v8hi __builtin_arc_vbicaw (__v8hi, __v8hi); +__v8hi __builtin_arc_vdifaw (__v8hi, __v8hi); +__v8hi __builtin_arc_vdifw (__v8hi, __v8hi); +__v8hi __builtin_arc_veqw (__v8hi, __v8hi); +__v8hi __builtin_arc_vh264f (__v8hi, __v8hi); +__v8hi __builtin_arc_vh264ft (__v8hi, __v8hi); +__v8hi __builtin_arc_vh264fw (__v8hi, __v8hi); +__v8hi __builtin_arc_vlew (__v8hi, __v8hi); +__v8hi __builtin_arc_vltw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmaxaw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmaxw (__v8hi, __v8hi); +__v8hi __builtin_arc_vminaw (__v8hi, __v8hi); +__v8hi __builtin_arc_vminw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr1aw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr1w (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr2aw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr2w (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr3aw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr3w (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr4aw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr4w (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr5aw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr5w (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr6aw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr6w (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr7aw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmr7w (__v8hi, __v8hi); +__v8hi __builtin_arc_vmrb (__v8hi, __v8hi); +__v8hi __builtin_arc_vmulaw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmulfaw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmulfw (__v8hi, __v8hi); +__v8hi __builtin_arc_vmulw (__v8hi, __v8hi); +__v8hi __builtin_arc_vnew (__v8hi, __v8hi); +__v8hi __builtin_arc_vor (__v8hi, __v8hi); +__v8hi __builtin_arc_vsubaw (__v8hi, __v8hi); +__v8hi __builtin_arc_vsubw (__v8hi, __v8hi); +__v8hi __builtin_arc_vsummw (__v8hi, __v8hi); +__v8hi __builtin_arc_vvc1f (__v8hi, __v8hi); +__v8hi __builtin_arc_vvc1ft (__v8hi, __v8hi); +__v8hi __builtin_arc_vxor (__v8hi, __v8hi); +__v8hi __builtin_arc_vxoraw (__v8hi, __v8hi);</pre> +</div> <p>The following take one <code class="code">__v8hi</code> and one <code class="code">int</code> argument and return a <code class="code">__v8hi</code> result: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">__v8hi __builtin_arc_vbaddw (__v8hi, int); +__v8hi __builtin_arc_vbmaxw (__v8hi, int); +__v8hi __builtin_arc_vbminw (__v8hi, int); +__v8hi __builtin_arc_vbmulaw (__v8hi, int); +__v8hi __builtin_arc_vbmulfw (__v8hi, int); +__v8hi __builtin_arc_vbmulw (__v8hi, int); +__v8hi __builtin_arc_vbrsubw (__v8hi, int); +__v8hi __builtin_arc_vbsubw (__v8hi, int);</pre> +</div> <p>The following take one <code class="code">__v8hi</code> argument and one <code class="code">int</code> argument which must be a 3-bit compile time constant indicating a register number I0-I7. They return a <code class="code">__v8hi</code> result. </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">__v8hi __builtin_arc_vasrw (__v8hi, const int); +__v8hi __builtin_arc_vsr8 (__v8hi, const int); +__v8hi __builtin_arc_vsr8aw (__v8hi, const int);</pre> +</div> <p>The following take one <code class="code">__v8hi</code> argument and one <code class="code">int</code> argument which must be a 6-bit compile time constant. They return a <code class="code">__v8hi</code> result. </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">__v8hi __builtin_arc_vasrpwbi (__v8hi, const int); +__v8hi __builtin_arc_vasrrpwbi (__v8hi, const int); +__v8hi __builtin_arc_vasrrwi (__v8hi, const int); +__v8hi __builtin_arc_vasrsrwi (__v8hi, const int); +__v8hi __builtin_arc_vasrwi (__v8hi, const int); +__v8hi __builtin_arc_vsr8awi (__v8hi, const int); +__v8hi __builtin_arc_vsr8i (__v8hi, const int);</pre> +</div> <p>The following take one <code class="code">__v8hi</code> argument and one <code class="code">int</code> argument which must be a 8-bit compile time constant. They return a <code class="code">__v8hi</code> result. </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">__v8hi __builtin_arc_vd6tapf (__v8hi, const int); +__v8hi __builtin_arc_vmvaw (__v8hi, const int); +__v8hi __builtin_arc_vmvw (__v8hi, const int); +__v8hi __builtin_arc_vmvzw (__v8hi, const int);</pre> +</div> <p>The following take two <code class="code">int</code> arguments, the second of which which must be a 8-bit compile time constant. They return a <code class="code">__v8hi</code> result: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">__v8hi __builtin_arc_vmovaw (int, const int); +__v8hi __builtin_arc_vmovw (int, const int); +__v8hi __builtin_arc_vmovzw (int, const int);</pre> +</div> <p>The following take a single <code class="code">__v8hi</code> argument and return a <code class="code">__v8hi</code> result: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">__v8hi __builtin_arc_vabsaw (__v8hi); +__v8hi __builtin_arc_vabsw (__v8hi); +__v8hi __builtin_arc_vaddsuw (__v8hi); +__v8hi __builtin_arc_vexch1 (__v8hi); +__v8hi __builtin_arc_vexch2 (__v8hi); +__v8hi __builtin_arc_vexch4 (__v8hi); +__v8hi __builtin_arc_vsignw (__v8hi); +__v8hi __builtin_arc_vupbaw (__v8hi); +__v8hi __builtin_arc_vupbw (__v8hi); +__v8hi __builtin_arc_vupsbaw (__v8hi); +__v8hi __builtin_arc_vupsbw (__v8hi);</pre> +</div> <p>The following take two <code class="code">int</code> arguments and return no result: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">void __builtin_arc_vdirun (int, int); +void __builtin_arc_vdorun (int, int);</pre> +</div> <p>The following take two <code class="code">int</code> arguments and return no result. The first argument must a 3-bit compile time constant indicating one of the DR0-DR7 DMA setup channels: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">void __builtin_arc_vdiwr (const int, int); +void __builtin_arc_vdowr (const int, int);</pre> +</div> <p>The following take an <code class="code">int</code> argument and return no result: </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">void __builtin_arc_vendrec (int); +void __builtin_arc_vrec (int); +void __builtin_arc_vrecrun (int); +void __builtin_arc_vrun (int);</pre> +</div> <p>The following take a <code class="code">__v8hi</code> argument and two <code class="code">int</code> arguments and return a <code class="code">__v8hi</code> result. The second argument must be a 3-bit compile time constants, indicating one the registers I0-I7, and the third argument must be an 8-bit compile time constant. </p> <p><em class="emph">Note:</em> Although the equivalent hardware instructions do not take an SIMD register as an operand, these builtins overwrite the relevant bits of the <code class="code">__v8hi</code> register provided as the first argument with the value loaded from the <code class="code">[Ib, u8]</code> location in the SDM. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">__v8hi __builtin_arc_vld32 (__v8hi, const int, const int); +__v8hi __builtin_arc_vld32wh (__v8hi, const int, const int); +__v8hi __builtin_arc_vld32wl (__v8hi, const int, const int); +__v8hi __builtin_arc_vld64 (__v8hi, const int, const int);</pre> +</div> <p>The following take two <code class="code">int</code> arguments and return a <code class="code">__v8hi</code> result. The first argument must be a 3-bit compile time constants, indicating one the registers I0-I7, and the second argument must be an 8-bit compile time constant. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">__v8hi __builtin_arc_vld128 (const int, const int); +__v8hi __builtin_arc_vld64w (const int, const int);</pre> +</div> <p>The following take a <code class="code">__v8hi</code> argument and two <code class="code">int</code> arguments and return no result. The second argument must be a 3-bit compile time constants, indicating one the registers I0-I7, and the third argument must be an 8-bit compile time constant. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">void __builtin_arc_vst128 (__v8hi, const int, const int); +void __builtin_arc_vst64 (__v8hi, const int, const int);</pre> +</div> <p>The following take a <code class="code">__v8hi</code> argument and three <code class="code">int</code> arguments and return no result. The second argument must be a 3-bit compile-time constant, identifying the 16-bit sub-register to be stored, the third argument must be a 3-bit compile time constants, indicating one the registers I0-I7, and the fourth argument must be an 8-bit compile time constant. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">void __builtin_arc_vst16_n (__v8hi, const int, const int, const int); +void __builtin_arc_vst32_n (__v8hi, const int, const int, const int);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="arm-iwmmxt-built-in-functions">ARM iWMMXt Built-in Functions</a>, Previous: <a href="arc-built-in-functions">ARC Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-SIMD-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-SIMD-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arc-type-attributes.html b/devdocs/gcc~13/arc-type-attributes.html new file mode 100644 index 00000000..917c86a9 --- /dev/null +++ b/devdocs/gcc~13/arc-type-attributes.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="ARC-Type-Attributes"> <div class="nav-panel"> <p> Next: <a href="arm-type-attributes" accesskey="n" rel="next">ARM Type Attributes</a>, Previous: <a href="common-type-attributes" accesskey="p" rel="prev">Common Type Attributes</a>, Up: <a href="type-attributes" accesskey="u" rel="up">Specifying Attributes of Types</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARC-Type-Attributes-1"><span>6.35.2 ARC Type Attributes<a class="copiable-link" href="#ARC-Type-Attributes-1"> ¶</a></span></h1> <p>Declaring objects with <code class="code">uncached</code> allows you to exclude data-cache participation in load and store operations on those objects without involving the additional semantic implications of <code class="code">volatile</code>. The <code class="code">.di</code> instruction suffix is used for all loads and stores of data declared <code class="code">uncached</code>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Type-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Type-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arc-variable-attributes.html b/devdocs/gcc~13/arc-variable-attributes.html new file mode 100644 index 00000000..19c7aa56 --- /dev/null +++ b/devdocs/gcc~13/arc-variable-attributes.html @@ -0,0 +1,9 @@ +<div class="subsection-level-extent" id="ARC-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="variable-attributes" accesskey="n" rel="next">AVR Variable Attributes</a>, Previous: <a href="common-variable-attributes" accesskey="p" rel="prev">Common Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARC-Variable-Attributes-1"><span>6.34.2 ARC Variable Attributes<a class="copiable-link" href="#ARC-Variable-Attributes-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">aux</code><a class="copiable-link" href="#index-aux-variable-attribute_002c-ARC"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">aux</code> attribute is used to directly access the ARC’s auxiliary register space from C. The auxilirary register number is given via attribute argument. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/architecture-implementation.html b/devdocs/gcc~13/architecture-implementation.html new file mode 100644 index 00000000..760b6efe --- /dev/null +++ b/devdocs/gcc~13/architecture-implementation.html @@ -0,0 +1,12 @@ +<div class="section-level-extent" id="Architecture-implementation"> <div class="nav-panel"> <p> Next: <a href="locale-specific-behavior-implementation" accesskey="n" rel="next">Locale-Specific Behavior</a>, Previous: <a href="library-functions-implementation" accesskey="p" rel="prev">Library Functions</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Architecture"><span>4.15 Architecture<a class="copiable-link" href="#Architecture"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>The values or expressions assigned to the macros specified in the headers <code class="code"><float.h></code>, <code class="code"><limits.h></code>, and <code class="code"><stdint.h></code> (C90, C99 and C11 5.2.4.2, C99 7.18.2, C99 7.18.3, C11 7.20.2, C11 7.20.3). <p>Determined by ABI. </p> </li> +<li>The result of attempting to indirectly access an object with automatic or thread storage duration from a thread other than the one with which it is associated (C11 6.2.4). <p>Such accesses are supported, subject to the same requirements for synchronization for concurrent accesses as for concurrent accesses to any object. </p> </li> +<li>The number, order, and encoding of bytes in any object (when not explicitly specified in this International Standard) (C99 and C11 6.2.6.1). <p>Determined by ABI. </p> </li> +<li>Whether any extended alignments are supported and the contexts in which they are supported (C11 6.2.8). <p>Extended alignments up to <em class="math">2^{28}</em> (bytes) are supported for objects of automatic storage duration. Alignments supported for objects of static and thread storage duration are determined by the ABI. </p> </li> +<li>Valid alignment values other than those returned by an _Alignof expression for fundamental types, if any (C11 6.2.8). <p>Valid alignments are powers of 2 up to and including <em class="math">2^{28}</em>. </p> </li> +<li>The value of the result of the <code class="code">sizeof</code> and <code class="code">_Alignof</code> operators (C90 6.3.3.4, C99 and C11 6.5.3.4). <p>Determined by ABI. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Architecture-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Architecture-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/argument-types.html b/devdocs/gcc~13/argument-types.html new file mode 100644 index 00000000..563e70e3 --- /dev/null +++ b/devdocs/gcc~13/argument-types.html @@ -0,0 +1,52 @@ +<div class="subsubsection-level-extent" id="Argument-Types"> <div class="nav-panel"> <p> Next: <a href="directly-mapped-integer-functions" accesskey="n" rel="next">Directly-Mapped Integer Functions</a>, Up: <a href="fr-v-built-in-functions" accesskey="u" rel="up">FR-V Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Argument-Types-1"><span>6.60.13.1 Argument Types<a class="copiable-link" href="#Argument-Types-1"> ¶</a></span></h1> <p>The arguments to the built-in functions can be divided into three groups: register numbers, compile-time constants and run-time values. In order to make this classification clear at a glance, the arguments and return values are given the following pseudo types: </p> <table class="multitable"> <thead><tr> +<th width="20%">Pseudo type</th> +<th width="30%">Real C type</th> +<th width="15%">Constant?</th> +<th width="35%">Description</th> +</tr></thead> <tbody> +<tr> +<td width="20%"><code class="code">uh</code></td> +<td width="30%"><code class="code">unsigned short</code></td> +<td width="15%">No</td> +<td width="35%">an unsigned halfword</td> +</tr> <tr> +<td width="20%"><code class="code">uw1</code></td> +<td width="30%"><code class="code">unsigned int</code></td> +<td width="15%">No</td> +<td width="35%">an unsigned word</td> +</tr> <tr> +<td width="20%"><code class="code">sw1</code></td> +<td width="30%"><code class="code">int</code></td> +<td width="15%">No</td> +<td width="35%">a signed word</td> +</tr> <tr> +<td width="20%"><code class="code">uw2</code></td> +<td width="30%"><code class="code">unsigned long long</code></td> +<td width="15%">No</td> +<td width="35%">an unsigned doubleword</td> +</tr> <tr> +<td width="20%"><code class="code">sw2</code></td> +<td width="30%"><code class="code">long long</code></td> +<td width="15%">No</td> +<td width="35%">a signed doubleword</td> +</tr> <tr> +<td width="20%"><code class="code">const</code></td> +<td width="30%"><code class="code">int</code></td> +<td width="15%">Yes</td> +<td width="35%">an integer constant</td> +</tr> <tr> +<td width="20%"><code class="code">acc</code></td> +<td width="30%"><code class="code">int</code></td> +<td width="15%">Yes</td> +<td width="35%">an ACC register number</td> +</tr> <tr> +<td width="20%"><code class="code">iacc</code></td> +<td width="30%"><code class="code">int</code></td> +<td width="15%">Yes</td> +<td width="35%">an IACC register number</td> +</tr> </tbody> </table> <p>These pseudo types are not defined by GCC, they are simply a notational convenience used in this manual. </p> <p>Arguments of type <code class="code">uh</code>, <code class="code">uw1</code>, <code class="code">sw1</code>, <code class="code">uw2</code> and <code class="code">sw2</code> are evaluated at run time. They correspond to register operands in the underlying FR-V instructions. </p> <p><code class="code">const</code> arguments represent immediate operands in the underlying FR-V instructions. They must be compile-time constants. </p> <p><code class="code">acc</code> arguments are evaluated at compile time and specify the number of an accumulator register. For example, an <code class="code">acc</code> argument of 2 selects the ACC2 register. </p> <p><code class="code">iacc</code> arguments are similar to <code class="code">acc</code> arguments but specify the number of an IACC register. See see <a class="pxref" href="other-built-in-functions">Other Built-in Functions</a> for more details. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Argument-Types.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Argument-Types.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arm-armv8-m-security-extensions.html b/devdocs/gcc~13/arm-armv8-m-security-extensions.html new file mode 100644 index 00000000..14c9eff9 --- /dev/null +++ b/devdocs/gcc~13/arm-armv8-m-security-extensions.html @@ -0,0 +1,18 @@ +<div class="subsection-level-extent" id="ARM-ARMv8-M-Security-Extensions"> <div class="nav-panel"> <p> Next: <a href="avr-built-in-functions" accesskey="n" rel="next">AVR Built-in Functions</a>, Previous: <a href="arm-floating-point-status-and-control-intrinsics" accesskey="p" rel="prev">ARM Floating Point Status and Control Intrinsics</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARM-ARMv8-M-Security-Extensions-1"><span>6.60.9 ARM ARMv8-M Security Extensions<a class="copiable-link" href="#ARM-ARMv8-M-Security-Extensions-1"> ¶</a></span></h1> <p>GCC implements the ARMv8-M Security Extensions as described in the ARMv8-M Security Extensions: Requirements on Development Tools Engineering Specification, which can be found at <a class="uref" href="https://developer.arm.com/documentation/ecm0359818/latest/">https://developer.arm.com/documentation/ecm0359818/latest/</a>. </p> <p>As part of the Security Extensions GCC implements two new function attributes: <code class="code">cmse_nonsecure_entry</code> and <code class="code">cmse_nonsecure_call</code>. </p> <p>As part of the Security Extensions GCC implements the intrinsics below. FPTR is used here to mean any function pointer type. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">cmse_address_info_t cmse_TT (void *); +cmse_address_info_t cmse_TT_fptr (FPTR); +cmse_address_info_t cmse_TTT (void *); +cmse_address_info_t cmse_TTT_fptr (FPTR); +cmse_address_info_t cmse_TTA (void *); +cmse_address_info_t cmse_TTA_fptr (FPTR); +cmse_address_info_t cmse_TTAT (void *); +cmse_address_info_t cmse_TTAT_fptr (FPTR); +void * cmse_check_address_range (void *, size_t, int); +typeof(p) cmse_nsfptr_create (FPTR p); +intptr_t cmse_is_nsfptr (FPTR); +int cmse_nonsecure_caller (void);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-ARMv8-M-Security-Extensions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-ARMv8-M-Security-Extensions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arm-c-language-extensions-_0028acle_0029.html b/devdocs/gcc~13/arm-c-language-extensions-_0028acle_0029.html new file mode 100644 index 00000000..b22924d0 --- /dev/null +++ b/devdocs/gcc~13/arm-c-language-extensions-_0028acle_0029.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="ARM-C-Language-Extensions-_0028ACLE_0029"> <div class="nav-panel"> <p> Next: <a href="arm-floating-point-status-and-control-intrinsics" accesskey="n" rel="next">ARM Floating Point Status and Control Intrinsics</a>, Previous: <a href="arm-iwmmxt-built-in-functions" accesskey="p" rel="prev">ARM iWMMXt Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARM-C-Language-Extensions-_0028ACLE_0029-1"><span>6.60.7 ARM C Language Extensions (ACLE)<a class="copiable-link" href="#ARM-C-Language-Extensions-_0028ACLE_0029-1"> ¶</a></span></h1> <p>GCC implements extensions for C as described in the ARM C Language Extensions (ACLE) specification, which can be found at <a class="uref" href="https://developer.arm.com/documentation/ihi0053/latest/">https://developer.arm.com/documentation/ihi0053/latest/</a>. </p> <p>As a part of ACLE, GCC implements extensions for Advanced SIMD as described in the ARM C Language Extensions Specification. The complete list of Advanced SIMD intrinsics can be found at <a class="uref" href="https://developer.arm.com/documentation/ihi0073/latest/">https://developer.arm.com/documentation/ihi0073/latest/</a>. The built-in intrinsics for the Advanced SIMD extension are available when NEON is enabled. </p> <p>Currently, ARM and AArch64 back ends do not support ACLE 2.0 fully. Both back ends support CRC32 intrinsics and the ARM back end supports the Coprocessor intrinsics, all from <samp class="file">arm_acle.h</samp>. The ARM back end’s 16-bit floating-point Advanced SIMD intrinsics currently comply to ACLE v1.1. AArch64’s back end does not have support for 16-bit floating point Advanced SIMD intrinsics yet. </p> <p>See <a class="ref" href="arm-options">ARM Options</a> and <a class="ref" href="aarch64-options">AArch64 Options</a> for more information on the availability of extensions. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-C-Language-Extensions-_0028ACLE_0029.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-C-Language-Extensions-_0028ACLE_0029.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arm-floating-point-status-and-control-intrinsics.html b/devdocs/gcc~13/arm-floating-point-status-and-control-intrinsics.html new file mode 100644 index 00000000..550f6cb1 --- /dev/null +++ b/devdocs/gcc~13/arm-floating-point-status-and-control-intrinsics.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="ARM-Floating-Point-Status-and-Control-Intrinsics"> <div class="nav-panel"> <p> Next: <a href="arm-armv8-m-security-extensions" accesskey="n" rel="next">ARM ARMv8-M Security Extensions</a>, Previous: <a href="arm-c-language-extensions-_0028acle_0029" accesskey="p" rel="prev">ARM C Language Extensions (ACLE)</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARM-Floating-Point-Status-and-Control-Intrinsics-1"><span>6.60.8 ARM Floating Point Status and Control Intrinsics<a class="copiable-link" href="#ARM-Floating-Point-Status-and-Control-Intrinsics-1"> ¶</a></span></h1> <p>These built-in functions are available for the ARM family of processors with floating-point unit. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_arm_get_fpscr (); +void __builtin_arm_set_fpscr (unsigned int);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Floating-Point-Status-and-Control-Intrinsics.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Floating-Point-Status-and-Control-Intrinsics.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arm-function-attributes.html b/devdocs/gcc~13/arm-function-attributes.html new file mode 100644 index 00000000..f6f2a1e6 --- /dev/null +++ b/devdocs/gcc~13/arm-function-attributes.html @@ -0,0 +1,53 @@ +<div class="subsection-level-extent" id="ARM-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="avr-function-attributes" accesskey="n" rel="next">AVR Function Attributes</a>, Previous: <a href="arc-function-attributes" accesskey="p" rel="prev">ARC Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARM-Function-Attributes-1"><span>6.33.5 ARM Function Attributes<a class="copiable-link" href="#ARM-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported for ARM targets: </p> <dl class="table"> <dt> +<span><code class="code">general-regs-only</code><a class="copiable-link" href="#index-general-regs-only-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dd> +<p>Indicates that no floating-point or Advanced SIMD registers should be used when generating code for this function. If the function explicitly uses floating-point code, then the compiler gives an error. This is the same behavior as that of the command-line option <samp class="option">-mgeneral-regs-only</samp>. </p> </dd> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> <p>You can specify the kind of interrupt to be handled by adding an optional parameter to the interrupt attribute like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f () __attribute__ ((interrupt ("IRQ")));</pre> +</div> <p>Permissible values for this parameter are: <code class="code">IRQ</code>, <code class="code">FIQ</code>, <code class="code">SWI</code>, <code class="code">ABORT</code> and <code class="code">UNDEF</code>. </p> <p>On ARMv7-M the interrupt type is ignored, and the attribute means the function may be called with a word-aligned stack pointer. </p> </dd> <dt> +<span><code class="code">isr</code><a class="copiable-link" href="#index-isr-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on ARM to write Interrupt Service Routines. This is an alias to the <code class="code">interrupt</code> attribute above. </p> </dd> <dt> + <span><code class="code">long_call</code><a class="copiable-link" href="#index-long_005fcall-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dt><code class="code">short_call</code></dt> <dd> +<p>These attributes specify how a particular function is called. These attributes override the <samp class="option">-mlong-calls</samp> (see <a class="pxref" href="arm-options">ARM Options</a>) command-line switch and <code class="code">#pragma long_calls</code> settings. For ARM, the <code class="code">long_call</code> attribute indicates that the function might be far away from the call site and require a different (more expensive) calling sequence. The <code class="code">short_call</code> attribute always places the offset to the function from the call site into the ‘<samp class="samp">BL</samp>’ instruction directly. </p> </dd> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dd> +<p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p> </dd> <dt> +<span><code class="code">pcs</code><a class="copiable-link" href="#index-pcs-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dd> <p>The <code class="code">pcs</code> attribute can be used to control the calling convention used for a function on ARM. The attribute takes an argument that specifies the calling convention to use. </p> <p>When compiling using the AAPCS ABI (or a variant of it) then valid values for the argument are <code class="code">"aapcs"</code> and <code class="code">"aapcs-vfp"</code>. In order to use a variant other than <code class="code">"aapcs"</code> then the compiler must be permitted to use the appropriate co-processor registers (i.e., the VFP registers must be available in order to use <code class="code">"aapcs-vfp"</code>). For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">/* Argument passed in r0, and result returned in r0+r1. */ +double f2d (float) __attribute__((pcs("aapcs")));</pre> +</div> <p>Variadic functions always use the <code class="code">"aapcs"</code> calling convention and the compiler rejects attempts to specify an alternative. </p> </dd> <dt> +<span><code class="code">target (<var class="var">options</var>)</code><a class="copiable-link" href="#index-target-function-attribute-1"> ¶</a></span> +</dt> <dd> +<p>As discussed in <a class="ref" href="common-function-attributes">Common Function Attributes</a>, this attribute allows specification of target-specific compilation options. </p> <p>On ARM, the following options are allowed: </p> <dl class="table"> <dt> +<span>‘<samp class="samp">thumb</samp>’<a class="copiable-link" href="#index-target_0028_0022thumb_0022_0029-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dd> +<p>Force code generation in the Thumb (T16/T32) ISA, depending on the architecture level. </p> </dd> <dt> +<span>‘<samp class="samp">arm</samp>’<a class="copiable-link" href="#index-target_0028_0022arm_0022_0029-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dd> +<p>Force code generation in the ARM (A32) ISA. </p> <p>Functions from different modes can be inlined in the caller’s mode. </p> </dd> <dt> +<span>‘<samp class="samp">fpu=</samp>’<a class="copiable-link" href="#index-target_0028_0022fpu_003d_0022_0029-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dd> +<p>Specifies the fpu for which to tune the performance of this function. The behavior and permissible arguments are the same as for the <samp class="option">-mfpu=</samp> command-line option. </p> </dd> <dt> +<span>‘<samp class="samp">arch=</samp>’<a class="copiable-link" href="#index-arch_003d-function-attribute_002c-ARM"> ¶</a></span> +</dt> <dd> +<p>Specifies the architecture version and architectural extensions to use for this function. The behavior and permissible arguments are the same as for the <samp class="option">-march=</samp> command-line option. </p> <p>The above target attributes can be specified as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__((target("arch=armv8-a+crc"))) +int +f (int a) +{ + return a + 5; +}</pre> +</div> <p>Additionally, the architectural extension string may be specified on its own. This can be used to turn on and off particular architectural extensions without having to specify a particular architecture version or core. Example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__((target("+crc+nocrypto"))) +int +foo (int a) +{ + return a + 5; +}</pre> +</div> <p>In this example <code class="code">target("+crc+nocrypto")</code> enables the <code class="code">crc</code> extension and disables the <code class="code">crypto</code> extension for the function <code class="code">foo</code> without modifying an existing <samp class="option">-march=</samp> or <samp class="option">-mcpu</samp> option. </p> </dd> </dl> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="avr-function-attributes">AVR Function Attributes</a>, Previous: <a href="arc-function-attributes">ARC Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arm-iwmmxt-built-in-functions.html b/devdocs/gcc~13/arm-iwmmxt-built-in-functions.html new file mode 100644 index 00000000..b5bf0209 --- /dev/null +++ b/devdocs/gcc~13/arm-iwmmxt-built-in-functions.html @@ -0,0 +1,150 @@ +<div class="subsection-level-extent" id="ARM-iWMMXt-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="arm-c-language-extensions-_0028acle_0029" accesskey="n" rel="next">ARM C Language Extensions (ACLE)</a>, Previous: <a href="arc-simd-built-in-functions" accesskey="p" rel="prev">ARC SIMD Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARM-iWMMXt-Built-in-Functions-1"><span>6.60.6 ARM iWMMXt Built-in Functions<a class="copiable-link" href="#ARM-iWMMXt-Built-in-Functions-1"> ¶</a></span></h1> <p>These built-in functions are available for the ARM family of processors when the <samp class="option">-mcpu=iwmmxt</samp> switch is used: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int v2si __attribute__ ((vector_size (8))); +typedef short v4hi __attribute__ ((vector_size (8))); +typedef char v8qi __attribute__ ((vector_size (8))); + +int __builtin_arm_getwcgr0 (void); +void __builtin_arm_setwcgr0 (int); +int __builtin_arm_getwcgr1 (void); +void __builtin_arm_setwcgr1 (int); +int __builtin_arm_getwcgr2 (void); +void __builtin_arm_setwcgr2 (int); +int __builtin_arm_getwcgr3 (void); +void __builtin_arm_setwcgr3 (int); +int __builtin_arm_textrmsb (v8qi, int); +int __builtin_arm_textrmsh (v4hi, int); +int __builtin_arm_textrmsw (v2si, int); +int __builtin_arm_textrmub (v8qi, int); +int __builtin_arm_textrmuh (v4hi, int); +int __builtin_arm_textrmuw (v2si, int); +v8qi __builtin_arm_tinsrb (v8qi, int, int); +v4hi __builtin_arm_tinsrh (v4hi, int, int); +v2si __builtin_arm_tinsrw (v2si, int, int); +long long __builtin_arm_tmia (long long, int, int); +long long __builtin_arm_tmiabb (long long, int, int); +long long __builtin_arm_tmiabt (long long, int, int); +long long __builtin_arm_tmiaph (long long, int, int); +long long __builtin_arm_tmiatb (long long, int, int); +long long __builtin_arm_tmiatt (long long, int, int); +int __builtin_arm_tmovmskb (v8qi); +int __builtin_arm_tmovmskh (v4hi); +int __builtin_arm_tmovmskw (v2si); +long long __builtin_arm_waccb (v8qi); +long long __builtin_arm_wacch (v4hi); +long long __builtin_arm_waccw (v2si); +v8qi __builtin_arm_waddb (v8qi, v8qi); +v8qi __builtin_arm_waddbss (v8qi, v8qi); +v8qi __builtin_arm_waddbus (v8qi, v8qi); +v4hi __builtin_arm_waddh (v4hi, v4hi); +v4hi __builtin_arm_waddhss (v4hi, v4hi); +v4hi __builtin_arm_waddhus (v4hi, v4hi); +v2si __builtin_arm_waddw (v2si, v2si); +v2si __builtin_arm_waddwss (v2si, v2si); +v2si __builtin_arm_waddwus (v2si, v2si); +v8qi __builtin_arm_walign (v8qi, v8qi, int); +long long __builtin_arm_wand(long long, long long); +long long __builtin_arm_wandn (long long, long long); +v8qi __builtin_arm_wavg2b (v8qi, v8qi); +v8qi __builtin_arm_wavg2br (v8qi, v8qi); +v4hi __builtin_arm_wavg2h (v4hi, v4hi); +v4hi __builtin_arm_wavg2hr (v4hi, v4hi); +v8qi __builtin_arm_wcmpeqb (v8qi, v8qi); +v4hi __builtin_arm_wcmpeqh (v4hi, v4hi); +v2si __builtin_arm_wcmpeqw (v2si, v2si); +v8qi __builtin_arm_wcmpgtsb (v8qi, v8qi); +v4hi __builtin_arm_wcmpgtsh (v4hi, v4hi); +v2si __builtin_arm_wcmpgtsw (v2si, v2si); +v8qi __builtin_arm_wcmpgtub (v8qi, v8qi); +v4hi __builtin_arm_wcmpgtuh (v4hi, v4hi); +v2si __builtin_arm_wcmpgtuw (v2si, v2si); +long long __builtin_arm_wmacs (long long, v4hi, v4hi); +long long __builtin_arm_wmacsz (v4hi, v4hi); +long long __builtin_arm_wmacu (long long, v4hi, v4hi); +long long __builtin_arm_wmacuz (v4hi, v4hi); +v4hi __builtin_arm_wmadds (v4hi, v4hi); +v4hi __builtin_arm_wmaddu (v4hi, v4hi); +v8qi __builtin_arm_wmaxsb (v8qi, v8qi); +v4hi __builtin_arm_wmaxsh (v4hi, v4hi); +v2si __builtin_arm_wmaxsw (v2si, v2si); +v8qi __builtin_arm_wmaxub (v8qi, v8qi); +v4hi __builtin_arm_wmaxuh (v4hi, v4hi); +v2si __builtin_arm_wmaxuw (v2si, v2si); +v8qi __builtin_arm_wminsb (v8qi, v8qi); +v4hi __builtin_arm_wminsh (v4hi, v4hi); +v2si __builtin_arm_wminsw (v2si, v2si); +v8qi __builtin_arm_wminub (v8qi, v8qi); +v4hi __builtin_arm_wminuh (v4hi, v4hi); +v2si __builtin_arm_wminuw (v2si, v2si); +v4hi __builtin_arm_wmulsm (v4hi, v4hi); +v4hi __builtin_arm_wmulul (v4hi, v4hi); +v4hi __builtin_arm_wmulum (v4hi, v4hi); +long long __builtin_arm_wor (long long, long long); +v2si __builtin_arm_wpackdss (long long, long long); +v2si __builtin_arm_wpackdus (long long, long long); +v8qi __builtin_arm_wpackhss (v4hi, v4hi); +v8qi __builtin_arm_wpackhus (v4hi, v4hi); +v4hi __builtin_arm_wpackwss (v2si, v2si); +v4hi __builtin_arm_wpackwus (v2si, v2si); +long long __builtin_arm_wrord (long long, long long); +long long __builtin_arm_wrordi (long long, int); +v4hi __builtin_arm_wrorh (v4hi, long long); +v4hi __builtin_arm_wrorhi (v4hi, int); +v2si __builtin_arm_wrorw (v2si, long long); +v2si __builtin_arm_wrorwi (v2si, int); +v2si __builtin_arm_wsadb (v2si, v8qi, v8qi); +v2si __builtin_arm_wsadbz (v8qi, v8qi); +v2si __builtin_arm_wsadh (v2si, v4hi, v4hi); +v2si __builtin_arm_wsadhz (v4hi, v4hi); +v4hi __builtin_arm_wshufh (v4hi, int); +long long __builtin_arm_wslld (long long, long long); +long long __builtin_arm_wslldi (long long, int); +v4hi __builtin_arm_wsllh (v4hi, long long); +v4hi __builtin_arm_wsllhi (v4hi, int); +v2si __builtin_arm_wsllw (v2si, long long); +v2si __builtin_arm_wsllwi (v2si, int); +long long __builtin_arm_wsrad (long long, long long); +long long __builtin_arm_wsradi (long long, int); +v4hi __builtin_arm_wsrah (v4hi, long long); +v4hi __builtin_arm_wsrahi (v4hi, int); +v2si __builtin_arm_wsraw (v2si, long long); +v2si __builtin_arm_wsrawi (v2si, int); +long long __builtin_arm_wsrld (long long, long long); +long long __builtin_arm_wsrldi (long long, int); +v4hi __builtin_arm_wsrlh (v4hi, long long); +v4hi __builtin_arm_wsrlhi (v4hi, int); +v2si __builtin_arm_wsrlw (v2si, long long); +v2si __builtin_arm_wsrlwi (v2si, int); +v8qi __builtin_arm_wsubb (v8qi, v8qi); +v8qi __builtin_arm_wsubbss (v8qi, v8qi); +v8qi __builtin_arm_wsubbus (v8qi, v8qi); +v4hi __builtin_arm_wsubh (v4hi, v4hi); +v4hi __builtin_arm_wsubhss (v4hi, v4hi); +v4hi __builtin_arm_wsubhus (v4hi, v4hi); +v2si __builtin_arm_wsubw (v2si, v2si); +v2si __builtin_arm_wsubwss (v2si, v2si); +v2si __builtin_arm_wsubwus (v2si, v2si); +v4hi __builtin_arm_wunpckehsb (v8qi); +v2si __builtin_arm_wunpckehsh (v4hi); +long long __builtin_arm_wunpckehsw (v2si); +v4hi __builtin_arm_wunpckehub (v8qi); +v2si __builtin_arm_wunpckehuh (v4hi); +long long __builtin_arm_wunpckehuw (v2si); +v4hi __builtin_arm_wunpckelsb (v8qi); +v2si __builtin_arm_wunpckelsh (v4hi); +long long __builtin_arm_wunpckelsw (v2si); +v4hi __builtin_arm_wunpckelub (v8qi); +v2si __builtin_arm_wunpckeluh (v4hi); +long long __builtin_arm_wunpckeluw (v2si); +v8qi __builtin_arm_wunpckihb (v8qi, v8qi); +v4hi __builtin_arm_wunpckihh (v4hi, v4hi); +v2si __builtin_arm_wunpckihw (v2si, v2si); +v8qi __builtin_arm_wunpckilb (v8qi, v8qi); +v4hi __builtin_arm_wunpckilh (v4hi, v4hi); +v2si __builtin_arm_wunpckilw (v2si, v2si); +long long __builtin_arm_wxor (long long, long long); +long long __builtin_arm_wzero ();</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="arm-c-language-extensions-_0028acle_0029">ARM C Language Extensions (ACLE)</a>, Previous: <a href="arc-simd-built-in-functions">ARC SIMD Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-iWMMXt-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-iWMMXt-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arm-options.html b/devdocs/gcc~13/arm-options.html new file mode 100644 index 00000000..2d67dd43 --- /dev/null +++ b/devdocs/gcc~13/arm-options.html @@ -0,0 +1,257 @@ +<div class="subsection-level-extent" id="ARM-Options"> <div class="nav-panel"> <p> Next: <a href="avr-options" accesskey="n" rel="next">AVR Options</a>, Previous: <a href="arc-options" accesskey="p" rel="prev">ARC Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARM-Options-1"><span>3.19.5 ARM Options<a class="copiable-link" href="#ARM-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for the ARM port: </p> <dl class="table"> <dt> +<span><code class="code">-mabi=<var class="var">name</var></code><a class="copiable-link" href="#index-mabi-1"> ¶</a></span> +</dt> <dd> +<p>Generate code for the specified ABI. Permissible values are: ‘<samp class="samp">apcs-gnu</samp>’, ‘<samp class="samp">atpcs</samp>’, ‘<samp class="samp">aapcs</samp>’, ‘<samp class="samp">aapcs-linux</samp>’ and ‘<samp class="samp">iwmmxt</samp>’. </p> </dd> <dt> +<span><code class="code">-mapcs-frame</code><a class="copiable-link" href="#index-mapcs-frame"> ¶</a></span> +</dt> <dd> +<p>Generate a stack frame that is compliant with the ARM Procedure Call Standard for all functions, even if this is not strictly necessary for correct execution of the code. Specifying <samp class="option">-fomit-frame-pointer</samp> with this option causes the stack frames not to be generated for leaf functions. The default is <samp class="option">-mno-apcs-frame</samp>. This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mapcs</code><a class="copiable-link" href="#index-mapcs"> ¶</a></span> +</dt> <dd> +<p>This is a synonym for <samp class="option">-mapcs-frame</samp> and is deprecated. </p> </dd> <dt> +<span><code class="code">-mthumb-interwork</code><a class="copiable-link" href="#index-mthumb-interwork"> ¶</a></span> +</dt> <dd> +<p>Generate code that supports calling between the ARM and Thumb instruction sets. Without this option, on pre-v5 architectures, the two instruction sets cannot be reliably used inside one program. The default is <samp class="option">-mno-thumb-interwork</samp>, since slightly larger code is generated when <samp class="option">-mthumb-interwork</samp> is specified. In AAPCS configurations this option is meaningless. </p> </dd> <dt> + <span><code class="code">-mno-sched-prolog</code><a class="copiable-link" href="#index-mno-sched-prolog"> ¶</a></span> +</dt> <dd> +<p>Prevent the reordering of instructions in the function prologue, or the merging of those instruction with the instructions in the function’s body. This means that all functions start with a recognizable set of instructions (or in fact one of a choice from a small set of different function prologues), and this information can be used to locate the start of functions inside an executable piece of code. The default is <samp class="option">-msched-prolog</samp>. </p> </dd> <dt> +<span><code class="code">-mfloat-abi=<var class="var">name</var></code><a class="copiable-link" href="#index-mfloat-abi"> ¶</a></span> +</dt> <dd> +<p>Specifies which floating-point ABI to use. Permissible values are: ‘<samp class="samp">soft</samp>’, ‘<samp class="samp">softfp</samp>’ and ‘<samp class="samp">hard</samp>’. </p> <p>Specifying ‘<samp class="samp">soft</samp>’ causes GCC to generate output containing library calls for floating-point operations. ‘<samp class="samp">softfp</samp>’ allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions. ‘<samp class="samp">hard</samp>’ allows generation of floating-point instructions and uses FPU-specific calling conventions. </p> <p>The default depends on the specific target configuration. Note that the hard-float and soft-float ABIs are not link-compatible; you must compile your entire program with the same ABI, and link with a compatible set of libraries. </p> </dd> <dt> +<span><code class="code">-mgeneral-regs-only</code><a class="copiable-link" href="#index-mgeneral-regs-only-1"> ¶</a></span> +</dt> <dd> +<p>Generate code which uses only the general-purpose registers. This will prevent the compiler from using floating-point and Advanced SIMD registers but will not impose any restrictions on the assembler. </p> </dd> <dt> +<span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian-2"> ¶</a></span> +</dt> <dd> +<p>Generate code for a processor running in little-endian mode. This is the default for all standard configurations. </p> </dd> <dt> +<span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian-2"> ¶</a></span> +</dt> <dd> +<p>Generate code for a processor running in big-endian mode; the default is to compile code for a little-endian processor. </p> </dd> <dt> +<span><code class="code">-mbe8</code><a class="copiable-link" href="#index-mbe8"> ¶</a></span> +</dt> <dt><code class="code">-mbe32</code></dt> <dd> +<p>When linking a big-endian image select between BE8 and BE32 formats. The option has no effect for little-endian images and is ignored. The default is dependent on the selected target architecture. For ARMv6 and later architectures the default is BE8, for older architectures the default is BE32. BE32 format has been deprecated by ARM. </p> </dd> <dt> +<span><code class="code">-march=<var class="var">name</var><span class="r">[</span>+extension…<span class="r">]</span></code><a class="copiable-link" href="#index-march-2"> ¶</a></span> +</dt> <dd> +<p>This specifies the name of the target ARM architecture. GCC uses this name to determine what kind of instructions it can emit when generating assembly code. This option can be used in conjunction with or instead of the <samp class="option">-mcpu=</samp> option. </p> <p>Permissible names are: ‘<samp class="samp">armv4t</samp>’, ‘<samp class="samp">armv5t</samp>’, ‘<samp class="samp">armv5te</samp>’, ‘<samp class="samp">armv6</samp>’, ‘<samp class="samp">armv6j</samp>’, ‘<samp class="samp">armv6k</samp>’, ‘<samp class="samp">armv6kz</samp>’, ‘<samp class="samp">armv6t2</samp>’, ‘<samp class="samp">armv6z</samp>’, ‘<samp class="samp">armv6zk</samp>’, ‘<samp class="samp">armv7</samp>’, ‘<samp class="samp">armv7-a</samp>’, ‘<samp class="samp">armv7ve</samp>’, ‘<samp class="samp">armv8-a</samp>’, ‘<samp class="samp">armv8.1-a</samp>’, ‘<samp class="samp">armv8.2-a</samp>’, ‘<samp class="samp">armv8.3-a</samp>’, ‘<samp class="samp">armv8.4-a</samp>’, ‘<samp class="samp">armv8.5-a</samp>’, ‘<samp class="samp">armv8.6-a</samp>’, ‘<samp class="samp">armv9-a</samp>’, ‘<samp class="samp">armv7-r</samp>’, ‘<samp class="samp">armv8-r</samp>’, ‘<samp class="samp">armv6-m</samp>’, ‘<samp class="samp">armv6s-m</samp>’, ‘<samp class="samp">armv7-m</samp>’, ‘<samp class="samp">armv7e-m</samp>’, ‘<samp class="samp">armv8-m.base</samp>’, ‘<samp class="samp">armv8-m.main</samp>’, ‘<samp class="samp">armv8.1-m.main</samp>’, ‘<samp class="samp">armv9-a</samp>’, ‘<samp class="samp">iwmmxt</samp>’ and ‘<samp class="samp">iwmmxt2</samp>’. </p> <p>Additionally, the following architectures, which lack support for the Thumb execution state, are recognized but support is deprecated: ‘<samp class="samp">armv4</samp>’. </p> <p>Many of the architectures support extensions. These can be added by appending ‘<samp class="samp">+<var class="var">extension</var></samp>’ to the architecture name. Extension options are processed in order and capabilities accumulate. An extension will also enable any necessary base extensions upon which it depends. For example, the ‘<samp class="samp">+crypto</samp>’ extension will always enable the ‘<samp class="samp">+simd</samp>’ extension. The exception to the additive construction is for extensions that are prefixed with ‘<samp class="samp">+no…</samp>’: these extensions disable the specified option and any other extensions that may depend on the presence of that extension. </p> <p>For example, ‘<samp class="samp">-march=armv7-a+simd+nofp+vfpv4</samp>’ is equivalent to writing ‘<samp class="samp">-march=armv7-a+vfpv4</samp>’ since the ‘<samp class="samp">+simd</samp>’ option is entirely disabled by the ‘<samp class="samp">+nofp</samp>’ option that follows it. </p> <p>Most extension names are generically named, but have an effect that is dependent upon the architecture to which it is applied. For example, the ‘<samp class="samp">+simd</samp>’ option can be applied to both ‘<samp class="samp">armv7-a</samp>’ and ‘<samp class="samp">armv8-a</samp>’ architectures, but will enable the original ARMv7-A Advanced SIMD (Neon) extensions for ‘<samp class="samp">armv7-a</samp>’ and the ARMv8-A variant for ‘<samp class="samp">armv8-a</samp>’. </p> <p>The table below lists the supported extensions for each architecture. Architectures not mentioned do not support any extensions. </p> <dl class="table"> <dt>‘<samp class="samp">armv5te</samp>’</dt> <dt>‘<samp class="samp">armv6</samp>’</dt> <dt>‘<samp class="samp">armv6j</samp>’</dt> <dt>‘<samp class="samp">armv6k</samp>’</dt> <dt>‘<samp class="samp">armv6kz</samp>’</dt> <dt>‘<samp class="samp">armv6t2</samp>’</dt> <dt>‘<samp class="samp">armv6z</samp>’</dt> <dt>‘<samp class="samp">armv6zk</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+fp</samp>’</dt> <dd> +<p>The VFPv2 floating-point instructions. The extension ‘<samp class="samp">+vfpv2</samp>’ can be used as an alias for this extension. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd><p>Disable the floating-point instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv7</samp>’</dt> <dd> +<p>The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures. </p> +<dl class="table"> <dt>‘<samp class="samp">+fp</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions, with 16 double-precision registers. The extension ‘<samp class="samp">+vfpv3-d16</samp>’ can be used as an alias for this extension. Note that floating-point is not supported by the base ARMv7-M architecture, but is compatible with both the ARMv7-A and ARMv7-R architectures. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd><p>Disable the floating-point instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv7-a</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+mp</samp>’</dt> <dd> +<p>The multiprocessing extension. </p> </dd> <dt>‘<samp class="samp">+sec</samp>’</dt> <dd> +<p>The security extension. </p> </dd> <dt>‘<samp class="samp">+fp</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions, with 16 double-precision registers. The extension ‘<samp class="samp">+vfpv3-d16</samp>’ can be used as an alias for this extension. </p> </dd> <dt>‘<samp class="samp">+simd</samp>’</dt> <dd> +<p>The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. The extensions ‘<samp class="samp">+neon</samp>’ and ‘<samp class="samp">+neon-vfpv3</samp>’ can be used as aliases for this extension. </p> </dd> <dt>‘<samp class="samp">+vfpv3</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions, with 32 double-precision registers. </p> </dd> <dt>‘<samp class="samp">+vfpv3-d16-fp16</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions, with 16 double-precision registers and the half-precision floating-point conversion operations. </p> </dd> <dt>‘<samp class="samp">+vfpv3-fp16</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions, with 32 double-precision registers and the half-precision floating-point conversion operations. </p> </dd> <dt>‘<samp class="samp">+vfpv4-d16</samp>’</dt> <dd> +<p>The VFPv4 floating-point instructions, with 16 double-precision registers. </p> </dd> <dt>‘<samp class="samp">+vfpv4</samp>’</dt> <dd> +<p>The VFPv4 floating-point instructions, with 32 double-precision registers. </p> </dd> <dt>‘<samp class="samp">+neon-fp16</samp>’</dt> <dd> +<p>The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with the half-precision floating-point conversion operations. </p> </dd> <dt>‘<samp class="samp">+neon-vfpv4</samp>’</dt> <dd> +<p>The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+nosimd</samp>’</dt> <dd> +<p>Disable the Advanced SIMD instructions (does not disable floating point). </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd><p>Disable the floating-point and Advanced SIMD instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv7ve</samp>’</dt> <dd> +<p>The extended version of the ARMv7-A architecture with support for virtualization. </p> +<dl class="table"> <dt>‘<samp class="samp">+fp</samp>’</dt> <dd> +<p>The VFPv4 floating-point instructions, with 16 double-precision registers. The extension ‘<samp class="samp">+vfpv4-d16</samp>’ can be used as an alias for this extension. </p> </dd> <dt>‘<samp class="samp">+simd</samp>’</dt> <dd> +<p>The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The extension ‘<samp class="samp">+neon-vfpv4</samp>’ can be used as an alias for this extension. </p> </dd> <dt>‘<samp class="samp">+vfpv3-d16</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions, with 16 double-precision registers. </p> </dd> <dt>‘<samp class="samp">+vfpv3</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions, with 32 double-precision registers. </p> </dd> <dt>‘<samp class="samp">+vfpv3-d16-fp16</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions, with 16 double-precision registers and the half-precision floating-point conversion operations. </p> </dd> <dt>‘<samp class="samp">+vfpv3-fp16</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions, with 32 double-precision registers and the half-precision floating-point conversion operations. </p> </dd> <dt>‘<samp class="samp">+vfpv4-d16</samp>’</dt> <dd> +<p>The VFPv4 floating-point instructions, with 16 double-precision registers. </p> </dd> <dt>‘<samp class="samp">+vfpv4</samp>’</dt> <dd> +<p>The VFPv4 floating-point instructions, with 32 double-precision registers. </p> </dd> <dt>‘<samp class="samp">+neon</samp>’</dt> <dd> +<p>The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions. The extension ‘<samp class="samp">+neon-vfpv3</samp>’ can be used as an alias for this extension. </p> </dd> <dt>‘<samp class="samp">+neon-fp16</samp>’</dt> <dd> +<p>The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with the half-precision floating-point conversion operations. </p> </dd> <dt>‘<samp class="samp">+nosimd</samp>’</dt> <dd> +<p>Disable the Advanced SIMD instructions (does not disable floating point). </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd><p>Disable the floating-point and Advanced SIMD instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv8-a</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+crc</samp>’</dt> <dd><p>The Cyclic Redundancy Check (CRC) instructions. </p></dd> <dt>‘<samp class="samp">+simd</samp>’</dt> <dd><p>The ARMv8-A Advanced SIMD and floating-point instructions. </p></dd> <dt>‘<samp class="samp">+crypto</samp>’</dt> <dd><p>The cryptographic instructions. </p></dd> <dt>‘<samp class="samp">+nocrypto</samp>’</dt> <dd><p>Disable the cryptographic instructions. </p></dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd><p>Disable the floating-point, Advanced SIMD and cryptographic instructions. </p></dd> <dt>‘<samp class="samp">+sb</samp>’</dt> <dd><p>Speculation Barrier Instruction. </p></dd> <dt>‘<samp class="samp">+predres</samp>’</dt> <dd><p>Execution and Data Prediction Restriction Instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv8.1-a</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+simd</samp>’</dt> <dd> +<p>The ARMv8.1-A Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+crypto</samp>’</dt> <dd> +<p>The cryptographic instructions. This also enables the Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+nocrypto</samp>’</dt> <dd> +<p>Disable the cryptographic instructions. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd> +<p>Disable the floating-point, Advanced SIMD and cryptographic instructions. </p> </dd> <dt>‘<samp class="samp">+sb</samp>’</dt> <dd> +<p>Speculation Barrier Instruction. </p> </dd> <dt>‘<samp class="samp">+predres</samp>’</dt> <dd><p>Execution and Data Prediction Restriction Instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv8.2-a</samp>’</dt> <dt>‘<samp class="samp">armv8.3-a</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+fp16</samp>’</dt> <dd> +<p>The half-precision floating-point data processing instructions. This also enables the Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+fp16fml</samp>’</dt> <dd> +<p>The half-precision floating-point fmla extension. This also enables the half-precision floating-point extension and Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+simd</samp>’</dt> <dd> +<p>The ARMv8.1-A Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+crypto</samp>’</dt> <dd> +<p>The cryptographic instructions. This also enables the Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+dotprod</samp>’</dt> <dd> +<p>Enable the Dot Product extension. This also enables Advanced SIMD instructions. </p> </dd> <dt>‘<samp class="samp">+nocrypto</samp>’</dt> <dd> +<p>Disable the cryptographic extension. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd> +<p>Disable the floating-point, Advanced SIMD and cryptographic instructions. </p> </dd> <dt>‘<samp class="samp">+sb</samp>’</dt> <dd> +<p>Speculation Barrier Instruction. </p> </dd> <dt>‘<samp class="samp">+predres</samp>’</dt> <dd> +<p>Execution and Data Prediction Restriction Instructions. </p> </dd> <dt>‘<samp class="samp">+i8mm</samp>’</dt> <dd> +<p>8-bit Integer Matrix Multiply instructions. This also enables Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+bf16</samp>’</dt> <dd><p>Brain half-precision floating-point instructions. This also enables Advanced SIMD and floating-point instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv8.4-a</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+fp16</samp>’</dt> <dd> +<p>The half-precision floating-point data processing instructions. This also enables the Advanced SIMD and floating-point instructions as well as the Dot Product extension and the half-precision floating-point fmla extension. </p> </dd> <dt>‘<samp class="samp">+simd</samp>’</dt> <dd> +<p>The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the Dot Product extension. </p> </dd> <dt>‘<samp class="samp">+crypto</samp>’</dt> <dd> +<p>The cryptographic instructions. This also enables the Advanced SIMD and floating-point instructions as well as the Dot Product extension. </p> </dd> <dt>‘<samp class="samp">+nocrypto</samp>’</dt> <dd> +<p>Disable the cryptographic extension. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd> +<p>Disable the floating-point, Advanced SIMD and cryptographic instructions. </p> </dd> <dt>‘<samp class="samp">+sb</samp>’</dt> <dd> +<p>Speculation Barrier Instruction. </p> </dd> <dt>‘<samp class="samp">+predres</samp>’</dt> <dd> +<p>Execution and Data Prediction Restriction Instructions. </p> </dd> <dt>‘<samp class="samp">+i8mm</samp>’</dt> <dd> +<p>8-bit Integer Matrix Multiply instructions. This also enables Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+bf16</samp>’</dt> <dd><p>Brain half-precision floating-point instructions. This also enables Advanced SIMD and floating-point instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv8.5-a</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+fp16</samp>’</dt> <dd> +<p>The half-precision floating-point data processing instructions. This also enables the Advanced SIMD and floating-point instructions as well as the Dot Product extension and the half-precision floating-point fmla extension. </p> </dd> <dt>‘<samp class="samp">+simd</samp>’</dt> <dd> +<p>The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the Dot Product extension. </p> </dd> <dt>‘<samp class="samp">+crypto</samp>’</dt> <dd> +<p>The cryptographic instructions. This also enables the Advanced SIMD and floating-point instructions as well as the Dot Product extension. </p> </dd> <dt>‘<samp class="samp">+nocrypto</samp>’</dt> <dd> +<p>Disable the cryptographic extension. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd> +<p>Disable the floating-point, Advanced SIMD and cryptographic instructions. </p> </dd> <dt>‘<samp class="samp">+i8mm</samp>’</dt> <dd> +<p>8-bit Integer Matrix Multiply instructions. This also enables Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+bf16</samp>’</dt> <dd><p>Brain half-precision floating-point instructions. This also enables Advanced SIMD and floating-point instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv8.6-a</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+fp16</samp>’</dt> <dd> +<p>The half-precision floating-point data processing instructions. This also enables the Advanced SIMD and floating-point instructions as well as the Dot Product extension and the half-precision floating-point fmla extension. </p> </dd> <dt>‘<samp class="samp">+simd</samp>’</dt> <dd> +<p>The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the Dot Product extension. </p> </dd> <dt>‘<samp class="samp">+crypto</samp>’</dt> <dd> +<p>The cryptographic instructions. This also enables the Advanced SIMD and floating-point instructions as well as the Dot Product extension. </p> </dd> <dt>‘<samp class="samp">+nocrypto</samp>’</dt> <dd> +<p>Disable the cryptographic extension. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd> +<p>Disable the floating-point, Advanced SIMD and cryptographic instructions. </p> </dd> <dt>‘<samp class="samp">+i8mm</samp>’</dt> <dd> +<p>8-bit Integer Matrix Multiply instructions. This also enables Advanced SIMD and floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+bf16</samp>’</dt> <dd><p>Brain half-precision floating-point instructions. This also enables Advanced SIMD and floating-point instructions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv7-r</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+fp.sp</samp>’</dt> <dd> +<p>The single-precision VFPv3 floating-point instructions. The extension ‘<samp class="samp">+vfpv3xd</samp>’ can be used as an alias for this extension. </p> </dd> <dt>‘<samp class="samp">+fp</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions with 16 double-precision registers. The extension +vfpv3-d16 can be used as an alias for this extension. </p> </dd> <dt>‘<samp class="samp">+vfpv3xd-d16-fp16</samp>’</dt> <dd> +<p>The single-precision VFPv3 floating-point instructions with 16 double-precision registers and the half-precision floating-point conversion operations. </p> </dd> <dt>‘<samp class="samp">+vfpv3-d16-fp16</samp>’</dt> <dd> +<p>The VFPv3 floating-point instructions with 16 double-precision registers and the half-precision floating-point conversion operations. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd> +<p>Disable the floating-point extension. </p> </dd> <dt>‘<samp class="samp">+idiv</samp>’</dt> <dd> +<p>The ARM-state integer division instructions. </p> </dd> <dt>‘<samp class="samp">+noidiv</samp>’</dt> <dd><p>Disable the ARM-state integer division extension. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv7e-m</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+fp</samp>’</dt> <dd> +<p>The single-precision VFPv4 floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+fpv5</samp>’</dt> <dd> +<p>The single-precision FPv5 floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+fp.dp</samp>’</dt> <dd> +<p>The single- and double-precision FPv5 floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd><p>Disable the floating-point extensions. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv8.1-m.main</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+dsp</samp>’</dt> <dd> +<p>The DSP instructions. </p> </dd> <dt>‘<samp class="samp">+mve</samp>’</dt> <dd> +<p>The M-Profile Vector Extension (MVE) integer instructions. </p> </dd> <dt>‘<samp class="samp">+mve.fp</samp>’</dt> <dd> +<p>The M-Profile Vector Extension (MVE) integer and single precision floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+fp</samp>’</dt> <dd> +<p>The single-precision floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+fp.dp</samp>’</dt> <dd> +<p>The single- and double-precision floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd> +<p>Disable the floating-point extension. </p> </dd> <dt>‘<samp class="samp">+cdecp0, +cdecp1, ... , +cdecp7</samp>’</dt> <dd> +<p>Enable the Custom Datapath Extension (CDE) on selected coprocessors according to the numbers given in the options in the range 0 to 7. </p> </dd> <dt>‘<samp class="samp">+pacbti</samp>’</dt> <dd><p>Enable the Pointer Authentication and Branch Target Identification Extension. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv8-m.main</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+dsp</samp>’</dt> <dd> +<p>The DSP instructions. </p> </dd> <dt>‘<samp class="samp">+nodsp</samp>’</dt> <dd> +<p>Disable the DSP extension. </p> </dd> <dt>‘<samp class="samp">+fp</samp>’</dt> <dd> +<p>The single-precision floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+fp.dp</samp>’</dt> <dd> +<p>The single- and double-precision floating-point instructions. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd> +<p>Disable the floating-point extension. </p> </dd> <dt>‘<samp class="samp">+cdecp0, +cdecp1, ... , +cdecp7</samp>’</dt> <dd><p>Enable the Custom Datapath Extension (CDE) on selected coprocessors according to the numbers given in the options in the range 0 to 7. </p></dd> </dl> </dd> <dt>‘<samp class="samp">armv8-r</samp>’</dt> <dd> +<dl class="table"> <dt>‘<samp class="samp">+crc</samp>’</dt> <dd><p>The Cyclic Redundancy Check (CRC) instructions. </p></dd> <dt>‘<samp class="samp">+fp.sp</samp>’</dt> <dd><p>The single-precision FPv5 floating-point instructions. </p></dd> <dt>‘<samp class="samp">+simd</samp>’</dt> <dd><p>The ARMv8-A Advanced SIMD and floating-point instructions. </p></dd> <dt>‘<samp class="samp">+crypto</samp>’</dt> <dd><p>The cryptographic instructions. </p></dd> <dt>‘<samp class="samp">+nocrypto</samp>’</dt> <dd><p>Disable the cryptographic instructions. </p></dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd><p>Disable the floating-point, Advanced SIMD and cryptographic instructions. </p></dd> </dl> </dd> </dl> <p><samp class="option">-march=native</samp> causes the compiler to auto-detect the architecture of the build computer. At present, this feature is only supported on GNU/Linux, and not all architectures are recognized. If the auto-detect is unsuccessful the option has no effect. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">name</var></code><a class="copiable-link" href="#index-mtune-4"> ¶</a></span> +</dt> <dd> +<p>This option specifies the name of the target ARM processor for which GCC should tune the performance of the code. For some ARM implementations better performance can be obtained by using this option. Permissible names are: ‘<samp class="samp">arm7tdmi</samp>’, ‘<samp class="samp">arm7tdmi-s</samp>’, ‘<samp class="samp">arm710t</samp>’, ‘<samp class="samp">arm720t</samp>’, ‘<samp class="samp">arm740t</samp>’, ‘<samp class="samp">strongarm</samp>’, ‘<samp class="samp">strongarm110</samp>’, ‘<samp class="samp">strongarm1100</samp>’, ‘<samp class="samp">strongarm1110</samp>’, ‘<samp class="samp">arm8</samp>’, ‘<samp class="samp">arm810</samp>’, ‘<samp class="samp">arm9</samp>’, ‘<samp class="samp">arm9e</samp>’, ‘<samp class="samp">arm920</samp>’, ‘<samp class="samp">arm920t</samp>’, ‘<samp class="samp">arm922t</samp>’, ‘<samp class="samp">arm946e-s</samp>’, ‘<samp class="samp">arm966e-s</samp>’, ‘<samp class="samp">arm968e-s</samp>’, ‘<samp class="samp">arm926ej-s</samp>’, ‘<samp class="samp">arm940t</samp>’, ‘<samp class="samp">arm9tdmi</samp>’, ‘<samp class="samp">arm10tdmi</samp>’, ‘<samp class="samp">arm1020t</samp>’, ‘<samp class="samp">arm1026ej-s</samp>’, ‘<samp class="samp">arm10e</samp>’, ‘<samp class="samp">arm1020e</samp>’, ‘<samp class="samp">arm1022e</samp>’, ‘<samp class="samp">arm1136j-s</samp>’, ‘<samp class="samp">arm1136jf-s</samp>’, ‘<samp class="samp">mpcore</samp>’, ‘<samp class="samp">mpcorenovfp</samp>’, ‘<samp class="samp">arm1156t2-s</samp>’, ‘<samp class="samp">arm1156t2f-s</samp>’, ‘<samp class="samp">arm1176jz-s</samp>’, ‘<samp class="samp">arm1176jzf-s</samp>’, ‘<samp class="samp">generic-armv7-a</samp>’, ‘<samp class="samp">cortex-a5</samp>’, ‘<samp class="samp">cortex-a7</samp>’, ‘<samp class="samp">cortex-a8</samp>’, ‘<samp class="samp">cortex-a9</samp>’, ‘<samp class="samp">cortex-a12</samp>’, ‘<samp class="samp">cortex-a15</samp>’, ‘<samp class="samp">cortex-a17</samp>’, ‘<samp class="samp">cortex-a32</samp>’, ‘<samp class="samp">cortex-a35</samp>’, ‘<samp class="samp">cortex-a53</samp>’, ‘<samp class="samp">cortex-a55</samp>’, ‘<samp class="samp">cortex-a57</samp>’, ‘<samp class="samp">cortex-a72</samp>’, ‘<samp class="samp">cortex-a73</samp>’, ‘<samp class="samp">cortex-a75</samp>’, ‘<samp class="samp">cortex-a76</samp>’, ‘<samp class="samp">cortex-a76ae</samp>’, ‘<samp class="samp">cortex-a77</samp>’, ‘<samp class="samp">cortex-a78</samp>’, ‘<samp class="samp">cortex-a78ae</samp>’, ‘<samp class="samp">cortex-a78c</samp>’, ‘<samp class="samp">cortex-a710</samp>’, ‘<samp class="samp">ares</samp>’, ‘<samp class="samp">cortex-r4</samp>’, ‘<samp class="samp">cortex-r4f</samp>’, ‘<samp class="samp">cortex-r5</samp>’, ‘<samp class="samp">cortex-r7</samp>’, ‘<samp class="samp">cortex-r8</samp>’, ‘<samp class="samp">cortex-r52</samp>’, ‘<samp class="samp">cortex-r52plus</samp>’, ‘<samp class="samp">cortex-m0</samp>’, ‘<samp class="samp">cortex-m0plus</samp>’, ‘<samp class="samp">cortex-m1</samp>’, ‘<samp class="samp">cortex-m3</samp>’, ‘<samp class="samp">cortex-m4</samp>’, ‘<samp class="samp">cortex-m7</samp>’, ‘<samp class="samp">cortex-m23</samp>’, ‘<samp class="samp">cortex-m33</samp>’, ‘<samp class="samp">cortex-m35p</samp>’, ‘<samp class="samp">cortex-m55</samp>’, ‘<samp class="samp">cortex-m85</samp>’, ‘<samp class="samp">cortex-x1</samp>’, ‘<samp class="samp">cortex-x1c</samp>’, ‘<samp class="samp">cortex-m1.small-multiply</samp>’, ‘<samp class="samp">cortex-m0.small-multiply</samp>’, ‘<samp class="samp">cortex-m0plus.small-multiply</samp>’, ‘<samp class="samp">exynos-m1</samp>’, ‘<samp class="samp">marvell-pj4</samp>’, ‘<samp class="samp">neoverse-n1</samp>’, ‘<samp class="samp">neoverse-n2</samp>’, ‘<samp class="samp">neoverse-v1</samp>’, ‘<samp class="samp">xscale</samp>’, ‘<samp class="samp">iwmmxt</samp>’, ‘<samp class="samp">iwmmxt2</samp>’, ‘<samp class="samp">ep9312</samp>’, ‘<samp class="samp">fa526</samp>’, ‘<samp class="samp">fa626</samp>’, ‘<samp class="samp">fa606te</samp>’, ‘<samp class="samp">fa626te</samp>’, ‘<samp class="samp">fmp626</samp>’, ‘<samp class="samp">fa726te</samp>’, ‘<samp class="samp">star-mc1</samp>’, ‘<samp class="samp">xgene1</samp>’. </p> <p>Additionally, this option can specify that GCC should tune the performance of the code for a big.LITTLE system. Permissible names are: ‘<samp class="samp">cortex-a15.cortex-a7</samp>’, ‘<samp class="samp">cortex-a17.cortex-a7</samp>’, ‘<samp class="samp">cortex-a57.cortex-a53</samp>’, ‘<samp class="samp">cortex-a72.cortex-a53</samp>’, ‘<samp class="samp">cortex-a72.cortex-a35</samp>’, ‘<samp class="samp">cortex-a73.cortex-a53</samp>’, ‘<samp class="samp">cortex-a75.cortex-a55</samp>’, ‘<samp class="samp">cortex-a76.cortex-a55</samp>’. </p> <p><samp class="option">-mtune=generic-<var class="var">arch</var></samp> specifies that GCC should tune the performance for a blend of processors within architecture <var class="var">arch</var>. The aim is to generate code that run well on the current most popular processors, balancing between optimizations that benefit some CPUs in the range, and avoiding performance pitfalls of other CPUs. The effects of this option may change in future GCC versions as CPU models come and go. </p> <p><samp class="option">-mtune</samp> permits the same extension options as <samp class="option">-mcpu</samp>, but the extension options do not affect the tuning of the generated code. </p> <p><samp class="option">-mtune=native</samp> causes the compiler to auto-detect the CPU of the build computer. At present, this feature is only supported on GNU/Linux, and not all architectures are recognized. If the auto-detect is unsuccessful the option has no effect. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">name</var><span class="r">[</span>+extension…<span class="r">]</span></code><a class="copiable-link" href="#index-mcpu-2"> ¶</a></span> +</dt> <dd> +<p>This specifies the name of the target ARM processor. GCC uses this name to derive the name of the target ARM architecture (as if specified by <samp class="option">-march</samp>) and the ARM processor type for which to tune for performance (as if specified by <samp class="option">-mtune</samp>). Where this option is used in conjunction with <samp class="option">-march</samp> or <samp class="option">-mtune</samp>, those options take precedence over the appropriate part of this option. </p> <p>Many of the supported CPUs implement optional architectural extensions. Where this is so the architectural extensions are normally enabled by default. If implementations that lack the extension exist, then the extension syntax can be used to disable those extensions that have been omitted. For floating-point and Advanced SIMD (Neon) instructions, the settings of the options <samp class="option">-mfloat-abi</samp> and <samp class="option">-mfpu</samp> must also be considered: floating-point and Advanced SIMD instructions will only be used if <samp class="option">-mfloat-abi</samp> is not set to ‘<samp class="samp">soft</samp>’; and any setting of <samp class="option">-mfpu</samp> other than ‘<samp class="samp">auto</samp>’ will override the available floating-point and SIMD extension instructions. </p> <p>For example, ‘<samp class="samp">cortex-a9</samp>’ can be found in three major configurations: integer only, with just a floating-point unit or with floating-point and Advanced SIMD. The default is to enable all the instructions, but the extensions ‘<samp class="samp">+nosimd</samp>’ and ‘<samp class="samp">+nofp</samp>’ can be used to disable just the SIMD or both the SIMD and floating-point instructions respectively. </p> <p>Permissible names for this option are the same as those for <samp class="option">-mtune</samp>. </p> <p>The following extension options are common to the listed CPUs: </p> <dl class="table"> <dt>‘<samp class="samp">+nodsp</samp>’</dt> <dd> +<p>Disable the DSP instructions on ‘<samp class="samp">cortex-m33</samp>’, ‘<samp class="samp">cortex-m35p</samp>’, ‘<samp class="samp">cortex-m55</samp>’ and ‘<samp class="samp">cortex-m85</samp>’. Also disable the M-Profile Vector Extension (MVE) integer and single precision floating-point instructions on ‘<samp class="samp">cortex-m55</samp>’ and ‘<samp class="samp">cortex-m85</samp>’. </p> </dd> <dt>‘<samp class="samp">+nopacbti</samp>’</dt> <dd> +<p>Disable the Pointer Authentication and Branch Target Identification Extension on ‘<samp class="samp">cortex-m85</samp>’. </p> </dd> <dt>‘<samp class="samp">+nomve</samp>’</dt> <dd> +<p>Disable the M-Profile Vector Extension (MVE) integer and single precision floating-point instructions on ‘<samp class="samp">cortex-m55</samp>’ and ‘<samp class="samp">cortex-m85</samp>’. </p> </dd> <dt>‘<samp class="samp">+nomve.fp</samp>’</dt> <dd> +<p>Disable the M-Profile Vector Extension (MVE) single precision floating-point instructions on ‘<samp class="samp">cortex-m55</samp>’ and ‘<samp class="samp">cortex-m85</samp>’. </p> </dd> <dt>‘<samp class="samp">+cdecp0, +cdecp1, ... , +cdecp7</samp>’</dt> <dd> +<p>Enable the Custom Datapath Extension (CDE) on selected coprocessors according to the numbers given in the options in the range 0 to 7 on ‘<samp class="samp">cortex-m55</samp>’. </p> </dd> <dt>‘<samp class="samp">+nofp</samp>’</dt> <dd> +<p>Disables the floating-point instructions on ‘<samp class="samp">arm9e</samp>’, ‘<samp class="samp">arm946e-s</samp>’, ‘<samp class="samp">arm966e-s</samp>’, ‘<samp class="samp">arm968e-s</samp>’, ‘<samp class="samp">arm10e</samp>’, ‘<samp class="samp">arm1020e</samp>’, ‘<samp class="samp">arm1022e</samp>’, ‘<samp class="samp">arm926ej-s</samp>’, ‘<samp class="samp">arm1026ej-s</samp>’, ‘<samp class="samp">cortex-r5</samp>’, ‘<samp class="samp">cortex-r7</samp>’, ‘<samp class="samp">cortex-r8</samp>’, ‘<samp class="samp">cortex-m4</samp>’, ‘<samp class="samp">cortex-m7</samp>’, ‘<samp class="samp">cortex-m33</samp>’, ‘<samp class="samp">cortex-m35p</samp>’ ‘<samp class="samp">cortex-m4</samp>’, ‘<samp class="samp">cortex-m7</samp>’, ‘<samp class="samp">cortex-m33</samp>’, ‘<samp class="samp">cortex-m35p</samp>’, ‘<samp class="samp">cortex-m55</samp>’ and ‘<samp class="samp">cortex-m85</samp>’. Disables the floating-point and SIMD instructions on ‘<samp class="samp">generic-armv7-a</samp>’, ‘<samp class="samp">cortex-a5</samp>’, ‘<samp class="samp">cortex-a7</samp>’, ‘<samp class="samp">cortex-a8</samp>’, ‘<samp class="samp">cortex-a9</samp>’, ‘<samp class="samp">cortex-a12</samp>’, ‘<samp class="samp">cortex-a15</samp>’, ‘<samp class="samp">cortex-a17</samp>’, ‘<samp class="samp">cortex-a15.cortex-a7</samp>’, ‘<samp class="samp">cortex-a17.cortex-a7</samp>’, ‘<samp class="samp">cortex-a32</samp>’, ‘<samp class="samp">cortex-a35</samp>’, ‘<samp class="samp">cortex-a53</samp>’ and ‘<samp class="samp">cortex-a55</samp>’. </p> </dd> <dt>‘<samp class="samp">+nofp.dp</samp>’</dt> <dd> +<p>Disables the double-precision component of the floating-point instructions on ‘<samp class="samp">cortex-r5</samp>’, ‘<samp class="samp">cortex-r7</samp>’, ‘<samp class="samp">cortex-r8</samp>’, ‘<samp class="samp">cortex-r52</samp>’, ‘<samp class="samp">cortex-r52plus</samp>’ and ‘<samp class="samp">cortex-m7</samp>’. </p> </dd> <dt>‘<samp class="samp">+nosimd</samp>’</dt> <dd> +<p>Disables the SIMD (but not floating-point) instructions on ‘<samp class="samp">generic-armv7-a</samp>’, ‘<samp class="samp">cortex-a5</samp>’, ‘<samp class="samp">cortex-a7</samp>’ and ‘<samp class="samp">cortex-a9</samp>’. </p> </dd> <dt>‘<samp class="samp">+crypto</samp>’</dt> <dd><p>Enables the cryptographic instructions on ‘<samp class="samp">cortex-a32</samp>’, ‘<samp class="samp">cortex-a35</samp>’, ‘<samp class="samp">cortex-a53</samp>’, ‘<samp class="samp">cortex-a55</samp>’, ‘<samp class="samp">cortex-a57</samp>’, ‘<samp class="samp">cortex-a72</samp>’, ‘<samp class="samp">cortex-a73</samp>’, ‘<samp class="samp">cortex-a75</samp>’, ‘<samp class="samp">exynos-m1</samp>’, ‘<samp class="samp">xgene1</samp>’, ‘<samp class="samp">cortex-a57.cortex-a53</samp>’, ‘<samp class="samp">cortex-a72.cortex-a53</samp>’, ‘<samp class="samp">cortex-a73.cortex-a35</samp>’, ‘<samp class="samp">cortex-a73.cortex-a53</samp>’ and ‘<samp class="samp">cortex-a75.cortex-a55</samp>’. </p></dd> </dl> <p>Additionally the ‘<samp class="samp">generic-armv7-a</samp>’ pseudo target defaults to VFPv3 with 16 double-precision registers. It supports the following extension options: ‘<samp class="samp">mp</samp>’, ‘<samp class="samp">sec</samp>’, ‘<samp class="samp">vfpv3-d16</samp>’, ‘<samp class="samp">vfpv3</samp>’, ‘<samp class="samp">vfpv3-d16-fp16</samp>’, ‘<samp class="samp">vfpv3-fp16</samp>’, ‘<samp class="samp">vfpv4-d16</samp>’, ‘<samp class="samp">vfpv4</samp>’, ‘<samp class="samp">neon</samp>’, ‘<samp class="samp">neon-vfpv3</samp>’, ‘<samp class="samp">neon-fp16</samp>’, ‘<samp class="samp">neon-vfpv4</samp>’. The meanings are the same as for the extensions to <samp class="option">-march=armv7-a</samp>. </p> <p><samp class="option">-mcpu=generic-<var class="var">arch</var></samp> is also permissible, and is equivalent to <samp class="option">-march=<var class="var">arch</var> -mtune=generic-<var class="var">arch</var></samp>. See <samp class="option">-mtune</samp> for more information. </p> <p><samp class="option">-mcpu=native</samp> causes the compiler to auto-detect the CPU of the build computer. At present, this feature is only supported on GNU/Linux, and not all architectures are recognized. If the auto-detect is unsuccessful the option has no effect. </p> </dd> <dt> +<span><code class="code">-mfpu=<var class="var">name</var></code><a class="copiable-link" href="#index-mfpu-1"> ¶</a></span> +</dt> <dd> +<p>This specifies what floating-point hardware (or hardware emulation) is available on the target. Permissible names are: ‘<samp class="samp">auto</samp>’, ‘<samp class="samp">vfpv2</samp>’, ‘<samp class="samp">vfpv3</samp>’, ‘<samp class="samp">vfpv3-fp16</samp>’, ‘<samp class="samp">vfpv3-d16</samp>’, ‘<samp class="samp">vfpv3-d16-fp16</samp>’, ‘<samp class="samp">vfpv3xd</samp>’, ‘<samp class="samp">vfpv3xd-fp16</samp>’, ‘<samp class="samp">neon-vfpv3</samp>’, ‘<samp class="samp">neon-fp16</samp>’, ‘<samp class="samp">vfpv4</samp>’, ‘<samp class="samp">vfpv4-d16</samp>’, ‘<samp class="samp">fpv4-sp-d16</samp>’, ‘<samp class="samp">neon-vfpv4</samp>’, ‘<samp class="samp">fpv5-d16</samp>’, ‘<samp class="samp">fpv5-sp-d16</samp>’, ‘<samp class="samp">fp-armv8</samp>’, ‘<samp class="samp">neon-fp-armv8</samp>’ and ‘<samp class="samp">crypto-neon-fp-armv8</samp>’. Note that ‘<samp class="samp">neon</samp>’ is an alias for ‘<samp class="samp">neon-vfpv3</samp>’ and ‘<samp class="samp">vfp</samp>’ is an alias for ‘<samp class="samp">vfpv2</samp>’. </p> <p>The setting ‘<samp class="samp">auto</samp>’ is the default and is special. It causes the compiler to select the floating-point and Advanced SIMD instructions based on the settings of <samp class="option">-mcpu</samp> and <samp class="option">-march</samp>. </p> <p>If the selected floating-point hardware includes the NEON extension (e.g. <samp class="option">-mfpu=neon</samp>), note that floating-point operations are not generated by GCC’s auto-vectorization pass unless <samp class="option">-funsafe-math-optimizations</samp> is also specified. This is because NEON hardware does not fully implement the IEEE 754 standard for floating-point arithmetic (in particular denormal values are treated as zero), so the use of NEON instructions may lead to a loss of precision. </p> <p>You can also set the fpu name at function level by using the <code class="code">target("fpu=")</code> function attributes (see <a class="pxref" href="arm-function-attributes">ARM Function Attributes</a>) or pragmas (see <a class="pxref" href="function-specific-option-pragmas">Function Specific Option Pragmas</a>). </p> </dd> <dt> +<span><code class="code">-mfp16-format=<var class="var">name</var></code><a class="copiable-link" href="#index-mfp16-format"> ¶</a></span> +</dt> <dd> +<p>Specify the format of the <code class="code">__fp16</code> half-precision floating-point type. Permissible names are ‘<samp class="samp">none</samp>’, ‘<samp class="samp">ieee</samp>’, and ‘<samp class="samp">alternative</samp>’; the default is ‘<samp class="samp">none</samp>’, in which case the <code class="code">__fp16</code> type is not defined. See <a class="xref" href="half-precision">Half-Precision Floating Point</a>, for more information. </p> </dd> <dt> +<span><code class="code">-mstructure-size-boundary=<var class="var">n</var></code><a class="copiable-link" href="#index-mstructure-size-boundary"> ¶</a></span> +</dt> <dd> +<p>The sizes of all structures and unions are rounded up to a multiple of the number of bits set by this option. Permissible values are 8, 32 and 64. The default value varies for different toolchains. For the COFF targeted toolchain the default value is 8. A value of 64 is only allowed if the underlying ABI supports it. </p> <p>Specifying a larger number can produce faster, more efficient code, but can also increase the size of the program. Different values are potentially incompatible. Code compiled with one value cannot necessarily expect to work with code or libraries compiled with another value, if they exchange information using structures or unions. </p> <p>This option is deprecated. </p> </dd> <dt> +<span><code class="code">-mabort-on-noreturn</code><a class="copiable-link" href="#index-mabort-on-noreturn"> ¶</a></span> +</dt> <dd> +<p>Generate a call to the function <code class="code">abort</code> at the end of a <code class="code">noreturn</code> function. It is executed if the function tries to return. </p> </dd> <dt> + <span><code class="code">-mlong-calls</code><a class="copiable-link" href="#index-mlong-calls-2"> ¶</a></span> +</dt> <dt><code class="code">-mno-long-calls</code></dt> <dd> +<p>Tells the compiler to perform function calls by first loading the address of the function into a register and then performing a subroutine call on this register. This switch is needed if the target function lies outside of the 64-megabyte addressing range of the offset-based version of subroutine call instruction. </p> <p>Even if this switch is enabled, not all function calls are turned into long calls. The heuristic is that static functions, functions that have the <code class="code">short_call</code> attribute, functions that are inside the scope of a <code class="code">#pragma no_long_calls</code> directive, and functions whose definitions have already been compiled within the current compilation unit are not turned into long calls. The exceptions to this rule are that weak function definitions, functions with the <code class="code">long_call</code> attribute or the <code class="code">section</code> attribute, and functions that are within the scope of a <code class="code">#pragma long_calls</code> directive are always turned into long calls. </p> <p>This feature is not enabled by default. Specifying <samp class="option">-mno-long-calls</samp> restores the default behavior, as does placing the function calls within the scope of a <code class="code">#pragma +long_calls_off</code> directive. Note these switches have no effect on how the compiler generates code to handle function calls via function pointers. </p> </dd> <dt> +<span><code class="code">-msingle-pic-base</code><a class="copiable-link" href="#index-msingle-pic-base"> ¶</a></span> +</dt> <dd> +<p>Treat the register used for PIC addressing as read-only, rather than loading it in the prologue for each function. The runtime system is responsible for initializing this register with an appropriate value before execution begins. </p> </dd> <dt> +<span><code class="code">-mpic-register=<var class="var">reg</var></code><a class="copiable-link" href="#index-mpic-register"> ¶</a></span> +</dt> <dd> +<p>Specify the register to be used for PIC addressing. For standard PIC base case, the default is any suitable register determined by compiler. For single PIC base case, the default is ‘<samp class="samp">R9</samp>’ if target is EABI based or stack-checking is enabled, otherwise the default is ‘<samp class="samp">R10</samp>’. </p> </dd> <dt> +<span><code class="code">-mpic-data-is-text-relative</code><a class="copiable-link" href="#index-mpic-data-is-text-relative"> ¶</a></span> +</dt> <dd> +<p>Assume that the displacement between the text and data segments is fixed at static link time. This permits using PC-relative addressing operations to access data known to be in the data segment. For non-VxWorks RTP targets, this option is enabled by default. When disabled on such targets, it will enable <samp class="option">-msingle-pic-base</samp> by default. </p> </dd> <dt> +<span><code class="code">-mpoke-function-name</code><a class="copiable-link" href="#index-mpoke-function-name"> ¶</a></span> +</dt> <dd> +<p>Write the name of each function into the text section, directly preceding the function prologue. The generated code is similar to this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">t0 + .ascii "arm_poke_function_name", 0 + .align +t1 + .word 0xff000000 + (t1 - t0) +arm_poke_function_name + mov ip, sp + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #4</pre> +</div> <p>When performing a stack backtrace, code can inspect the value of <code class="code">pc</code> stored at <code class="code">fp + 0</code>. If the trace function then looks at location <code class="code">pc - 12</code> and the top 8 bits are set, then we know that there is a function name embedded immediately preceding this location and has length <code class="code">((pc[-3]) & 0xff000000)</code>. </p> </dd> <dt> + <span><code class="code">-mthumb</code><a class="copiable-link" href="#index-marm"> ¶</a></span> +</dt> <dt><code class="code">-marm</code></dt> <dd> <p>Select between generating code that executes in ARM and Thumb states. The default for most configurations is to generate code that executes in ARM state, but the default can be changed by configuring GCC with the <samp class="option">--with-mode=</samp><var class="var">state</var> configure option. </p> <p>You can also override the ARM and Thumb mode for each function by using the <code class="code">target("thumb")</code> and <code class="code">target("arm")</code> function attributes (see <a class="pxref" href="arm-function-attributes">ARM Function Attributes</a>) or pragmas (see <a class="pxref" href="function-specific-option-pragmas">Function Specific Option Pragmas</a>). </p> </dd> <dt> +<span><code class="code">-mflip-thumb</code><a class="copiable-link" href="#index-mflip-thumb"> ¶</a></span> +</dt> <dd> +<p>Switch ARM/Thumb modes on alternating functions. This option is provided for regression testing of mixed Thumb/ARM code generation, and is not intended for ordinary use in compiling code. </p> </dd> <dt> +<span><code class="code">-mtpcs-frame</code><a class="copiable-link" href="#index-mtpcs-frame"> ¶</a></span> +</dt> <dd> +<p>Generate a stack frame that is compliant with the Thumb Procedure Call Standard for all non-leaf functions. (A leaf function is one that does not call any other functions.) The default is <samp class="option">-mno-tpcs-frame</samp>. </p> </dd> <dt> +<span><code class="code">-mtpcs-leaf-frame</code><a class="copiable-link" href="#index-mtpcs-leaf-frame"> ¶</a></span> +</dt> <dd> +<p>Generate a stack frame that is compliant with the Thumb Procedure Call Standard for all leaf functions. (A leaf function is one that does not call any other functions.) The default is <samp class="option">-mno-apcs-leaf-frame</samp>. </p> </dd> <dt> +<span><code class="code">-mcallee-super-interworking</code><a class="copiable-link" href="#index-mcallee-super-interworking"> ¶</a></span> +</dt> <dd> +<p>Gives all externally visible functions in the file being compiled an ARM instruction set header which switches to Thumb mode before executing the rest of the function. This allows these functions to be called from non-interworking code. This option is not valid in AAPCS configurations because interworking is enabled by default. </p> </dd> <dt> +<span><code class="code">-mcaller-super-interworking</code><a class="copiable-link" href="#index-mcaller-super-interworking"> ¶</a></span> +</dt> <dd> +<p>Allows calls via function pointers (including virtual functions) to execute correctly regardless of whether the target code has been compiled for interworking or not. There is a small overhead in the cost of executing a function pointer if this option is enabled. This option is not valid in AAPCS configurations because interworking is enabled by default. </p> </dd> <dt> +<span><code class="code">-mtp=<var class="var">name</var></code><a class="copiable-link" href="#index-mtp"> ¶</a></span> +</dt> <dd> +<p>Specify the access model for the thread local storage pointer. The valid models are ‘<samp class="samp">soft</samp>’, which generates calls to <code class="code">__aeabi_read_tp</code>, ‘<samp class="samp">cp15</samp>’, which fetches the thread pointer from <code class="code">cp15</code> directly (supported in the arm6k architecture), and ‘<samp class="samp">auto</samp>’, which uses the best available method for the selected processor. The default setting is ‘<samp class="samp">auto</samp>’. </p> </dd> <dt> +<span><code class="code">-mtls-dialect=<var class="var">dialect</var></code><a class="copiable-link" href="#index-mtls-dialect"> ¶</a></span> +</dt> <dd> +<p>Specify the dialect to use for accessing thread local storage. Two <var class="var">dialect</var>s are supported—‘<samp class="samp">gnu</samp>’ and ‘<samp class="samp">gnu2</samp>’. The ‘<samp class="samp">gnu</samp>’ dialect selects the original GNU scheme for supporting local and global dynamic TLS models. The ‘<samp class="samp">gnu2</samp>’ dialect selects the GNU descriptor scheme, which provides better performance for shared libraries. The GNU descriptor scheme is compatible with the original scheme, but does require new assembler, linker and library support. Initial and local exec TLS models are unaffected by this option and always use the original scheme. </p> </dd> <dt> +<span><code class="code">-mword-relocations</code><a class="copiable-link" href="#index-mword-relocations"> ¶</a></span> +</dt> <dd> +<p>Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32). This is enabled by default on targets (uClinux, SymbianOS) where the runtime loader imposes this restriction, and when <samp class="option">-fpic</samp> or <samp class="option">-fPIC</samp> is specified. This option conflicts with <samp class="option">-mslow-flash-data</samp>. </p> </dd> <dt> +<span><code class="code">-mfix-cortex-m3-ldrd</code><a class="copiable-link" href="#index-mfix-cortex-m3-ldrd"> ¶</a></span> +</dt> <dd> +<p>Some Cortex-M3 cores can cause data corruption when <code class="code">ldrd</code> instructions with overlapping destination and base registers are used. This option avoids generating these instructions. This option is enabled by default when <samp class="option">-mcpu=cortex-m3</samp> is specified. </p> </dd> <dt><code class="code">-mfix-cortex-a57-aes-1742098</code></dt> <dt><code class="code">-mno-fix-cortex-a57-aes-1742098</code></dt> <dt><code class="code">-mfix-cortex-a72-aes-1655431</code></dt> <dt><code class="code">-mno-fix-cortex-a72-aes-1655431</code></dt> <dd> +<p>Enable (disable) mitigation for an erratum on Cortex-A57 and Cortex-A72 that affects the AES cryptographic instructions. This option is enabled by default when either <samp class="option">-mcpu=cortex-a57</samp> or <samp class="option">-mcpu=cortex-a72</samp> is specified. </p> </dd> <dt> + <span><code class="code">-munaligned-access</code><a class="copiable-link" href="#index-munaligned-access"> ¶</a></span> +</dt> <dt><code class="code">-mno-unaligned-access</code></dt> <dd> +<p>Enables (or disables) reading and writing of 16- and 32- bit values from addresses that are not 16- or 32- bit aligned. By default unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for ARMv8-M Baseline architectures, and enabled for all other architectures. If unaligned access is not enabled then words in packed data structures are accessed a byte at a time. </p> <p>The ARM attribute <code class="code">Tag_CPU_unaligned_access</code> is set in the generated object file to either true or false, depending upon the setting of this option. If unaligned access is enabled then the preprocessor symbol <code class="code">__ARM_FEATURE_UNALIGNED</code> is also defined. </p> </dd> <dt> +<span><code class="code">-mneon-for-64bits</code><a class="copiable-link" href="#index-mneon-for-64bits"> ¶</a></span> +</dt> <dd> +<p>This option is deprecated and has no effect. </p> </dd> <dt> +<span><code class="code">-mslow-flash-data</code><a class="copiable-link" href="#index-mslow-flash-data"> ¶</a></span> +</dt> <dd> +<p>Assume loading data from flash is slower than fetching instruction. Therefore literal load is minimized for better performance. This option is only supported when compiling for ARMv7 M-profile and off by default. It conflicts with <samp class="option">-mword-relocations</samp>. </p> </dd> <dt> +<span><code class="code">-masm-syntax-unified</code><a class="copiable-link" href="#index-masm-syntax-unified"> ¶</a></span> +</dt> <dd> +<p>Assume inline assembler is using unified asm syntax. The default is currently off which implies divided syntax. This option has no impact on Thumb2. However, this may change in future releases of GCC. Divided syntax should be considered deprecated. </p> </dd> <dt> +<span><code class="code">-mrestrict-it</code><a class="copiable-link" href="#index-mrestrict-it"> ¶</a></span> +</dt> <dd> +<p>Restricts generation of IT blocks to conform to the rules of ARMv8-A. IT blocks can only contain a single 16-bit instruction from a select set of instructions. This option is on by default for ARMv8-A Thumb mode. </p> </dd> <dt> +<span><code class="code">-mprint-tune-info</code><a class="copiable-link" href="#index-mprint-tune-info"> ¶</a></span> +</dt> <dd> +<p>Print CPU tuning information as comment in assembler file. This is an option used only for regression testing of the compiler and not intended for ordinary use in compiling code. This option is disabled by default. </p> </dd> <dt> +<span><code class="code">-mverbose-cost-dump</code><a class="copiable-link" href="#index-mverbose-cost-dump-1"> ¶</a></span> +</dt> <dd> +<p>Enable verbose cost model dumping in the debug dump files. This option is provided for use in debugging the compiler. </p> </dd> <dt> +<span><code class="code">-mpure-code</code><a class="copiable-link" href="#index-mpure-code"> ¶</a></span> +</dt> <dd> +<p>Do not allow constant data to be placed in code sections. Additionally, when compiling for ELF object format give all text sections the ELF processor-specific section attribute <code class="code">SHF_ARM_PURECODE</code>. This option is only available when generating non-pic code for M-profile targets. </p> </dd> <dt> +<span><code class="code">-mcmse</code><a class="copiable-link" href="#index-mcmse"> ¶</a></span> +</dt> <dd> +<p>Generate secure code as per the "ARMv8-M Security Extensions: Requirements on Development Tools Engineering Specification", which can be found on <a class="url" href="https://developer.arm.com/documentation/ecm0359818/latest/">https://developer.arm.com/documentation/ecm0359818/latest/</a>. </p> </dd> <dt> +<span><code class="code">-mfix-cmse-cve-2021-35465</code><a class="copiable-link" href="#index-mfix-cmse-cve-2021-35465"> ¶</a></span> +</dt> <dd> +<p>Mitigate against a potential security issue with the <code class="code">VLLDM</code> instruction in some M-profile devices when using CMSE (CVE-2021-365465). This option is enabled by default when the option <samp class="option">-mcpu=</samp> is used with <code class="code">cortex-m33</code>, <code class="code">cortex-m35p</code>, <code class="code">cortex-m55</code>, <code class="code">cortex-m85</code> or <code class="code">star-mc1</code>. The option <samp class="option">-mno-fix-cmse-cve-2021-35465</samp> can be used to disable the mitigation. </p> </dd> <dt> + <span><code class="code">-mstack-protector-guard=<var class="var">guard</var></code><a class="copiable-link" href="#index-mstack-protector-guard-1"> ¶</a></span> +</dt> <dt><code class="code">-mstack-protector-guard-offset=<var class="var">offset</var></code></dt> <dd> +<p>Generate stack protection code using canary at <var class="var">guard</var>. Supported locations are ‘<samp class="samp">global</samp>’ for a global canary or ‘<samp class="samp">tls</samp>’ for a canary accessible via the TLS register. The option <samp class="option">-mstack-protector-guard-offset=</samp> is for use with <samp class="option">-fstack-protector-guard=tls</samp> and not for use in user-land code. </p> </dd> <dt> + <span><code class="code">-mfdpic</code><a class="copiable-link" href="#index-mfdpic"> ¶</a></span> +</dt> <dt><code class="code">-mno-fdpic</code></dt> <dd> +<p>Select the FDPIC ABI, which uses 64-bit function descriptors to represent pointers to functions. When the compiler is configured for <code class="code">arm-*-uclinuxfdpiceabi</code> targets, this option is on by default and implies <samp class="option">-fPIE</samp> if none of the PIC/PIE-related options is provided. On other targets, it only enables the FDPIC-specific code generation features, and the user should explicitly provide the PIC/PIE-related options as needed. </p> <p>Note that static linking is not supported because it would still involve the dynamic linker when the program self-relocates. If such behavior is acceptable, use -static and -Wl,-dynamic-linker options. </p> <p>The opposite <samp class="option">-mno-fdpic</samp> option is useful (and required) to build the Linux kernel using the same (<code class="code">arm-*-uclinuxfdpiceabi</code>) toolchain as the one used to build the userland programs. </p> </dd> <dt> +<span><code class="code">-mbranch-protection=<var class="var">none</var>|<var class="var">standard</var>|<var class="var">pac-ret</var>[+<var class="var">leaf</var>][+<var class="var">bti</var>]|<var class="var">bti</var>[+<var class="var">pac-ret</var>[+<var class="var">leaf</var>]]</code><a class="copiable-link" href="#index-mbranch-protection-1"> ¶</a></span> +</dt> <dd> +<p>Enable branch protection features (armv8.1-m.main only). ‘<samp class="samp">none</samp>’ generate code without branch protection or return address signing. ‘<samp class="samp">standard[+<var class="var">leaf</var>]</samp>’ generate code with all branch protection features enabled at their standard level. ‘<samp class="samp">pac-ret[+<var class="var">leaf</var>]</samp>’ generate code with return address signing set to its standard level, which is to sign all functions that save the return address to memory. ‘<samp class="samp">leaf</samp>’ When return address signing is enabled, also sign leaf functions even if they do not write the return address to memory. +‘<samp class="samp">bti</samp>’ Add landing-pad instructions at the permitted targets of indirect branch instructions. </p> <p>If the ‘<samp class="samp">+pacbti</samp>’ architecture extension is not enabled, then all branch protection and return address signing operations are constrained to use only the instructions defined in the architectural-NOP space. The generated code will remain backwards-compatible with earlier versions of the architecture, but the additional security can be enabled at run time on processors that support the ‘<samp class="samp">PACBTI</samp>’ extension. </p> <p>Branch target enforcement using BTI can only be enabled at runtime if all code in the application has been compiled with at least ‘<samp class="samp">-mbranch-protection=bti</samp>’. </p> <p>Any setting other than ‘<samp class="samp">none</samp>’ is supported only on armv8-m.main or later. </p> <p>The default is to generate code without branch protection or return address signing. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="avr-options">AVR Options</a>, Previous: <a href="arc-options">ARC Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arm-pragmas.html b/devdocs/gcc~13/arm-pragmas.html new file mode 100644 index 00000000..bd8cb2b0 --- /dev/null +++ b/devdocs/gcc~13/arm-pragmas.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="ARM-Pragmas"> <div class="nav-panel"> <p> Next: <a href="m32c-pragmas" accesskey="n" rel="next">M32C Pragmas</a>, Previous: <a href="aarch64-pragmas" accesskey="p" rel="prev">AArch64 Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARM-Pragmas-1"><span>6.62.2 ARM Pragmas<a class="copiable-link" href="#ARM-Pragmas-1"> ¶</a></span></h1> <p>The ARM target defines pragmas for controlling the default addition of <code class="code">long_call</code> and <code class="code">short_call</code> attributes to functions. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>, for information about the effects of these attributes. </p> <dl class="table"> <dt> +<span><code class="code">long_calls</code><a class="copiable-link" href="#index-pragma_002c-long_005fcalls"> ¶</a></span> +</dt> <dd> +<p>Set all subsequent functions to have the <code class="code">long_call</code> attribute. </p> </dd> <dt> +<span><code class="code">no_long_calls</code><a class="copiable-link" href="#index-pragma_002c-no_005flong_005fcalls"> ¶</a></span> +</dt> <dd> +<p>Set all subsequent functions to have the <code class="code">short_call</code> attribute. </p> </dd> <dt> +<span><code class="code">long_calls_off</code><a class="copiable-link" href="#index-pragma_002c-long_005fcalls_005foff"> ¶</a></span> +</dt> <dd><p>Do not affect the <code class="code">long_call</code> or <code class="code">short_call</code> attributes of subsequent functions. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arm-type-attributes.html b/devdocs/gcc~13/arm-type-attributes.html new file mode 100644 index 00000000..415037e5 --- /dev/null +++ b/devdocs/gcc~13/arm-type-attributes.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="ARM-Type-Attributes"> <div class="nav-panel"> <p> Next: <a href="bpf-type-attributes" accesskey="n" rel="next">BPF Type Attributes</a>, Previous: <a href="arc-type-attributes" accesskey="p" rel="prev">ARC Type Attributes</a>, Up: <a href="type-attributes" accesskey="u" rel="up">Specifying Attributes of Types</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ARM-Type-Attributes-1"><span>6.35.3 ARM Type Attributes<a class="copiable-link" href="#ARM-Type-Attributes-1"> ¶</a></span></h1> <p>On those ARM targets that support <code class="code">dllimport</code> (such as Symbian OS), you can use the <code class="code">notshared</code> attribute to indicate that the virtual table and other similar data for a class should not be exported from a DLL. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">class __declspec(notshared) C { +public: + __declspec(dllimport) C(); + virtual void f(); +} + +__declspec(dllexport) +C::C() {}</pre> +</div> <p>In this code, <code class="code">C::C</code> is exported from the current DLL, but the virtual table for <code class="code">C</code> is not exported. (You can use <code class="code">__attribute__</code> instead of <code class="code">__declspec</code> if you prefer, but most Symbian OS code uses <code class="code">__declspec</code>.) </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Type-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-Type-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/arrays-and-pointers-implementation.html b/devdocs/gcc~13/arrays-and-pointers-implementation.html new file mode 100644 index 00000000..a98946aa --- /dev/null +++ b/devdocs/gcc~13/arrays-and-pointers-implementation.html @@ -0,0 +1,8 @@ +<div class="section-level-extent" id="Arrays-and-pointers-implementation"> <div class="nav-panel"> <p> Next: <a href="hints-implementation" accesskey="n" rel="next">Hints</a>, Previous: <a href="floating-point-implementation" accesskey="p" rel="prev">Floating Point</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Arrays-and-Pointers"><span>4.7 Arrays and Pointers<a class="copiable-link" href="#Arrays-and-Pointers"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>The result of converting a pointer to an integer or vice versa (C90 6.3.4, C99 and C11 6.3.2.3). <p>A cast from pointer to integer discards most-significant bits if the pointer representation is larger than the integer type, sign-extends<a class="footnote" id="DOCF5" href="#FOOT5"><sup>5</sup></a> if the pointer representation is smaller than the integer type, otherwise the bits are unchanged. </p> <p>A cast from integer to pointer discards most-significant bits if the pointer representation is smaller than the integer type, extends according to the signedness of the integer type if the pointer representation is larger than the integer type, otherwise the bits are unchanged. </p> <p>When casting from pointer to integer and back again, the resulting pointer must reference the same object as the original pointer, otherwise the behavior is undefined. That is, one may not use integer arithmetic to avoid the undefined behavior of pointer arithmetic as proscribed in C99 and C11 6.5.6/8. </p> </li> +<li>The size of the result of subtracting two pointers to elements of the same array (C90 6.3.6, C99 and C11 6.5.6). <p>The value is as specified in the standard and the type is determined by the ABI. </p> </li> +</ul> </div> <div class="footnotes-segment"> <h2 class="footnotes-heading">Footnotes</h2> <h3 class="footnote-body-heading"><a id="FOOT5" href="#DOCF5">(5)</a></h3> <p>Future versions of GCC may zero-extend, or use a target-defined <code class="code">ptr_extend</code> pattern. Do not rely on sign extension.</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Arrays-and-pointers-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Arrays-and-pointers-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/asm-labels.html b/devdocs/gcc~13/asm-labels.html new file mode 100644 index 00000000..14860c1f --- /dev/null +++ b/devdocs/gcc~13/asm-labels.html @@ -0,0 +1,12 @@ +<div class="subsection-level-extent" id="Asm-Labels"> <div class="nav-panel"> <p> Next: <a href="explicit-register-variables" accesskey="n" rel="next">Variables in Specified Registers</a>, Previous: <a href="constraints" accesskey="p" rel="prev">Constraints for <code class="code">asm</code> Operands</a>, Up: <a href="using-assembly-language-with-c" accesskey="u" rel="up">How to Use Inline Assembly Language in C Code</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Controlling-Names-Used-in-Assembler-Code"><span>6.47.4 Controlling Names Used in Assembler Code<a class="copiable-link" href="#Controlling-Names-Used-in-Assembler-Code"> ¶</a></span></h1> <p>You can specify the name to be used in the assembler code for a C function or variable by writing the <code class="code">asm</code> (or <code class="code">__asm__</code>) keyword after the declarator. It is up to you to make sure that the assembler names you choose do not conflict with any other assembler symbols, or reference registers. </p> <h1 class="subsubheading" id="Assembler-names-for-data"><span>Assembler names for data<a class="copiable-link" href="#Assembler-names-for-data"> ¶</a></span></h1> <p>This sample shows how to specify the assembler name for data: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int foo asm ("myfoo") = 2;</pre> +</div> <p>This specifies that the name to be used for the variable <code class="code">foo</code> in the assembler code should be ‘<samp class="samp">myfoo</samp>’ rather than the usual ‘<samp class="samp">_foo</samp>’. </p> <p>On systems where an underscore is normally prepended to the name of a C variable, this feature allows you to define names for the linker that do not start with an underscore. </p> <p>GCC does not support using this feature with a non-static local variable since such variables do not have assembler names. If you are trying to put the variable in a particular register, see <a class="ref" href="explicit-register-variables">Variables in Specified Registers</a>. </p> <h1 class="subsubheading" id="Assembler-names-for-functions"><span>Assembler names for functions<a class="copiable-link" href="#Assembler-names-for-functions"> ¶</a></span></h1> <p>To specify the assembler name for functions, write a declaration for the function before its definition and put <code class="code">asm</code> there, like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int func (int x, int y) asm ("MYFUNC"); + +int func (int x, int y) +{ + /* <span class="r">…</span> */</pre> +</div> <p>This specifies that the name to be used for the function <code class="code">func</code> in the assembler code should be <code class="code">MYFUNC</code>. </p> </div> <div class="nav-panel"> <p> Next: <a href="explicit-register-variables">Variables in Specified Registers</a>, Previous: <a href="constraints">Constraints for <code class="code">asm</code> Operands</a>, Up: <a href="using-assembly-language-with-c">How to Use Inline Assembly Language in C Code</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Asm-Labels.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Asm-Labels.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/assembler-options.html b/devdocs/gcc~13/assembler-options.html new file mode 100644 index 00000000..bf0d61ac --- /dev/null +++ b/devdocs/gcc~13/assembler-options.html @@ -0,0 +1,12 @@ +<div class="section-level-extent" id="Assembler-Options"> <div class="nav-panel"> <p> Next: <a href="link-options" accesskey="n" rel="next">Options for Linking</a>, Previous: <a href="preprocessor-options" accesskey="p" rel="prev">Options Controlling the Preprocessor</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Passing-Options-to-the-Assembler"><span>3.14 Passing Options to the Assembler<a class="copiable-link" href="#Passing-Options-to-the-Assembler"> ¶</a></span></h1> <p>You can pass options to the assembler. </p> <dl class="table"> <dt> +<span><code class="code">-Wa,<var class="var">option</var></code><a class="copiable-link" href="#index-Wa"> ¶</a></span> +</dt> <dd> +<p>Pass <var class="var">option</var> as an option to the assembler. If <var class="var">option</var> contains commas, it is split into multiple options at the commas. </p> </dd> <dt> +<span><code class="code">-Xassembler <var class="var">option</var></code><a class="copiable-link" href="#index-Xassembler"> ¶</a></span> +</dt> <dd> +<p>Pass <var class="var">option</var> as an option to the assembler. You can use this to supply system-specific assembler options that GCC does not recognize. </p> <p>If you want to pass an option that takes an argument, you must use <samp class="option">-Xassembler</samp> twice, once for the option and once for the argument. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Assembler-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Assembler-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/attribute-syntax.html b/devdocs/gcc~13/attribute-syntax.html new file mode 100644 index 00000000..a1495df9 --- /dev/null +++ b/devdocs/gcc~13/attribute-syntax.html @@ -0,0 +1,20 @@ +<div class="section-level-extent" id="Attribute-Syntax"> <div class="nav-panel"> <p> Next: <a href="function-prototypes" accesskey="n" rel="next">Prototypes and Old-Style Function Definitions</a>, Previous: <a href="statement-attributes" accesskey="p" rel="prev">Statement Attributes</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Attribute-Syntax-1"><span>6.39 Attribute Syntax<a class="copiable-link" href="#Attribute-Syntax-1"> ¶</a></span></h1> <p>This section describes the syntax with which <code class="code">__attribute__</code> may be used, and the constructs to which attribute specifiers bind, for the C language. Some details may vary for C++ and Objective-C. Because of limitations in the grammar for attributes, some forms described here may not be successfully parsed in all cases. </p> <p>There are some problems with the semantics of attributes in C++. For example, there are no manglings for attributes, although they may affect code generation, so problems may arise when attributed types are used in conjunction with templates or overloading. Similarly, <code class="code">typeid</code> does not distinguish between types with different attributes. Support for attributes in C++ may be restricted in future to attributes on declarations only, but not on nested declarators. </p> <p>See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>, for details of the semantics of attributes applying to functions. See <a class="xref" href="variable-attributes">Specifying Attributes of Variables</a>, for details of the semantics of attributes applying to variables. See <a class="xref" href="type-attributes">Specifying Attributes of Types</a>, for details of the semantics of attributes applying to structure, union and enumerated types. See <a class="xref" href="label-attributes">Label Attributes</a>, for details of the semantics of attributes applying to labels. See <a class="xref" href="enumerator-attributes">Enumerator Attributes</a>, for details of the semantics of attributes applying to enumerators. See <a class="xref" href="statement-attributes">Statement Attributes</a>, for details of the semantics of attributes applying to statements. </p> <p>An <em class="dfn">attribute specifier</em> is of the form <code class="code">__attribute__ ((<var class="var">attribute-list</var>))</code>. An <em class="dfn">attribute list</em> is a possibly empty comma-separated sequence of <em class="dfn">attributes</em>, where each attribute is one of the following: </p> <ul class="itemize mark-bullet"> <li>Empty. Empty attributes are ignored. </li> +<li>An attribute name (which may be an identifier such as <code class="code">unused</code>, or a reserved word such as <code class="code">const</code>). </li> +<li>An attribute name followed by a parenthesized list of parameters for the attribute. These parameters take one of the following forms: <ul class="itemize mark-bullet"> <li>An identifier. For example, <code class="code">mode</code> attributes use this form. </li> +<li>An identifier followed by a comma and a non-empty comma-separated list of expressions. For example, <code class="code">format</code> attributes use this form. </li> +<li>A possibly empty comma-separated list of expressions. For example, <code class="code">format_arg</code> attributes use this form with the list being a single integer constant expression, and <code class="code">alias</code> attributes use this form with the list being a single string constant. </li> +</ul> </li> +</ul> <p>An <em class="dfn">attribute specifier list</em> is a sequence of one or more attribute specifiers, not separated by any other tokens. </p> <p>You may optionally specify attribute names with ‘<samp class="samp">__</samp>’ preceding and following the name. This allows you to use them in header files without being concerned about a possible macro of the same name. For example, you may use the attribute name <code class="code">__noreturn__</code> instead of <code class="code">noreturn</code>. </p> <h2 class="subsubheading" id="Label-Attributes-2"><span>Label Attributes<a class="copiable-link" href="#Label-Attributes-2"> ¶</a></span></h2> <p>In GNU C, an attribute specifier list may appear after the colon following a label, other than a <code class="code">case</code> or <code class="code">default</code> label. GNU C++ only permits attributes on labels if the attribute specifier is immediately followed by a semicolon (i.e., the label applies to an empty statement). If the semicolon is missing, C++ label attributes are ambiguous, as it is permissible for a declaration, which could begin with an attribute list, to be labelled in C++. Declarations cannot be labelled in C90 or C99, so the ambiguity does not arise there. </p> <h2 class="subsubheading" id="Enumerator-Attributes-2"><span>Enumerator Attributes<a class="copiable-link" href="#Enumerator-Attributes-2"> ¶</a></span></h2> <p>In GNU C, an attribute specifier list may appear as part of an enumerator. The attribute goes after the enumeration constant, before <code class="code">=</code>, if present. The optional attribute in the enumerator appertains to the enumeration constant. It is not possible to place the attribute after the constant expression, if present. </p> <h2 class="subsubheading" id="Statement-Attributes-2"><span>Statement Attributes<a class="copiable-link" href="#Statement-Attributes-2"> ¶</a></span></h2> <p>In GNU C, an attribute specifier list may appear as part of a null statement. The attribute goes before the semicolon. </p> <h2 class="subsubheading" id="Type-Attributes-1"><span>Type Attributes<a class="copiable-link" href="#Type-Attributes-1"> ¶</a></span></h2> <p>An attribute specifier list may appear as part of a <code class="code">struct</code>, <code class="code">union</code> or <code class="code">enum</code> specifier. It may go either immediately after the <code class="code">struct</code>, <code class="code">union</code> or <code class="code">enum</code> keyword, or after the closing brace. The former syntax is preferred. Where attribute specifiers follow the closing brace, they are considered to relate to the structure, union or enumerated type defined, not to any enclosing declaration the type specifier appears in, and the type defined is not complete until after the attribute specifiers. </p> <h2 class="subsubheading" id="All-other-attributes"><span>All other attributes<a class="copiable-link" href="#All-other-attributes"> ¶</a></span></h2> <p>Otherwise, an attribute specifier appears as part of a declaration, counting declarations of unnamed parameters and type names, and relates to that declaration (which may be nested in another declaration, for example in the case of a parameter declaration), or to a particular declarator within a declaration. Where an attribute specifier is applied to a parameter declared as a function or an array, it should apply to the function or array rather than the pointer to which the parameter is implicitly converted, but this is not yet correctly implemented. </p> <p>Any list of specifiers and qualifiers at the start of a declaration may contain attribute specifiers, whether or not such a list may in that context contain storage class specifiers. (Some attributes, however, are essentially in the nature of storage class specifiers, and only make sense where storage class specifiers may be used; for example, <code class="code">section</code>.) There is one necessary limitation to this syntax: the first old-style parameter declaration in a function definition cannot begin with an attribute specifier, because such an attribute applies to the function instead by syntax described below (which, however, is not yet implemented in this case). In some other cases, attribute specifiers are permitted by this grammar but not yet supported by the compiler. All attribute specifiers in this place relate to the declaration as a whole. In the obsolescent usage where a type of <code class="code">int</code> is implied by the absence of type specifiers, such a list of specifiers and qualifiers may be an attribute specifier list with no other specifiers or qualifiers. </p> <p>At present, the first parameter in a function prototype must have some type specifier that is not an attribute specifier; this resolves an ambiguity in the interpretation of <code class="code">void f(int +(__attribute__((foo)) x))</code>, but is subject to change. At present, if the parentheses of a function declarator contain only attributes then those attributes are ignored, rather than yielding an error or warning or implying a single parameter of type int, but this is subject to change. </p> <p>An attribute specifier list may appear immediately before a declarator (other than the first) in a comma-separated list of declarators in a declaration of more than one identifier using a single list of specifiers and qualifiers. Such attribute specifiers apply only to the identifier before whose declarator they appear. For example, in </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__((noreturn)) void d0 (void), + __attribute__((format(printf, 1, 2))) d1 (const char *, ...), + d2 (void);</pre> +</div> <p>the <code class="code">noreturn</code> attribute applies to all the functions declared; the <code class="code">format</code> attribute only applies to <code class="code">d1</code>. </p> <p>An attribute specifier list may appear immediately before the comma, <code class="code">=</code> or semicolon terminating the declaration of an identifier other than a function definition. Such attribute specifiers apply to the declared object or function. Where an assembler name for an object or function is specified (see <a class="pxref" href="asm-labels">Controlling Names Used in Assembler Code</a>), the attribute must follow the <code class="code">asm</code> specification. </p> <p>An attribute specifier list may, in future, be permitted to appear after the declarator in a function definition (before any old-style parameter declarations or the function body). </p> <p>Attribute specifiers may be mixed with type qualifiers appearing inside the <code class="code">[]</code> of a parameter array declarator, in the C99 construct by which such qualifiers are applied to the pointer to which the array is implicitly converted. Such attribute specifiers apply to the pointer, not to the array, but at present this is not implemented and they are ignored. </p> <p>An attribute specifier list may appear at the start of a nested declarator. At present, there are some limitations in this usage: the attributes correctly apply to the declarator, but for most individual attributes the semantics this implies are not implemented. When attribute specifiers follow the <code class="code">*</code> of a pointer declarator, they may be mixed with any type qualifiers present. The following describes the formal semantics of this syntax. It makes the most sense if you are familiar with the formal specification of declarators in the ISO C standard. </p> <p>Consider (as in C99 subclause 6.7.5 paragraph 4) a declaration <code class="code">T +D1</code>, where <code class="code">T</code> contains declaration specifiers that specify a type <var class="var">Type</var> (such as <code class="code">int</code>) and <code class="code">D1</code> is a declarator that contains an identifier <var class="var">ident</var>. The type specified for <var class="var">ident</var> for derived declarators whose type does not include an attribute specifier is as in the ISO C standard. </p> <p>If <code class="code">D1</code> has the form <code class="code">( <var class="var">attribute-specifier-list</var> D )</code>, and the declaration <code class="code">T D</code> specifies the type “<var class="var">derived-declarator-type-list</var> <var class="var">Type</var>” for <var class="var">ident</var>, then <code class="code">T D1</code> specifies the type “<var class="var">derived-declarator-type-list</var> <var class="var">attribute-specifier-list</var> <var class="var">Type</var>” for <var class="var">ident</var>. </p> <p>If <code class="code">D1</code> has the form <code class="code">* +<var class="var">type-qualifier-and-attribute-specifier-list</var> D</code>, and the declaration <code class="code">T D</code> specifies the type “<var class="var">derived-declarator-type-list</var> <var class="var">Type</var>” for <var class="var">ident</var>, then <code class="code">T D1</code> specifies the type “<var class="var">derived-declarator-type-list</var> <var class="var">type-qualifier-and-attribute-specifier-list</var> pointer to <var class="var">Type</var>” for <var class="var">ident</var>. </p> <p>For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void (__attribute__((noreturn)) ****f) (void);</pre> +</div> <p>specifies the type “pointer to pointer to pointer to pointer to non-returning function returning <code class="code">void</code>”. As another example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">char *__attribute__((aligned(8))) *f;</pre> +</div> <p>specifies the type “pointer to 8-byte-aligned pointer to <code class="code">char</code>”. Note again that this does not work with most attributes; for example, the usage of ‘<samp class="samp">aligned</samp>’ and ‘<samp class="samp">noreturn</samp>’ attributes given above is not yet supported. </p> <p>For compatibility with existing code written for compiler versions that did not implement attributes on nested declarators, some laxity is allowed in the placing of attributes. If an attribute that only applies to types is applied to a declaration, it is treated as applying to the type of that declaration. If an attribute that only applies to declarations is applied to the type of a declaration, it is treated as applying to that declaration; and, for compatibility with code placing the attributes immediately before the identifier declared, such an attribute applied to a function return type is treated as applying to the function type, and such an attribute applied to an array element type is treated as applying to the array type. If an attribute that only applies to function types is applied to a pointer-to-function type, it is treated as applying to the pointer target type; if such an attribute is applied to a function return type that is not a pointer-to-function type, it is treated as applying to the function type. </p> </div> <div class="nav-panel"> <p> Next: <a href="function-prototypes">Prototypes and Old-Style Function Definitions</a>, Previous: <a href="statement-attributes">Statement Attributes</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Attribute-Syntax.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Attribute-Syntax.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/avr-built-in-functions.html b/devdocs/gcc~13/avr-built-in-functions.html new file mode 100644 index 00000000..b257fc49 --- /dev/null +++ b/devdocs/gcc~13/avr-built-in-functions.html @@ -0,0 +1,34 @@ +<div class="subsection-level-extent" id="AVR-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="blackfin-built-in-functions" accesskey="n" rel="next">Blackfin Built-in Functions</a>, Previous: <a href="arm-armv8-m-security-extensions" accesskey="p" rel="prev">ARM ARMv8-M Security Extensions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AVR-Built-in-Functions-1"><span>6.60.10 AVR Built-in Functions<a class="copiable-link" href="#AVR-Built-in-Functions-1"> ¶</a></span></h1> <p>For each built-in function for AVR, there is an equally named, uppercase built-in macro defined. That way users can easily query if or if not a specific built-in is implemented or not. For example, if <code class="code">__builtin_avr_nop</code> is available the macro <code class="code">__BUILTIN_AVR_NOP</code> is defined to <code class="code">1</code> and undefined otherwise. </p> <dl class="table"> <dt><code class="code">void __builtin_avr_nop (void)</code></dt> <dt><code class="code">void __builtin_avr_sei (void)</code></dt> <dt><code class="code">void __builtin_avr_cli (void)</code></dt> <dt><code class="code">void __builtin_avr_sleep (void)</code></dt> <dt><code class="code">void __builtin_avr_wdr (void)</code></dt> <dt><code class="code">unsigned char __builtin_avr_swap (unsigned char)</code></dt> <dt><code class="code">unsigned int __builtin_avr_fmul (unsigned char, unsigned char)</code></dt> <dt><code class="code">int __builtin_avr_fmuls (char, char)</code></dt> <dt><code class="code">int __builtin_avr_fmulsu (char, unsigned char)</code></dt> <dd> +<p>These built-in functions map to the respective machine instruction, i.e. <code class="code">nop</code>, <code class="code">sei</code>, <code class="code">cli</code>, <code class="code">sleep</code>, <code class="code">wdr</code>, <code class="code">swap</code>, <code class="code">fmul</code>, <code class="code">fmuls</code> resp. <code class="code">fmulsu</code>. The three <code class="code">fmul*</code> built-ins are implemented as library call if no hardware multiplier is available. </p> </dd> <dt><code class="code">void __builtin_avr_delay_cycles (unsigned long ticks)</code></dt> <dd> +<p>Delay execution for <var class="var">ticks</var> cycles. Note that this built-in does not take into account the effect of interrupts that might increase delay time. <var class="var">ticks</var> must be a compile-time integer constant; delays with a variable number of cycles are not supported. </p> </dd> <dt><code class="code">char __builtin_avr_flash_segment (const __memx void*)</code></dt> <dd> +<p>This built-in takes a byte address to the 24-bit <a class="ref" href="named-address-spaces#AVR-Named-Address-Spaces">address space</a> <code class="code">__memx</code> and returns the number of the flash segment (the 64 KiB chunk) where the address points to. Counting starts at <code class="code">0</code>. If the address does not point to flash memory, return <code class="code">-1</code>. </p> </dd> <dt><code class="code">uint8_t __builtin_avr_insert_bits (uint32_t map, uint8_t bits, uint8_t val)</code></dt> <dd> +<p>Insert bits from <var class="var">bits</var> into <var class="var">val</var> and return the resulting value. The nibbles of <var class="var">map</var> determine how the insertion is performed: Let <var class="var">X</var> be the <var class="var">n</var>-th nibble of <var class="var">map</var> </p> +<ol class="enumerate"> <li> If <var class="var">X</var> is <code class="code">0xf</code>, then the <var class="var">n</var>-th bit of <var class="var">val</var> is returned unaltered. </li> +<li> If X is in the range 0…7, then the <var class="var">n</var>-th result bit is set to the <var class="var">X</var>-th bit of <var class="var">bits</var> </li> +<li> If X is in the range 8…<code class="code">0xe</code>, then the <var class="var">n</var>-th result bit is undefined. </li> +</ol> <p>One typical use case for this built-in is adjusting input and output values to non-contiguous port layouts. Some examples: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">// same as val, bits is unused +__builtin_avr_insert_bits (0xffffffff, bits, val);</pre> +</div> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">// same as bits, val is unused +__builtin_avr_insert_bits (0x76543210, bits, val);</pre> +</div> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">// same as rotating bits by 4 +__builtin_avr_insert_bits (0x32107654, bits, 0);</pre> +</div> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">// high nibble of result is the high nibble of val +// low nibble of result is the low nibble of bits +__builtin_avr_insert_bits (0xffff3210, bits, val);</pre> +</div> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">// reverse the bit order of bits +__builtin_avr_insert_bits (0x01234567, bits, 0);</pre> +</div> </dd> <dt><code class="code">void __builtin_avr_nops (unsigned count)</code></dt> <dd> +<p>Insert <var class="var">count</var> <code class="code">NOP</code> instructions. The number of instructions must be a compile-time integer constant. </p> </dd> </dl> <p>There are many more AVR-specific built-in functions that are used to implement the ISO/IEC TR 18037 “Embedded C” fixed-point functions of section 7.18a.6. You don’t need to use these built-ins directly. Instead, use the declarations as supplied by the <code class="code">stdfix.h</code> header with GNU-C99: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <stdfix.h> + +// Re-interpret the bit representation of unsigned 16-bit +// integer <var class="var">uval</var> as Q-format 0.16 value. +unsigned fract get_bits (uint_ur_t uval) +{ + return urbits (uval); +}</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="blackfin-built-in-functions">Blackfin Built-in Functions</a>, Previous: <a href="arm-armv8-m-security-extensions">ARM ARMv8-M Security Extensions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AVR-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AVR-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/avr-function-attributes.html b/devdocs/gcc~13/avr-function-attributes.html new file mode 100644 index 00000000..556c063d --- /dev/null +++ b/devdocs/gcc~13/avr-function-attributes.html @@ -0,0 +1,36 @@ +<div class="subsection-level-extent" id="AVR-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="blackfin-function-attributes" accesskey="n" rel="next">Blackfin Function Attributes</a>, Previous: <a href="arm-function-attributes" accesskey="p" rel="prev">ARM Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AVR-Function-Attributes-1"><span>6.33.6 AVR Function Attributes<a class="copiable-link" href="#AVR-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the AVR back end: </p> <dl class="table"> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-AVR"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> <p>On the AVR, the hardware globally disables interrupts when an interrupt is executed. The first instruction of an interrupt handler declared with this attribute is a <code class="code">SEI</code> instruction to re-enable interrupts. See also the <code class="code">signal</code> function attribute that does not insert a <code class="code">SEI</code> instruction. If both <code class="code">signal</code> and <code class="code">interrupt</code> are specified for the same function, <code class="code">signal</code> is silently ignored. </p> </dd> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-AVR"> ¶</a></span> +</dt> <dd> +<p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p> </dd> <dt> +<span><code class="code">no_gccisr</code><a class="copiable-link" href="#index-no_005fgccisr-function-attribute_002c-AVR"> ¶</a></span> +</dt> <dd> +<p>Do not use <code class="code">__gcc_isr</code> pseudo instructions in a function with the <code class="code">interrupt</code> or <code class="code">signal</code> attribute aka. interrupt service routine (ISR). Use this attribute if the preamble of the ISR prologue should always read </p> +<div class="example"> <pre class="example-preformatted" data-language="cpp">push __zero_reg__ +push __tmp_reg__ +in __tmp_reg__, __SREG__ +push __tmp_reg__ +clr __zero_reg__</pre> +</div> <p>and accordingly for the postamble of the epilogue — no matter whether the mentioned registers are actually used in the ISR or not. Situations where you might want to use this attribute include: </p> +<ul class="itemize mark-bullet"> <li>Code that (effectively) clobbers bits of <code class="code">SREG</code> other than the <code class="code">I</code>-flag by writing to the memory location of <code class="code">SREG</code>. </li> +<li>Code that uses inline assembler to jump to a different function which expects (parts of) the prologue code as outlined above to be present. </li> +</ul> <p>To disable <code class="code">__gcc_isr</code> generation for the whole compilation unit, there is option <samp class="option">-mno-gas-isr-prologues</samp>, see <a class="pxref" href="avr-options">AVR Options</a>. </p> </dd> <dt> + <span><code class="code">OS_main</code><a class="copiable-link" href="#index-OS_005fmain-function-attribute_002c-AVR"> ¶</a></span> +</dt> <dt><code class="code">OS_task</code></dt> <dd> +<p>On AVR, functions with the <code class="code">OS_main</code> or <code class="code">OS_task</code> attribute do not save/restore any call-saved register in their prologue/epilogue. </p> <p>The <code class="code">OS_main</code> attribute can be used when there <em class="emph">is guarantee</em> that interrupts are disabled at the time when the function is entered. This saves resources when the stack pointer has to be changed to set up a frame for local variables. </p> <p>The <code class="code">OS_task</code> attribute can be used when there is <em class="emph">no guarantee</em> that interrupts are disabled at that time when the function is entered like for, e.g. task functions in a multi-threading operating system. In that case, changing the stack pointer register is guarded by save/clear/restore of the global interrupt enable flag. </p> <p>The differences to the <code class="code">naked</code> function attribute are: </p> +<ul class="itemize mark-bullet"> <li> +<code class="code">naked</code> functions do not have a return instruction whereas <code class="code">OS_main</code> and <code class="code">OS_task</code> functions have a <code class="code">RET</code> or <code class="code">RETI</code> return instruction. </li> +<li> +<code class="code">naked</code> functions do not set up a frame for local variables or a frame pointer whereas <code class="code">OS_main</code> and <code class="code">OS_task</code> do this as needed. </li> +</ul> </dd> <dt> +<span><code class="code">signal</code><a class="copiable-link" href="#index-signal-function-attribute_002c-AVR"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the AVR to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> <p>See also the <code class="code">interrupt</code> function attribute. </p> <p>The AVR hardware globally disables interrupts when an interrupt is executed. Interrupt handler functions defined with the <code class="code">signal</code> attribute do not re-enable interrupts. It is save to enable interrupts in a <code class="code">signal</code> handler. This “save” only applies to the code generated by the compiler and not to the IRQ layout of the application which is responsibility of the application. </p> <p>If both <code class="code">signal</code> and <code class="code">interrupt</code> are specified for the same function, <code class="code">signal</code> is silently ignored. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="blackfin-function-attributes">Blackfin Function Attributes</a>, Previous: <a href="arm-function-attributes">ARM Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AVR-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AVR-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/avr-options.html b/devdocs/gcc~13/avr-options.html new file mode 100644 index 00000000..b6fadd2f --- /dev/null +++ b/devdocs/gcc~13/avr-options.html @@ -0,0 +1,166 @@ +<div class="subsection-level-extent" id="AVR-Options"> <div class="nav-panel"> <p> Next: <a href="blackfin-options" accesskey="n" rel="next">Blackfin Options</a>, Previous: <a href="arm-options" accesskey="p" rel="prev">ARM Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AVR-Options-1"><span>3.19.6 AVR Options<a class="copiable-link" href="#AVR-Options-1"> ¶</a></span></h1> <p>These options are defined for AVR implementations: </p> <dl class="table"> <dt> +<span><code class="code">-mmcu=<var class="var">mcu</var></code><a class="copiable-link" href="#index-mmcu"> ¶</a></span> +</dt> <dd> +<p>Specify Atmel AVR instruction set architectures (ISA) or MCU type. </p> <p>The default for this option is ‘<samp class="samp">avr2</samp>’. </p> <p>GCC supports the following AVR devices and ISAs: </p> <dl class="table"> <dt><code class="code">avr2</code></dt> <dd> +<p>“Classic” devices with up to 8 KiB of program memory. <var class="var">mcu</var> = <code class="code">attiny22</code>, <code class="code">attiny26</code>, <code class="code">at90s2313</code>, <code class="code">at90s2323</code>, <code class="code">at90s2333</code>, <code class="code">at90s2343</code>, <code class="code">at90s4414</code>, <code class="code">at90s4433</code>, <code class="code">at90s4434</code>, <code class="code">at90c8534</code>, <code class="code">at90s8515</code>, <code class="code">at90s8535</code>. </p> </dd> <dt><code class="code">avr25</code></dt> <dd> +<p>“Classic” devices with up to 8 KiB of program memory and with the <code class="code">MOVW</code> instruction. <var class="var">mcu</var> = <code class="code">attiny13</code>, <code class="code">attiny13a</code>, <code class="code">attiny24</code>, <code class="code">attiny24a</code>, <code class="code">attiny25</code>, <code class="code">attiny261</code>, <code class="code">attiny261a</code>, <code class="code">attiny2313</code>, <code class="code">attiny2313a</code>, <code class="code">attiny43u</code>, <code class="code">attiny44</code>, <code class="code">attiny44a</code>, <code class="code">attiny45</code>, <code class="code">attiny48</code>, <code class="code">attiny441</code>, <code class="code">attiny461</code>, <code class="code">attiny461a</code>, <code class="code">attiny4313</code>, <code class="code">attiny84</code>, <code class="code">attiny84a</code>, <code class="code">attiny85</code>, <code class="code">attiny87</code>, <code class="code">attiny88</code>, <code class="code">attiny828</code>, <code class="code">attiny841</code>, <code class="code">attiny861</code>, <code class="code">attiny861a</code>, <code class="code">ata5272</code>, <code class="code">ata6616c</code>, <code class="code">at86rf401</code>. </p> </dd> <dt><code class="code">avr3</code></dt> <dd> +<p>“Classic” devices with 16 KiB up to 64 KiB of program memory. <var class="var">mcu</var> = <code class="code">at76c711</code>, <code class="code">at43usb355</code>. </p> </dd> <dt><code class="code">avr31</code></dt> <dd> +<p>“Classic” devices with 128 KiB of program memory. <var class="var">mcu</var> = <code class="code">atmega103</code>, <code class="code">at43usb320</code>. </p> </dd> <dt><code class="code">avr35</code></dt> <dd> +<p>“Classic” devices with 16 KiB up to 64 KiB of program memory and with the <code class="code">MOVW</code> instruction. <var class="var">mcu</var> = <code class="code">attiny167</code>, <code class="code">attiny1634</code>, <code class="code">atmega8u2</code>, <code class="code">atmega16u2</code>, <code class="code">atmega32u2</code>, <code class="code">ata5505</code>, <code class="code">ata6617c</code>, <code class="code">ata664251</code>, <code class="code">at90usb82</code>, <code class="code">at90usb162</code>. </p> </dd> <dt><code class="code">avr4</code></dt> <dd> +<p>“Enhanced” devices with up to 8 KiB of program memory. <var class="var">mcu</var> = <code class="code">atmega48</code>, <code class="code">atmega48a</code>, <code class="code">atmega48p</code>, <code class="code">atmega48pa</code>, <code class="code">atmega48pb</code>, <code class="code">atmega8</code>, <code class="code">atmega8a</code>, <code class="code">atmega8hva</code>, <code class="code">atmega88</code>, <code class="code">atmega88a</code>, <code class="code">atmega88p</code>, <code class="code">atmega88pa</code>, <code class="code">atmega88pb</code>, <code class="code">atmega8515</code>, <code class="code">atmega8535</code>, <code class="code">ata6285</code>, <code class="code">ata6286</code>, <code class="code">ata6289</code>, <code class="code">ata6612c</code>, <code class="code">at90pwm1</code>, <code class="code">at90pwm2</code>, <code class="code">at90pwm2b</code>, <code class="code">at90pwm3</code>, <code class="code">at90pwm3b</code>, <code class="code">at90pwm81</code>. </p> </dd> <dt><code class="code">avr5</code></dt> <dd> +<p>“Enhanced” devices with 16 KiB up to 64 KiB of program memory. <var class="var">mcu</var> = <code class="code">atmega16</code>, <code class="code">atmega16a</code>, <code class="code">atmega16hva</code>, <code class="code">atmega16hva2</code>, <code class="code">atmega16hvb</code>, <code class="code">atmega16hvbrevb</code>, <code class="code">atmega16m1</code>, <code class="code">atmega16u4</code>, <code class="code">atmega161</code>, <code class="code">atmega162</code>, <code class="code">atmega163</code>, <code class="code">atmega164a</code>, <code class="code">atmega164p</code>, <code class="code">atmega164pa</code>, <code class="code">atmega165</code>, <code class="code">atmega165a</code>, <code class="code">atmega165p</code>, <code class="code">atmega165pa</code>, <code class="code">atmega168</code>, <code class="code">atmega168a</code>, <code class="code">atmega168p</code>, <code class="code">atmega168pa</code>, <code class="code">atmega168pb</code>, <code class="code">atmega169</code>, <code class="code">atmega169a</code>, <code class="code">atmega169p</code>, <code class="code">atmega169pa</code>, <code class="code">atmega32</code>, <code class="code">atmega32a</code>, <code class="code">atmega32c1</code>, <code class="code">atmega32hvb</code>, <code class="code">atmega32hvbrevb</code>, <code class="code">atmega32m1</code>, <code class="code">atmega32u4</code>, <code class="code">atmega32u6</code>, <code class="code">atmega323</code>, <code class="code">atmega324a</code>, <code class="code">atmega324p</code>, <code class="code">atmega324pa</code>, <code class="code">atmega324pb</code>, <code class="code">atmega325</code>, <code class="code">atmega325a</code>, <code class="code">atmega325p</code>, <code class="code">atmega325pa</code>, <code class="code">atmega328</code>, <code class="code">atmega328p</code>, <code class="code">atmega328pb</code>, <code class="code">atmega329</code>, <code class="code">atmega329a</code>, <code class="code">atmega329p</code>, <code class="code">atmega329pa</code>, <code class="code">atmega3250</code>, <code class="code">atmega3250a</code>, <code class="code">atmega3250p</code>, <code class="code">atmega3250pa</code>, <code class="code">atmega3290</code>, <code class="code">atmega3290a</code>, <code class="code">atmega3290p</code>, <code class="code">atmega3290pa</code>, <code class="code">atmega406</code>, <code class="code">atmega64</code>, <code class="code">atmega64a</code>, <code class="code">atmega64c1</code>, <code class="code">atmega64hve</code>, <code class="code">atmega64hve2</code>, <code class="code">atmega64m1</code>, <code class="code">atmega64rfr2</code>, <code class="code">atmega640</code>, <code class="code">atmega644</code>, <code class="code">atmega644a</code>, <code class="code">atmega644p</code>, <code class="code">atmega644pa</code>, <code class="code">atmega644rfr2</code>, <code class="code">atmega645</code>, <code class="code">atmega645a</code>, <code class="code">atmega645p</code>, <code class="code">atmega649</code>, <code class="code">atmega649a</code>, <code class="code">atmega649p</code>, <code class="code">atmega6450</code>, <code class="code">atmega6450a</code>, <code class="code">atmega6450p</code>, <code class="code">atmega6490</code>, <code class="code">atmega6490a</code>, <code class="code">atmega6490p</code>, <code class="code">ata5795</code>, <code class="code">ata5790</code>, <code class="code">ata5790n</code>, <code class="code">ata5791</code>, <code class="code">ata6613c</code>, <code class="code">ata6614q</code>, <code class="code">ata5782</code>, <code class="code">ata5831</code>, <code class="code">ata8210</code>, <code class="code">ata8510</code>, <code class="code">ata5702m322</code>, <code class="code">at90pwm161</code>, <code class="code">at90pwm216</code>, <code class="code">at90pwm316</code>, <code class="code">at90can32</code>, <code class="code">at90can64</code>, <code class="code">at90scr100</code>, <code class="code">at90usb646</code>, <code class="code">at90usb647</code>, <code class="code">at94k</code>, <code class="code">m3000</code>. </p> </dd> <dt><code class="code">avr51</code></dt> <dd> +<p>“Enhanced” devices with 128 KiB of program memory. <var class="var">mcu</var> = <code class="code">atmega128</code>, <code class="code">atmega128a</code>, <code class="code">atmega128rfa1</code>, <code class="code">atmega128rfr2</code>, <code class="code">atmega1280</code>, <code class="code">atmega1281</code>, <code class="code">atmega1284</code>, <code class="code">atmega1284p</code>, <code class="code">atmega1284rfr2</code>, <code class="code">at90can128</code>, <code class="code">at90usb1286</code>, <code class="code">at90usb1287</code>. </p> </dd> <dt><code class="code">avr6</code></dt> <dd> +<p>“Enhanced” devices with 3-byte PC, i.e. with more than 128 KiB of program memory. <var class="var">mcu</var> = <code class="code">atmega256rfr2</code>, <code class="code">atmega2560</code>, <code class="code">atmega2561</code>, <code class="code">atmega2564rfr2</code>. </p> </dd> <dt><code class="code">avrxmega2</code></dt> <dd> +<p>“XMEGA” devices with more than 8 KiB and up to 64 KiB of program memory. <var class="var">mcu</var> = <code class="code">atxmega8e5</code>, <code class="code">atxmega16a4</code>, <code class="code">atxmega16a4u</code>, <code class="code">atxmega16c4</code>, <code class="code">atxmega16d4</code>, <code class="code">atxmega16e5</code>, <code class="code">atxmega32a4</code>, <code class="code">atxmega32a4u</code>, <code class="code">atxmega32c3</code>, <code class="code">atxmega32c4</code>, <code class="code">atxmega32d3</code>, <code class="code">atxmega32d4</code>, <code class="code">atxmega32e5</code>, <code class="code">avr64da28</code>, <code class="code">avr64da32</code>, <code class="code">avr64da48</code>, <code class="code">avr64da64</code>, <code class="code">avr64db28</code>, <code class="code">avr64db32</code>, <code class="code">avr64db48</code>, <code class="code">avr64db64</code>. </p> </dd> <dt><code class="code">avrxmega3</code></dt> <dd> +<p>“XMEGA” devices with up to 64 KiB of combined program memory and RAM, and with program memory visible in the RAM address space. <var class="var">mcu</var> = <code class="code">attiny202</code>, <code class="code">attiny204</code>, <code class="code">attiny212</code>, <code class="code">attiny214</code>, <code class="code">attiny402</code>, <code class="code">attiny404</code>, <code class="code">attiny406</code>, <code class="code">attiny412</code>, <code class="code">attiny414</code>, <code class="code">attiny416</code>, <code class="code">attiny417</code>, <code class="code">attiny804</code>, <code class="code">attiny806</code>, <code class="code">attiny807</code>, <code class="code">attiny814</code>, <code class="code">attiny816</code>, <code class="code">attiny817</code>, <code class="code">attiny1604</code>, <code class="code">attiny1606</code>, <code class="code">attiny1607</code>, <code class="code">attiny1614</code>, <code class="code">attiny1616</code>, <code class="code">attiny1617</code>, <code class="code">attiny3214</code>, <code class="code">attiny3216</code>, <code class="code">attiny3217</code>, <code class="code">atmega808</code>, <code class="code">atmega809</code>, <code class="code">atmega1608</code>, <code class="code">atmega1609</code>, <code class="code">atmega3208</code>, <code class="code">atmega3209</code>, <code class="code">atmega4808</code>, <code class="code">atmega4809</code>, <code class="code">avr32da28</code>, <code class="code">avr32da32</code>, <code class="code">avr32da48</code>, <code class="code">avr32db28</code>, <code class="code">avr32db32</code>, <code class="code">avr32db48</code>. </p> </dd> <dt><code class="code">avrxmega4</code></dt> <dd> +<p>“XMEGA” devices with more than 64 KiB and up to 128 KiB of program memory. <var class="var">mcu</var> = <code class="code">atxmega64a3</code>, <code class="code">atxmega64a3u</code>, <code class="code">atxmega64a4u</code>, <code class="code">atxmega64b1</code>, <code class="code">atxmega64b3</code>, <code class="code">atxmega64c3</code>, <code class="code">atxmega64d3</code>, <code class="code">atxmega64d4</code>, <code class="code">avr128da28</code>, <code class="code">avr128da32</code>, <code class="code">avr128da48</code>, <code class="code">avr128da64</code>, <code class="code">avr128db28</code>, <code class="code">avr128db32</code>, <code class="code">avr128db48</code>, <code class="code">avr128db64</code>. </p> </dd> <dt><code class="code">avrxmega5</code></dt> <dd> +<p>“XMEGA” devices with more than 64 KiB and up to 128 KiB of program memory and more than 64 KiB of RAM. <var class="var">mcu</var> = <code class="code">atxmega64a1</code>, <code class="code">atxmega64a1u</code>. </p> </dd> <dt><code class="code">avrxmega6</code></dt> <dd> +<p>“XMEGA” devices with more than 128 KiB of program memory. <var class="var">mcu</var> = <code class="code">atxmega128a3</code>, <code class="code">atxmega128a3u</code>, <code class="code">atxmega128b1</code>, <code class="code">atxmega128b3</code>, <code class="code">atxmega128c3</code>, <code class="code">atxmega128d3</code>, <code class="code">atxmega128d4</code>, <code class="code">atxmega192a3</code>, <code class="code">atxmega192a3u</code>, <code class="code">atxmega192c3</code>, <code class="code">atxmega192d3</code>, <code class="code">atxmega256a3</code>, <code class="code">atxmega256a3b</code>, <code class="code">atxmega256a3bu</code>, <code class="code">atxmega256a3u</code>, <code class="code">atxmega256c3</code>, <code class="code">atxmega256d3</code>, <code class="code">atxmega384c3</code>, <code class="code">atxmega384d3</code>. </p> </dd> <dt><code class="code">avrxmega7</code></dt> <dd> +<p>“XMEGA” devices with more than 128 KiB of program memory and more than 64 KiB of RAM. <var class="var">mcu</var> = <code class="code">atxmega128a1</code>, <code class="code">atxmega128a1u</code>, <code class="code">atxmega128a4u</code>. </p> </dd> <dt><code class="code">avrtiny</code></dt> <dd> +<p>“TINY” Tiny core devices with 512 B up to 4 KiB of program memory. <var class="var">mcu</var> = <code class="code">attiny4</code>, <code class="code">attiny5</code>, <code class="code">attiny9</code>, <code class="code">attiny10</code>, <code class="code">attiny20</code>, <code class="code">attiny40</code>. </p> </dd> <dt><code class="code">avr1</code></dt> <dd> +<p>This ISA is implemented by the minimal AVR core and supported for assembler only. <var class="var">mcu</var> = <code class="code">attiny11</code>, <code class="code">attiny12</code>, <code class="code">attiny15</code>, <code class="code">attiny28</code>, <code class="code">at90s1200</code>. </p> </dd> </dl> </dd> <dt> +<span><code class="code">-mabsdata</code><a class="copiable-link" href="#index-mabsdata"> ¶</a></span> +</dt> <dd> <p>Assume that all data in static storage can be accessed by LDS / STS instructions. This option has only an effect on reduced Tiny devices like ATtiny40. See also the <code class="code">absdata</code> <a class="ref" href="variable-attributes">variable attribute</a>. </p> </dd> <dt> +<span><code class="code">-maccumulate-args</code><a class="copiable-link" href="#index-maccumulate-args"> ¶</a></span> +</dt> <dd> +<p>Accumulate outgoing function arguments and acquire/release the needed stack space for outgoing function arguments once in function prologue/epilogue. Without this option, outgoing arguments are pushed before calling a function and popped afterwards. </p> <p>Popping the arguments after the function call can be expensive on AVR so that accumulating the stack space might lead to smaller executables because arguments need not be removed from the stack after such a function call. </p> <p>This option can lead to reduced code size for functions that perform several calls to functions that get their arguments on the stack like calls to printf-like functions. </p> </dd> <dt> +<span><code class="code">-mbranch-cost=<var class="var">cost</var></code><a class="copiable-link" href="#index-mbranch-cost-1"> ¶</a></span> +</dt> <dd> +<p>Set the branch costs for conditional branch instructions to <var class="var">cost</var>. Reasonable values for <var class="var">cost</var> are small, non-negative integers. The default branch cost is 0. </p> </dd> <dt> +<span><code class="code">-mcall-prologues</code><a class="copiable-link" href="#index-mcall-prologues"> ¶</a></span> +</dt> <dd> +<p>Functions prologues/epilogues are expanded as calls to appropriate subroutines. Code size is smaller. </p> </dd> <dt> + <span><code class="code">-mdouble=<var class="var">bits</var></code><a class="copiable-link" href="#index-mdouble"> ¶</a></span> +</dt> <dt><code class="code">-mlong-double=<var class="var">bits</var></code></dt> <dd> +<p>Set the size (in bits) of the <code class="code">double</code> or <code class="code">long double</code> type, respectively. Possible values for <var class="var">bits</var> are 32 and 64. Whether or not a specific value for <var class="var">bits</var> is allowed depends on the <code class="code">--with-double=</code> and <code class="code">--with-long-double=</code> <a class="uref" href="https://gcc.gnu.org/install/configure.html#avr">configure options</a>, and the same applies for the default values of the options. </p> </dd> <dt> +<span><code class="code">-mgas-isr-prologues</code><a class="copiable-link" href="#index-mgas-isr-prologues"> ¶</a></span> +</dt> <dd> +<p>Interrupt service routines (ISRs) may use the <code class="code">__gcc_isr</code> pseudo instruction supported by GNU Binutils. If this option is on, the feature can still be disabled for individual ISRs by means of the <a class="ref" href="avr-function-attributes"><code class="code">no_gccisr</code></a> function attribute. This feature is activated per default if optimization is on (but not with <samp class="option">-Og</samp>, see <a class="pxref" href="optimize-options">Options That Control Optimization</a>), and if GNU Binutils support <a class="uref" href="https://sourceware.org/PR21683">PR21683</a>. </p> </dd> <dt> +<span><code class="code">-mint8</code><a class="copiable-link" href="#index-mint8"> ¶</a></span> +</dt> <dd> +<p>Assume <code class="code">int</code> to be 8-bit integer. This affects the sizes of all types: a <code class="code">char</code> is 1 byte, an <code class="code">int</code> is 1 byte, a <code class="code">long</code> is 2 bytes, and <code class="code">long long</code> is 4 bytes. Please note that this option does not conform to the C standards, but it results in smaller code size. </p> </dd> <dt> +<span><code class="code">-mmain-is-OS_task</code><a class="copiable-link" href="#index-mmain-is-OS_005ftask"> ¶</a></span> +</dt> <dd> +<p>Do not save registers in <code class="code">main</code>. The effect is the same like attaching attribute <a class="ref" href="avr-function-attributes"><code class="code">OS_task</code></a> to <code class="code">main</code>. It is activated per default if optimization is on. </p> </dd> <dt> +<span><code class="code">-mn-flash=<var class="var">num</var></code><a class="copiable-link" href="#index-mn-flash"> ¶</a></span> +</dt> <dd> +<p>Assume that the flash memory has a size of <var class="var">num</var> times 64 KiB. </p> </dd> <dt> +<span><code class="code">-mno-interrupts</code><a class="copiable-link" href="#index-mno-interrupts"> ¶</a></span> +</dt> <dd> +<p>Generated code is not compatible with hardware interrupts. Code size is smaller. </p> </dd> <dt> +<span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax"> ¶</a></span> +</dt> <dd> +<p>Try to replace <code class="code">CALL</code> resp. <code class="code">JMP</code> instruction by the shorter <code class="code">RCALL</code> resp. <code class="code">RJMP</code> instruction if applicable. Setting <samp class="option">-mrelax</samp> just adds the <samp class="option">--mlink-relax</samp> option to the assembler’s command line and the <samp class="option">--relax</samp> option to the linker’s command line. </p> <p>Jump relaxing is performed by the linker because jump offsets are not known before code is located. Therefore, the assembler code generated by the compiler is the same, but the instructions in the executable may differ from instructions in the assembler code. </p> <p>Relaxing must be turned on if linker stubs are needed, see the section on <code class="code">EIND</code> and linker stubs below. </p> </dd> <dt> +<span><code class="code">-mrmw</code><a class="copiable-link" href="#index-mrmw"> ¶</a></span> +</dt> <dd> +<p>Assume that the device supports the Read-Modify-Write instructions <code class="code">XCH</code>, <code class="code">LAC</code>, <code class="code">LAS</code> and <code class="code">LAT</code>. </p> </dd> <dt> +<span><code class="code">-mshort-calls</code><a class="copiable-link" href="#index-mshort-calls"> ¶</a></span> +</dt> <dd> <p>Assume that <code class="code">RJMP</code> and <code class="code">RCALL</code> can target the whole program memory. </p> <p>This option is used internally for multilib selection. It is not an optimization option, and you don’t need to set it by hand. </p> </dd> <dt> +<span><code class="code">-msp8</code><a class="copiable-link" href="#index-msp8"> ¶</a></span> +</dt> <dd> +<p>Treat the stack pointer register as an 8-bit register, i.e. assume the high byte of the stack pointer is zero. In general, you don’t need to set this option by hand. </p> <p>This option is used internally by the compiler to select and build multilibs for architectures <code class="code">avr2</code> and <code class="code">avr25</code>. These architectures mix devices with and without <code class="code">SPH</code>. For any setting other than <samp class="option">-mmcu=avr2</samp> or <samp class="option">-mmcu=avr25</samp> the compiler driver adds or removes this option from the compiler proper’s command line, because the compiler then knows if the device or architecture has an 8-bit stack pointer and thus no <code class="code">SPH</code> register or not. </p> </dd> <dt> +<span><code class="code">-mstrict-X</code><a class="copiable-link" href="#index-mstrict-X"> ¶</a></span> +</dt> <dd> +<p>Use address register <code class="code">X</code> in a way proposed by the hardware. This means that <code class="code">X</code> is only used in indirect, post-increment or pre-decrement addressing. </p> <p>Without this option, the <code class="code">X</code> register may be used in the same way as <code class="code">Y</code> or <code class="code">Z</code> which then is emulated by additional instructions. For example, loading a value with <code class="code">X+const</code> addressing with a small non-negative <code class="code">const < 64</code> to a register <var class="var">Rn</var> is performed as </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">adiw r26, const ; X += const +ld <var class="var">Rn</var>, X ; <var class="var">Rn</var> = *X +sbiw r26, const ; X -= const</pre> +</div> </dd> <dt> +<span><code class="code">-mtiny-stack</code><a class="copiable-link" href="#index-mtiny-stack"> ¶</a></span> +</dt> <dd> +<p>Only change the lower 8 bits of the stack pointer. </p> </dd> <dt> +<span><code class="code">-mfract-convert-truncate</code><a class="copiable-link" href="#index-mfract-convert-truncate"> ¶</a></span> +</dt> <dd> +<p>Allow to use truncation instead of rounding towards zero for fractional fixed-point types. </p> </dd> <dt> +<span><code class="code">-nodevicelib</code><a class="copiable-link" href="#index-nodevicelib"> ¶</a></span> +</dt> <dd> +<p>Don’t link against AVR-LibC’s device specific library <code class="code">lib<mcu>.a</code>. </p> </dd> <dt> +<span><code class="code">-nodevicespecs</code><a class="copiable-link" href="#index-nodevicespecs"> ¶</a></span> +</dt> <dd> +<p>Don’t add <samp class="option">-specs=device-specs/specs-<var class="var">mcu</var></samp> to the compiler driver’s command line. The user takes responsibility for supplying the sub-processes like compiler proper, assembler and linker with appropriate command line options. This means that the user has to supply her private device specs file by means of <samp class="option">-specs=<var class="var">path-to-specs-file</var></samp>. There is no more need for option <samp class="option">-mmcu=<var class="var">mcu</var></samp>. </p> <p>This option can also serve as a replacement for the older way of specifying custom device-specs files that needed <samp class="option">-B <var class="var">some-path</var></samp> to point to a directory which contains a folder named <code class="code">device-specs</code> which contains a specs file named <code class="code">specs-<var class="var">mcu</var></code>, where <var class="var">mcu</var> was specified by <samp class="option">-mmcu=<var class="var">mcu</var></samp>. </p> </dd> <dt> + <span><code class="code">-Waddr-space-convert</code><a class="copiable-link" href="#index-Waddr-space-convert"> ¶</a></span> +</dt> <dd> +<p>Warn about conversions between address spaces in the case where the resulting address space is not contained in the incoming address space. </p> </dd> <dt> + <span><code class="code">-Wmisspelled-isr</code><a class="copiable-link" href="#index-Wmisspelled-isr"> ¶</a></span> +</dt> <dd><p>Warn if the ISR is misspelled, i.e. without __vector prefix. Enabled by default. </p></dd> </dl> <ul class="mini-toc"> <li><a href="#EIND-and-Devices-with-More-Than-128-Ki-Bytes-of-Flash" accesskey="1"><code class="code">EIND</code> and Devices with More Than 128 Ki Bytes of Flash</a></li> <li><a href="#Handling-of-the-RAMPD_002c-RAMPX_002c-RAMPY-and-RAMPZ-Special-Function-Registers" accesskey="2">Handling of the <code class="code">RAMPD</code>, <code class="code">RAMPX</code>, <code class="code">RAMPY</code> and <code class="code">RAMPZ</code> Special Function Registers</a></li> <li><a href="#AVR-Built-in-Macros" accesskey="3">AVR Built-in Macros</a></li> </ul> <div class="subsubsection-level-extent" id="EIND-and-Devices-with-More-Than-128-Ki-Bytes-of-Flash"> <h1 class="subsubsection"><span>3.19.6.1 EIND and Devices with More Than 128 Ki Bytes of Flash<a class="copiable-link" href="#EIND-and-Devices-with-More-Than-128-Ki-Bytes-of-Flash"> ¶</a></span></h1> <p>Pointers in the implementation are 16 bits wide. The address of a function or label is represented as word address so that indirect jumps and calls can target any code address in the range of 64 Ki words. </p> <p>In order to facilitate indirect jump on devices with more than 128 Ki bytes of program memory space, there is a special function register called <code class="code">EIND</code> that serves as most significant part of the target address when <code class="code">EICALL</code> or <code class="code">EIJMP</code> instructions are used. </p> <p>Indirect jumps and calls on these devices are handled as follows by the compiler and are subject to some limitations: </p> <ul class="itemize mark-bullet"> <li>The compiler never sets <code class="code">EIND</code>. </li> +<li>The compiler uses <code class="code">EIND</code> implicitly in <code class="code">EICALL</code>/<code class="code">EIJMP</code> instructions or might read <code class="code">EIND</code> directly in order to emulate an indirect call/jump by means of a <code class="code">RET</code> instruction. </li> +<li>The compiler assumes that <code class="code">EIND</code> never changes during the startup code or during the application. In particular, <code class="code">EIND</code> is not saved/restored in function or interrupt service routine prologue/epilogue. </li> +<li>For indirect calls to functions and computed goto, the linker generates <em class="emph">stubs</em>. Stubs are jump pads sometimes also called <em class="emph">trampolines</em>. Thus, the indirect call/jump jumps to such a stub. The stub contains a direct jump to the desired address. </li> +<li>Linker relaxation must be turned on so that the linker generates the stubs correctly in all situations. See the compiler option <samp class="option">-mrelax</samp> and the linker option <samp class="option">--relax</samp>. There are corner cases where the linker is supposed to generate stubs but aborts without relaxation and without a helpful error message. </li> +<li>The default linker script is arranged for code with <code class="code">EIND = 0</code>. If code is supposed to work for a setup with <code class="code">EIND != 0</code>, a custom linker script has to be used in order to place the sections whose name start with <code class="code">.trampolines</code> into the segment where <code class="code">EIND</code> points to. </li> +<li>The startup code from libgcc never sets <code class="code">EIND</code>. Notice that startup code is a blend of code from libgcc and AVR-LibC. For the impact of AVR-LibC on <code class="code">EIND</code>, see the <a class="uref" href="https://www.nongnu.org/avr-libc/user-manual/">AVR-LibC user manual</a>. </li> +<li>It is legitimate for user-specific startup code to set up <code class="code">EIND</code> early, for example by means of initialization code located in section <code class="code">.init3</code>. Such code runs prior to general startup code that initializes RAM and calls constructors, but after the bit of startup code from AVR-LibC that sets <code class="code">EIND</code> to the segment where the vector table is located. <div class="example"> <pre class="example-preformatted" data-language="cpp">#include <avr/io.h> + +static void +__attribute__((section(".init3"),naked,used,no_instrument_function)) +init3_set_eind (void) +{ + __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t" + "out %i0,r24" :: "n" (&EIND) : "r24","memory"); +}</pre> +</div> <p>The <code class="code">__trampolines_start</code> symbol is defined in the linker script. </p> </li> +<li>Stubs are generated automatically by the linker if the following two conditions are met: <ul class="itemize mark-minus"> <li>The address of a label is taken by means of the <code class="code">gs</code> modifier (short for <em class="emph">generate stubs</em>) like so: <div class="example"> <pre class="example-preformatted" data-language="cpp">LDI r24, lo8(gs(<var class="var">func</var>)) +LDI r25, hi8(gs(<var class="var">func</var>))</pre> +</div> </li> +<li>The final location of that label is in a code segment <em class="emph">outside</em> the segment where the stubs are located. </li> +</ul> </li> +<li>The compiler emits such <code class="code">gs</code> modifiers for code labels in the following situations: <ul class="itemize mark-minus"> <li>Taking address of a function or code label. </li> +<li>Computed goto. </li> +<li>If prologue-save function is used, see <samp class="option">-mcall-prologues</samp> command-line option. </li> +<li>Switch/case dispatch tables. If you do not want such dispatch tables you can specify the <samp class="option">-fno-jump-tables</samp> command-line option. </li> +<li>C and C++ constructors/destructors called during startup/shutdown. </li> +<li>If the tools hit a <code class="code">gs()</code> modifier explained above. </li> +</ul> </li> +<li>Jumping to non-symbolic addresses like so is <em class="emph">not</em> supported: <div class="example"> <pre class="example-preformatted" data-language="cpp">int main (void) +{ + /* Call function at word address 0x2 */ + return ((int(*)(void)) 0x2)(); +}</pre> +</div> <p>Instead, a stub has to be set up, i.e. the function has to be called through a symbol (<code class="code">func_4</code> in the example): </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">int main (void) +{ + extern int func_4 (void); + + /* Call function at byte address 0x4 */ + return func_4(); +}</pre> +</div> <p>and the application be linked with <samp class="option">-Wl,--defsym,func_4=0x4</samp>. Alternatively, <code class="code">func_4</code> can be defined in the linker script. </p> +</li> +</ul> </div> <div class="subsubsection-level-extent" id="Handling-of-the-RAMPD_002c-RAMPX_002c-RAMPY-and-RAMPZ-Special-Function-Registers"> <h1 class="subsubsection"><span>3.19.6.2 Handling of the RAMPD, RAMPX, RAMPY and RAMPZ Special Function Registers<a class="copiable-link" href="#Handling-of-the-RAMPD_002c-RAMPX_002c-RAMPY-and-RAMPZ-Special-Function-Registers"> ¶</a></span></h1> <p>Some AVR devices support memories larger than the 64 KiB range that can be accessed with 16-bit pointers. To access memory locations outside this 64 KiB range, the content of a <code class="code">RAMP</code> register is used as high part of the address: The <code class="code">X</code>, <code class="code">Y</code>, <code class="code">Z</code> address register is concatenated with the <code class="code">RAMPX</code>, <code class="code">RAMPY</code>, <code class="code">RAMPZ</code> special function register, respectively, to get a wide address. Similarly, <code class="code">RAMPD</code> is used together with direct addressing. </p> <ul class="itemize mark-bullet"> <li>The startup code initializes the <code class="code">RAMP</code> special function registers with zero. </li> +<li>If a <a class="ref" href="named-address-spaces#AVR-Named-Address-Spaces">named address space</a> other than generic or <code class="code">__flash</code> is used, then <code class="code">RAMPZ</code> is set as needed before the operation. </li> +<li>If the device supports RAM larger than 64 KiB and the compiler needs to change <code class="code">RAMPZ</code> to accomplish an operation, <code class="code">RAMPZ</code> is reset to zero after the operation. </li> +<li>If the device comes with a specific <code class="code">RAMP</code> register, the ISR prologue/epilogue saves/restores that SFR and initializes it with zero in case the ISR code might (implicitly) use it. </li> +<li>RAM larger than 64 KiB is not supported by GCC for AVR targets. If you use inline assembler to read from locations outside the 16-bit address range and change one of the <code class="code">RAMP</code> registers, you must reset it to zero after the access. </li> +</ul> </div> <div class="subsubsection-level-extent" id="AVR-Built-in-Macros"> <h1 class="subsubsection"><span>3.19.6.3 AVR Built-in Macros<a class="copiable-link" href="#AVR-Built-in-Macros"> ¶</a></span></h1> <p>GCC defines several built-in macros so that the user code can test for the presence or absence of features. Almost any of the following built-in macros are deduced from device capabilities and thus triggered by the <samp class="option">-mmcu=</samp> command-line option. </p> <p>For even more AVR-specific built-in macros see <a class="ref" href="named-address-spaces#AVR-Named-Address-Spaces">AVR Named Address Spaces</a> and <a class="ref" href="avr-built-in-functions">AVR Built-in Functions</a>. </p> <dl class="table"> <dt><code class="code">__AVR_ARCH__</code></dt> <dd> +<p>Build-in macro that resolves to a decimal number that identifies the architecture and depends on the <samp class="option">-mmcu=<var class="var">mcu</var></samp> option. Possible values are: </p> <p><code class="code">2</code>, <code class="code">25</code>, <code class="code">3</code>, <code class="code">31</code>, <code class="code">35</code>, <code class="code">4</code>, <code class="code">5</code>, <code class="code">51</code>, <code class="code">6</code> </p> <p>for <var class="var">mcu</var>=<code class="code">avr2</code>, <code class="code">avr25</code>, <code class="code">avr3</code>, <code class="code">avr31</code>, <code class="code">avr35</code>, <code class="code">avr4</code>, <code class="code">avr5</code>, <code class="code">avr51</code>, <code class="code">avr6</code>, </p> <p>respectively and </p> <p><code class="code">100</code>, <code class="code">102</code>, <code class="code">103</code>, <code class="code">104</code>, <code class="code">105</code>, <code class="code">106</code>, <code class="code">107</code> </p> <p>for <var class="var">mcu</var>=<code class="code">avrtiny</code>, <code class="code">avrxmega2</code>, <code class="code">avrxmega3</code>, <code class="code">avrxmega4</code>, <code class="code">avrxmega5</code>, <code class="code">avrxmega6</code>, <code class="code">avrxmega7</code>, respectively. If <var class="var">mcu</var> specifies a device, this built-in macro is set accordingly. For example, with <samp class="option">-mmcu=atmega8</samp> the macro is defined to <code class="code">4</code>. </p> </dd> <dt><code class="code">__AVR_<var class="var">Device</var>__</code></dt> <dd> +<p>Setting <samp class="option">-mmcu=<var class="var">device</var></samp> defines this built-in macro which reflects the device’s name. For example, <samp class="option">-mmcu=atmega8</samp> defines the built-in macro <code class="code">__AVR_ATmega8__</code>, <samp class="option">-mmcu=attiny261a</samp> defines <code class="code">__AVR_ATtiny261A__</code>, etc. </p> <p>The built-in macros’ names follow the scheme <code class="code">__AVR_<var class="var">Device</var>__</code> where <var class="var">Device</var> is the device name as from the AVR user manual. The difference between <var class="var">Device</var> in the built-in macro and <var class="var">device</var> in <samp class="option">-mmcu=<var class="var">device</var></samp> is that the latter is always lowercase. </p> <p>If <var class="var">device</var> is not a device but only a core architecture like ‘<samp class="samp">avr51</samp>’, this macro is not defined. </p> </dd> <dt><code class="code">__AVR_DEVICE_NAME__</code></dt> <dd> +<p>Setting <samp class="option">-mmcu=<var class="var">device</var></samp> defines this built-in macro to the device’s name. For example, with <samp class="option">-mmcu=atmega8</samp> the macro is defined to <code class="code">atmega8</code>. </p> <p>If <var class="var">device</var> is not a device but only a core architecture like ‘<samp class="samp">avr51</samp>’, this macro is not defined. </p> </dd> <dt><code class="code">__AVR_XMEGA__</code></dt> <dd> +<p>The device / architecture belongs to the XMEGA family of devices. </p> </dd> <dt><code class="code">__AVR_HAVE_ELPM__</code></dt> <dd> +<p>The device has the <code class="code">ELPM</code> instruction. </p> </dd> <dt><code class="code">__AVR_HAVE_ELPMX__</code></dt> <dd> +<p>The device has the <code class="code">ELPM R<var class="var">n</var>,Z</code> and <code class="code">ELPM +R<var class="var">n</var>,Z+</code> instructions. </p> </dd> <dt><code class="code">__AVR_HAVE_MOVW__</code></dt> <dd> +<p>The device has the <code class="code">MOVW</code> instruction to perform 16-bit register-register moves. </p> </dd> <dt><code class="code">__AVR_HAVE_LPMX__</code></dt> <dd> +<p>The device has the <code class="code">LPM R<var class="var">n</var>,Z</code> and <code class="code">LPM R<var class="var">n</var>,Z+</code> instructions. </p> </dd> <dt><code class="code">__AVR_HAVE_MUL__</code></dt> <dd> +<p>The device has a hardware multiplier. </p> </dd> <dt><code class="code">__AVR_HAVE_JMP_CALL__</code></dt> <dd> +<p>The device has the <code class="code">JMP</code> and <code class="code">CALL</code> instructions. This is the case for devices with more than 8 KiB of program memory. </p> </dd> <dt><code class="code">__AVR_HAVE_EIJMP_EICALL__</code></dt> <dt><code class="code">__AVR_3_BYTE_PC__</code></dt> <dd> +<p>The device has the <code class="code">EIJMP</code> and <code class="code">EICALL</code> instructions. This is the case for devices with more than 128 KiB of program memory. This also means that the program counter (PC) is 3 bytes wide. </p> </dd> <dt><code class="code">__AVR_2_BYTE_PC__</code></dt> <dd> +<p>The program counter (PC) is 2 bytes wide. This is the case for devices with up to 128 KiB of program memory. </p> </dd> <dt><code class="code">__AVR_HAVE_8BIT_SP__</code></dt> <dt><code class="code">__AVR_HAVE_16BIT_SP__</code></dt> <dd> +<p>The stack pointer (SP) register is treated as 8-bit respectively 16-bit register by the compiler. The definition of these macros is affected by <samp class="option">-mtiny-stack</samp>. </p> </dd> <dt><code class="code">__AVR_HAVE_SPH__</code></dt> <dt><code class="code">__AVR_SP8__</code></dt> <dd> +<p>The device has the SPH (high part of stack pointer) special function register or has an 8-bit stack pointer, respectively. The definition of these macros is affected by <samp class="option">-mmcu=</samp> and in the cases of <samp class="option">-mmcu=avr2</samp> and <samp class="option">-mmcu=avr25</samp> also by <samp class="option">-msp8</samp>. </p> </dd> <dt><code class="code">__AVR_HAVE_RAMPD__</code></dt> <dt><code class="code">__AVR_HAVE_RAMPX__</code></dt> <dt><code class="code">__AVR_HAVE_RAMPY__</code></dt> <dt><code class="code">__AVR_HAVE_RAMPZ__</code></dt> <dd> +<p>The device has the <code class="code">RAMPD</code>, <code class="code">RAMPX</code>, <code class="code">RAMPY</code>, <code class="code">RAMPZ</code> special function register, respectively. </p> </dd> <dt><code class="code">__NO_INTERRUPTS__</code></dt> <dd> +<p>This macro reflects the <samp class="option">-mno-interrupts</samp> command-line option. </p> </dd> <dt><code class="code">__AVR_ERRATA_SKIP__</code></dt> <dt><code class="code">__AVR_ERRATA_SKIP_JMP_CALL__</code></dt> <dd> +<p>Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit instructions because of a hardware erratum. Skip instructions are <code class="code">SBRS</code>, <code class="code">SBRC</code>, <code class="code">SBIS</code>, <code class="code">SBIC</code> and <code class="code">CPSE</code>. The second macro is only defined if <code class="code">__AVR_HAVE_JMP_CALL__</code> is also set. </p> </dd> <dt><code class="code">__AVR_ISA_RMW__</code></dt> <dd> +<p>The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT). </p> </dd> <dt><code class="code">__AVR_SFR_OFFSET__=<var class="var">offset</var></code></dt> <dd> +<p>Instructions that can address I/O special function registers directly like <code class="code">IN</code>, <code class="code">OUT</code>, <code class="code">SBI</code>, etc. may use a different address as if addressed by an instruction to access RAM like <code class="code">LD</code> or <code class="code">STS</code>. This offset depends on the device architecture and has to be subtracted from the RAM address in order to get the respective I/O address. </p> </dd> <dt><code class="code">__AVR_SHORT_CALLS__</code></dt> <dd> +<p>The <samp class="option">-mshort-calls</samp> command line option is set. </p> </dd> <dt><code class="code">__AVR_PM_BASE_ADDRESS__=<var class="var">addr</var></code></dt> <dd> +<p>Some devices support reading from flash memory by means of <code class="code">LD*</code> instructions. The flash memory is seen in the data address space at an offset of <code class="code">__AVR_PM_BASE_ADDRESS__</code>. If this macro is not defined, this feature is not available. If defined, the address space is linear and there is no need to put <code class="code">.rodata</code> into RAM. This is handled by the default linker description file, and is currently available for <code class="code">avrtiny</code> and <code class="code">avrxmega3</code>. Even more convenient, there is no need to use address spaces like <code class="code">__flash</code> or features like attribute <code class="code">progmem</code> and <code class="code">pgm_read_*</code>. </p> </dd> <dt><code class="code">__WITH_AVRLIBC__</code></dt> <dd> +<p>The compiler is configured to be used together with AVR-Libc. See the <samp class="option">--with-avrlibc</samp> configure option. </p> </dd> <dt><code class="code">__HAVE_DOUBLE_MULTILIB__</code></dt> <dd> +<p>Defined if <samp class="option">-mdouble=</samp> acts as a multilib option. </p> </dd> <dt><code class="code">__HAVE_DOUBLE32__</code></dt> <dt><code class="code">__HAVE_DOUBLE64__</code></dt> <dd> +<p>Defined if the compiler supports 32-bit double resp. 64-bit double. The actual layout is specified by option <samp class="option">-mdouble=</samp>. </p> </dd> <dt><code class="code">__DEFAULT_DOUBLE__</code></dt> <dd> +<p>The size in bits of <code class="code">double</code> if <samp class="option">-mdouble=</samp> is not set. To test the layout of <code class="code">double</code> in a program, use the built-in macro <code class="code">__SIZEOF_DOUBLE__</code>. </p> </dd> <dt><code class="code">__HAVE_LONG_DOUBLE32__</code></dt> <dt><code class="code">__HAVE_LONG_DOUBLE64__</code></dt> <dt><code class="code">__HAVE_LONG_DOUBLE_MULTILIB__</code></dt> <dt><code class="code">__DEFAULT_LONG_DOUBLE__</code></dt> <dd> +<p>Same as above, but for <code class="code">long double</code> instead of <code class="code">double</code>. </p> </dd> <dt><code class="code">__WITH_DOUBLE_COMPARISON__</code></dt> <dd> +<p>Reflects the <code class="code">--with-double-comparison={tristate|bool|libf7}</code> <a class="uref" href="https://gcc.gnu.org/install/configure.html#avr">configure option</a> and is defined to <code class="code">2</code> or <code class="code">3</code>. </p> </dd> <dt><code class="code">__WITH_LIBF7_LIBGCC__</code></dt> <dt><code class="code">__WITH_LIBF7_MATH__</code></dt> <dt><code class="code">__WITH_LIBF7_MATH_SYMBOLS__</code></dt> <dd> +<p>Reflects the <code class="code">--with-libf7={libgcc|math|math-symbols}</code> <a class="uref" href="https://gcc.gnu.org/install/configure.html#avr">configure option</a>. </p> </dd> </dl> </div> </div> <div class="nav-panel"> <p> Next: <a href="blackfin-options">Blackfin Options</a>, Previous: <a href="arm-options">ARM Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AVR-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AVR-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/backwards-compatibility.html b/devdocs/gcc~13/backwards-compatibility.html new file mode 100644 index 00000000..0741dcdd --- /dev/null +++ b/devdocs/gcc~13/backwards-compatibility.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Backwards-Compatibility"> <div class="nav-panel"> <p> Previous: <a href="deprecated-features" accesskey="p" rel="prev">Deprecated Features</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Backwards-Compatibility-1"><span>7.12 Backwards Compatibility<a class="copiable-link" href="#Backwards-Compatibility-1"> ¶</a></span></h1> <p>Now that there is a definitive ISO standard C++, G++ has a specification to adhere to. The C++ language evolved over time, and features that used to be acceptable in previous drafts of the standard, such as the ARM [Annotated C++ Reference Manual], are no longer accepted. In order to allow compilation of C++ written to such drafts, G++ contains some backwards compatibilities. <em class="emph">All such backwards compatibility features are liable to disappear in future versions of G++.</em> They should be considered deprecated. See <a class="xref" href="deprecated-features">Deprecated Features</a>. </p> <dl class="table"> <dt><code class="code">Implicit C language</code></dt> <dd> +<p>Old C system header files did not contain an <code class="code">extern "C" {…}</code> scope to set the language. On such systems, all system header files are implicitly scoped inside a C language scope. Such headers must correctly prototype function argument types, there is no leeway for <code class="code">()</code> to indicate an unspecified set of arguments. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Backwards-Compatibility.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Backwards-Compatibility.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/basic-asm.html b/devdocs/gcc~13/basic-asm.html new file mode 100644 index 00000000..fcb05c6d --- /dev/null +++ b/devdocs/gcc~13/basic-asm.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="Basic-Asm"> <div class="nav-panel"> <p> Next: <a href="extended-asm" accesskey="n" rel="next">Extended Asm - Assembler Instructions with C Expression Operands</a>, Up: <a href="using-assembly-language-with-c" accesskey="u" rel="up">How to Use Inline Assembly Language in C Code</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Basic-Asm-----Assembler-Instructions-Without-Operands"><span>6.47.1 Basic Asm — Assembler Instructions Without Operands<a class="copiable-link" href="#Basic-Asm-----Assembler-Instructions-Without-Operands"> ¶</a></span></h1> <p>A basic <code class="code">asm</code> statement has the following syntax: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">asm <var class="var">asm-qualifiers</var> ( <var class="var">AssemblerInstructions</var> )</pre> +</div> <p>For the C language, the <code class="code">asm</code> keyword is a GNU extension. When writing C code that can be compiled with <samp class="option">-ansi</samp> and the <samp class="option">-std</samp> options that select C dialects without GNU extensions, use <code class="code">__asm__</code> instead of <code class="code">asm</code> (see <a class="pxref" href="alternate-keywords">Alternate Keywords</a>). For the C++ language, <code class="code">asm</code> is a standard keyword, but <code class="code">__asm__</code> can be used for code compiled with <samp class="option">-fno-asm</samp>. </p> <h1 class="subsubheading" id="Qualifiers-1"><span>Qualifiers<a class="copiable-link" href="#Qualifiers-1"> ¶</a></span></h1> <dl class="table"> <dt><code class="code">volatile</code></dt> <dd> +<p>The optional <code class="code">volatile</code> qualifier has no effect. All basic <code class="code">asm</code> blocks are implicitly volatile. </p> </dd> <dt><code class="code">inline</code></dt> <dd><p>If you use the <code class="code">inline</code> qualifier, then for inlining purposes the size of the <code class="code">asm</code> statement is taken as the smallest size possible (see <a class="pxref" href="size-of-an-asm">Size of an <code class="code">asm</code></a>). </p></dd> </dl> <h1 class="subsubheading" id="Parameters"><span>Parameters<a class="copiable-link" href="#Parameters"> ¶</a></span></h1> <dl class="table"> <dt><var class="var">AssemblerInstructions</var></dt> <dd> +<p>This is a literal string that specifies the assembler code. The string can contain any instructions recognized by the assembler, including directives. GCC does not parse the assembler instructions themselves and does not know what they mean or even whether they are valid assembler input. </p> <p>You may place multiple assembler instructions together in a single <code class="code">asm</code> string, separated by the characters normally used in assembly code for the system. A combination that works in most places is a newline to break the line, plus a tab character (written as ‘<samp class="samp">\n\t</samp>’). Some assemblers allow semicolons as a line separator. However, note that some assembler dialects use semicolons to start a comment. </p> +</dd> </dl> <h1 class="subsubheading" id="Remarks"><span>Remarks<a class="copiable-link" href="#Remarks"> ¶</a></span></h1> <p>Using extended <code class="code">asm</code> (see <a class="pxref" href="extended-asm">Extended Asm - Assembler Instructions with C Expression Operands</a>) typically produces smaller, safer, and more efficient code, and in most cases it is a better solution than basic <code class="code">asm</code>. However, there are two situations where only basic <code class="code">asm</code> can be used: </p> <ul class="itemize mark-bullet"> <li>Extended <code class="code">asm</code> statements have to be inside a C function, so to write inline assembly language at file scope (“top-level”), outside of C functions, you must use basic <code class="code">asm</code>. You can use this technique to emit assembler directives, define assembly language macros that can be invoked elsewhere in the file, or write entire functions in assembly language. Basic <code class="code">asm</code> statements outside of functions may not use any qualifiers. </li> +<li>Functions declared with the <code class="code">naked</code> attribute also require basic <code class="code">asm</code> (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </li> +</ul> <p>Safely accessing C data and calling functions from basic <code class="code">asm</code> is more complex than it may appear. To access C data, it is better to use extended <code class="code">asm</code>. </p> <p>Do not expect a sequence of <code class="code">asm</code> statements to remain perfectly consecutive after compilation. If certain instructions need to remain consecutive in the output, put them in a single multi-instruction <code class="code">asm</code> statement. Note that GCC’s optimizers can move <code class="code">asm</code> statements relative to other code, including across jumps. </p> <p><code class="code">asm</code> statements may not perform jumps into other <code class="code">asm</code> statements. GCC does not know about these jumps, and therefore cannot take account of them when deciding how to optimize. Jumps from <code class="code">asm</code> to C labels are only supported in extended <code class="code">asm</code>. </p> <p>Under certain circumstances, GCC may duplicate (or remove duplicates of) your assembly code when optimizing. This can lead to unexpected duplicate symbol errors during compilation if your assembly code defines symbols or labels. </p> <p><strong class="strong">Warning:</strong> The C standards do not specify semantics for <code class="code">asm</code>, making it a potential source of incompatibilities between compilers. These incompatibilities may not produce compiler warnings/errors. </p> <p>GCC does not parse basic <code class="code">asm</code>’s <var class="var">AssemblerInstructions</var>, which means there is no way to communicate to the compiler what is happening inside them. GCC has no visibility of symbols in the <code class="code">asm</code> and may discard them as unreferenced. It also does not know about side effects of the assembler code, such as modifications to memory or registers. Unlike some compilers, GCC assumes that no changes to general purpose registers occur. This assumption may change in a future release. </p> <p>To avoid complications from future changes to the semantics and the compatibility issues between compilers, consider replacing basic <code class="code">asm</code> with extended <code class="code">asm</code>. See <a class="uref" href="https://gcc.gnu.org/wiki/ConvertBasicAsmToExtended">How to convert from basic asm to extended asm</a> for information about how to perform this conversion. </p> <p>The compiler copies the assembler instructions in a basic <code class="code">asm</code> verbatim to the assembly language output file, without processing dialects or any of the ‘<samp class="samp">%</samp>’ operators that are available with extended <code class="code">asm</code>. This results in minor differences between basic <code class="code">asm</code> strings and extended <code class="code">asm</code> templates. For example, to refer to registers you might use ‘<samp class="samp">%eax</samp>’ in basic <code class="code">asm</code> and ‘<samp class="samp">%%eax</samp>’ in extended <code class="code">asm</code>. </p> <p>On targets such as x86 that support multiple assembler dialects, all basic <code class="code">asm</code> blocks use the assembler dialect specified by the <samp class="option">-masm</samp> command-line option (see <a class="pxref" href="x86-options">x86 Options</a>). Basic <code class="code">asm</code> provides no mechanism to provide different assembler strings for different dialects. </p> <p>For basic <code class="code">asm</code> with non-empty assembler string GCC assumes the assembler block does not change any general purpose registers, but it may read or write any globally accessible variable. </p> <p>Here is an example of basic <code class="code">asm</code> for i386: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">/* Note that this code will not compile with -masm=intel */ +#define DebugBreak() asm("int $3")</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="extended-asm">Extended Asm - Assembler Instructions with C Expression Operands</a>, Up: <a href="using-assembly-language-with-c">How to Use Inline Assembly Language in C Code</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-Asm.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-Asm.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-all-configurations.html b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-all-configurations.html new file mode 100644 index 00000000..e1422c9d --- /dev/null +++ b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-all-configurations.html @@ -0,0 +1,49 @@ +<div class="subsubsection-level-extent" id="Basic-PowerPC-Built-in-Functions-Available-on-all-Configurations"> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions-available-on-isa-2_002e05" accesskey="n" rel="next">Basic PowerPC Built-in Functions Available on ISA 2.05</a>, Up: <a href="basic-powerpc-built-in-functions" accesskey="u" rel="up">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Basic-PowerPC-Built-in-Functions-Available-on-all-Configurations-1"><span>6.60.22.1 Basic PowerPC Built-in Functions Available on all Configurations<a class="copiable-link" href="#Basic-PowerPC-Built-in-Functions-Available-on-all-Configurations-1"> ¶</a></span></h1> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcpu_005finit"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_cpu_init</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcpu_005finit"> ¶</a></span> +</dt> <dd><p>This function is a <code class="code">nop</code> on the PowerPC platform and is included solely to maintain API compatibility with the x86 builtins. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcpu_005fis"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_cpu_is</strong> <code class="def-code-arguments">(const char *<var class="var">cpuname</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcpu_005fis"> ¶</a></span> +</dt> <dd> +<p>This function returns a value of <code class="code">1</code> if the run-time CPU is of type <var class="var">cpuname</var> and returns <code class="code">0</code> otherwise </p> <p>The <code class="code">__builtin_cpu_is</code> function requires GLIBC 2.23 or newer which exports the hardware capability bits. GCC defines the macro <code class="code">__BUILTIN_CPU_SUPPORTS__</code> if the <code class="code">__builtin_cpu_supports</code> built-in function is fully supported. </p> <p>If GCC was configured to use a GLIBC before 2.23, the built-in function <code class="code">__builtin_cpu_is</code> always returns a 0 and the compiler issues a warning. </p> <p>The following CPU names can be detected: </p> <dl class="table"> <dt>‘<samp class="samp">power10</samp>’</dt> <dd><p>IBM POWER10 Server CPU. </p></dd> <dt>‘<samp class="samp">power9</samp>’</dt> <dd><p>IBM POWER9 Server CPU. </p></dd> <dt>‘<samp class="samp">power8</samp>’</dt> <dd><p>IBM POWER8 Server CPU. </p></dd> <dt>‘<samp class="samp">power7</samp>’</dt> <dd><p>IBM POWER7 Server CPU. </p></dd> <dt>‘<samp class="samp">power6x</samp>’</dt> <dd><p>IBM POWER6 Server CPU (RAW mode). </p></dd> <dt>‘<samp class="samp">power6</samp>’</dt> <dd><p>IBM POWER6 Server CPU (Architected mode). </p></dd> <dt>‘<samp class="samp">power5+</samp>’</dt> <dd><p>IBM POWER5+ Server CPU. </p></dd> <dt>‘<samp class="samp">power5</samp>’</dt> <dd><p>IBM POWER5 Server CPU. </p></dd> <dt>‘<samp class="samp">ppc970</samp>’</dt> <dd><p>IBM 970 Server CPU (ie, Apple G5). </p></dd> <dt>‘<samp class="samp">power4</samp>’</dt> <dd><p>IBM POWER4 Server CPU. </p></dd> <dt>‘<samp class="samp">ppca2</samp>’</dt> <dd><p>IBM A2 64-bit Embedded CPU </p></dd> <dt>‘<samp class="samp">ppc476</samp>’</dt> <dd><p>IBM PowerPC 476FP 32-bit Embedded CPU. </p></dd> <dt>‘<samp class="samp">ppc464</samp>’</dt> <dd><p>IBM PowerPC 464 32-bit Embedded CPU. </p></dd> <dt>‘<samp class="samp">ppc440</samp>’</dt> <dd><p>PowerPC 440 32-bit Embedded CPU. </p></dd> <dt>‘<samp class="samp">ppc405</samp>’</dt> <dd><p>PowerPC 405 32-bit Embedded CPU. </p></dd> <dt>‘<samp class="samp">ppc-cell-be</samp>’</dt> <dd><p>IBM PowerPC Cell Broadband Engine Architecture CPU. </p></dd> </dl> <p>Here is an example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#ifdef __BUILTIN_CPU_SUPPORTS__ + if (__builtin_cpu_is ("power8")) + { + do_power8 (); // POWER8 specific implementation. + } + else +#endif + { + do_generic (); // Generic implementation. + }</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcpu_005fsupports"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_cpu_supports</strong> <code class="def-code-arguments">(const char *<var class="var">feature</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcpu_005fsupports"> ¶</a></span> +</dt> <dd> +<p>This function returns a value of <code class="code">1</code> if the run-time CPU supports the HWCAP feature <var class="var">feature</var> and returns <code class="code">0</code> otherwise. </p> <p>The <code class="code">__builtin_cpu_supports</code> function requires GLIBC 2.23 or newer which exports the hardware capability bits. GCC defines the macro <code class="code">__BUILTIN_CPU_SUPPORTS__</code> if the <code class="code">__builtin_cpu_supports</code> built-in function is fully supported. </p> <p>If GCC was configured to use a GLIBC before 2.23, the built-in function <code class="code">__builtin_cpu_supports</code> always returns a 0 and the compiler issues a warning. </p> <p>The following features can be detected: </p> <dl class="table"> <dt>‘<samp class="samp">4xxmac</samp>’</dt> <dd><p>4xx CPU has a Multiply Accumulator. </p></dd> <dt>‘<samp class="samp">altivec</samp>’</dt> <dd><p>CPU has a SIMD/Vector Unit. </p></dd> <dt>‘<samp class="samp">arch_2_05</samp>’</dt> <dd><p>CPU supports ISA 2.05 (eg, POWER6) </p></dd> <dt>‘<samp class="samp">arch_2_06</samp>’</dt> <dd><p>CPU supports ISA 2.06 (eg, POWER7) </p></dd> <dt>‘<samp class="samp">arch_2_07</samp>’</dt> <dd><p>CPU supports ISA 2.07 (eg, POWER8) </p></dd> <dt>‘<samp class="samp">arch_3_00</samp>’</dt> <dd><p>CPU supports ISA 3.0 (eg, POWER9) </p></dd> <dt>‘<samp class="samp">arch_3_1</samp>’</dt> <dd><p>CPU supports ISA 3.1 (eg, POWER10) </p></dd> <dt>‘<samp class="samp">archpmu</samp>’</dt> <dd><p>CPU supports the set of compatible performance monitoring events. </p></dd> <dt>‘<samp class="samp">booke</samp>’</dt> <dd><p>CPU supports the Embedded ISA category. </p></dd> <dt>‘<samp class="samp">cellbe</samp>’</dt> <dd><p>CPU has a CELL broadband engine. </p></dd> <dt>‘<samp class="samp">darn</samp>’</dt> <dd><p>CPU supports the <code class="code">darn</code> (deliver a random number) instruction. </p></dd> <dt>‘<samp class="samp">dfp</samp>’</dt> <dd><p>CPU has a decimal floating point unit. </p></dd> <dt>‘<samp class="samp">dscr</samp>’</dt> <dd><p>CPU supports the data stream control register. </p></dd> <dt>‘<samp class="samp">ebb</samp>’</dt> <dd><p>CPU supports event base branching. </p></dd> <dt>‘<samp class="samp">efpdouble</samp>’</dt> <dd><p>CPU has a SPE double precision floating point unit. </p></dd> <dt>‘<samp class="samp">efpsingle</samp>’</dt> <dd><p>CPU has a SPE single precision floating point unit. </p></dd> <dt>‘<samp class="samp">fpu</samp>’</dt> <dd><p>CPU has a floating point unit. </p></dd> <dt>‘<samp class="samp">htm</samp>’</dt> <dd><p>CPU has hardware transaction memory instructions. </p></dd> <dt>‘<samp class="samp">htm-nosc</samp>’</dt> <dd><p>Kernel aborts hardware transactions when a syscall is made. </p></dd> <dt>‘<samp class="samp">htm-no-suspend</samp>’</dt> <dd><p>CPU supports hardware transaction memory but does not support the <code class="code">tsuspend.</code> instruction. </p></dd> <dt>‘<samp class="samp">ic_snoop</samp>’</dt> <dd><p>CPU supports icache snooping capabilities. </p></dd> <dt>‘<samp class="samp">ieee128</samp>’</dt> <dd><p>CPU supports 128-bit IEEE binary floating point instructions. </p></dd> <dt>‘<samp class="samp">isel</samp>’</dt> <dd><p>CPU supports the integer select instruction. </p></dd> <dt>‘<samp class="samp">mma</samp>’</dt> <dd><p>CPU supports the matrix-multiply assist instructions. </p></dd> <dt>‘<samp class="samp">mmu</samp>’</dt> <dd><p>CPU has a memory management unit. </p></dd> <dt>‘<samp class="samp">notb</samp>’</dt> <dd><p>CPU does not have a timebase (eg, 601 and 403gx). </p></dd> <dt>‘<samp class="samp">pa6t</samp>’</dt> <dd><p>CPU supports the PA Semi 6T CORE ISA. </p></dd> <dt>‘<samp class="samp">power4</samp>’</dt> <dd><p>CPU supports ISA 2.00 (eg, POWER4) </p></dd> <dt>‘<samp class="samp">power5</samp>’</dt> <dd><p>CPU supports ISA 2.02 (eg, POWER5) </p></dd> <dt>‘<samp class="samp">power5+</samp>’</dt> <dd><p>CPU supports ISA 2.03 (eg, POWER5+) </p></dd> <dt>‘<samp class="samp">power6x</samp>’</dt> <dd><p>CPU supports ISA 2.05 (eg, POWER6) extended opcodes mffgpr and mftgpr. </p></dd> <dt>‘<samp class="samp">ppc32</samp>’</dt> <dd><p>CPU supports 32-bit mode execution. </p></dd> <dt>‘<samp class="samp">ppc601</samp>’</dt> <dd><p>CPU supports the old POWER ISA (eg, 601) </p></dd> <dt>‘<samp class="samp">ppc64</samp>’</dt> <dd><p>CPU supports 64-bit mode execution. </p></dd> <dt>‘<samp class="samp">ppcle</samp>’</dt> <dd><p>CPU supports a little-endian mode that uses address swizzling. </p></dd> <dt>‘<samp class="samp">scv</samp>’</dt> <dd><p>Kernel supports system call vectored. </p></dd> <dt>‘<samp class="samp">smt</samp>’</dt> <dd><p>CPU support simultaneous multi-threading. </p></dd> <dt>‘<samp class="samp">spe</samp>’</dt> <dd><p>CPU has a signal processing extension unit. </p></dd> <dt>‘<samp class="samp">tar</samp>’</dt> <dd><p>CPU supports the target address register. </p></dd> <dt>‘<samp class="samp">true_le</samp>’</dt> <dd><p>CPU supports true little-endian mode. </p></dd> <dt>‘<samp class="samp">ucache</samp>’</dt> <dd><p>CPU has unified I/D cache. </p></dd> <dt>‘<samp class="samp">vcrypto</samp>’</dt> <dd><p>CPU supports the vector cryptography instructions. </p></dd> <dt>‘<samp class="samp">vsx</samp>’</dt> <dd><p>CPU supports the vector-scalar extension. </p></dd> </dl> <p>Here is an example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#ifdef __BUILTIN_CPU_SUPPORTS__ + if (__builtin_cpu_supports ("fpu")) + { + asm("fadd %0,%1,%2" : "=d"(dst) : "d"(src1), "d"(src2)); + } + else +#endif + { + dst = __fadd (src1, src2); // Software FP addition function. + }</pre> +</div> </dd> +</dl> <p>The following built-in functions are also available on all PowerPC processors: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">uint64_t __builtin_ppc_get_timebase (); +unsigned long __builtin_ppc_mftb (); +double __builtin_unpack_ibm128 (__ibm128, int); +__ibm128 __builtin_pack_ibm128 (double, double); +double __builtin_mffs (void); +void __builtin_mtfsf (const int, double); +void __builtin_mtfsb0 (const int); +void __builtin_mtfsb1 (const int); +void __builtin_set_fpscr_rn (int);</pre> +</div> <p>The <code class="code">__builtin_ppc_get_timebase</code> and <code class="code">__builtin_ppc_mftb</code> functions generate instructions to read the Time Base Register. The <code class="code">__builtin_ppc_get_timebase</code> function may generate multiple instructions and always returns the 64 bits of the Time Base Register. The <code class="code">__builtin_ppc_mftb</code> function always generates one instruction and returns the Time Base Register value as an unsigned long, throwing away the most significant word on 32-bit environments. The <code class="code">__builtin_mffs</code> return the value of the FPSCR register. Note, ISA 3.0 supports the <code class="code">__builtin_mffsl()</code> which permits software to read the control and non-sticky status bits in the FSPCR without the higher latency associated with accessing the sticky status bits. The <code class="code">__builtin_mtfsf</code> takes a constant 8-bit integer field mask and a double precision floating point argument and generates the <code class="code">mtfsf</code> (extended mnemonic) instruction to write new values to selected fields of the FPSCR. The <code class="code">__builtin_mtfsb0</code> and <code class="code">__builtin_mtfsb1</code> take the bit to change as an argument. The valid bit range is between 0 and 31. The builtins map to the <code class="code">mtfsb0</code> and <code class="code">mtfsb1</code> instructions which take the argument and add 32. Hence these instructions only modify the FPSCR[32:63] bits by changing the specified bit to a zero or one respectively. The <code class="code">__builtin_set_fpscr_rn</code> builtin allows changing both of the floating point rounding mode bits. The argument is a 2-bit value. The argument can either be a <code class="code">const int</code> or stored in a variable. The builtin uses the ISA 3.0 instruction <code class="code">mffscrn</code> if available, otherwise it reads the FPSCR, masks the current rounding mode bits out and OR’s in the new value. </p> </div> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions-available-on-isa-2_002e05">Basic PowerPC Built-in Functions Available on ISA 2.05</a>, Up: <a href="basic-powerpc-built-in-functions">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-all-Configurations.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-all-Configurations.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-2_002e05.html b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-2_002e05.html new file mode 100644 index 00000000..304d8f8b --- /dev/null +++ b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-2_002e05.html @@ -0,0 +1,37 @@ +<div class="subsubsection-level-extent" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e05"> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions-available-on-isa-2_002e06" accesskey="n" rel="next">Basic PowerPC Built-in Functions Available on ISA 2.06</a>, Previous: <a href="basic-powerpc-built-in-functions-available-on-all-configurations" accesskey="p" rel="prev">Basic PowerPC Built-in Functions Available on all Configurations</a>, Up: <a href="basic-powerpc-built-in-functions" accesskey="u" rel="up">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e05-1"><span>6.60.22.2 Basic PowerPC Built-in Functions Available on ISA 2.05<a class="copiable-link" href="#Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e05-1"> ¶</a></span></h1> <p>The basic built-in functions described in this section are available on the PowerPC family of processors starting with ISA 2.05 or later. Unless specific options are explicitly disabled on the command line, specifying option <samp class="option">-mcpu=power6</samp> has the effect of enabling the <samp class="option">-mpowerpc64</samp>, <samp class="option">-mpowerpc-gpopt</samp>, <samp class="option">-mpowerpc-gfxopt</samp>, <samp class="option">-mmfcrf</samp>, <samp class="option">-mpopcntb</samp>, <samp class="option">-mfprnd</samp>, <samp class="option">-mcmpb</samp>, <samp class="option">-mhard-dfp</samp>, and <samp class="option">-mrecip-precision</samp> options. Specify the <samp class="option">-maltivec</samp> option explicitly in combination with the above options if desired. </p> <p>The following functions require option <samp class="option">-mcmpb</samp>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned long long __builtin_cmpb (unsigned long long int, unsigned long long int); +unsigned int __builtin_cmpb (unsigned int, unsigned int);</pre> +</div> <p>The <code class="code">__builtin_cmpb</code> function performs a byte-wise compare on the contents of its two arguments, returning the result of the byte-wise comparison as the returned value. For each byte comparison, the corresponding byte of the return value holds 0xff if the input bytes are equal and 0 if the input bytes are not equal. If either of the arguments to this built-in function is wider than 32 bits, the function call expands into the form that expects <code class="code">unsigned long long int</code> arguments which is only available on 64-bit targets. </p> <p>The following built-in functions are available when hardware decimal floating point (<samp class="option">-mhard-dfp</samp>) is available: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_set_fpscr_drn(int); +_Decimal64 __builtin_ddedpd (int, _Decimal64); +_Decimal128 __builtin_ddedpdq (int, _Decimal128); +_Decimal64 __builtin_denbcd (int, _Decimal64); +_Decimal128 __builtin_denbcdq (int, _Decimal128); +_Decimal64 __builtin_diex (long long, _Decimal64); +_Decimal128 _builtin_diexq (long long, _Decimal128); +_Decimal64 __builtin_dscli (_Decimal64, int); +_Decimal128 __builtin_dscliq (_Decimal128, int); +_Decimal64 __builtin_dscri (_Decimal64, int); +_Decimal128 __builtin_dscriq (_Decimal128, int); +long long __builtin_dxex (_Decimal64); +long long __builtin_dxexq (_Decimal128); +_Decimal128 __builtin_pack_dec128 (unsigned long long, unsigned long long); +unsigned long long __builtin_unpack_dec128 (_Decimal128, int); + +The <code class="code">__builtin_set_fpscr_drn</code> builtin allows changing the three decimal +floating point rounding mode bits. The argument is a 3-bit value. The +argument can either be a <code class="code">const int</code> or the value can be stored in +a variable. +The builtin uses the ISA 3.0 instruction <code class="code">mffscdrn</code> if available. +Otherwise the builtin reads the FPSCR, masks the current decimal rounding +mode bits out and OR's in the new value.</pre> +</div> <p>The following functions require <samp class="option">-mhard-float</samp>, <samp class="option">-mpowerpc-gfxopt</samp>, and <samp class="option">-mpopcntb</samp> options. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">double __builtin_recipdiv (double, double); +float __builtin_recipdivf (float, float); +double __builtin_rsqrt (double); +float __builtin_rsqrtf (float);</pre> +</div> <p>The <code class="code">vec_rsqrt</code>, <code class="code">__builtin_rsqrt</code>, and <code class="code">__builtin_rsqrtf</code> functions generate multiple instructions to implement the reciprocal sqrt functionality using reciprocal sqrt estimate instructions. </p> <p>The <code class="code">__builtin_recipdiv</code>, and <code class="code">__builtin_recipdivf</code> functions generate multiple instructions to implement division using the reciprocal estimate instructions. </p> <p>The following functions require <samp class="option">-mhard-float</samp> and <samp class="option">-mmultiple</samp> options. </p> <p>The <code class="code">__builtin_unpack_longdouble</code> function takes a <code class="code">long double</code> argument and a compile time constant of 0 or 1. If the constant is 0, the first <code class="code">double</code> within the <code class="code">long double</code> is returned, otherwise the second <code class="code">double</code> is returned. The <code class="code">__builtin_unpack_longdouble</code> function is only available if <code class="code">long double</code> uses the IBM extended double representation. </p> <p>The <code class="code">__builtin_pack_longdouble</code> function takes two <code class="code">double</code> arguments and returns a <code class="code">long double</code> value that combines the two arguments. The <code class="code">__builtin_pack_longdouble</code> function is only available if <code class="code">long double</code> uses the IBM extended double representation. </p> <p>The <code class="code">__builtin_unpack_ibm128</code> function takes a <code class="code">__ibm128</code> argument and a compile time constant of 0 or 1. If the constant is 0, the first <code class="code">double</code> within the <code class="code">__ibm128</code> is returned, otherwise the second <code class="code">double</code> is returned. </p> <p>The <code class="code">__builtin_pack_ibm128</code> function takes two <code class="code">double</code> arguments and returns a <code class="code">__ibm128</code> value that combines the two arguments. </p> <p>Additional built-in functions are available for the 64-bit PowerPC family of processors, for efficient use of 128-bit floating point (<code class="code">__float128</code>) values. </p> </div> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions-available-on-isa-2_002e06">Basic PowerPC Built-in Functions Available on ISA 2.06</a>, Previous: <a href="basic-powerpc-built-in-functions-available-on-all-configurations">Basic PowerPC Built-in Functions Available on all Configurations</a>, Up: <a href="basic-powerpc-built-in-functions">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e05.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e05.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-2_002e06.html b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-2_002e06.html new file mode 100644 index 00000000..5150b40b --- /dev/null +++ b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-2_002e06.html @@ -0,0 +1,28 @@ +<div class="subsubsection-level-extent" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e06"> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions-available-on-isa-2_002e07" accesskey="n" rel="next">Basic PowerPC Built-in Functions Available on ISA 2.07</a>, Previous: <a href="basic-powerpc-built-in-functions-available-on-isa-2_002e05" accesskey="p" rel="prev">Basic PowerPC Built-in Functions Available on ISA 2.05</a>, Up: <a href="basic-powerpc-built-in-functions" accesskey="u" rel="up">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e06-1"><span>6.60.22.3 Basic PowerPC Built-in Functions Available on ISA 2.06<a class="copiable-link" href="#Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e06-1"> ¶</a></span></h1> <p>The basic built-in functions described in this section are available on the PowerPC family of processors starting with ISA 2.05 or later. Unless specific options are explicitly disabled on the command line, specifying option <samp class="option">-mcpu=power7</samp> has the effect of enabling all the same options as for <samp class="option">-mcpu=power6</samp> in addition to the <samp class="option">-maltivec</samp>, <samp class="option">-mpopcntd</samp>, and <samp class="option">-mvsx</samp> options. </p> <p>The following basic built-in functions require <samp class="option">-mpopcntd</samp>: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_addg6s (unsigned int, unsigned int); +long long __builtin_bpermd (long long, long long); +unsigned int __builtin_cbcdtd (unsigned int); +unsigned int __builtin_cdtbcd (unsigned int); +long long __builtin_divde (long long, long long); +unsigned long long __builtin_divdeu (unsigned long long, unsigned long long); +int __builtin_divwe (int, int); +unsigned int __builtin_divweu (unsigned int, unsigned int); +vector __int128 __builtin_pack_vector_int128 (long long, long long); +void __builtin_rs6000_speculation_barrier (void); +long long __builtin_unpack_vector_int128 (vector __int128, signed char);</pre> +</div> <p>Of these, the <code class="code">__builtin_divde</code> and <code class="code">__builtin_divdeu</code> functions require a 64-bit environment. </p> <p>The following basic built-in functions, which are also supported on x86 targets, require <samp class="option">-mfloat128</samp>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__float128 __builtin_fabsq (__float128); +__float128 __builtin_copysignq (__float128, __float128); +__float128 __builtin_infq (void); +__float128 __builtin_huge_valq (void); +__float128 __builtin_nanq (void); +__float128 __builtin_nansq (void); + +__float128 __builtin_sqrtf128 (__float128); +__float128 __builtin_fmaf128 (__float128, __float128, __float128);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e06.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e06.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-2_002e07.html b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-2_002e07.html new file mode 100644 index 00000000..2a079b1b --- /dev/null +++ b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-2_002e07.html @@ -0,0 +1,6 @@ +<div class="subsubsection-level-extent" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e07"> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions-available-on-isa-3_002e0" accesskey="n" rel="next">Basic PowerPC Built-in Functions Available on ISA 3.0</a>, Previous: <a href="basic-powerpc-built-in-functions-available-on-isa-2_002e06" accesskey="p" rel="prev">Basic PowerPC Built-in Functions Available on ISA 2.06</a>, Up: <a href="basic-powerpc-built-in-functions" accesskey="u" rel="up">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e07-1"><span>6.60.22.4 Basic PowerPC Built-in Functions Available on ISA 2.07<a class="copiable-link" href="#Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e07-1"> ¶</a></span></h1> <p>The basic built-in functions described in this section are available on the PowerPC family of processors starting with ISA 2.07 or later. Unless specific options are explicitly disabled on the command line, specifying option <samp class="option">-mcpu=power8</samp> has the effect of enabling all the same options as for <samp class="option">-mcpu=power7</samp> in addition to the <samp class="option">-mpower8-fusion</samp>, <samp class="option">-mpower8-vector</samp>, <samp class="option">-mcrypto</samp>, <samp class="option">-mhtm</samp>, <samp class="option">-mquad-memory</samp>, and <samp class="option">-mquad-memory-atomic</samp> options. </p> <p>This section intentionally empty. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e07.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e07.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-3_002e0.html b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-3_002e0.html new file mode 100644 index 00000000..be24800b --- /dev/null +++ b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-3_002e0.html @@ -0,0 +1,59 @@ +<div class="subsubsection-level-extent" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e0"> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions-available-on-isa-3_002e1" accesskey="n" rel="next">Basic PowerPC Built-in Functions Available on ISA 3.1</a>, Previous: <a href="basic-powerpc-built-in-functions-available-on-isa-2_002e07" accesskey="p" rel="prev">Basic PowerPC Built-in Functions Available on ISA 2.07</a>, Up: <a href="basic-powerpc-built-in-functions" accesskey="u" rel="up">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e0-1"><span>6.60.22.5 Basic PowerPC Built-in Functions Available on ISA 3.0<a class="copiable-link" href="#Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e0-1"> ¶</a></span></h1> <p>The basic built-in functions described in this section are available on the PowerPC family of processors starting with ISA 3.0 or later. Unless specific options are explicitly disabled on the command line, specifying option <samp class="option">-mcpu=power9</samp> has the effect of enabling all the same options as for <samp class="option">-mcpu=power8</samp> in addition to the <samp class="option">-misel</samp> option. </p> <p>The following built-in functions are available on Linux 64-bit systems that use the ISA 3.0 instruction set (<samp class="option">-mcpu=power9</samp>): </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005faddf128_005fround_005fto_005fodd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_addf128_round_to_odd</strong> <code class="def-code-arguments">(__float128, __float128)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005faddf128_005fround_005fto_005fodd"> ¶</a></span> +</dt> <dd><p>Perform a 128-bit IEEE floating point add using round to odd as the rounding mode. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fsubf128_005fround_005fto_005fodd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_subf128_round_to_odd</strong> <code class="def-code-arguments">(__float128, __float128)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsubf128_005fround_005fto_005fodd"> ¶</a></span> +</dt> <dd><p>Perform a 128-bit IEEE floating point subtract using round to odd as the rounding mode. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fmulf128_005fround_005fto_005fodd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_mulf128_round_to_odd</strong> <code class="def-code-arguments">(__float128, __float128)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fmulf128_005fround_005fto_005fodd"> ¶</a></span> +</dt> <dd><p>Perform a 128-bit IEEE floating point multiply using round to odd as the rounding mode. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fdivf128_005fround_005fto_005fodd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_divf128_round_to_odd</strong> <code class="def-code-arguments">(__float128, __float128)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fdivf128_005fround_005fto_005fodd"> ¶</a></span> +</dt> <dd><p>Perform a 128-bit IEEE floating point divide using round to odd as the rounding mode. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fsqrtf128_005fround_005fto_005fodd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_sqrtf128_round_to_odd</strong> <code class="def-code-arguments">(__float128)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsqrtf128_005fround_005fto_005fodd"> ¶</a></span> +</dt> <dd><p>Perform a 128-bit IEEE floating point square root using round to odd as the rounding mode. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ffmaf128_005fround_005fto_005fodd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_fmaf128_round_to_odd</strong> <code class="def-code-arguments">(__float128, __float128, __float128)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ffmaf128_005fround_005fto_005fodd"> ¶</a></span> +</dt> <dd><p>Perform a 128-bit IEEE floating point fused multiply and add operation using round to odd as the rounding mode. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftruncf128_005fround_005fto_005fodd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">double</code> <strong class="def-name">__builtin_truncf128_round_to_odd</strong> <code class="def-code-arguments">(__float128)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftruncf128_005fround_005fto_005fodd"> ¶</a></span> +</dt> <dd><p>Convert a 128-bit IEEE floating point value to <code class="code">double</code> using round to odd as the rounding mode. </p></dd> +</dl> <p>The following additional built-in functions are also available for the PowerPC family of processors, starting with ISA 3.0 or later: </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-long"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long</code> <strong class="def-name">long</strong> <code class="def-code-arguments">__builtin_darn (void)</code><a class="copiable-link" href="#index-long"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-long-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long</code> <strong class="def-name">long</strong> <code class="def-code-arguments">__builtin_darn_raw (void)</code><a class="copiable-link" href="#index-long-1"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fdarn_005f32"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_darn_32</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fdarn_005f32"> ¶</a></span> +</dt> <dd><p>The <code class="code">__builtin_darn</code> and <code class="code">__builtin_darn_raw</code> functions require a 64-bit environment supporting ISA 3.0 or later. The <code class="code">__builtin_darn</code> function provides a 64-bit conditioned random number. The <code class="code">__builtin_darn_raw</code> function provides a 64-bit raw random number. The <code class="code">__builtin_darn_32</code> function provides a 32-bit conditioned random number. </p></dd> +</dl> <p>The following additional built-in functions are also available for the PowerPC family of processors, starting with ISA 3.0 or later: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int __builtin_byte_in_set (unsigned char u, unsigned long long set); +int __builtin_byte_in_range (unsigned char u, unsigned int range); +int __builtin_byte_in_either_range (unsigned char u, unsigned int ranges); + +int __builtin_dfp_dtstsfi_lt (unsigned int comparison, _Decimal64 value); +int __builtin_dfp_dtstsfi_lt (unsigned int comparison, _Decimal128 value); +int __builtin_dfp_dtstsfi_lt_dd (unsigned int comparison, _Decimal64 value); +int __builtin_dfp_dtstsfi_lt_td (unsigned int comparison, _Decimal128 value); + +int __builtin_dfp_dtstsfi_gt (unsigned int comparison, _Decimal64 value); +int __builtin_dfp_dtstsfi_gt (unsigned int comparison, _Decimal128 value); +int __builtin_dfp_dtstsfi_gt_dd (unsigned int comparison, _Decimal64 value); +int __builtin_dfp_dtstsfi_gt_td (unsigned int comparison, _Decimal128 value); + +int __builtin_dfp_dtstsfi_eq (unsigned int comparison, _Decimal64 value); +int __builtin_dfp_dtstsfi_eq (unsigned int comparison, _Decimal128 value); +int __builtin_dfp_dtstsfi_eq_dd (unsigned int comparison, _Decimal64 value); +int __builtin_dfp_dtstsfi_eq_td (unsigned int comparison, _Decimal128 value); + +int __builtin_dfp_dtstsfi_ov (unsigned int comparison, _Decimal64 value); +int __builtin_dfp_dtstsfi_ov (unsigned int comparison, _Decimal128 value); +int __builtin_dfp_dtstsfi_ov_dd (unsigned int comparison, _Decimal64 value); +int __builtin_dfp_dtstsfi_ov_td (unsigned int comparison, _Decimal128 value); + +double __builtin_mffsl(void);</pre> +</div> <p>The <code class="code">__builtin_byte_in_set</code> function requires a 64-bit environment supporting ISA 3.0 or later. This function returns a non-zero value if and only if its <code class="code">u</code> argument exactly equals one of the eight bytes contained within its 64-bit <code class="code">set</code> argument. </p> <p>The <code class="code">__builtin_byte_in_range</code> and <code class="code">__builtin_byte_in_either_range</code> require an environment supporting ISA 3.0 or later. For these two functions, the <code class="code">range</code> argument is encoded as 4 bytes, organized as <code class="code">hi_1:lo_1:hi_2:lo_2</code>. The <code class="code">__builtin_byte_in_range</code> function returns a non-zero value if and only if its <code class="code">u</code> argument is within the range bounded between <code class="code">lo_2</code> and <code class="code">hi_2</code> inclusive. The <code class="code">__builtin_byte_in_either_range</code> function returns non-zero if and only if its <code class="code">u</code> argument is within either the range bounded between <code class="code">lo_1</code> and <code class="code">hi_1</code> inclusive or the range bounded between <code class="code">lo_2</code> and <code class="code">hi_2</code> inclusive. </p> <p>The <code class="code">__builtin_dfp_dtstsfi_lt</code> function returns a non-zero value if and only if the number of signficant digits of its <code class="code">value</code> argument is less than its <code class="code">comparison</code> argument. The <code class="code">__builtin_dfp_dtstsfi_lt_dd</code> and <code class="code">__builtin_dfp_dtstsfi_lt_td</code> functions behave similarly, but require that the type of the <code class="code">value</code> argument be <code class="code">__Decimal64</code> and <code class="code">__Decimal128</code> respectively. </p> <p>The <code class="code">__builtin_dfp_dtstsfi_gt</code> function returns a non-zero value if and only if the number of signficant digits of its <code class="code">value</code> argument is greater than its <code class="code">comparison</code> argument. The <code class="code">__builtin_dfp_dtstsfi_gt_dd</code> and <code class="code">__builtin_dfp_dtstsfi_gt_td</code> functions behave similarly, but require that the type of the <code class="code">value</code> argument be <code class="code">__Decimal64</code> and <code class="code">__Decimal128</code> respectively. </p> <p>The <code class="code">__builtin_dfp_dtstsfi_eq</code> function returns a non-zero value if and only if the number of signficant digits of its <code class="code">value</code> argument equals its <code class="code">comparison</code> argument. The <code class="code">__builtin_dfp_dtstsfi_eq_dd</code> and <code class="code">__builtin_dfp_dtstsfi_eq_td</code> functions behave similarly, but require that the type of the <code class="code">value</code> argument be <code class="code">__Decimal64</code> and <code class="code">__Decimal128</code> respectively. </p> <p>The <code class="code">__builtin_dfp_dtstsfi_ov</code> function returns a non-zero value if and only if its <code class="code">value</code> argument has an undefined number of significant digits, such as when <code class="code">value</code> is an encoding of <code class="code">NaN</code>. The <code class="code">__builtin_dfp_dtstsfi_ov_dd</code> and <code class="code">__builtin_dfp_dtstsfi_ov_td</code> functions behave similarly, but require that the type of the <code class="code">value</code> argument be <code class="code">__Decimal64</code> and <code class="code">__Decimal128</code> respectively. </p> <p>The <code class="code">__builtin_mffsl</code> uses the ISA 3.0 <code class="code">mffsl</code> instruction to read the FPSCR. The instruction is a lower latency version of the <code class="code">mffs</code> instruction. If the <code class="code">mffsl</code> instruction is not available, then the builtin uses the older <code class="code">mffs</code> instruction to read the FPSCR. </p> </div> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions-available-on-isa-3_002e1">Basic PowerPC Built-in Functions Available on ISA 3.1</a>, Previous: <a href="basic-powerpc-built-in-functions-available-on-isa-2_002e07">Basic PowerPC Built-in Functions Available on ISA 2.07</a>, Up: <a href="basic-powerpc-built-in-functions">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e0.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e0.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-3_002e1.html b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-3_002e1.html new file mode 100644 index 00000000..44aa2282 --- /dev/null +++ b/devdocs/gcc~13/basic-powerpc-built-in-functions-available-on-isa-3_002e1.html @@ -0,0 +1,57 @@ +<div class="subsubsection-level-extent" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e1"> <div class="nav-panel"> <p> Previous: <a href="basic-powerpc-built-in-functions-available-on-isa-3_002e0" accesskey="p" rel="prev">Basic PowerPC Built-in Functions Available on ISA 3.0</a>, Up: <a href="basic-powerpc-built-in-functions" accesskey="u" rel="up">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e1-1"><span>6.60.22.6 Basic PowerPC Built-in Functions Available on ISA 3.1<a class="copiable-link" href="#Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e1-1"> ¶</a></span></h1> <p>The basic built-in functions described in this section are available on the PowerPC family of processors starting with ISA 3.1. Unless specific options are explicitly disabled on the command line, specifying option <samp class="option">-mcpu=power10</samp> has the effect of enabling all the same options as for <samp class="option">-mcpu=power9</samp>. </p> <p>The following built-in functions are available on Linux 64-bit systems that use a future architecture instruction set (<samp class="option">-mcpu=power10</samp>): </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcfuged"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned long long</code> <strong class="def-name">__builtin_cfuged</strong> <code class="def-code-arguments">(unsigned long long, unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcfuged"> ¶</a></span> +</dt> <dd><p>Perform a 64-bit centrifuge operation, as if implemented by the <code class="code">cfuged</code> instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcntlzdm"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned long long</code> <strong class="def-name">__builtin_cntlzdm</strong> <code class="def-code-arguments">(unsigned long long, unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcntlzdm"> ¶</a></span> +</dt> <dd><p>Perform a 64-bit count leading zeros operation under mask, as if implemented by the <code class="code">cntlzdm</code> instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcnttzdm"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned long long</code> <strong class="def-name">__builtin_cnttzdm</strong> <code class="def-code-arguments">(unsigned long long, unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcnttzdm"> ¶</a></span> +</dt> <dd><p>Perform a 64-bit count trailing zeros operation under mask, as if implemented by the <code class="code">cnttzdm</code> instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpdepd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned long long</code> <strong class="def-name">__builtin_pdepd</strong> <code class="def-code-arguments">(unsigned long long, unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpdepd"> ¶</a></span> +</dt> <dd><p>Perform a 64-bit parallel bits deposit operation, as if implemented by the <code class="code">pdepd</code> instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpextd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned long long</code> <strong class="def-name">__builtin_pextd</strong> <code class="def-code-arguments">(unsigned long long, unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpextd"> ¶</a></span> +</dt> <dd><p>Perform a 64-bit parallel bits extract operation, as if implemented by the <code class="code">pextd</code> instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-vsx_005fxl_005fsext"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">vector signed __int128</code> <strong class="def-name">vsx_xl_sext</strong> <code class="def-code-arguments">(signed long long, signed char *)</code><a class="copiable-link" href="#index-vsx_005fxl_005fsext"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vsx_005fxl_005fsext-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">vector signed __int128</code> <strong class="def-name">vsx_xl_sext</strong> <code class="def-code-arguments">(signed long long, signed short *)</code><a class="copiable-link" href="#index-vsx_005fxl_005fsext-1"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vsx_005fxl_005fsext-2"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">vector signed __int128</code> <strong class="def-name">vsx_xl_sext</strong> <code class="def-code-arguments">(signed long long, signed int *)</code><a class="copiable-link" href="#index-vsx_005fxl_005fsext-2"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vsx_005fxl_005fsext-3"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">vector signed __int128</code> <strong class="def-name">vsx_xl_sext</strong> <code class="def-code-arguments">(signed long long, signed long long *)</code><a class="copiable-link" href="#index-vsx_005fxl_005fsext-3"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vsx_005fxl_005fzext"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">vector unsigned __int128</code> <strong class="def-name">vsx_xl_zext</strong> <code class="def-code-arguments">(signed long long, unsigned char *)</code><a class="copiable-link" href="#index-vsx_005fxl_005fzext"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vsx_005fxl_005fzext-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">vector unsigned __int128</code> <strong class="def-name">vsx_xl_zext</strong> <code class="def-code-arguments">(signed long long, unsigned short *)</code><a class="copiable-link" href="#index-vsx_005fxl_005fzext-1"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vsx_005fxl_005fzext-2"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">vector unsigned __int128</code> <strong class="def-name">vsx_xl_zext</strong> <code class="def-code-arguments">(signed long long, unsigned int *)</code><a class="copiable-link" href="#index-vsx_005fxl_005fzext-2"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vsx_005fxl_005fzext-3"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">vector unsigned __int128</code> <strong class="def-name">vsx_xl_zext</strong> <code class="def-code-arguments">(signed long long, unsigned long long *)</code><a class="copiable-link" href="#index-vsx_005fxl_005fzext-3"> ¶</a></span> +</dt> <dd> <p>Load (and sign extend) to an __int128 vector, as if implemented by the ISA 3.1 <code class="code">lxvrbx</code>, <code class="code">lxvrhx</code>, <code class="code">lxvrwx</code>, and <code class="code">lxvrdx</code> instructions. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-vec_005fxst_005ftrunc"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">vec_xst_trunc</strong> <code class="def-code-arguments">(vector signed __int128, signed long long, signed char *)</code><a class="copiable-link" href="#index-vec_005fxst_005ftrunc"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vec_005fxst_005ftrunc-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">vec_xst_trunc</strong> <code class="def-code-arguments">(vector signed __int128, signed long long, signed short *)</code><a class="copiable-link" href="#index-vec_005fxst_005ftrunc-1"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vec_005fxst_005ftrunc-2"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">vec_xst_trunc</strong> <code class="def-code-arguments">(vector signed __int128, signed long long, signed int *)</code><a class="copiable-link" href="#index-vec_005fxst_005ftrunc-2"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vec_005fxst_005ftrunc-3"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">vec_xst_trunc</strong> <code class="def-code-arguments">(vector signed __int128, signed long long, signed long long *)</code><a class="copiable-link" href="#index-vec_005fxst_005ftrunc-3"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vec_005fxst_005ftrunc-4"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">vec_xst_trunc</strong> <code class="def-code-arguments">(vector unsigned __int128, signed long long, unsigned char *)</code><a class="copiable-link" href="#index-vec_005fxst_005ftrunc-4"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vec_005fxst_005ftrunc-5"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">vec_xst_trunc</strong> <code class="def-code-arguments">(vector unsigned __int128, signed long long, unsigned short *)</code><a class="copiable-link" href="#index-vec_005fxst_005ftrunc-5"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vec_005fxst_005ftrunc-6"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">vec_xst_trunc</strong> <code class="def-code-arguments">(vector unsigned __int128, signed long long, unsigned int *)</code><a class="copiable-link" href="#index-vec_005fxst_005ftrunc-6"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-vec_005fxst_005ftrunc-7"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">vec_xst_trunc</strong> <code class="def-code-arguments">(vector unsigned __int128, signed long long, unsigned long long *)</code><a class="copiable-link" href="#index-vec_005fxst_005ftrunc-7"> ¶</a></span> +</dt> <dd> <p>Truncate and store the rightmost element of a vector, as if implemented by the ISA 3.1 <code class="code">stxvrbx</code>, <code class="code">stxvrhx</code>, <code class="code">stxvrwx</code>, and <code class="code">stxvrdx</code> instructions. </p> +</dd> +</dl> </div> <div class="nav-panel"> <p> Previous: <a href="basic-powerpc-built-in-functions-available-on-isa-3_002e0">Basic PowerPC Built-in Functions Available on ISA 3.0</a>, Up: <a href="basic-powerpc-built-in-functions">Basic PowerPC Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e1.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e1.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/basic-powerpc-built-in-functions.html b/devdocs/gcc~13/basic-powerpc-built-in-functions.html new file mode 100644 index 00000000..efd0cd26 --- /dev/null +++ b/devdocs/gcc~13/basic-powerpc-built-in-functions.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="Basic-PowerPC-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="powerpc-altivec_002fvsx-built-in-functions" accesskey="n" rel="next">PowerPC AltiVec/VSX Built-in Functions</a>, Previous: <a href="nds32-built-in-functions" accesskey="p" rel="prev">NDS32 Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Basic-PowerPC-Built-in-Functions-1"><span>6.60.22 Basic PowerPC Built-in Functions<a class="copiable-link" href="#Basic-PowerPC-Built-in-Functions-1"> ¶</a></span></h1> <p>This section describes PowerPC built-in functions that do not require the inclusion of any special header files to declare prototypes or provide macro definitions. The sections that follow describe additional PowerPC built-in functions. </p> <ul class="mini-toc"> <li><a href="basic-powerpc-built-in-functions-available-on-all-configurations" accesskey="1">Basic PowerPC Built-in Functions Available on all Configurations</a></li> <li><a href="basic-powerpc-built-in-functions-available-on-isa-2_002e05" accesskey="2">Basic PowerPC Built-in Functions Available on ISA 2.05</a></li> <li><a href="basic-powerpc-built-in-functions-available-on-isa-2_002e06" accesskey="3">Basic PowerPC Built-in Functions Available on ISA 2.06</a></li> <li><a href="basic-powerpc-built-in-functions-available-on-isa-2_002e07" accesskey="4">Basic PowerPC Built-in Functions Available on ISA 2.07</a></li> <li><a href="basic-powerpc-built-in-functions-available-on-isa-3_002e0" accesskey="5">Basic PowerPC Built-in Functions Available on ISA 3.0</a></li> <li><a href="basic-powerpc-built-in-functions-available-on-isa-3_002e1" accesskey="6">Basic PowerPC Built-in Functions Available on ISA 3.1</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Basic-PowerPC-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/binary-constants.html b/devdocs/gcc~13/binary-constants.html new file mode 100644 index 00000000..90974191 --- /dev/null +++ b/devdocs/gcc~13/binary-constants.html @@ -0,0 +1,10 @@ +<div class="section-level-extent" id="Binary-constants"> <div class="nav-panel"> <p> Previous: <a href="thread-local" accesskey="p" rel="prev">Thread-Local Storage</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Binary-Constants-using-the-0b-Prefix"><span>6.65 Binary Constants using the ‘<samp class="samp">0b</samp>’ Prefix<a class="copiable-link" href="#Binary-Constants-using-the-0b-Prefix"> ¶</a></span></h1> <p>Integer constants can be written as binary constants, consisting of a sequence of ‘<samp class="samp">0</samp>’ and ‘<samp class="samp">1</samp>’ digits, prefixed by ‘<samp class="samp">0b</samp>’ or ‘<samp class="samp">0B</samp>’. This is particularly useful in environments that operate a lot on the bit level (like microcontrollers). </p> <p>The following statements are identical: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">i = 42; +i = 0x2a; +i = 052; +i = 0b101010;</pre> +</div> <p>The type of these constants follows the same rules as for octal or hexadecimal integer constants, so suffixes like ‘<samp class="samp">L</samp>’ or ‘<samp class="samp">UL</samp>’ can be applied. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Binary-constants.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Binary-constants.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/blackfin-built-in-functions.html b/devdocs/gcc~13/blackfin-built-in-functions.html new file mode 100644 index 00000000..2809a2be --- /dev/null +++ b/devdocs/gcc~13/blackfin-built-in-functions.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="Blackfin-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="bpf-built-in-functions" accesskey="n" rel="next">BPF Built-in Functions</a>, Previous: <a href="avr-built-in-functions" accesskey="p" rel="prev">AVR Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Blackfin-Built-in-Functions-1"><span>6.60.11 Blackfin Built-in Functions<a class="copiable-link" href="#Blackfin-Built-in-Functions-1"> ¶</a></span></h1> <p>Currently, there are two Blackfin-specific built-in functions. These are used for generating <code class="code">CSYNC</code> and <code class="code">SSYNC</code> machine insns without using inline assembly; by using these built-in functions the compiler can automatically add workarounds for hardware errata involving these instructions. These functions are named as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_bfin_csync (void); +void __builtin_bfin_ssync (void);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Blackfin-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Blackfin-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/blackfin-function-attributes.html b/devdocs/gcc~13/blackfin-function-attributes.html new file mode 100644 index 00000000..f0f5d2d0 --- /dev/null +++ b/devdocs/gcc~13/blackfin-function-attributes.html @@ -0,0 +1,32 @@ +<div class="subsection-level-extent" id="Blackfin-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="bpf-function-attributes" accesskey="n" rel="next">BPF Function Attributes</a>, Previous: <a href="avr-function-attributes" accesskey="p" rel="prev">AVR Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Blackfin-Function-Attributes-1"><span>6.33.7 Blackfin Function Attributes<a class="copiable-link" href="#Blackfin-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the Blackfin back end: </p> <dl class="table"> <dt> + <span><code class="code">exception_handler</code><a class="copiable-link" href="#index-exception_005fhandler-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the Blackfin to indicate that the specified function is an exception handler. The compiler generates function entry and exit sequences suitable for use in an exception handler when this attribute is present. </p> </dd> <dt> +<span><code class="code">interrupt_handler</code><a class="copiable-link" href="#index-interrupt_005fhandler-function-attribute_002c-Blackfin"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> </dd> <dt> + <span><code class="code">kspisusp</code><a class="copiable-link" href="#index-kspisusp-function-attribute_002c-Blackfin"> ¶</a></span> +</dt> <dd> +<p>When used together with <code class="code">interrupt_handler</code>, <code class="code">exception_handler</code> or <code class="code">nmi_handler</code>, code is generated to load the stack pointer from the USP register in the function prologue. </p> </dd> <dt> +<span><code class="code">l1_text</code><a class="copiable-link" href="#index-l1_005ftext-function-attribute_002c-Blackfin"> ¶</a></span> +</dt> <dd> +<p>This attribute specifies a function to be placed into L1 Instruction SRAM. The function is put into a specific section named <code class="code">.l1.text</code>. With <samp class="option">-mfdpic</samp>, function calls with a such function as the callee or caller uses inlined PLT. </p> </dd> <dt> +<span><code class="code">l2</code><a class="copiable-link" href="#index-l2-function-attribute_002c-Blackfin"> ¶</a></span> +</dt> <dd> +<p>This attribute specifies a function to be placed into L2 SRAM. The function is put into a specific section named <code class="code">.l2.text</code>. With <samp class="option">-mfdpic</samp>, callers of such functions use an inlined PLT. </p> </dd> <dt> + <span><code class="code">longcall</code><a class="copiable-link" href="#index-indirect-calls_002c-Blackfin"> ¶</a></span> +</dt> <dt><code class="code">shortcall</code></dt> <dd> +<p>The <code class="code">longcall</code> attribute indicates that the function might be far away from the call site and require a different (more expensive) calling sequence. The <code class="code">shortcall</code> attribute indicates that the function is always close enough for the shorter calling sequence to be used. These attributes override the <samp class="option">-mlongcall</samp> switch. </p> </dd> <dt> + <span><code class="code">nesting</code><a class="copiable-link" href="#index-nesting-function-attribute_002c-Blackfin"> ¶</a></span> +</dt> <dd> +<p>Use this attribute together with <code class="code">interrupt_handler</code>, <code class="code">exception_handler</code> or <code class="code">nmi_handler</code> to indicate that the function entry code should enable nested interrupts or exceptions. </p> </dd> <dt> + <span><code class="code">nmi_handler</code><a class="copiable-link" href="#index-nmi_005fhandler-function-attribute_002c-Blackfin"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the Blackfin to indicate that the specified function is an NMI handler. The compiler generates function entry and exit sequences suitable for use in an NMI handler when this attribute is present. </p> </dd> <dt> + <span><code class="code">saveall</code><a class="copiable-link" href="#index-saveall-function-attribute_002c-Blackfin"> ¶</a></span> +</dt> <dd><p>Use this attribute to indicate that all registers except the stack pointer should be saved in the prologue regardless of whether they are used or not. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="bpf-function-attributes">BPF Function Attributes</a>, Previous: <a href="avr-function-attributes">AVR Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Blackfin-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Blackfin-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/blackfin-options.html b/devdocs/gcc~13/blackfin-options.html new file mode 100644 index 00000000..eb8224dc --- /dev/null +++ b/devdocs/gcc~13/blackfin-options.html @@ -0,0 +1,80 @@ +<div class="subsection-level-extent" id="Blackfin-Options"> <div class="nav-panel"> <p> Next: <a href="c6x-options" accesskey="n" rel="next">C6X Options</a>, Previous: <a href="avr-options" accesskey="p" rel="prev">AVR Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Blackfin-Options-1"><span>3.19.7 Blackfin Options<a class="copiable-link" href="#Blackfin-Options-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">-mcpu=<var class="var">cpu</var><span class="r">[</span>-<var class="var">sirevision</var><span class="r">]</span></code><a class="copiable-link" href="#index-mcpu_003d"> ¶</a></span> +</dt> <dd> +<p>Specifies the name of the target Blackfin processor. Currently, <var class="var">cpu</var> can be one of ‘<samp class="samp">bf512</samp>’, ‘<samp class="samp">bf514</samp>’, ‘<samp class="samp">bf516</samp>’, ‘<samp class="samp">bf518</samp>’, ‘<samp class="samp">bf522</samp>’, ‘<samp class="samp">bf523</samp>’, ‘<samp class="samp">bf524</samp>’, ‘<samp class="samp">bf525</samp>’, ‘<samp class="samp">bf526</samp>’, ‘<samp class="samp">bf527</samp>’, ‘<samp class="samp">bf531</samp>’, ‘<samp class="samp">bf532</samp>’, ‘<samp class="samp">bf533</samp>’, ‘<samp class="samp">bf534</samp>’, ‘<samp class="samp">bf536</samp>’, ‘<samp class="samp">bf537</samp>’, ‘<samp class="samp">bf538</samp>’, ‘<samp class="samp">bf539</samp>’, ‘<samp class="samp">bf542</samp>’, ‘<samp class="samp">bf544</samp>’, ‘<samp class="samp">bf547</samp>’, ‘<samp class="samp">bf548</samp>’, ‘<samp class="samp">bf549</samp>’, ‘<samp class="samp">bf542m</samp>’, ‘<samp class="samp">bf544m</samp>’, ‘<samp class="samp">bf547m</samp>’, ‘<samp class="samp">bf548m</samp>’, ‘<samp class="samp">bf549m</samp>’, ‘<samp class="samp">bf561</samp>’, ‘<samp class="samp">bf592</samp>’. </p> <p>The optional <var class="var">sirevision</var> specifies the silicon revision of the target Blackfin processor. Any workarounds available for the targeted silicon revision are enabled. If <var class="var">sirevision</var> is ‘<samp class="samp">none</samp>’, no workarounds are enabled. If <var class="var">sirevision</var> is ‘<samp class="samp">any</samp>’, all workarounds for the targeted processor are enabled. The <code class="code">__SILICON_REVISION__</code> macro is defined to two hexadecimal digits representing the major and minor numbers in the silicon revision. If <var class="var">sirevision</var> is ‘<samp class="samp">none</samp>’, the <code class="code">__SILICON_REVISION__</code> is not defined. If <var class="var">sirevision</var> is ‘<samp class="samp">any</samp>’, the <code class="code">__SILICON_REVISION__</code> is defined to be <code class="code">0xffff</code>. If this optional <var class="var">sirevision</var> is not used, GCC assumes the latest known silicon revision of the targeted Blackfin processor. </p> <p>GCC defines a preprocessor macro for the specified <var class="var">cpu</var>. For the ‘<samp class="samp">bfin-elf</samp>’ toolchain, this option causes the hardware BSP provided by libgloss to be linked in if <samp class="option">-msim</samp> is not given. </p> <p>Without this option, ‘<samp class="samp">bf532</samp>’ is used as the processor by default. </p> <p>Note that support for ‘<samp class="samp">bf561</samp>’ is incomplete. For ‘<samp class="samp">bf561</samp>’, only the preprocessor macro is defined. </p> </dd> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim"> ¶</a></span> +</dt> <dd> +<p>Specifies that the program will be run on the simulator. This causes the simulator BSP provided by libgloss to be linked in. This option has effect only for ‘<samp class="samp">bfin-elf</samp>’ toolchain. Certain other options, such as <samp class="option">-mid-shared-library</samp> and <samp class="option">-mfdpic</samp>, imply <samp class="option">-msim</samp>. </p> </dd> <dt> +<span><code class="code">-momit-leaf-frame-pointer</code><a class="copiable-link" href="#index-momit-leaf-frame-pointer-1"> ¶</a></span> +</dt> <dd> +<p>Don’t keep the frame pointer in a register for leaf functions. This avoids the instructions to save, set up and restore frame pointers and makes an extra register available in leaf functions. </p> </dd> <dt> +<span><code class="code">-mspecld-anomaly</code><a class="copiable-link" href="#index-mspecld-anomaly"> ¶</a></span> +</dt> <dd> +<p>When enabled, the compiler ensures that the generated code does not contain speculative loads after jump instructions. If this option is used, <code class="code">__WORKAROUND_SPECULATIVE_LOADS</code> is defined. </p> </dd> <dt> + <span><code class="code">-mno-specld-anomaly</code><a class="copiable-link" href="#index-mno-specld-anomaly"> ¶</a></span> +</dt> <dd> +<p>Don’t generate extra code to prevent speculative loads from occurring. </p> </dd> <dt> +<span><code class="code">-mcsync-anomaly</code><a class="copiable-link" href="#index-mcsync-anomaly"> ¶</a></span> +</dt> <dd> +<p>When enabled, the compiler ensures that the generated code does not contain CSYNC or SSYNC instructions too soon after conditional branches. If this option is used, <code class="code">__WORKAROUND_SPECULATIVE_SYNCS</code> is defined. </p> </dd> <dt> + <span><code class="code">-mno-csync-anomaly</code><a class="copiable-link" href="#index-mno-csync-anomaly"> ¶</a></span> +</dt> <dd> +<p>Don’t generate extra code to prevent CSYNC or SSYNC instructions from occurring too soon after a conditional branch. </p> </dd> <dt> +<span><code class="code">-mlow64k</code><a class="copiable-link" href="#index-mlow64k"> ¶</a></span> +</dt> <dd> +<p>When enabled, the compiler is free to take advantage of the knowledge that the entire program fits into the low 64k of memory. </p> </dd> <dt> +<span><code class="code">-mno-low64k</code><a class="copiable-link" href="#index-mno-low64k"> ¶</a></span> +</dt> <dd> +<p>Assume that the program is arbitrarily large. This is the default. </p> </dd> <dt> +<span><code class="code">-mstack-check-l1</code><a class="copiable-link" href="#index-mstack-check-l1"> ¶</a></span> +</dt> <dd> +<p>Do stack checking using information placed into L1 scratchpad memory by the uClinux kernel. </p> </dd> <dt> +<span><code class="code">-mid-shared-library</code><a class="copiable-link" href="#index-mid-shared-library"> ¶</a></span> +</dt> <dd> +<p>Generate code that supports shared libraries via the library ID method. This allows for execute in place and shared libraries in an environment without virtual memory management. This option implies <samp class="option">-fPIC</samp>. With a ‘<samp class="samp">bfin-elf</samp>’ target, this option implies <samp class="option">-msim</samp>. </p> </dd> <dt> + <span><code class="code">-mno-id-shared-library</code><a class="copiable-link" href="#index-mno-id-shared-library"> ¶</a></span> +</dt> <dd> +<p>Generate code that doesn’t assume ID-based shared libraries are being used. This is the default. </p> </dd> <dt> +<span><code class="code">-mleaf-id-shared-library</code><a class="copiable-link" href="#index-mleaf-id-shared-library"> ¶</a></span> +</dt> <dd> +<p>Generate code that supports shared libraries via the library ID method, but assumes that this library or executable won’t link against any other ID shared libraries. That allows the compiler to use faster code for jumps and calls. </p> </dd> <dt> + <span><code class="code">-mno-leaf-id-shared-library</code><a class="copiable-link" href="#index-mno-leaf-id-shared-library"> ¶</a></span> +</dt> <dd> +<p>Do not assume that the code being compiled won’t link against any ID shared libraries. Slower code is generated for jump and call insns. </p> </dd> <dt> +<span><code class="code">-mshared-library-id=n</code><a class="copiable-link" href="#index-mshared-library-id"> ¶</a></span> +</dt> <dd> +<p>Specifies the identification number of the ID-based shared library being compiled. Specifying a value of 0 generates more compact code; specifying other values forces the allocation of that number to the current library but is no more space- or time-efficient than omitting this option. </p> </dd> <dt> +<span><code class="code">-msep-data</code><a class="copiable-link" href="#index-msep-data"> ¶</a></span> +</dt> <dd> +<p>Generate code that allows the data segment to be located in a different area of memory from the text segment. This allows for execute in place in an environment without virtual memory management by eliminating relocations against the text section. </p> </dd> <dt> + <span><code class="code">-mno-sep-data</code><a class="copiable-link" href="#index-mno-sep-data"> ¶</a></span> +</dt> <dd> +<p>Generate code that assumes that the data segment follows the text segment. This is the default. </p> </dd> <dt> + <span><code class="code">-mlong-calls</code><a class="copiable-link" href="#index-mlong-calls-3"> ¶</a></span> +</dt> <dt><code class="code">-mno-long-calls</code></dt> <dd> +<p>Tells the compiler to perform function calls by first loading the address of the function into a register and then performing a subroutine call on this register. This switch is needed if the target function lies outside of the 24-bit addressing range of the offset-based version of subroutine call instruction. </p> <p>This feature is not enabled by default. Specifying <samp class="option">-mno-long-calls</samp> restores the default behavior. Note these switches have no effect on how the compiler generates code to handle function calls via function pointers. </p> </dd> <dt> +<span><code class="code">-mfast-fp</code><a class="copiable-link" href="#index-mfast-fp"> ¶</a></span> +</dt> <dd> +<p>Link with the fast floating-point library. This library relaxes some of the IEEE floating-point standard’s rules for checking inputs against Not-a-Number (NAN), in the interest of performance. </p> </dd> <dt> +<span><code class="code">-minline-plt</code><a class="copiable-link" href="#index-minline-plt"> ¶</a></span> +</dt> <dd> +<p>Enable inlining of PLT entries in function calls to functions that are not known to bind locally. It has no effect without <samp class="option">-mfdpic</samp>. </p> </dd> <dt> +<span><code class="code">-mmulticore</code><a class="copiable-link" href="#index-mmulticore"> ¶</a></span> +</dt> <dd> +<p>Build a standalone application for multicore Blackfin processors. This option causes proper start files and link scripts supporting multicore to be used, and defines the macro <code class="code">__BFIN_MULTICORE</code>. It can only be used with <samp class="option">-mcpu=bf561<span class="r">[</span>-<var class="var">sirevision</var><span class="r">]</span></samp>. </p> <p>This option can be used with <samp class="option">-mcorea</samp> or <samp class="option">-mcoreb</samp>, which selects the one-application-per-core programming model. Without <samp class="option">-mcorea</samp> or <samp class="option">-mcoreb</samp>, the single-application/dual-core programming model is used. In this model, the main function of Core B should be named as <code class="code">coreb_main</code>. </p> <p>If this option is not used, the single-core application programming model is used. </p> </dd> <dt> +<span><code class="code">-mcorea</code><a class="copiable-link" href="#index-mcorea"> ¶</a></span> +</dt> <dd> +<p>Build a standalone application for Core A of BF561 when using the one-application-per-core programming model. Proper start files and link scripts are used to support Core A, and the macro <code class="code">__BFIN_COREA</code> is defined. This option can only be used in conjunction with <samp class="option">-mmulticore</samp>. </p> </dd> <dt> +<span><code class="code">-mcoreb</code><a class="copiable-link" href="#index-mcoreb"> ¶</a></span> +</dt> <dd> +<p>Build a standalone application for Core B of BF561 when using the one-application-per-core programming model. Proper start files and link scripts are used to support Core B, and the macro <code class="code">__BFIN_COREB</code> is defined. When this option is used, <code class="code">coreb_main</code> should be used instead of <code class="code">main</code>. This option can only be used in conjunction with <samp class="option">-mmulticore</samp>. </p> </dd> <dt> +<span><code class="code">-msdram</code><a class="copiable-link" href="#index-msdram"> ¶</a></span> +</dt> <dd> +<p>Build a standalone application for SDRAM. Proper start files and link scripts are used to put the application into SDRAM, and the macro <code class="code">__BFIN_SDRAM</code> is defined. The loader should initialize SDRAM before loading the application. </p> </dd> <dt> +<span><code class="code">-micplb</code><a class="copiable-link" href="#index-micplb"> ¶</a></span> +</dt> <dd><p>Assume that ICPLBs are enabled at run time. This has an effect on certain anomaly workarounds. For Linux targets, the default is to assume ICPLBs are enabled; for standalone applications the default is off. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="c6x-options">C6X Options</a>, Previous: <a href="avr-options">AVR Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Blackfin-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Blackfin-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/blackfin-variable-attributes.html b/devdocs/gcc~13/blackfin-variable-attributes.html new file mode 100644 index 00000000..a2db1b86 --- /dev/null +++ b/devdocs/gcc~13/blackfin-variable-attributes.html @@ -0,0 +1,11 @@ +<div class="subsection-level-extent" id="Blackfin-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="h8_002f300-variable-attributes" accesskey="n" rel="next">H8/300 Variable Attributes</a>, Previous: <a href="variable-attributes" accesskey="p" rel="prev">AVR Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Blackfin-Variable-Attributes-1"><span>6.34.4 Blackfin Variable Attributes<a class="copiable-link" href="#Blackfin-Variable-Attributes-1"> ¶</a></span></h1> <p>Three attributes are currently defined for the Blackfin. </p> <dl class="table"> <dt> + <span><code class="code">l1_data</code><a class="copiable-link" href="#index-l1_005fdata-variable-attribute_002c-Blackfin"> ¶</a></span> +</dt> <dt><code class="code">l1_data_A</code></dt> <dt><code class="code">l1_data_B</code></dt> <dd> +<p>Use these attributes on the Blackfin to place the variable into L1 Data SRAM. Variables with <code class="code">l1_data</code> attribute are put into the specific section named <code class="code">.l1.data</code>. Those with <code class="code">l1_data_A</code> attribute are put into the specific section named <code class="code">.l1.data.A</code>. Those with <code class="code">l1_data_B</code> attribute are put into the specific section named <code class="code">.l1.data.B</code>. </p> </dd> <dt> +<span><code class="code">l2</code><a class="copiable-link" href="#index-l2-variable-attribute_002c-Blackfin"> ¶</a></span> +</dt> <dd><p>Use this attribute on the Blackfin to place the variable into L2 SRAM. Variables with <code class="code">l2</code> attribute are put into the specific section named <code class="code">.l2.data</code>. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Blackfin-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Blackfin-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/bound-member-functions.html b/devdocs/gcc~13/bound-member-functions.html new file mode 100644 index 00000000..c6396aa8 --- /dev/null +++ b/devdocs/gcc~13/bound-member-functions.html @@ -0,0 +1,12 @@ +<div class="section-level-extent" id="Bound-member-functions"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-attributes" accesskey="n" rel="next">C++-Specific Variable, Function, and Type Attributes</a>, Previous: <a href="template-instantiation" accesskey="p" rel="prev">Where’s the Template?</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Extracting-the-Function-Pointer-from-a-Bound-Pointer-to-Member-Function"><span>7.6 Extracting the Function Pointer from a Bound Pointer to Member Function<a class="copiable-link" href="#Extracting-the-Function-Pointer-from-a-Bound-Pointer-to-Member-Function"> ¶</a></span></h1> <p>In C++, pointer to member functions (PMFs) are implemented using a wide pointer of sorts to handle all the possible call mechanisms; the PMF needs to store information about how to adjust the ‘<samp class="samp">this</samp>’ pointer, and if the function pointed to is virtual, where to find the vtable, and where in the vtable to look for the member function. If you are using PMFs in an inner loop, you should really reconsider that decision. If that is not an option, you can extract the pointer to the function that would be called for a given object/PMF pair and call it directly inside the inner loop, to save a bit of time. </p> <p>Note that you still pay the penalty for the call through a function pointer; on most modern architectures, such a call defeats the branch prediction features of the CPU. This is also true of normal virtual function calls. </p> <p>The syntax for this extension is </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern A a; +extern int (A::*fp)(); +typedef int (*fptr)(A *); + +fptr p = (fptr)(a.*fp);</pre> +</div> <p>For PMF constants (i.e. expressions of the form ‘<samp class="samp">&Klasse::Member</samp>’), no object is needed to obtain the address of the function. They can be converted to function pointers directly: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">fptr p1 = (fptr)(&A::foo);</pre> +</div> <p>You must specify <samp class="option">-Wno-pmf-conversions</samp> to use this extension. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Bound-member-functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Bound-member-functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/bpf-built-in-functions.html b/devdocs/gcc~13/bpf-built-in-functions.html new file mode 100644 index 00000000..348d9f2d --- /dev/null +++ b/devdocs/gcc~13/bpf-built-in-functions.html @@ -0,0 +1,57 @@ +<div class="subsection-level-extent" id="BPF-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="fr-v-built-in-functions" accesskey="n" rel="next">FR-V Built-in Functions</a>, Previous: <a href="blackfin-built-in-functions" accesskey="p" rel="prev">Blackfin Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="BPF-Built-in-Functions-1"><span>6.60.12 BPF Built-in Functions<a class="copiable-link" href="#BPF-Built-in-Functions-1"> ¶</a></span></h1> <p>The following built-in functions are available for eBPF targets. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fbpf_005fload_005fbyte"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned long long</code> <strong class="def-name">__builtin_bpf_load_byte</strong> <code class="def-code-arguments">(unsigned long long <var class="var">offset</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fbpf_005fload_005fbyte"> ¶</a></span> +</dt> <dd><p>Load a byte from the <code class="code">struct sk_buff</code> packet data pointed by the register <code class="code">%r6</code> and return it. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fbpf_005fload_005fhalf"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned long long</code> <strong class="def-name">__builtin_bpf_load_half</strong> <code class="def-code-arguments">(unsigned long long <var class="var">offset</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fbpf_005fload_005fhalf"> ¶</a></span> +</dt> <dd><p>Load 16 bits from the <code class="code">struct sk_buff</code> packet data pointed by the register <code class="code">%r6</code> and return it. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fbpf_005fload_005fword"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned long long</code> <strong class="def-name">__builtin_bpf_load_word</strong> <code class="def-code-arguments">(unsigned long long <var class="var">offset</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fbpf_005fload_005fword"> ¶</a></span> +</dt> <dd><p>Load 32 bits from the <code class="code">struct sk_buff</code> packet data pointed by the register <code class="code">%r6</code> and return it. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpreserve_005faccess_005findex"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_preserve_access_index</strong> <code class="def-code-arguments">(<var class="var">expr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpreserve_005faccess_005findex"> ¶</a></span> +</dt> <dd><p>BPF Compile Once-Run Everywhere (CO-RE) support. Instruct GCC to generate CO-RE relocation records for any accesses to aggregate data structures (struct, union, array types) in <var class="var">expr</var>. This builtin is otherwise transparent, the return value is whatever <var class="var">expr</var> evaluates to. It is also overloaded: <var class="var">expr</var> may be of any type (not necessarily a pointer), the return type is the same. Has no effect if <code class="code">-mco-re</code> is not in effect (either specified or implied). </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpreserve_005ffield_005finfo"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">__builtin_preserve_field_info</strong> <code class="def-code-arguments">(<var class="var">expr</var>, unsigned int <var class="var">kind</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpreserve_005ffield_005finfo"> ¶</a></span> +</dt> <dd> +<p>BPF Compile Once-Run Everywhere (CO-RE) support. This builtin is used to extract information to aid in struct/union relocations. <var class="var">expr</var> is an access to a field of a struct or union. Depending on <var class="var">kind</var>, different information is returned to the program. A CO-RE relocation for the access in <var class="var">expr</var> with kind <var class="var">kind</var> is recorded if <code class="code">-mco-re</code> is in effect. </p> <p>The following values are supported for <var class="var">kind</var>: </p> +<dl class="table"> <dt><code class="code">FIELD_BYTE_OFFSET = 0</code></dt> <dd> +<p>The returned value is the offset, in bytes, of the field from the beginning of the containing structure. For bit-fields, this is the byte offset of the containing word. </p> </dd> <dt><code class="code">FIELD_BYTE_SIZE = 1</code></dt> <dd> +<p>The returned value is the size, in bytes, of the field. For bit-fields, this is the size in bytes of the containing word. </p> </dd> <dt><code class="code">FIELD_EXISTENCE = 2</code></dt> <dd> +<p>The returned value is 1 if the field exists, 0 otherwise. Always 1 at compile time. </p> </dd> <dt><code class="code">FIELD_SIGNEDNESS = 3</code></dt> <dd> +<p>The returned value is 1 if the field is signed, 0 otherwise. </p> </dd> <dt><code class="code">FIELD_LSHIFT_U64 = 4</code></dt> <dt><code class="code">FIELD_RSHIFT_U64 = 5</code></dt> <dd> +<p>The returned value is the number of bits of left- or right-shifting (respectively) needed in order to recover the original value of the field, after it has been loaded by a read of <code class="code">FIELD_BYTE_SIZE</code> bytes into an unsigned 64-bit value. Primarily useful for reading bit-field values from structures that may change between kernel versions. </p> </dd> </dl> <p>Note that the return value is a constant which is known at compile time. If the field has a variable offset then <code class="code">FIELD_BYTE_OFFSET</code>, <code class="code">FIELD_LSHIFT_U64</code>, and <code class="code">FIELD_RSHIFT_U64</code> are not supported. Similarly, if the field has a variable size then <code class="code">FIELD_BYTE_SIZE</code>, <code class="code">FIELD_LSHIFT_U64</code>, and <code class="code">FIELD_RSHIFT_U64</code> are not supported. </p> <p>For example, <code class="code">__builtin_preserve_field_info</code> can be used to reliably extract bit-field values from a structure that may change between kernel versions: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct S +{ + short a; + int x:7; + int y:5; +}; + +int +read_y (struct S *arg) +{ + unsigned long long val; + unsigned int offset + = __builtin_preserve_field_info (arg->y, FIELD_BYTE_OFFSET); + unsigned int size + = __builtin_preserve_field_info (arg->y, FIELD_BYTE_SIZE); + + /* Read size bytes from arg + offset into val. */ + bpf_probe_read (&val, size, arg + offset); + + val <<= __builtin_preserve_field_info (arg->y, FIELD_LSHIFT_U64); + + if (__builtin_preserve_field_info (arg->y, FIELD_SIGNEDNESS)) + val = ((long long) val + >> __builtin_preserve_field_info (arg->y, FIELD_RSHIFT_U64)); + else + val >>= __builtin_preserve_field_info (arg->y, FIELD_RSHIFT_U64); + + return val; +}</pre> +</div> </dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="fr-v-built-in-functions">FR-V Built-in Functions</a>, Previous: <a href="blackfin-built-in-functions">Blackfin Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/BPF-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/BPF-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/bpf-function-attributes.html b/devdocs/gcc~13/bpf-function-attributes.html new file mode 100644 index 00000000..eac33473 --- /dev/null +++ b/devdocs/gcc~13/bpf-function-attributes.html @@ -0,0 +1,11 @@ +<div class="subsection-level-extent" id="BPF-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="c-sky-function-attributes" accesskey="n" rel="next">C-SKY Function Attributes</a>, Previous: <a href="blackfin-function-attributes" accesskey="p" rel="prev">Blackfin Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="BPF-Function-Attributes-1"><span>6.33.8 BPF Function Attributes<a class="copiable-link" href="#BPF-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the BPF back end: </p> <dl class="table"> <dt> +<span><code class="code">kernel_helper</code><a class="copiable-link" href="#index-kernel-helper_002c-function-attribute_002c-BPF"> ¶</a></span> +</dt> <dd> +<p>use this attribute to indicate the specified function declaration is a kernel helper. The helper function is passed as an argument to the attribute. Example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int bpf_probe_read (void *dst, int size, const void *unsafe_ptr) + __attribute__ ((kernel_helper (4)));</pre> +</div> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/BPF-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/BPF-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/bpf-type-attributes.html b/devdocs/gcc~13/bpf-type-attributes.html new file mode 100644 index 00000000..c1f3bd60 --- /dev/null +++ b/devdocs/gcc~13/bpf-type-attributes.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="BPF-Type-Attributes"> <div class="nav-panel"> <p> Next: <a href="type-attributes" accesskey="n" rel="next">PowerPC Type Attributes</a>, Previous: <a href="arm-type-attributes" accesskey="p" rel="prev">ARM Type Attributes</a>, Up: <a href="type-attributes" accesskey="u" rel="up">Specifying Attributes of Types</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="BPF-Type-Attributes-1"><span>6.35.4 BPF Type Attributes<a class="copiable-link" href="#BPF-Type-Attributes-1"> ¶</a></span></h1> <p>BPF Compile Once - Run Everywhere (CO-RE) support. When attached to a <code class="code">struct</code> or <code class="code">union</code> type definition, indicates that CO-RE relocation information should be generated for any access to a variable of that type. The behavior is equivalent to the programmer manually wrapping every such access with <code class="code">__builtin_preserve_access_index</code>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/BPF-Type-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/BPF-Type-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c-dialect-options.html b/devdocs/gcc~13/c-dialect-options.html new file mode 100644 index 00000000..821643d4 --- /dev/null +++ b/devdocs/gcc~13/c-dialect-options.html @@ -0,0 +1,118 @@ +<div class="section-level-extent" id="C-Dialect-Options"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-dialect-options" accesskey="n" rel="next">Options Controlling C++ Dialect</a>, Previous: <a href="invoking-g_002b_002b" accesskey="p" rel="prev">Compiling C++ Programs</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-Controlling-C-Dialect"><span>3.4 Options Controlling C Dialect<a class="copiable-link" href="#Options-Controlling-C-Dialect"> ¶</a></span></h1> <p>The following options control the dialect of C (or languages derived from C, such as C++, Objective-C and Objective-C++) that the compiler accepts: </p> <dl class="table"> <dt> + <span><code class="code">-ansi</code><a class="copiable-link" href="#index-ANSI-support"> ¶</a></span> +</dt> <dd> +<p>In C mode, this is equivalent to <samp class="option">-std=c90</samp>. In C++ mode, it is equivalent to <samp class="option">-std=c++98</samp>. </p> <p>This turns off certain features of GCC that are incompatible with ISO C90 (when compiling C code), or of standard C++ (when compiling C++ code), such as the <code class="code">asm</code> and <code class="code">typeof</code> keywords, and predefined macros such as <code class="code">unix</code> and <code class="code">vax</code> that identify the type of system you are using. It also enables the undesirable and rarely used ISO trigraph feature. For the C compiler, it disables recognition of C++ style ‘<samp class="samp">//</samp>’ comments as well as the <code class="code">inline</code> keyword. </p> <p>The alternate keywords <code class="code">__asm__</code>, <code class="code">__extension__</code>, <code class="code">__inline__</code> and <code class="code">__typeof__</code> continue to work despite <samp class="option">-ansi</samp>. You would not want to use them in an ISO C program, of course, but it is useful to put them in header files that might be included in compilations done with <samp class="option">-ansi</samp>. Alternate predefined macros such as <code class="code">__unix__</code> and <code class="code">__vax__</code> are also available, with or without <samp class="option">-ansi</samp>. </p> <p>The <samp class="option">-ansi</samp> option does not cause non-ISO programs to be rejected gratuitously. For that, <samp class="option">-Wpedantic</samp> is required in addition to <samp class="option">-ansi</samp>. See <a class="xref" href="warning-options">Options to Request or Suppress Warnings</a>. </p> <p>The macro <code class="code">__STRICT_ANSI__</code> is predefined when the <samp class="option">-ansi</samp> option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ISO standard doesn’t call for; this is to avoid interfering with any programs that might use these names for other things. </p> <p>Functions that are normally built in but do not have semantics defined by ISO C (such as <code class="code">alloca</code> and <code class="code">ffs</code>) are not built-in functions when <samp class="option">-ansi</samp> is used. See <a class="xref" href="other-builtins">Other built-in functions provided by GCC</a>, for details of the functions affected. </p> </dd> <dt> +<span><code class="code">-std=</code><a class="copiable-link" href="#index-std-1"> ¶</a></span> +</dt> <dd> +<p>Determine the language standard. See <a class="xref" href="standards">Language Standards Supported by GCC</a>, for details of these standard versions. This option is currently only supported when compiling C or C++. </p> <p>The compiler can accept several base standards, such as ‘<samp class="samp">c90</samp>’ or ‘<samp class="samp">c++98</samp>’, and GNU dialects of those standards, such as ‘<samp class="samp">gnu90</samp>’ or ‘<samp class="samp">gnu++98</samp>’. When a base standard is specified, the compiler accepts all programs following that standard plus those using GNU extensions that do not contradict it. For example, <samp class="option">-std=c90</samp> turns off certain features of GCC that are incompatible with ISO C90, such as the <code class="code">asm</code> and <code class="code">typeof</code> keywords, but not other GNU extensions that do not have a meaning in ISO C90, such as omitting the middle term of a <code class="code">?:</code> expression. On the other hand, when a GNU dialect of a standard is specified, all features supported by the compiler are enabled, even when those features change the meaning of the base standard. As a result, some strict-conforming programs may be rejected. The particular standard is used by <samp class="option">-Wpedantic</samp> to identify which features are GNU extensions given that version of the standard. For example <samp class="option">-std=gnu90 -Wpedantic</samp> warns about C++ style ‘<samp class="samp">//</samp>’ comments, while <samp class="option">-std=gnu99 -Wpedantic</samp> does not. </p> <p>A value for this option must be provided; possible values are </p> <dl class="table"> <dt>‘<samp class="samp">c90</samp>’</dt> <dt>‘<samp class="samp">c89</samp>’</dt> <dt>‘<samp class="samp">iso9899:1990</samp>’</dt> <dd> +<p>Support all ISO C90 programs (certain GNU extensions that conflict with ISO C90 are disabled). Same as <samp class="option">-ansi</samp> for C code. </p> </dd> <dt>‘<samp class="samp">iso9899:199409</samp>’</dt> <dd> +<p>ISO C90 as modified in amendment 1. </p> </dd> <dt>‘<samp class="samp">c99</samp>’</dt> <dt>‘<samp class="samp">c9x</samp>’</dt> <dt>‘<samp class="samp">iso9899:1999</samp>’</dt> <dt>‘<samp class="samp">iso9899:199x</samp>’</dt> <dd> +<p>ISO C99. This standard is substantially completely supported, modulo bugs and floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G). See <a class="uref" href="https://gcc.gnu.org/c99status.html">https://gcc.gnu.org/c99status.html</a> for more information. The names ‘<samp class="samp">c9x</samp>’ and ‘<samp class="samp">iso9899:199x</samp>’ are deprecated. </p> </dd> <dt>‘<samp class="samp">c11</samp>’</dt> <dt>‘<samp class="samp">c1x</samp>’</dt> <dt>‘<samp class="samp">iso9899:2011</samp>’</dt> <dd> +<p>ISO C11, the 2011 revision of the ISO C standard. This standard is substantially completely supported, modulo bugs, floating-point issues (mainly but not entirely relating to optional C11 features from Annexes F and G) and the optional Annexes K (Bounds-checking interfaces) and L (Analyzability). The name ‘<samp class="samp">c1x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c17</samp>’</dt> <dt>‘<samp class="samp">c18</samp>’</dt> <dt>‘<samp class="samp">iso9899:2017</samp>’</dt> <dt>‘<samp class="samp">iso9899:2018</samp>’</dt> <dd> +<p>ISO C17, the 2017 revision of the ISO C standard (published in 2018). This standard is same as C11 except for corrections of defects (all of which are also applied with <samp class="option">-std=c11</samp>) and a new value of <code class="code">__STDC_VERSION__</code>, and so is supported to the same extent as C11. </p> </dd> <dt>‘<samp class="samp">c2x</samp>’</dt> <dd> +<p>The next version of the ISO C standard, still under development. The support for this version is experimental and incomplete. </p> </dd> <dt>‘<samp class="samp">gnu90</samp>’</dt> <dt>‘<samp class="samp">gnu89</samp>’</dt> <dd> +<p>GNU dialect of ISO C90 (including some C99 features). </p> </dd> <dt>‘<samp class="samp">gnu99</samp>’</dt> <dt>‘<samp class="samp">gnu9x</samp>’</dt> <dd> +<p>GNU dialect of ISO C99. The name ‘<samp class="samp">gnu9x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu11</samp>’</dt> <dt>‘<samp class="samp">gnu1x</samp>’</dt> <dd> +<p>GNU dialect of ISO C11. The name ‘<samp class="samp">gnu1x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu17</samp>’</dt> <dt>‘<samp class="samp">gnu18</samp>’</dt> <dd> +<p>GNU dialect of ISO C17. This is the default for C code. </p> </dd> <dt>‘<samp class="samp">gnu2x</samp>’</dt> <dd> +<p>The next version of the ISO C standard, still under development, plus GNU extensions. The support for this version is experimental and incomplete. </p> </dd> <dt>‘<samp class="samp">c++98</samp>’</dt> <dt>‘<samp class="samp">c++03</samp>’</dt> <dd> +<p>The 1998 ISO C++ standard plus the 2003 technical corrigendum and some additional defect reports. Same as <samp class="option">-ansi</samp> for C++ code. </p> </dd> <dt>‘<samp class="samp">gnu++98</samp>’</dt> <dt>‘<samp class="samp">gnu++03</samp>’</dt> <dd> +<p>GNU dialect of <samp class="option">-std=c++98</samp>. </p> </dd> <dt>‘<samp class="samp">c++11</samp>’</dt> <dt>‘<samp class="samp">c++0x</samp>’</dt> <dd> +<p>The 2011 ISO C++ standard plus amendments. The name ‘<samp class="samp">c++0x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu++11</samp>’</dt> <dt>‘<samp class="samp">gnu++0x</samp>’</dt> <dd> +<p>GNU dialect of <samp class="option">-std=c++11</samp>. The name ‘<samp class="samp">gnu++0x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c++14</samp>’</dt> <dt>‘<samp class="samp">c++1y</samp>’</dt> <dd> +<p>The 2014 ISO C++ standard plus amendments. The name ‘<samp class="samp">c++1y</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu++14</samp>’</dt> <dt>‘<samp class="samp">gnu++1y</samp>’</dt> <dd> +<p>GNU dialect of <samp class="option">-std=c++14</samp>. The name ‘<samp class="samp">gnu++1y</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c++17</samp>’</dt> <dt>‘<samp class="samp">c++1z</samp>’</dt> <dd> +<p>The 2017 ISO C++ standard plus amendments. The name ‘<samp class="samp">c++1z</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu++17</samp>’</dt> <dt>‘<samp class="samp">gnu++1z</samp>’</dt> <dd> +<p>GNU dialect of <samp class="option">-std=c++17</samp>. This is the default for C++ code. The name ‘<samp class="samp">gnu++1z</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c++20</samp>’</dt> <dt>‘<samp class="samp">c++2a</samp>’</dt> <dd> +<p>The 2020 ISO C++ standard plus amendments. Support is experimental, and could change in incompatible ways in future releases. The name ‘<samp class="samp">c++2a</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu++20</samp>’</dt> <dt>‘<samp class="samp">gnu++2a</samp>’</dt> <dd> +<p>GNU dialect of <samp class="option">-std=c++20</samp>. Support is experimental, and could change in incompatible ways in future releases. The name ‘<samp class="samp">gnu++2a</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c++2b</samp>’</dt> <dt>‘<samp class="samp">c++23</samp>’</dt> <dd> +<p>The next revision of the ISO C++ standard, planned for 2023. Support is highly experimental, and will almost certainly change in incompatible ways in future releases. </p> </dd> <dt>‘<samp class="samp">gnu++2b</samp>’</dt> <dt>‘<samp class="samp">gnu++23</samp>’</dt> <dd><p>GNU dialect of <samp class="option">-std=c++2b</samp>. Support is highly experimental, and will almost certainly change in incompatible ways in future releases. </p></dd> </dl> </dd> <dt> +<span><code class="code">-aux-info <var class="var">filename</var></code><a class="copiable-link" href="#index-aux-info"> ¶</a></span> +</dt> <dd> +<p>Output to the given filename prototyped declarations for all functions declared and/or defined in a translation unit, including those in header files. This option is silently ignored in any language other than C. </p> <p>Besides declarations, the file indicates, in comments, the origin of each declaration (source file and line), whether the declaration was implicit, prototyped or unprototyped (‘<samp class="samp">I</samp>’, ‘<samp class="samp">N</samp>’ for new or ‘<samp class="samp">O</samp>’ for old, respectively, in the first character after the line number and the colon), and whether it came from a declaration or a definition (‘<samp class="samp">C</samp>’ or ‘<samp class="samp">F</samp>’, respectively, in the following character). In the case of function definitions, a K&R-style list of arguments followed by their declarations is also provided, inside comments, after the declaration. </p> </dd> <dt> + <span><code class="code">-fno-asm</code><a class="copiable-link" href="#index-fno-asm"> ¶</a></span> +</dt> <dd> +<p>Do not recognize <code class="code">asm</code>, <code class="code">inline</code> or <code class="code">typeof</code> as a keyword, so that code can use these words as identifiers. You can use the keywords <code class="code">__asm__</code>, <code class="code">__inline__</code> and <code class="code">__typeof__</code> instead. In C, <samp class="option">-ansi</samp> implies <samp class="option">-fno-asm</samp>. </p> <p>In C++, <code class="code">inline</code> is a standard keyword and is not affected by this switch. You may want to use the <samp class="option">-fno-gnu-keywords</samp> flag instead, which disables <code class="code">typeof</code> but not <code class="code">asm</code> and <code class="code">inline</code>. In C99 mode (<samp class="option">-std=c99</samp> or <samp class="option">-std=gnu99</samp>), this switch only affects the <code class="code">asm</code> and <code class="code">typeof</code> keywords, since <code class="code">inline</code> is a standard keyword in ISO C99. In C2X mode (<samp class="option">-std=c2x</samp> or <samp class="option">-std=gnu2x</samp>), this switch only affects the <code class="code">asm</code> keyword, since <code class="code">typeof</code> is a standard keyword in ISO C2X. </p> </dd> <dt> + <span><code class="code">-fno-builtin</code><a class="copiable-link" href="#index-fno-builtin"> ¶</a></span> +</dt> <dt><code class="code">-fno-builtin-<var class="var">function</var></code></dt> <dd> +<p>Don’t recognize built-in functions that do not begin with ‘<samp class="samp">__builtin_</samp>’ as prefix. See <a class="xref" href="other-builtins">Other built-in functions provided by GCC</a>, for details of the functions affected, including those which are not built-in functions when <samp class="option">-ansi</samp> or <samp class="option">-std</samp> options for strict ISO C conformance are used because they do not have an ISO standard meaning. </p> <p>GCC normally generates special code to handle certain built-in functions more efficiently; for instance, calls to <code class="code">alloca</code> may become single instructions which adjust the stack directly, and calls to <code class="code">memcpy</code> may become inline copy loops. The resulting code is often both smaller and faster, but since the function calls no longer appear as such, you cannot set a breakpoint on those calls, nor can you change the behavior of the functions by linking with a different library. In addition, when a function is recognized as a built-in function, GCC may use information about that function to warn about problems with calls to that function, or to generate more efficient code, even if the resulting code still contains calls to that function. For example, warnings are given with <samp class="option">-Wformat</samp> for bad calls to <code class="code">printf</code> when <code class="code">printf</code> is built in and <code class="code">strlen</code> is known not to modify global memory. </p> <p>With the <samp class="option">-fno-builtin-<var class="var">function</var></samp> option only the built-in function <var class="var">function</var> is disabled. <var class="var">function</var> must not begin with ‘<samp class="samp">__builtin_</samp>’. If a function is named that is not built-in in this version of GCC, this option is ignored. There is no corresponding <samp class="option">-fbuiltin-<var class="var">function</var></samp> option; if you wish to enable built-in functions selectively when using <samp class="option">-fno-builtin</samp> or <samp class="option">-ffreestanding</samp>, you may define macros such as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define abs(n) __builtin_abs ((n)) +#define strcpy(d, s) __builtin_strcpy ((d), (s))</pre> +</div> </dd> <dt> +<span><code class="code">-fcond-mismatch</code><a class="copiable-link" href="#index-fcond-mismatch"> ¶</a></span> +</dt> <dd> +<p>Allow conditional expressions with mismatched types in the second and third arguments. The value of such an expression is void. This option is not supported for C++. </p> </dd> <dt> + <span><code class="code">-ffreestanding</code><a class="copiable-link" href="#index-ffreestanding-1"> ¶</a></span> +</dt> <dd> <p>Assert that compilation targets a freestanding environment. This implies <samp class="option">-fno-builtin</samp>. A freestanding environment is one in which the standard library may not exist, and program startup may not necessarily be at <code class="code">main</code>. The most obvious example is an OS kernel. This is equivalent to <samp class="option">-fno-hosted</samp>. </p> <p>See <a class="xref" href="standards">Language Standards Supported by GCC</a>, for details of freestanding and hosted environments. </p> </dd> <dt> +<span><code class="code">-fgimple</code><a class="copiable-link" href="#index-fgimple"> ¶</a></span> +</dt> <dd> <p>Enable parsing of function definitions marked with <code class="code">__GIMPLE</code>. This is an experimental feature that allows unit testing of GIMPLE passes. </p> </dd> <dt> +<span><code class="code">-fgnu-tm</code><a class="copiable-link" href="#index-fgnu-tm"> ¶</a></span> +</dt> <dd> +<p>When the option <samp class="option">-fgnu-tm</samp> is specified, the compiler generates code for the Linux variant of Intel’s current Transactional Memory ABI specification document (Revision 1.1, May 6 2009). This is an experimental feature whose interface may change in future versions of GCC, as the official specification changes. Please note that not all architectures are supported for this feature. </p> <p>For more information on GCC’s support for transactional memory, See <a data-manual="libitm" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/libitm_html/Enabling-libitm.html#Enabling-libitm">The GNU Transactional Memory Library</a> in GNU Transactional Memory Library. </p> <p>Note that the transactional memory feature is not supported with non-call exceptions (<samp class="option">-fnon-call-exceptions</samp>). </p> </dd> <dt> +<span><code class="code">-fgnu89-inline</code><a class="copiable-link" href="#index-fgnu89-inline"> ¶</a></span> +</dt> <dd> +<p>The option <samp class="option">-fgnu89-inline</samp> tells GCC to use the traditional GNU semantics for <code class="code">inline</code> functions when in C99 mode. See <a class="xref" href="inline">An Inline Function is As Fast As a Macro</a>. Using this option is roughly equivalent to adding the <code class="code">gnu_inline</code> function attribute to all inline functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> <p>The option <samp class="option">-fno-gnu89-inline</samp> explicitly tells GCC to use the C99 semantics for <code class="code">inline</code> when in C99 or gnu99 mode (i.e., it specifies the default behavior). This option is not supported in <samp class="option">-std=c90</samp> or <samp class="option">-std=gnu90</samp> mode. </p> <p>The preprocessor macros <code class="code">__GNUC_GNU_INLINE__</code> and <code class="code">__GNUC_STDC_INLINE__</code> may be used to check which semantics are in effect for <code class="code">inline</code> functions. See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros">Common Predefined Macros</a> in The C Preprocessor. </p> </dd> <dt> + <span><code class="code">-fhosted</code><a class="copiable-link" href="#index-fhosted"> ¶</a></span> +</dt> <dd> <p>Assert that compilation targets a hosted environment. This implies <samp class="option">-fbuiltin</samp>. A hosted environment is one in which the entire standard library is available, and in which <code class="code">main</code> has a return type of <code class="code">int</code>. Examples are nearly everything except a kernel. This is equivalent to <samp class="option">-fno-freestanding</samp>. </p> </dd> <dt> +<span><code class="code">-flax-vector-conversions</code><a class="copiable-link" href="#index-flax-vector-conversions"> ¶</a></span> +</dt> <dd> +<p>Allow implicit conversions between vectors with differing numbers of elements and/or incompatible element types. This option should not be used for new code. </p> </dd> <dt> +<span><code class="code">-fms-extensions</code><a class="copiable-link" href="#index-fms-extensions"> ¶</a></span> +</dt> <dd> +<p>Accept some non-standard constructs used in Microsoft header files. </p> <p>In C++ code, this allows member names in structures to be similar to previous types declarations. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int UOW; +struct ABC { + UOW UOW; +};</pre> +</div> <p>Some cases of unnamed fields in structures and unions are only accepted with this option. See <a class="xref" href="unnamed-fields">Unnamed struct/union fields within structs/unions</a>, for details. </p> <p>Note that this option is off for all targets except for x86 targets using ms-abi. </p> </dd> <dt> + <span><code class="code">-foffload=disable</code><a class="copiable-link" href="#index-foffload"> ¶</a></span> +</dt> <dt><code class="code">-foffload=default</code></dt> <dt><code class="code">-foffload=<var class="var">target-list</var></code></dt> <dd> +<p>Specify for which OpenMP and OpenACC offload targets code should be generated. The default behavior, equivalent to <samp class="option">-foffload=default</samp>, is to generate code for all supported offload targets. The <samp class="option">-foffload=disable</samp> form generates code only for the host fallback, while <samp class="option">-foffload=<var class="var">target-list</var></samp> generates code only for the specified comma-separated list of offload targets. </p> <p>Offload targets are specified in GCC’s internal target-triplet format. You can run the compiler with <samp class="option">-v</samp> to show the list of configured offload targets under <code class="code">OFFLOAD_TARGET_NAMES</code>. </p> </dd> <dt> + <span><code class="code">-foffload-options=<var class="var">options</var></code><a class="copiable-link" href="#index-foffload-options"> ¶</a></span> +</dt> <dt><code class="code">-foffload-options=<var class="var">target-triplet-list</var>=<var class="var">options</var></code></dt> <dd> <p>With <samp class="option">-foffload-options=<var class="var">options</var></samp>, GCC passes the specified <var class="var">options</var> to the compilers for all enabled offloading targets. You can specify options that apply only to a specific target or targets by using the <samp class="option">-foffload-options=<var class="var">target-list</var>=<var class="var">options</var></samp> form. The <var class="var">target-list</var> is a comma-separated list in the same format as for the <samp class="option">-foffload=</samp> option. </p> <p>Typical command lines are </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-foffload-options=-lgfortran -foffload-options=-lm +-foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic +-foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm</pre> +</div> </dd> <dt> + <span><code class="code">-fopenacc</code><a class="copiable-link" href="#index-fopenacc"> ¶</a></span> +</dt> <dd> +<p>Enable handling of OpenACC directives <code class="code">#pragma acc</code> in C/C++ and <code class="code">!$acc</code> in Fortran. When <samp class="option">-fopenacc</samp> is specified, the compiler generates accelerated code according to the OpenACC Application Programming Interface v2.6 <a class="uref" href="https://www.openacc.org">https://www.openacc.org</a>. This option implies <samp class="option">-pthread</samp>, and thus is only supported on targets that have support for <samp class="option">-pthread</samp>. </p> </dd> <dt> + <span><code class="code">-fopenacc-dim=<var class="var">geom</var></code><a class="copiable-link" href="#index-fopenacc-dim"> ¶</a></span> +</dt> <dd> +<p>Specify default compute dimensions for parallel offload regions that do not explicitly specify. The <var class="var">geom</var> value is a triple of ’:’-separated sizes, in order ’gang’, ’worker’ and, ’vector’. A size can be omitted, to use a target-specific default value. </p> </dd> <dt> + <span><code class="code">-fopenmp</code><a class="copiable-link" href="#index-fopenmp"> ¶</a></span> +</dt> <dd> +<p>Enable handling of OpenMP directives <code class="code">#pragma omp</code> in C/C++, <code class="code">[[omp::directive(...)]]</code> and <code class="code">[[omp::sequence(...)]]</code> in C++ and <code class="code">!$omp</code> in Fortran. When <samp class="option">-fopenmp</samp> is specified, the compiler generates parallel code according to the OpenMP Application Program Interface v4.5 <a class="uref" href="https://www.openmp.org">https://www.openmp.org</a>. This option implies <samp class="option">-pthread</samp>, and thus is only supported on targets that have support for <samp class="option">-pthread</samp>. <samp class="option">-fopenmp</samp> implies <samp class="option">-fopenmp-simd</samp>. </p> </dd> <dt> + <span><code class="code">-fopenmp-simd</code><a class="copiable-link" href="#index-fopenmp-simd"> ¶</a></span> +</dt> <dd> +<p>Enable handling of OpenMP’s <code class="code">simd</code>, <code class="code">declare simd</code>, <code class="code">declare reduction</code>, <code class="code">assume</code>, <code class="code">ordered</code>, <code class="code">scan</code>, <code class="code">loop</code> directives and combined or composite directives with <code class="code">simd</code> as constituent with <code class="code">#pragma omp</code> in C/C++, <code class="code">[[omp::directive(...)]]</code> and <code class="code">[[omp::sequence(...)]]</code> in C++ and <code class="code">!$omp</code> in Fortran. Other OpenMP directives are ignored. </p> </dd> <dt> + <span><code class="code">-fopenmp-target-simd-clone</code><a class="copiable-link" href="#index-fopenmp-target-simd-clone"> ¶</a></span> +</dt> <dt><code class="code">-fopenmp-target-simd-clone=<var class="var">device-type</var></code></dt> <dd> +<p>In addition to generating SIMD clones for functions marked with the <code class="code">declare simd</code> directive, GCC also generates clones for functions marked with the OpenMP <code class="code">declare target</code> directive that are suitable for vectorization when this option is in effect. The <var class="var">device-type</var> may be one of <code class="code">none</code>, <code class="code">host</code>, <code class="code">nohost</code>, and <code class="code">any</code>, which correspond to keywords for the <code class="code">device_type</code> clause of the <code class="code">declare target</code> directive; clones are generated for the intersection of devices specified. <samp class="option">-fopenmp-target-simd-clone</samp> is equivalent to <samp class="option">-fopenmp-target-simd-clone=any</samp> and <samp class="option">-fno-openmp-target-simd-clone</samp> is equivalent to <samp class="option">-fopenmp-target-simd-clone=none</samp>. </p> <p>At <samp class="option">-O2</samp> and higher (but not <samp class="option">-Os</samp> or <samp class="option">-Og</samp>) this optimization defaults to <samp class="option">-fopenmp-target-simd-clone=nohost</samp>; otherwise it is disabled by default. </p> </dd> <dt> + <span><code class="code">-fpermitted-flt-eval-methods=<var class="var">style</var></code><a class="copiable-link" href="#index-fpermitted-flt-eval-methods"> ¶</a></span> +</dt> <dd> +<p>ISO/IEC TS 18661-3 defines new permissible values for <code class="code">FLT_EVAL_METHOD</code> that indicate that operations and constants with a semantic type that is an interchange or extended format should be evaluated to the precision and range of that type. These new values are a superset of those permitted under C99/C11, which does not specify the meaning of other positive values of <code class="code">FLT_EVAL_METHOD</code>. As such, code conforming to C11 may not have been written expecting the possibility of the new values. </p> <p><samp class="option">-fpermitted-flt-eval-methods</samp> specifies whether the compiler should allow only the values of <code class="code">FLT_EVAL_METHOD</code> specified in C99/C11, or the extended set of values specified in ISO/IEC TS 18661-3. </p> <p><var class="var">style</var> is either <code class="code">c11</code> or <code class="code">ts-18661-3</code> as appropriate. </p> <p>The default when in a standards compliant mode (<samp class="option">-std=c11</samp> or similar) is <samp class="option">-fpermitted-flt-eval-methods=c11</samp>. The default when in a GNU dialect (<samp class="option">-std=gnu11</samp> or similar) is <samp class="option">-fpermitted-flt-eval-methods=ts-18661-3</samp>. </p> </dd> <dt> +<span><code class="code">-fplan9-extensions</code><a class="copiable-link" href="#index-fplan9-extensions"> ¶</a></span> +</dt> <dd> +<p>Accept some non-standard constructs used in Plan 9 code. </p> <p>This enables <samp class="option">-fms-extensions</samp>, permits passing pointers to structures with anonymous fields to functions that expect pointers to elements of the type of the field, and permits referring to anonymous fields declared using a typedef. See <a class="xref" href="unnamed-fields">Unnamed struct/union fields within structs/unions</a>, for details. This is only supported for C, not C++. </p> </dd> <dt> + <span><code class="code">-fsigned-bitfields</code><a class="copiable-link" href="#index-fsigned-bitfields"> ¶</a></span> +</dt> <dt><code class="code">-funsigned-bitfields</code></dt> <dt><code class="code">-fno-signed-bitfields</code></dt> <dt><code class="code">-fno-unsigned-bitfields</code></dt> <dd> +<p>These options control whether a bit-field is signed or unsigned, when the declaration does not use either <code class="code">signed</code> or <code class="code">unsigned</code>. By default, such a bit-field is signed, because this is consistent: the basic integer types such as <code class="code">int</code> are signed types. </p> </dd> <dt> +<span><code class="code">-fsigned-char</code><a class="copiable-link" href="#index-fsigned-char"> ¶</a></span> +</dt> <dd> +<p>Let the type <code class="code">char</code> be signed, like <code class="code">signed char</code>. </p> <p>Note that this is equivalent to <samp class="option">-fno-unsigned-char</samp>, which is the negative form of <samp class="option">-funsigned-char</samp>. Likewise, the option <samp class="option">-fno-signed-char</samp> is equivalent to <samp class="option">-funsigned-char</samp>. </p> </dd> <dt> +<span><code class="code">-funsigned-char</code><a class="copiable-link" href="#index-funsigned-char"> ¶</a></span> +</dt> <dd> +<p>Let the type <code class="code">char</code> be unsigned, like <code class="code">unsigned char</code>. </p> <p>Each kind of machine has a default for what <code class="code">char</code> should be. It is either like <code class="code">unsigned char</code> by default or like <code class="code">signed char</code> by default. </p> <p>Ideally, a portable program should always use <code class="code">signed char</code> or <code class="code">unsigned char</code> when it depends on the signedness of an object. But many programs have been written to use plain <code class="code">char</code> and expect it to be signed, or expect it to be unsigned, depending on the machines they were written for. This option, and its inverse, let you make such a program work with the opposite default. </p> <p>The type <code class="code">char</code> is always a distinct type from each of <code class="code">signed char</code> or <code class="code">unsigned char</code>, even though its behavior is always just like one of those two. </p> </dd> <dt> + <span><code class="code">-fstrict-flex-arrays</code><a class="copiable-link" href="#index-fstrict-flex-arrays"> ¶</a></span> +</dt> <dd> +<p>Control when to treat the trailing array of a structure as a flexible array member for the purpose of accessing the elements of such an array. The positive form is equivalent to <samp class="option">-fstrict-flex-arrays=3</samp>, which is the strictest. A trailing array is treated as a flexible array member only when it is declared as a flexible array member per C99 standard onwards. The negative form is equivalent to <samp class="option">-fstrict-flex-arrays=0</samp>, which is the least strict. All trailing arrays of structures are treated as flexible array members. </p> </dd> <dt> +<span><code class="code">-fstrict-flex-arrays=<var class="var">level</var></code><a class="copiable-link" href="#index-fstrict-flex-arrays_003dlevel"> ¶</a></span> +</dt> <dd> +<p>Control when to treat the trailing array of a structure as a flexible array member for the purpose of accessing the elements of such an array. The value of <var class="var">level</var> controls the level of strictness. </p> <p>The possible values of <var class="var">level</var> are the same as for the <code class="code">strict_flex_array</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> <p>You can control this behavior for a specific trailing array field of a structure by using the variable attribute <code class="code">strict_flex_array</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> </dd> <dt> +<span><code class="code">-fsso-struct=<var class="var">endianness</var></code><a class="copiable-link" href="#index-fsso-struct"> ¶</a></span> +</dt> <dd> +<p>Set the default scalar storage order of structures and unions to the specified endianness. The accepted values are ‘<samp class="samp">big-endian</samp>’, ‘<samp class="samp">little-endian</samp>’ and ‘<samp class="samp">native</samp>’ for the native endianness of the target (the default). This option is not supported for C++. </p> <p><strong class="strong">Warning:</strong> the <samp class="option">-fsso-struct</samp> switch causes GCC to generate code that is not binary compatible with code generated without it if the specified endianness is not the native endianness of the target. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-dialect-options">Options Controlling C++ Dialect</a>, Previous: <a href="invoking-g_002b_002b">Compiling C++ Programs</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-Dialect-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-Dialect-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c-extensions.html b/devdocs/gcc~13/c-extensions.html new file mode 100644 index 00000000..98398f74 --- /dev/null +++ b/devdocs/gcc~13/c-extensions.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="C-Extensions"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-extensions" accesskey="n" rel="next">Extensions to the C++ Language</a>, Previous: <a href="c_002b_002b-implementation" accesskey="p" rel="prev">C++ Implementation-Defined Behavior</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="Extensions-to-the-C-Language-Family"><span>6 Extensions to the C Language Family<a class="copiable-link" href="#Extensions-to-the-C-Language-Family"> ¶</a></span></h1> <p>GNU C provides several language features not found in ISO standard C. (The <samp class="option">-pedantic</samp> option directs GCC to print a warning message if any of these features is used.) To test for the availability of these features in conditional compilation, check for a predefined macro <code class="code">__GNUC__</code>, which is always defined under GCC. </p> <p>These extensions are available in C and Objective-C. Most of them are also available in C++. See <a class="xref" href="c_002b_002b-extensions">Extensions to the C++ Language</a>, for extensions that apply <em class="emph">only</em> to C++. </p> <p>Some features that are in ISO C99 but not C90 or C++ are also, as extensions, accepted by GCC in C90 mode and in C++. </p> <ul class="mini-toc"> <li><a href="statement-exprs" accesskey="1">Statements and Declarations in Expressions</a></li> <li><a href="local-labels" accesskey="2">Locally Declared Labels</a></li> <li><a href="labels-as-values" accesskey="3">Labels as Values</a></li> <li><a href="nested-functions" accesskey="4">Nested Functions</a></li> <li><a href="nonlocal-gotos" accesskey="5">Nonlocal Gotos</a></li> <li><a href="constructing-calls" accesskey="6">Constructing Function Calls</a></li> <li><a href="typeof" accesskey="7">Referring to a Type with <code class="code">typeof</code></a></li> <li><a href="conditionals" accesskey="8">Conditionals with Omitted Operands</a></li> <li><a href="_005f_005fint128" accesskey="9">128-bit Integers</a></li> <li><a href="long-long">Double-Word Integers</a></li> <li><a href="complex">Complex Numbers</a></li> <li><a href="floating-types">Additional Floating Types</a></li> <li><a href="half-precision">Half-Precision Floating Point</a></li> <li><a href="decimal-float">Decimal Floating Types</a></li> <li><a href="hex-floats">Hex Floats</a></li> <li><a href="fixed-point">Fixed-Point Types</a></li> <li><a href="named-address-spaces">Named Address Spaces</a></li> <li><a href="zero-length">Arrays of Length Zero</a></li> <li><a href="empty-structures">Structures with No Members</a></li> <li><a href="variable-length">Arrays of Variable Length</a></li> <li><a href="variadic-macros">Macros with a Variable Number of Arguments.</a></li> <li><a href="escaped-newlines">Slightly Looser Rules for Escaped Newlines</a></li> <li><a href="subscripting">Non-Lvalue Arrays May Have Subscripts</a></li> <li><a href="pointer-arith">Arithmetic on <code class="code">void</code>- and Function-Pointers</a></li> <li><a href="variadic-pointer-args">Pointer Arguments in Variadic Functions</a></li> <li><a href="pointers-to-arrays">Pointers to Arrays with Qualifiers Work as Expected</a></li> <li><a href="initializers">Non-Constant Initializers</a></li> <li><a href="compound-literals">Compound Literals</a></li> <li><a href="designated-inits">Designated Initializers</a></li> <li><a href="case-ranges">Case Ranges</a></li> <li><a href="cast-to-union">Cast to a Union Type</a></li> <li><a href="mixed-labels-and-declarations">Mixed Declarations, Labels and Code</a></li> <li><a href="function-attributes">Declaring Attributes of Functions</a></li> <li><a href="variable-attributes">Specifying Attributes of Variables</a></li> <li><a href="type-attributes">Specifying Attributes of Types</a></li> <li><a href="label-attributes">Label Attributes</a></li> <li><a href="enumerator-attributes">Enumerator Attributes</a></li> <li><a href="statement-attributes">Statement Attributes</a></li> <li><a href="attribute-syntax">Attribute Syntax</a></li> <li><a href="function-prototypes">Prototypes and Old-Style Function Definitions</a></li> <li><a href="c_002b_002b-comments">C++ Style Comments</a></li> <li><a href="dollar-signs">Dollar Signs in Identifier Names</a></li> <li><a href="character-escapes">The Character <kbd class="key">ESC</kbd> in Constants</a></li> <li><a href="alignment">Determining the Alignment of Functions, Types or Variables</a></li> <li><a href="inline">An Inline Function is As Fast As a Macro</a></li> <li><a href="volatiles">When is a Volatile Object Accessed?</a></li> <li><a href="using-assembly-language-with-c">How to Use Inline Assembly Language in C Code</a></li> <li><a href="alternate-keywords">Alternate Keywords</a></li> <li><a href="incomplete-enums">Incomplete <code class="code">enum</code> Types</a></li> <li><a href="function-names">Function Names as Strings</a></li> <li><a href="return-address">Getting the Return or Frame Address of a Function</a></li> <li><a href="vector-extensions">Using Vector Instructions through Built-in Functions</a></li> <li><a href="offsetof">Support for <code class="code">offsetof</code></a></li> <li><a href="_005f_005fsync-builtins">Legacy <code class="code">__sync</code> Built-in Functions for Atomic Memory Access</a></li> <li><a href="_005f_005fatomic-builtins">Built-in Functions for Memory Model Aware Atomic Operations</a></li> <li><a href="integer-overflow-builtins">Built-in Functions to Perform Arithmetic with Overflow Checking</a></li> <li><a href="x86-specific-memory-model-extensions-for-transactional-memory">x86-Specific Memory Model Extensions for Transactional Memory</a></li> <li><a href="object-size-checking">Object Size Checking</a></li> <li><a href="other-builtins">Other Built-in Functions Provided by GCC</a></li> <li><a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a></li> <li><a href="target-format-checks">Format Checks Specific to Particular Target Machines</a></li> <li><a href="pragmas">Pragmas Accepted by GCC</a></li> <li><a href="unnamed-fields">Unnamed Structure and Union Fields</a></li> <li><a href="thread-local">Thread-Local Storage</a></li> <li><a href="binary-constants">Binary Constants using the ‘<samp class="samp">0b</samp>’ Prefix</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a>, Previous: <a href="c_002b_002b-implementation">C++ Implementation-Defined Behavior</a>, Up: <a href="index">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-Extensions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-Extensions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c-implementation.html b/devdocs/gcc~13/c-implementation.html new file mode 100644 index 00000000..a5c49273 --- /dev/null +++ b/devdocs/gcc~13/c-implementation.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="C-Implementation"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-implementation" accesskey="n" rel="next">C++ Implementation-Defined Behavior</a>, Previous: <a href="invoking-gcc" accesskey="p" rel="prev">GCC Command Options</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="C-Implementation-Defined-Behavior"><span>4 C Implementation-Defined Behavior<a class="copiable-link" href="#C-Implementation-Defined-Behavior"> ¶</a></span></h1> <p>A conforming implementation of ISO C is required to document its choice of behavior in each of the areas that are designated “implementation defined”. The following lists all such areas, along with the section numbers from the ISO/IEC 9899:1990, ISO/IEC 9899:1999 and ISO/IEC 9899:2011 standards. Some areas are only implementation-defined in one version of the standard. </p> <p>Some choices depend on the externally determined ABI for the platform (including standard character encodings) which GCC follows; these are listed as “determined by ABI” below. See <a class="xref" href="compatibility">Binary Compatibility</a>, and <a class="uref" href="https://gcc.gnu.org/readings.html">https://gcc.gnu.org/readings.html</a>. Some choices are documented in the preprocessor manual. See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. Some choices are made by the library and operating system (or other environment when compiling for a freestanding environment); refer to their documentation for details. </p> <ul class="mini-toc"> <li><a href="translation-implementation" accesskey="1">Translation</a></li> <li><a href="environment-implementation" accesskey="2">Environment</a></li> <li><a href="identifiers-implementation" accesskey="3">Identifiers</a></li> <li><a href="characters-implementation" accesskey="4">Characters</a></li> <li><a href="integers-implementation" accesskey="5">Integers</a></li> <li><a href="floating-point-implementation" accesskey="6">Floating Point</a></li> <li><a href="arrays-and-pointers-implementation" accesskey="7">Arrays and Pointers</a></li> <li><a href="hints-implementation" accesskey="8">Hints</a></li> <li><a href="structures-unions-enumerations-and-bit-fields-implementation" accesskey="9">Structures, Unions, Enumerations, and Bit-Fields</a></li> <li><a href="qualifiers-implementation">Qualifiers</a></li> <li><a href="declarators-implementation">Declarators</a></li> <li><a href="statements-implementation">Statements</a></li> <li><a href="preprocessing-directives-implementation">Preprocessing Directives</a></li> <li><a href="library-functions-implementation">Library Functions</a></li> <li><a href="architecture-implementation">Architecture</a></li> <li><a href="locale-specific-behavior-implementation">Locale-Specific Behavior</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-Implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-Implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c-sky-function-attributes.html b/devdocs/gcc~13/c-sky-function-attributes.html new file mode 100644 index 00000000..a285f752 --- /dev/null +++ b/devdocs/gcc~13/c-sky-function-attributes.html @@ -0,0 +1,11 @@ +<div class="subsection-level-extent" id="C-SKY-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="epiphany-function-attributes" accesskey="n" rel="next">Epiphany Function Attributes</a>, Previous: <a href="bpf-function-attributes" accesskey="p" rel="prev">BPF Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="C-SKY-Function-Attributes-1"><span>6.33.9 C-SKY Function Attributes<a class="copiable-link" href="#C-SKY-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the C-SKY back end: </p> <dl class="table"> <dt> + <span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-C-SKY"> ¶</a></span> +</dt> <dt><code class="code">isr</code></dt> <dd> +<p>Use these attributes to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when either of these attributes are present. </p> <p>Use of these options requires the <samp class="option">-mistack</samp> command-line option to enable support for the necessary interrupt stack instructions. They are ignored with a warning otherwise. See <a class="xref" href="c-sky-options">C-SKY Options</a>. </p> </dd> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-C-SKY"> ¶</a></span> +</dt> <dd><p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-SKY-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-SKY-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c-sky-options.html b/devdocs/gcc~13/c-sky-options.html new file mode 100644 index 00000000..9f7767da --- /dev/null +++ b/devdocs/gcc~13/c-sky-options.html @@ -0,0 +1,88 @@ +<div class="subsection-level-extent" id="C-SKY-Options"> <div class="nav-panel"> <p> Next: <a href="darwin-options" accesskey="n" rel="next">Darwin Options</a>, Previous: <a href="cris-options" accesskey="p" rel="prev">CRIS Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="C-SKY-Options-1"><span>3.19.10 C-SKY Options<a class="copiable-link" href="#C-SKY-Options-1"> ¶</a></span></h1> <p>GCC supports these options when compiling for C-SKY V2 processors. </p> <dl class="table"> <dt> +<span><code class="code">-march=<var class="var">arch</var></code><a class="copiable-link" href="#index-march_003d"> ¶</a></span> +</dt> <dd> +<p>Specify the C-SKY target architecture. Valid values for <var class="var">arch</var> are: ‘<samp class="samp">ck801</samp>’, ‘<samp class="samp">ck802</samp>’, ‘<samp class="samp">ck803</samp>’, ‘<samp class="samp">ck807</samp>’, and ‘<samp class="samp">ck810</samp>’. The default is ‘<samp class="samp">ck810</samp>’. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu</var></code><a class="copiable-link" href="#index-mcpu_003d-1"> ¶</a></span> +</dt> <dd> +<p>Specify the C-SKY target processor. Valid values for <var class="var">cpu</var> are: ‘<samp class="samp">ck801</samp>’, ‘<samp class="samp">ck801t</samp>’, ‘<samp class="samp">ck802</samp>’, ‘<samp class="samp">ck802t</samp>’, ‘<samp class="samp">ck802j</samp>’, ‘<samp class="samp">ck803</samp>’, ‘<samp class="samp">ck803h</samp>’, ‘<samp class="samp">ck803t</samp>’, ‘<samp class="samp">ck803ht</samp>’, ‘<samp class="samp">ck803f</samp>’, ‘<samp class="samp">ck803fh</samp>’, ‘<samp class="samp">ck803e</samp>’, ‘<samp class="samp">ck803eh</samp>’, ‘<samp class="samp">ck803et</samp>’, ‘<samp class="samp">ck803eht</samp>’, ‘<samp class="samp">ck803ef</samp>’, ‘<samp class="samp">ck803efh</samp>’, ‘<samp class="samp">ck803ft</samp>’, ‘<samp class="samp">ck803eft</samp>’, ‘<samp class="samp">ck803efht</samp>’, ‘<samp class="samp">ck803r1</samp>’, ‘<samp class="samp">ck803hr1</samp>’, ‘<samp class="samp">ck803tr1</samp>’, ‘<samp class="samp">ck803htr1</samp>’, ‘<samp class="samp">ck803fr1</samp>’, ‘<samp class="samp">ck803fhr1</samp>’, ‘<samp class="samp">ck803er1</samp>’, ‘<samp class="samp">ck803ehr1</samp>’, ‘<samp class="samp">ck803etr1</samp>’, ‘<samp class="samp">ck803ehtr1</samp>’, ‘<samp class="samp">ck803efr1</samp>’, ‘<samp class="samp">ck803efhr1</samp>’, ‘<samp class="samp">ck803ftr1</samp>’, ‘<samp class="samp">ck803eftr1</samp>’, ‘<samp class="samp">ck803efhtr1</samp>’, ‘<samp class="samp">ck803s</samp>’, ‘<samp class="samp">ck803st</samp>’, ‘<samp class="samp">ck803se</samp>’, ‘<samp class="samp">ck803sf</samp>’, ‘<samp class="samp">ck803sef</samp>’, ‘<samp class="samp">ck803seft</samp>’, ‘<samp class="samp">ck807e</samp>’, ‘<samp class="samp">ck807ef</samp>’, ‘<samp class="samp">ck807</samp>’, ‘<samp class="samp">ck807f</samp>’, ‘<samp class="samp">ck810e</samp>’, ‘<samp class="samp">ck810et</samp>’, ‘<samp class="samp">ck810ef</samp>’, ‘<samp class="samp">ck810eft</samp>’, ‘<samp class="samp">ck810</samp>’, ‘<samp class="samp">ck810v</samp>’, ‘<samp class="samp">ck810f</samp>’, ‘<samp class="samp">ck810t</samp>’, ‘<samp class="samp">ck810fv</samp>’, ‘<samp class="samp">ck810tv</samp>’, ‘<samp class="samp">ck810ft</samp>’, and ‘<samp class="samp">ck810ftv</samp>’. </p> </dd> <dt> + <span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian-4"> ¶</a></span> +</dt> <dt><code class="code">-EB</code></dt> <dt><code class="code">-mlittle-endian</code></dt> <dt><code class="code">-EL</code></dt> <dd> <p>Select big- or little-endian code. The default is little-endian. </p> </dd> <dt> +<span><code class="code">-mfloat-abi=<var class="var">name</var></code><a class="copiable-link" href="#index-mfloat-abi-1"> ¶</a></span> +</dt> <dd> +<p>Specifies which floating-point ABI to use. Permissible values are: ‘<samp class="samp">soft</samp>’, ‘<samp class="samp">softfp</samp>’ and ‘<samp class="samp">hard</samp>’. </p> <p>Specifying ‘<samp class="samp">soft</samp>’ causes GCC to generate output containing library calls for floating-point operations. ‘<samp class="samp">softfp</samp>’ allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions. ‘<samp class="samp">hard</samp>’ allows generation of floating-point instructions and uses FPU-specific calling conventions. </p> <p>The default depends on the specific target configuration. Note that the hard-float and soft-float ABIs are not link-compatible; you must compile your entire program with the same ABI, and link with a compatible set of libraries. </p> </dd> <dt> + <span><code class="code">-mhard-float</code><a class="copiable-link" href="#index-mhard-float"> ¶</a></span> +</dt> <dt><code class="code">-msoft-float</code></dt> <dd> <p>Select hardware or software floating-point implementations. The default is soft float. </p> </dd> <dt> +<span><code class="code">-mdouble-float</code><a class="copiable-link" href="#index-mdouble-float"> ¶</a></span> +</dt> <dt><code class="code">-mno-double-float</code></dt> <dd> +<p>When <samp class="option">-mhard-float</samp> is in effect, enable generation of double-precision float instructions. This is the default except when compiling for CK803. </p> </dd> <dt> +<span><code class="code">-mfdivdu</code><a class="copiable-link" href="#index-mfdivdu"> ¶</a></span> +</dt> <dt><code class="code">-mno-fdivdu</code></dt> <dd> +<p>When <samp class="option">-mhard-float</samp> is in effect, enable generation of <code class="code">frecipd</code>, <code class="code">fsqrtd</code>, and <code class="code">fdivd</code> instructions. This is the default except when compiling for CK803. </p> </dd> <dt> +<span><code class="code">-mfpu=<var class="var">fpu</var></code><a class="copiable-link" href="#index-mfpu_003d"> ¶</a></span> +</dt> <dd> +<p>Select the floating-point processor. This option can only be used with <samp class="option">-mhard-float</samp>. Values for <var class="var">fpu</var> are ‘<samp class="samp">fpv2_sf</samp>’ (equivalent to ‘<samp class="samp">-mno-double-float -mno-fdivdu</samp>’), ‘<samp class="samp">fpv2</samp>’ (‘<samp class="samp">-mdouble-float -mno-divdu</samp>’), and ‘<samp class="samp">fpv2_divd</samp>’ (‘<samp class="samp">-mdouble-float -mdivdu</samp>’). </p> </dd> <dt> +<span><code class="code">-melrw</code><a class="copiable-link" href="#index-melrw"> ¶</a></span> +</dt> <dt><code class="code">-mno-elrw</code></dt> <dd> +<p>Enable the extended <code class="code">lrw</code> instruction. This option defaults to on for CK801 and off otherwise. </p> </dd> <dt> +<span><code class="code">-mistack</code><a class="copiable-link" href="#index-mistack"> ¶</a></span> +</dt> <dt><code class="code">-mno-istack</code></dt> <dd> +<p>Enable interrupt stack instructions; the default is off. </p> <p>The <samp class="option">-mistack</samp> option is required to handle the <code class="code">interrupt</code> and <code class="code">isr</code> function attributes (see <a class="pxref" href="c-sky-function-attributes">C-SKY Function Attributes</a>). </p> </dd> <dt> +<span><code class="code">-mmp</code><a class="copiable-link" href="#index-mmp"> ¶</a></span> +</dt> <dd> +<p>Enable multiprocessor instructions; the default is off. </p> </dd> <dt> +<span><code class="code">-mcp</code><a class="copiable-link" href="#index-mcp"> ¶</a></span> +</dt> <dd> +<p>Enable coprocessor instructions; the default is off. </p> </dd> <dt> +<span><code class="code">-mcache</code><a class="copiable-link" href="#index-mcache"> ¶</a></span> +</dt> <dd> +<p>Enable coprocessor instructions; the default is off. </p> </dd> <dt> +<span><code class="code">-msecurity</code><a class="copiable-link" href="#index-msecurity"> ¶</a></span> +</dt> <dd> +<p>Enable C-SKY security instructions; the default is off. </p> </dd> <dt> +<span><code class="code">-mtrust</code><a class="copiable-link" href="#index-mtrust"> ¶</a></span> +</dt> <dd> +<p>Enable C-SKY trust instructions; the default is off. </p> </dd> <dt> + <span><code class="code">-mdsp</code><a class="copiable-link" href="#index-mdsp"> ¶</a></span> +</dt> <dt><code class="code">-medsp</code></dt> <dt><code class="code">-mvdsp</code></dt> <dd> +<p>Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively. All of these options default to off. </p> </dd> <dt> +<span><code class="code">-mdiv</code><a class="copiable-link" href="#index-mdiv"> ¶</a></span> +</dt> <dt><code class="code">-mno-div</code></dt> <dd> +<p>Generate divide instructions. Default is off. </p> </dd> <dt> +<span><code class="code">-msmart</code><a class="copiable-link" href="#index-msmart"> ¶</a></span> +</dt> <dt><code class="code">-mno-smart</code></dt> <dd> +<p>Generate code for Smart Mode, using only registers numbered 0-7 to allow use of 16-bit instructions. This option is ignored for CK801 where this is the required behavior, and it defaults to on for CK802. For other targets, the default is off. </p> </dd> <dt> +<span><code class="code">-mhigh-registers</code><a class="copiable-link" href="#index-mhigh-registers"> ¶</a></span> +</dt> <dt><code class="code">-mno-high-registers</code></dt> <dd> +<p>Generate code using the high registers numbered 16-31. This option is not supported on CK801, CK802, or CK803, and is enabled by default for other processors. </p> </dd> <dt> +<span><code class="code">-manchor</code><a class="copiable-link" href="#index-manchor"> ¶</a></span> +</dt> <dt><code class="code">-mno-anchor</code></dt> <dd> +<p>Generate code using global anchor symbol addresses. </p> </dd> <dt> +<span><code class="code">-mpushpop</code><a class="copiable-link" href="#index-mpushpop"> ¶</a></span> +</dt> <dt><code class="code">-mno-pushpop</code></dt> <dd> +<p>Generate code using <code class="code">push</code> and <code class="code">pop</code> instructions. This option defaults to on. </p> </dd> <dt> +<span><code class="code">-mmultiple-stld</code><a class="copiable-link" href="#index-mmultiple-stld"> ¶</a></span> +</dt> <dt><code class="code">-mstm</code></dt> <dt><code class="code">-mno-multiple-stld</code></dt> <dt><code class="code">-mno-stm</code></dt> <dd> +<p>Generate code using <code class="code">stm</code> and <code class="code">ldm</code> instructions. This option isn’t supported on CK801 but is enabled by default on other processors. </p> </dd> <dt> +<span><code class="code">-mconstpool</code><a class="copiable-link" href="#index-mconstpool"> ¶</a></span> +</dt> <dt><code class="code">-mno-constpool</code></dt> <dd> +<p>Create constant pools in the compiler instead of deferring it to the assembler. This option is the default and required for correct code generation on CK801 and CK802, and is optional on other processors. </p> </dd> <dt> +<span><code class="code">-mstack-size</code><a class="copiable-link" href="#index-mstack-size-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-stack-size</code></dt> <dd> +<p>Emit <code class="code">.stack_size</code> directives for each function in the assembly output. This option defaults to off. </p> </dd> <dt> +<span><code class="code">-mccrt</code><a class="copiable-link" href="#index-mccrt"> ¶</a></span> +</dt> <dt><code class="code">-mno-ccrt</code></dt> <dd> +<p>Generate code for the C-SKY compiler runtime instead of libgcc. This option defaults to off. </p> </dd> <dt> +<span><code class="code">-mbranch-cost=<var class="var">n</var></code><a class="copiable-link" href="#index-mbranch-cost_003d"> ¶</a></span> +</dt> <dd> +<p>Set the branch costs to roughly <code class="code">n</code> instructions. The default is 1. </p> </dd> <dt> +<span><code class="code">-msched-prolog</code><a class="copiable-link" href="#index-msched-prolog-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-sched-prolog</code></dt> <dd> +<p>Permit scheduling of function prologue and epilogue sequences. Using this option can result in code that is not compliant with the C-SKY V2 ABI prologue requirements and that cannot be debugged or backtraced. It is disabled by default. </p> </dd> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-2"> ¶</a></span> +</dt> <dd> +<p>Links the library libsemi.a which is in compatible with simulator. Applicable to ELF compiler only. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="darwin-options">Darwin Options</a>, Previous: <a href="cris-options">CRIS Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-SKY-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-SKY-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c6x-options.html b/devdocs/gcc~13/c6x-options.html new file mode 100644 index 00000000..8df79b54 --- /dev/null +++ b/devdocs/gcc~13/c6x-options.html @@ -0,0 +1,26 @@ +<div class="subsection-level-extent" id="C6X-Options"> <div class="nav-panel"> <p> Next: <a href="cris-options" accesskey="n" rel="next">CRIS Options</a>, Previous: <a href="blackfin-options" accesskey="p" rel="prev">Blackfin Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="C6X-Options-1"><span>3.19.8 C6X Options<a class="copiable-link" href="#C6X-Options-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">-march=<var class="var">name</var></code><a class="copiable-link" href="#index-march-3"> ¶</a></span> +</dt> <dd> +<p>This specifies the name of the target architecture. GCC uses this name to determine what kind of instructions it can emit when generating assembly code. Permissible names are: ‘<samp class="samp">c62x</samp>’, ‘<samp class="samp">c64x</samp>’, ‘<samp class="samp">c64x+</samp>’, ‘<samp class="samp">c67x</samp>’, ‘<samp class="samp">c67x+</samp>’, ‘<samp class="samp">c674x</samp>’. </p> </dd> <dt> +<span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian-3"> ¶</a></span> +</dt> <dd> +<p>Generate code for a big-endian target. </p> </dd> <dt> +<span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian-3"> ¶</a></span> +</dt> <dd> +<p>Generate code for a little-endian target. This is the default. </p> </dd> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-1"> ¶</a></span> +</dt> <dd> +<p>Choose startup files and linker script suitable for the simulator. </p> </dd> <dt> +<span><code class="code">-msdata=default</code><a class="copiable-link" href="#index-msdata_003ddefault"> ¶</a></span> +</dt> <dd> +<p>Put small global and static data in the <code class="code">.neardata</code> section, which is pointed to by register <code class="code">B14</code>. Put small uninitialized global and static data in the <code class="code">.bss</code> section, which is adjacent to the <code class="code">.neardata</code> section. Put small read-only data into the <code class="code">.rodata</code> section. The corresponding sections used for large pieces of data are <code class="code">.fardata</code>, <code class="code">.far</code> and <code class="code">.const</code>. </p> </dd> <dt> +<span><code class="code">-msdata=all</code><a class="copiable-link" href="#index-msdata_003dall"> ¶</a></span> +</dt> <dd> +<p>Put all data, not just small objects, into the sections reserved for small data, and use addressing relative to the <code class="code">B14</code> register to access them. </p> </dd> <dt> +<span><code class="code">-msdata=none</code><a class="copiable-link" href="#index-msdata_003dnone"> ¶</a></span> +</dt> <dd><p>Make no use of the sections reserved for small data, and use absolute addresses to access all data. Put all initialized global and static data in the <code class="code">.fardata</code> section, and all uninitialized data in the <code class="code">.far</code> section. Put all constant data into the <code class="code">.const</code> section. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="cris-options">CRIS Options</a>, Previous: <a href="blackfin-options">Blackfin Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C6X-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C6X-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c99-like-fast-enumeration-syntax.html b/devdocs/gcc~13/c99-like-fast-enumeration-syntax.html new file mode 100644 index 00000000..3bae2368 --- /dev/null +++ b/devdocs/gcc~13/c99-like-fast-enumeration-syntax.html @@ -0,0 +1,21 @@ +<div class="subsection-level-extent" id="c99-like-fast-enumeration-syntax"> <div class="nav-panel"> <p> Next: <a href="fast-enumeration-details" accesskey="n" rel="next">Fast Enumeration Details</a>, Previous: <a href="using-fast-enumeration" accesskey="p" rel="prev">Using Fast Enumeration</a>, Up: <a href="fast-enumeration" accesskey="u" rel="up">Fast Enumeration</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="C99-Like-Fast-Enumeration-Syntax"><span>8.9.2 C99-Like Fast Enumeration Syntax<a class="copiable-link" href="#C99-Like-Fast-Enumeration-Syntax"> ¶</a></span></h1> <p>A c99-like declaration syntax is also allowed: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">id array = …; + +for (id object in array) +{ + /* Do something with 'object' */ +}</pre> +</div> <p>this is completely equivalent to: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">id array = …; + +{ + id object; + for (object in array) + { + /* Do something with 'object' */ + } +}</pre> +</div> <p>but can save some typing. </p> <p>Note that the option <samp class="option">-std=c99</samp> is not required to allow this syntax in Objective-C. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/c99-like-fast-enumeration-syntax.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/c99-like-fast-enumeration-syntax.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c99-thread-local-edits.html b/devdocs/gcc~13/c99-thread-local-edits.html new file mode 100644 index 00000000..255becf5 --- /dev/null +++ b/devdocs/gcc~13/c99-thread-local-edits.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="C99-Thread-Local-Edits"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b98-thread-local-edits" accesskey="n" rel="next">ISO/IEC 14882:1998 Edits for Thread-Local Storage</a>, Up: <a href="thread-local" accesskey="u" rel="up">Thread-Local Storage</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ISO_002fIEC-9899_003a1999-Edits-for-Thread-Local-Storage"><span>6.64.1 ISO/IEC 9899:1999 Edits for Thread-Local Storage<a class="copiable-link" href="#ISO_002fIEC-9899_003a1999-Edits-for-Thread-Local-Storage"> ¶</a></span></h1> <p>The following are a set of changes to ISO/IEC 9899:1999 (aka C99) that document the exact semantics of the language extension. </p> <ul class="itemize mark-bullet"> <li>5.1.2 Execution environments <p>Add new text after paragraph 1 </p> <blockquote class="quotation"> <p>Within either execution environment, a <em class="dfn">thread</em> is a flow of control within a program. It is implementation defined whether or not there may be more than one thread associated with a program. It is implementation defined how threads beyond the first are created, the name and type of the function called at thread startup, and how threads may be terminated. However, objects with thread storage duration shall be initialized before thread startup. </p> +</blockquote> </li> +<li>6.2.4 Storage durations of objects <p>Add new text before paragraph 3 </p> <blockquote class="quotation"> <p>An object whose identifier is declared with the storage-class specifier <code class="code">__thread</code> has <em class="dfn">thread storage duration</em>. Its lifetime is the entire execution of the thread, and its stored value is initialized only once, prior to thread startup. </p> +</blockquote> </li> +<li>6.4.1 Keywords <p>Add <code class="code">__thread</code>. </p> </li> +<li>6.7.1 Storage-class specifiers <p>Add <code class="code">__thread</code> to the list of storage class specifiers in paragraph 1. </p> <p>Change paragraph 2 to </p> <blockquote class="quotation"> <p>With the exception of <code class="code">__thread</code>, at most one storage-class specifier may be given […]. The <code class="code">__thread</code> specifier may be used alone, or immediately following <code class="code">extern</code> or <code class="code">static</code>. </p> +</blockquote> <p>Add new text after paragraph 6 </p> <blockquote class="quotation"> <p>The declaration of an identifier for a variable that has block scope that specifies <code class="code">__thread</code> shall also specify either <code class="code">extern</code> or <code class="code">static</code>. </p> <p>The <code class="code">__thread</code> specifier shall be used only with variables. </p> +</blockquote> </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="c_002b_002b98-thread-local-edits">ISO/IEC 14882:1998 Edits for Thread-Local Storage</a>, Up: <a href="thread-local">Thread-Local Storage</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C99-Thread-Local-Edits.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C99-Thread-Local-Edits.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-attributes.html b/devdocs/gcc~13/c_002b_002b-attributes.html new file mode 100644 index 00000000..b842366d --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-attributes.html @@ -0,0 +1,15 @@ +<div class="section-level-extent" id="C_002b_002b-Attributes"> <div class="nav-panel"> <p> Next: <a href="function-multiversioning" accesskey="n" rel="next">Function Multiversioning</a>, Previous: <a href="bound-member-functions" accesskey="p" rel="prev">Extracting the Function Pointer from a Bound Pointer to Member Function</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="C_002b_002b-Specific-Variable_002c-Function_002c-and-Type-Attributes"><span>7.7 C++-Specific Variable, Function, and Type Attributes<a class="copiable-link" href="#C_002b_002b-Specific-Variable_002c-Function_002c-and-Type-Attributes"> ¶</a></span></h1> <p>Some attributes only make sense for C++ programs. </p> <dl class="table"> <dt> + <span><code class="code">abi_tag ("<var class="var">tag</var>", ...)</code><a class="copiable-link" href="#index-abi_005ftag-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">abi_tag</code> attribute can be applied to a function, variable, or class declaration. It modifies the mangled name of the entity to incorporate the tag name, in order to distinguish the function or class from an earlier version with a different ABI; perhaps the class has changed size, or the function has a different return type that is not encoded in the mangled name. </p> <p>The attribute can also be applied to an inline namespace, but does not affect the mangled name of the namespace; in this case it is only used for <samp class="option">-Wabi-tag</samp> warnings and automatic tagging of functions and variables. Tagging inline namespaces is generally preferable to tagging individual declarations, but the latter is sometimes necessary, such as when only certain members of a class need to be tagged. </p> <p>The argument can be a list of strings of arbitrary length. The strings are sorted on output, so the order of the list is unimportant. </p> <p>A redeclaration of an entity must not add new ABI tags, since doing so would change the mangled name. </p> <p>The ABI tags apply to a name, so all instantiations and specializations of a template have the same tags. The attribute will be ignored if applied to an explicit specialization or instantiation. </p> <p>The <samp class="option">-Wabi-tag</samp> flag enables a warning about a class which does not have all the ABI tags used by its subobjects and virtual functions; for users with code that needs to coexist with an earlier ABI, using this option can help to find all affected types that need to be tagged. </p> <p>When a type involving an ABI tag is used as the type of a variable or return type of a function where that tag is not already present in the signature of the function, the tag is automatically applied to the variable or function. <samp class="option">-Wabi-tag</samp> also warns about this situation; this warning can be avoided by explicitly tagging the variable or function or moving it into a tagged inline namespace. </p> </dd> <dt> +<span><code class="code">init_priority (<var class="var">priority</var>)</code><a class="copiable-link" href="#index-init_005fpriority-variable-attribute"> ¶</a></span> +</dt> <dd> <p>In Standard C++, objects defined at namespace scope are guaranteed to be initialized in an order in strict accordance with that of their definitions <em class="emph">in a given translation unit</em>. No guarantee is made for initializations across translation units. However, GNU C++ allows users to control the order of initialization of objects defined at namespace scope with the <code class="code">init_priority</code> attribute by specifying a relative <var class="var">priority</var>, a constant integral expression currently bounded between 101 and 65535 inclusive. Lower numbers indicate a higher priority. </p> <p>In the following example, <code class="code">A</code> would normally be created before <code class="code">B</code>, but the <code class="code">init_priority</code> attribute reverses that order: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">Some_Class A __attribute__ ((init_priority (2000))); +Some_Class B __attribute__ ((init_priority (543)));</pre> +</div> <p>Note that the particular values of <var class="var">priority</var> do not matter; only their relative ordering. </p> </dd> <dt> +<span><code class="code">warn_unused</code><a class="copiable-link" href="#index-warn_005funused-type-attribute"> ¶</a></span> +</dt> <dd> <p>For C++ types with non-trivial constructors and/or destructors it is impossible for the compiler to determine whether a variable of this type is truly unused if it is not referenced. This type attribute informs the compiler that variables of this type should be warned about if they appear to be unused, just like variables of fundamental types. </p> <p>This attribute is appropriate for types which just represent a value, such as <code class="code">std::string</code>; it is not appropriate for types which control a resource, such as <code class="code">std::lock_guard</code>. </p> <p>This attribute is also accepted in C, but it is unnecessary because C does not have constructors or destructors. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="function-multiversioning">Function Multiversioning</a>, Previous: <a href="bound-member-functions">Extracting the Function Pointer from a Bound Pointer to Member Function</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-comments.html b/devdocs/gcc~13/c_002b_002b-comments.html new file mode 100644 index 00000000..e3ec1d4a --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-comments.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="C_002b_002b-Comments"> <div class="nav-panel"> <p> Next: <a href="dollar-signs" accesskey="n" rel="next">Dollar Signs in Identifier Names</a>, Previous: <a href="function-prototypes" accesskey="p" rel="prev">Prototypes and Old-Style Function Definitions</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="C_002b_002b-Style-Comments"><span>6.41 C++ Style Comments<a class="copiable-link" href="#C_002b_002b-Style-Comments"> ¶</a></span></h1> <p>In GNU C, you may use C++ style comments, which start with ‘<samp class="samp">//</samp>’ and continue until the end of the line. Many other C implementations allow such comments, and they are included in the 1999 C standard. However, C++ style comments are not recognized if you specify an <samp class="option">-std</samp> option specifying a version of ISO C before C99, or <samp class="option">-ansi</samp> (equivalent to <samp class="option">-std=c90</samp>). </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Comments.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Comments.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-compiled-module-interface.html b/devdocs/gcc~13/c_002b_002b-compiled-module-interface.html new file mode 100644 index 00000000..26b68822 --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-compiled-module-interface.html @@ -0,0 +1,20 @@ +<div class="subsection-level-extent" id="C_002b_002b-Compiled-Module-Interface"> <div class="nav-panel"> <p> Previous: <a href="c_002b_002b-module-preprocessing" accesskey="p" rel="prev">Module Preprocessing</a>, Up: <a href="c_002b_002b-modules" accesskey="u" rel="up">C++ Modules</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Compiled-Module-Interface"><span>3.23.3 Compiled Module Interface<a class="copiable-link" href="#Compiled-Module-Interface"> ¶</a></span></h1> <p>CMIs are an additional artifact when compiling named module interfaces, partitions or header units. These are read when importing. CMI contents are implementation-specific, and in GCC’s case tied to the compiler version. Consider them a rebuildable cache artifact, not a distributable object. </p> <p>When creating an output CMI, any missing directory components are created in a manner that is safe for concurrent builds creating multiple, different, CMIs within a common subdirectory tree. </p> <p>CMI contents are written to a temporary file, which is then atomically renamed. Observers either see old contents (if there is an existing file), or complete new contents. They do not observe the CMI during its creation. This is unlike object file writing, which may be observed by an external process. </p> <p>CMIs are read in lazily, if the host OS provides <code class="code">mmap</code> functionality. Generally blocks are read when name lookup or template instantiation occurs. To inhibit this, the <samp class="option">-fno-module-lazy</samp> option may be used. </p> <p>The <samp class="option">--param lazy-modules=<var class="var">n</var></samp> parameter controls the limit on the number of concurrently open module files during lazy loading. Should more modules be imported, an LRU algorithm is used to determine which files to close—until that file is needed again. This limit may be exceeded with deep module dependency hierarchies. With large code bases there may be more imports than the process limit of file descriptors. By default, the limit is a few less than the per-process file descriptor hard limit, if that is determinable.<a class="footnote" id="DOCF3" href="#FOOT3"><sup>3</sup></a> </p> <p>GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism. You may use <code class="command">readelf</code> to inspect them, although section contents are largely undecipherable. There is a section named <code class="code">.gnu.c++.README</code>, which contains human-readable text. Other than the first line, each line consists of <code class="code"><var class="var">tag</var>: <code class="code">value</code></code> tuples. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">> <code class="command">readelf -p.gnu.c++.README gcm.cache/foo.gcm</code> + +String dump of section '.gnu.c++.README': + [ 0] GNU C++ primary module interface + [ 21] compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454] + [ 6f] version: 2020/11/16-04:54 + [ 89] module: foo + [ 95] source: c_b.ii + [ a4] dialect: C++20/coroutines + [ be] cwd: /data/users/nathans/modules/obj/x86_64/gcc + [ ee] repository: gcm.cache + [ 104] buildtime: 2020/11/16 15:03:21 UTC + [ 127] localtime: 2020/11/16 07:03:21 PST + [ 14a] export: foo:part1 foo-part1.gcm</pre> +</div> <p>Amongst other things, this lists the source that was built, C++ dialect used and imports of the module.<a class="footnote" id="DOCF4" href="#FOOT4"><sup>4</sup></a> The timestamp is the same value as that provided by the <code class="code">__DATE__</code> & <code class="code">__TIME__</code> macros, and may be explicitly specified with the environment variable <code class="code">SOURCE_DATE_EPOCH</code>. For further details see <a class="pxref" href="environment-variables">Environment Variables Affecting GCC</a>. </p> <p>A set of related CMIs may be copied, provided the relative pathnames are preserved. </p> <p>The <code class="code">.gnu.c++.README</code> contents do not affect CMI integrity, and it may be removed or altered. The section numbering of the sections whose names do not begin with <code class="code">.gnu.c++.</code>, or are not the string section is significant and must not be altered. </p> </div> <div class="footnotes-segment"> <h1 class="footnotes-heading">Footnotes</h1> <h2 class="footnote-body-heading"><a id="FOOT3" href="#DOCF3">(3)</a></h2> <p>Where applicable the soft limit is incremented as needed towards the hard limit.</p> <h2 class="footnote-body-heading"><a id="FOOT4" href="#DOCF4">(4)</a></h2> <p>The precise contents of this output may change.</p> </div> <div class="nav-panel"> <p> Previous: <a href="c_002b_002b-module-preprocessing">Module Preprocessing</a>, Up: <a href="c_002b_002b-modules">C++ Modules</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Compiled-Module-Interface.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Compiled-Module-Interface.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-concepts.html b/devdocs/gcc~13/c_002b_002b-concepts.html new file mode 100644 index 00000000..f8fbb16e --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-concepts.html @@ -0,0 +1,23 @@ +<div class="section-level-extent" id="C_002b_002b-Concepts"> <div class="nav-panel"> <p> Next: <a href="deprecated-features" accesskey="n" rel="next">Deprecated Features</a>, Previous: <a href="type-traits" accesskey="p" rel="prev">Type Traits</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="C_002b_002b-Concepts-1"><span>7.10 C++ Concepts<a class="copiable-link" href="#C_002b_002b-Concepts-1"> ¶</a></span></h1> <p>C++ concepts provide much-improved support for generic programming. In particular, they allow the specification of constraints on template arguments. The constraints are used to extend the usual overloading and partial specialization capabilities of the language, allowing generic data structures and algorithms to be “refined” based on their properties rather than their type names. </p> <p>The following keywords are reserved for concepts. </p> <dl class="table"> <dt> +<span><code class="code">assumes</code><a class="copiable-link" href="#index-assumes"> ¶</a></span> +</dt> <dd> +<p>States an expression as an assumption, and if possible, verifies that the assumption is valid. For example, <code class="code">assume(n > 0)</code>. </p> </dd> <dt> +<span><code class="code">axiom</code><a class="copiable-link" href="#index-axiom"> ¶</a></span> +</dt> <dd> +<p>Introduces an axiom definition. Axioms introduce requirements on values. </p> </dd> <dt> +<span><code class="code">forall</code><a class="copiable-link" href="#index-axiom-1"> ¶</a></span> +</dt> <dd> +<p>Introduces a universally quantified object in an axiom. For example, <code class="code">forall (int n) n + 0 == n</code>). </p> </dd> <dt> +<span><code class="code">concept</code><a class="copiable-link" href="#index-axiom-2"> ¶</a></span> +</dt> <dd> +<p>Introduces a concept definition. Concepts are sets of syntactic and semantic requirements on types and their values. </p> </dd> <dt> +<span><code class="code">requires</code><a class="copiable-link" href="#index-requires"> ¶</a></span> +</dt> <dd><p>Introduces constraints on template arguments or requirements for a member function of a class template. </p></dd> </dl> <p>The front end also exposes a number of internal mechanism that can be used to simplify the writing of type traits. Note that some of these traits are likely to be removed in the future. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fsame"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_same</strong> <code class="def-code-arguments">(<var class="var">type1</var>, <var class="var">type2</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fsame"> ¶</a></span> +</dt> <dd><p>A binary type trait: <code class="code">true</code> whenever the <var class="var">type1</var> and <var class="var">type2</var> refer to the same type. </p></dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="deprecated-features">Deprecated Features</a>, Previous: <a href="type-traits">Type Traits</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Concepts.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Concepts.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-dialect-options.html b/devdocs/gcc~13/c_002b_002b-dialect-options.html new file mode 100644 index 00000000..14190366 --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-dialect-options.html @@ -0,0 +1,620 @@ +<div class="section-level-extent" id="C_002b_002b-Dialect-Options"> <div class="nav-panel"> <p> Next: <a href="objective-c-and-objective-c_002b_002b-dialect-options" accesskey="n" rel="next">Options Controlling Objective-C and Objective-C++ Dialects</a>, Previous: <a href="c-dialect-options" accesskey="p" rel="prev">Options Controlling C Dialect</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-Controlling-C_002b_002b-Dialect"><span>3.5 Options Controlling C++ Dialect<a class="copiable-link" href="#Options-Controlling-C_002b_002b-Dialect"> ¶</a></span></h1> <p>This section describes the command-line options that are only meaningful for C++ programs. You can also use most of the GNU compiler options regardless of what language your program is in. For example, you might compile a file <samp class="file">firstClass.C</samp> like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">g++ -g -fstrict-enums -O -c firstClass.C</pre> +</div> <p>In this example, only <samp class="option">-fstrict-enums</samp> is an option meant only for C++ programs; you can use the other options with any language supported by GCC. </p> <p>Some options for compiling C programs, such as <samp class="option">-std</samp>, are also relevant for C++ programs. See <a class="xref" href="c-dialect-options">Options Controlling C Dialect</a>. </p> <p>Here is a list of options that are <em class="emph">only</em> for compiling C++ programs: </p> <dl class="table"> <dt> +<span><code class="code">-fabi-version=<var class="var">n</var></code><a class="copiable-link" href="#index-fabi-version"> ¶</a></span> +</dt> <dd> +<p>Use version <var class="var">n</var> of the C++ ABI. The default is version 0. </p> <p>Version 0 refers to the version conforming most closely to the C++ ABI specification. Therefore, the ABI obtained using version 0 will change in different versions of G++ as ABI bugs are fixed. </p> <p>Version 1 is the version of the C++ ABI that first appeared in G++ 3.2. </p> <p>Version 2 is the version of the C++ ABI that first appeared in G++ 3.4, and was the default through G++ 4.9. </p> <p>Version 3 corrects an error in mangling a constant address as a template argument. </p> <p>Version 4, which first appeared in G++ 4.5, implements a standard mangling for vector types. </p> <p>Version 5, which first appeared in G++ 4.6, corrects the mangling of attribute const/volatile on function pointer types, decltype of a plain decl, and use of a function parameter in the declaration of another parameter. </p> <p>Version 6, which first appeared in G++ 4.7, corrects the promotion behavior of C++11 scoped enums and the mangling of template argument packs, const/static_cast, prefix ++ and –, and a class scope function used as a template argument. </p> <p>Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a builtin type and corrects the mangling of lambdas in default argument scope. </p> <p>Version 8, which first appeared in G++ 4.9, corrects the substitution behavior of function types with function-cv-qualifiers. </p> <p>Version 9, which first appeared in G++ 5.2, corrects the alignment of <code class="code">nullptr_t</code>. </p> <p>Version 10, which first appeared in G++ 6.1, adds mangling of attributes that affect type identity, such as ia32 calling convention attributes (e.g. ‘<samp class="samp">stdcall</samp>’). </p> <p>Version 11, which first appeared in G++ 7, corrects the mangling of sizeof... expressions and operator names. For multiple entities with the same name within a function, that are declared in different scopes, the mangling now changes starting with the twelfth occurrence. It also implies <samp class="option">-fnew-inheriting-ctors</samp>. </p> <p>Version 12, which first appeared in G++ 8, corrects the calling conventions for empty classes on the x86_64 target and for classes with only deleted copy/move constructors. It accidentally changes the calling convention for classes with a deleted copy constructor and a trivial move constructor. </p> <p>Version 13, which first appeared in G++ 8.2, fixes the accidental change in version 12. </p> <p>Version 14, which first appeared in G++ 10, corrects the mangling of the nullptr expression. </p> <p>Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI tag regression. </p> <p>Version 16, which first appeared in G++ 11, changes the mangling of <code class="code">__alignof__</code> to be distinct from that of <code class="code">alignof</code>, and dependent operator names. </p> <p>Version 17, which first appeared in G++ 12, fixes layout of classes that inherit from aggregate classes with default member initializers in C++14 and up. </p> <p>Version 18, which first appeard in G++ 13, fixes manglings of lambdas that have additional context. </p> <p>See also <samp class="option">-Wabi</samp>. </p> </dd> <dt> +<span><code class="code">-fabi-compat-version=<var class="var">n</var></code><a class="copiable-link" href="#index-fabi-compat-version"> ¶</a></span> +</dt> <dd> +<p>On targets that support strong aliases, G++ works around mangling changes by creating an alias with the correct mangled name when defining a symbol with an incorrect mangled name. This switch specifies which ABI version to use for the alias. </p> <p>With <samp class="option">-fabi-version=0</samp> (the default), this defaults to 13 (GCC 8.2 compatibility). If another ABI version is explicitly selected, this defaults to 0. For compatibility with GCC versions 3.2 through 4.9, use <samp class="option">-fabi-compat-version=2</samp>. </p> <p>If this option is not provided but <samp class="option">-Wabi=<var class="var">n</var></samp> is, that version is used for compatibility aliases. If this option is provided along with <samp class="option">-Wabi</samp> (without the version), the version from this option is used for the warning. </p> </dd> <dt> + <span><code class="code">-fno-access-control</code><a class="copiable-link" href="#index-fno-access-control"> ¶</a></span> +</dt> <dd> +<p>Turn off all access checking. This switch is mainly useful for working around bugs in the access control code. </p> </dd> <dt> +<span><code class="code">-faligned-new</code><a class="copiable-link" href="#index-faligned-new"> ¶</a></span> +</dt> <dd> +<p>Enable support for C++17 <code class="code">new</code> of types that require more alignment than <code class="code">void* ::operator new(std::size_t)</code> provides. A numeric argument such as <code class="code">-faligned-new=32</code> can be used to specify how much alignment (in bytes) is provided by that function, but few users will need to override the default of <code class="code">alignof(std::max_align_t)</code>. </p> <p>This flag is enabled by default for <samp class="option">-std=c++17</samp>. </p> </dd> <dt> + <span><code class="code">-fchar8_t</code><a class="copiable-link" href="#index-fchar8_005ft"> ¶</a></span> +</dt> <dt><code class="code">-fno-char8_t</code></dt> <dd> +<p>Enable support for <code class="code">char8_t</code> as adopted for C++20. This includes the addition of a new <code class="code">char8_t</code> fundamental type, changes to the types of UTF-8 string and character literals, new signatures for user-defined literals, associated standard library updates, and new <code class="code">__cpp_char8_t</code> and <code class="code">__cpp_lib_char8_t</code> feature test macros. </p> <p>This option enables functions to be overloaded for ordinary and UTF-8 strings: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int f(const char *); // #1 +int f(const char8_t *); // #2 +int v1 = f("text"); // Calls #1 +int v2 = f(u8"text"); // Calls #2</pre> +</div> <p>and introduces new signatures for user-defined literals: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int operator""_udl1(char8_t); +int v3 = u8'x'_udl1; +int operator""_udl2(const char8_t*, std::size_t); +int v4 = u8"text"_udl2; +template<typename T, T...> int operator""_udl3(); +int v5 = u8"text"_udl3;</pre> +</div> <p>The change to the types of UTF-8 string and character literals introduces incompatibilities with ISO C++11 and later standards. For example, the following code is well-formed under ISO C++11, but is ill-formed when <samp class="option">-fchar8_t</samp> is specified. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">const char *cp = u8"xx";// error: invalid conversion from + // `const char8_t*' to `const char*' +int f(const char*); +auto v = f(u8"xx"); // error: invalid conversion from + // `const char8_t*' to `const char*' +std::string s{u8"xx"}; // error: no matching function for call to + // `std::basic_string<char>::basic_string()' +using namespace std::literals; +s = u8"xx"s; // error: conversion from + // `basic_string<char8_t>' to non-scalar + // type `basic_string<char>' requested</pre> +</div> </dd> <dt> +<span><code class="code">-fcheck-new</code><a class="copiable-link" href="#index-fcheck-new"> ¶</a></span> +</dt> <dd> +<p>Check that the pointer returned by <code class="code">operator new</code> is non-null before attempting to modify the storage allocated. This check is normally unnecessary because the C++ standard specifies that <code class="code">operator new</code> only returns <code class="code">0</code> if it is declared <code class="code">throw()</code>, in which case the compiler always checks the return value even without this option. In all other cases, when <code class="code">operator new</code> has a non-empty exception specification, memory exhaustion is signalled by throwing <code class="code">std::bad_alloc</code>. See also ‘<samp class="samp">new (nothrow)</samp>’. </p> </dd> <dt> + <span><code class="code">-fconcepts</code><a class="copiable-link" href="#index-fconcepts"> ¶</a></span> +</dt> <dt><code class="code">-fconcepts-ts</code></dt> <dd> +<p>Enable support for the C++ Concepts feature for constraining template arguments. With <samp class="option">-std=c++20</samp> and above, Concepts are part of the language standard, so <samp class="option">-fconcepts</samp> defaults to on. </p> <p>Some constructs that were allowed by the earlier C++ Extensions for Concepts Technical Specification, ISO 19217 (2015), but didn’t make it into the standard, can additionally be enabled by <samp class="option">-fconcepts-ts</samp>. </p> </dd> <dt> +<span><code class="code">-fconstexpr-depth=<var class="var">n</var></code><a class="copiable-link" href="#index-fconstexpr-depth"> ¶</a></span> +</dt> <dd> +<p>Set the maximum nested evaluation depth for C++11 constexpr functions to <var class="var">n</var>. A limit is needed to detect endless recursion during constant expression evaluation. The minimum specified by the standard is 512. </p> </dd> <dt> +<span><code class="code">-fconstexpr-cache-depth=<var class="var">n</var></code><a class="copiable-link" href="#index-fconstexpr-cache-depth"> ¶</a></span> +</dt> <dd> +<p>Set the maximum level of nested evaluation depth for C++11 constexpr functions that will be cached to <var class="var">n</var>. This is a heuristic that trades off compilation speed (when the cache avoids repeated calculations) against memory consumption (when the cache grows very large from highly recursive evaluations). The default is 8. Very few users are likely to want to adjust it, but if your code does heavy constexpr calculations you might want to experiment to find which value works best for you. </p> </dd> <dt> +<span><code class="code">-fconstexpr-fp-except</code><a class="copiable-link" href="#index-fconstexpr-fp-except"> ¶</a></span> +</dt> <dd> +<p>Annex F of the C standard specifies that IEC559 floating point exceptions encountered at compile time should not stop compilation. C++ compilers have historically not followed this guidance, instead treating floating point division by zero as non-constant even though it has a well defined value. This flag tells the compiler to give Annex F priority over other rules saying that a particular operation is undefined. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except</pre> +</div> </dd> <dt> +<span><code class="code">-fconstexpr-loop-limit=<var class="var">n</var></code><a class="copiable-link" href="#index-fconstexpr-loop-limit"> ¶</a></span> +</dt> <dd> +<p>Set the maximum number of iterations for a loop in C++14 constexpr functions to <var class="var">n</var>. A limit is needed to detect infinite loops during constant expression evaluation. The default is 262144 (1<<18). </p> </dd> <dt> +<span><code class="code">-fconstexpr-ops-limit=<var class="var">n</var></code><a class="copiable-link" href="#index-fconstexpr-ops-limit"> ¶</a></span> +</dt> <dd> +<p>Set the maximum number of operations during a single constexpr evaluation. Even when number of iterations of a single loop is limited with the above limit, if there are several nested loops and each of them has many iterations but still smaller than the above limit, or if in a body of some loop or even outside of a loop too many expressions need to be evaluated, the resulting constexpr evaluation might take too long. The default is 33554432 (1<<25). </p> </dd> <dt> +<span><code class="code">-fcontracts</code><a class="copiable-link" href="#index-fcontracts"> ¶</a></span> +</dt> <dd> +<p>Enable experimental support for the C++ Contracts feature, as briefly added to and then removed from the C++20 working paper (N4820). The implementation also includes proposed enhancements from papers P1290, P1332, and P1429. This functionality is intended mostly for those interested in experimentation towards refining the feature to get it into shape for a future C++ standard. </p> <p>On violation of a checked contract, the violation handler is called. Users can replace the violation handler by defining </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void +handle_contract_violation (const std::experimental::contract_violation&);</pre> +</div> <p>There are different sets of additional flags that can be used together to specify which contracts will be checked and how, for N4820 contracts, P1332 contracts, or P1429 contracts; these sets cannot be used together. </p> <dl class="table"> <dt> +<span><code class="code">-fcontract-mode=[on|off]</code><a class="copiable-link" href="#index-fcontract-mode"> ¶</a></span> +</dt> <dd> +<p>Control whether any contracts have any semantics at all. Defaults to on. </p> </dd> <dt> +<span><code class="code">-fcontract-assumption-mode=[on|off]</code><a class="copiable-link" href="#index-fcontract-assumption-mode"> ¶</a></span> +</dt> <dd> +<p>[N4820] Control whether contracts with level ‘<samp class="samp">axiom</samp>’ should have the assume semantic. Defaults to on. </p> </dd> <dt> +<span><code class="code">-fcontract-build-level=[off|default|audit]</code><a class="copiable-link" href="#index-fcontract-build-level"> ¶</a></span> +</dt> <dd> +<p>[N4820] Specify which level of contracts to generate checks for. Defaults to ‘<samp class="samp">default</samp>’. </p> </dd> <dt> +<span><code class="code">-fcontract-continuation-mode=[on|off]</code><a class="copiable-link" href="#index-fcontract-continuation-mode"> ¶</a></span> +</dt> <dd> +<p>[N4820] Control whether to allow the program to continue executing after a contract violation. That is, do checked contracts have the ‘<samp class="samp">maybe</samp>’ semantic described below rather than the ‘<samp class="samp">never</samp>’ semantic. Defaults to off. </p> </dd> <dt> +<span><code class="code">-fcontract-role=<name>:<default>,<audit>,<axiom></code><a class="copiable-link" href="#index-fcontract-role"> ¶</a></span> +</dt> <dd> +<p>[P1332] Specify the concrete semantics for each contract level of a particular contract role. </p> </dd> <dt><code class="code">-fcontract-semantic=[default|audit|axiom]:<semantic></code></dt> <dd> +<p>[P1429] Specify the concrete semantic for a particular contract level. </p> </dd> <dt> +<span><code class="code">-fcontract-strict-declarations=[on|off]</code><a class="copiable-link" href="#index-fcontract-strict-declarations"> ¶</a></span> +</dt> <dd><p>Control whether to reject adding contracts to a function after its first declaration. Defaults to off. </p></dd> </dl> <p>The possible concrete semantics for that can be specified with ‘<samp class="samp">-fcontract-role</samp>’ or ‘<samp class="samp">-fcontract-semantic</samp>’ are: </p> <dl class="table"> <dt><code class="code">ignore</code></dt> <dd> +<p>This contract has no effect. </p> </dd> <dt><code class="code">assume</code></dt> <dd> +<p>This contract is treated like C++23 <code class="code">[[assume]]</code>. </p> </dd> <dt><code class="code">check_never_continue</code></dt> <dt><code class="code">never</code></dt> <dt><code class="code">abort</code></dt> <dd> +<p>This contract is checked. If it fails, the violation handler is called. If the handler returns, <code class="code">std::terminate</code> is called. </p> </dd> <dt><code class="code">check_maybe_continue</code></dt> <dt><code class="code">maybe</code></dt> <dd><p>This contract is checked. If it fails, the violation handler is called. If the handler returns, execution continues normally. </p></dd> </dl> </dd> <dt> +<span><code class="code">-fcoroutines</code><a class="copiable-link" href="#index-fcoroutines"> ¶</a></span> +</dt> <dd> +<p>Enable support for the C++ coroutines extension (experimental). </p> </dd> <dt> + <span><code class="code">-fno-elide-constructors</code><a class="copiable-link" href="#index-fno-elide-constructors"> ¶</a></span> +</dt> <dd> +<p>The C++ standard allows an implementation to omit creating a temporary that is only used to initialize another object of the same type. Specifying this option disables that optimization, and forces G++ to call the copy constructor in all cases. This option also causes G++ to call trivial member functions which otherwise would be expanded inline. </p> <p>In C++17, the compiler is required to omit these temporaries, but this option still affects trivial member functions. </p> </dd> <dt> + <span><code class="code">-fno-enforce-eh-specs</code><a class="copiable-link" href="#index-fno-enforce-eh-specs"> ¶</a></span> +</dt> <dd> +<p>Don’t generate code to check for violation of exception specifications at run time. This option violates the C++ standard, but may be useful for reducing code size in production builds, much like defining <code class="code">NDEBUG</code>. This does not give user code permission to throw exceptions in violation of the exception specifications; the compiler still optimizes based on the specifications, so throwing an unexpected exception results in undefined behavior at run time. </p> </dd> <dt> + <span><code class="code">-fextern-tls-init</code><a class="copiable-link" href="#index-fextern-tls-init"> ¶</a></span> +</dt> <dt><code class="code">-fno-extern-tls-init</code></dt> <dd> +<p>The C++11 and OpenMP standards allow <code class="code">thread_local</code> and <code class="code">threadprivate</code> variables to have dynamic (runtime) initialization. To support this, any use of such a variable goes through a wrapper function that performs any necessary initialization. When the use and definition of the variable are in the same translation unit, this overhead can be optimized away, but when the use is in a different translation unit there is significant overhead even if the variable doesn’t actually need dynamic initialization. If the programmer can be sure that no use of the variable in a non-defining TU needs to trigger dynamic initialization (either because the variable is statically initialized, or a use of the variable in the defining TU will be executed before any uses in another TU), they can avoid this overhead with the <samp class="option">-fno-extern-tls-init</samp> option. </p> <p>On targets that support symbol aliases, the default is <samp class="option">-fextern-tls-init</samp>. On targets that do not support symbol aliases, the default is <samp class="option">-fno-extern-tls-init</samp>. </p> </dd> <dt> + <span><code class="code">-ffold-simple-inlines</code><a class="copiable-link" href="#index-ffold-simple-inlines"> ¶</a></span> +</dt> <dt><code class="code">-fno-fold-simple-inlines</code></dt> <dd> +<p>Permit the C++ frontend to fold calls to <code class="code">std::move</code>, <code class="code">std::forward</code>, <code class="code">std::addressof</code> and <code class="code">std::as_const</code>. In contrast to inlining, this means no debug information will be generated for such calls. Since these functions are rarely interesting to debug, this flag is enabled by default unless <samp class="option">-fno-inline</samp> is active. </p> </dd> <dt> + <span><code class="code">-fno-gnu-keywords</code><a class="copiable-link" href="#index-fno-gnu-keywords"> ¶</a></span> +</dt> <dd> +<p>Do not recognize <code class="code">typeof</code> as a keyword, so that code can use this word as an identifier. You can use the keyword <code class="code">__typeof__</code> instead. This option is implied by the strict ISO C++ dialects: <samp class="option">-ansi</samp>, <samp class="option">-std=c++98</samp>, <samp class="option">-std=c++11</samp>, etc. </p> </dd> <dt> +<span><code class="code">-fimplicit-constexpr</code><a class="copiable-link" href="#index-fimplicit-constexpr"> ¶</a></span> +</dt> <dd> +<p>Make inline functions implicitly constexpr, if they satisfy the requirements for a constexpr function. This option can be used in C++14 mode or later. This can result in initialization changing from dynamic to static and other optimizations. </p> </dd> <dt> + <span><code class="code">-fno-implicit-templates</code><a class="copiable-link" href="#index-fno-implicit-templates"> ¶</a></span> +</dt> <dd> +<p>Never emit code for non-inline templates that are instantiated implicitly (i.e. by use); only emit code for explicit instantiations. If you use this option, you must take care to structure your code to include all the necessary explicit instantiations to avoid getting undefined symbols at link time. See <a class="xref" href="template-instantiation">Where’s the Template?</a>, for more information. </p> </dd> <dt> + <span><code class="code">-fno-implicit-inline-templates</code><a class="copiable-link" href="#index-fno-implicit-inline-templates"> ¶</a></span> +</dt> <dd> +<p>Don’t emit code for implicit instantiations of inline templates, either. The default is to handle inlines differently so that compiles with and without optimization need the same set of explicit instantiations. </p> </dd> <dt> + <span><code class="code">-fno-implement-inlines</code><a class="copiable-link" href="#index-fno-implement-inlines"> ¶</a></span> +</dt> <dd> +<p>To save space, do not emit out-of-line copies of inline functions controlled by <code class="code">#pragma implementation</code>. This causes linker errors if these functions are not inlined everywhere they are called. </p> </dd> <dt> + <span><code class="code">-fmodules-ts</code><a class="copiable-link" href="#index-fmodules-ts"> ¶</a></span> +</dt> <dt><code class="code">-fno-modules-ts</code></dt> <dd> +<p>Enable support for C++20 modules (see <a class="pxref" href="c_002b_002b-modules">C++ Modules</a>). The <samp class="option">-fno-modules-ts</samp> is usually not needed, as that is the default. Even though this is a C++20 feature, it is not currently implicitly enabled by selecting that standard version. </p> </dd> <dt> +<span><code class="code">-fmodule-header</code><a class="copiable-link" href="#index-fmodule-header"> ¶</a></span> +</dt> <dt><code class="code">-fmodule-header=user</code></dt> <dt><code class="code">-fmodule-header=system</code></dt> <dd> +<p>Compile a header file to create an importable header unit. </p> </dd> <dt> +<span><code class="code">-fmodule-implicit-inline</code><a class="copiable-link" href="#index-fmodule-implicit-inline"> ¶</a></span> +</dt> <dd> +<p>Member functions defined in their class definitions are not implicitly inline for modular code. This is different to traditional C++ behavior, for good reasons. However, it may result in a difficulty during code porting. This option makes such function definitions implicitly inline. It does however generate an ABI incompatibility, so you must use it everywhere or nowhere. (Such definitions outside of a named module remain implicitly inline, regardless.) </p> </dd> <dt> + <span><code class="code">-fno-module-lazy</code><a class="copiable-link" href="#index-fno-module-lazy"> ¶</a></span> +</dt> <dd> +<p>Disable lazy module importing and module mapper creation. </p> </dd> <dt> + <span><code class="code">-fmodule-mapper=<span class="r">[</span><var class="var">hostname</var><span class="r">]</span>:<var class="var">port</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code><a class="copiable-link" href="#index-CXX_005fMODULE_005fMAPPER-environment-variable"> ¶</a></span> +</dt> <dt><code class="code">-fmodule-mapper=|<var class="var">program</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span> <var class="var">args...</var></code></dt> <dt><code class="code">-fmodule-mapper==<var class="var">socket</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dt><code class="code">-fmodule-mapper=<><span class="r">[</span><var class="var">inout</var><span class="r">]</span><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dt><code class="code">-fmodule-mapper=<<var class="var">in</var>><var class="var">out</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dt><code class="code">-fmodule-mapper=<var class="var">file</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dd> +<p>An oracle to query for module name to filename mappings. If unspecified the <code class="env">CXX_MODULE_MAPPER</code> environment variable is used, and if that is unset, an in-process default is provided. </p> </dd> <dt> +<span><code class="code">-fmodule-only</code><a class="copiable-link" href="#index-fmodule-only"> ¶</a></span> +</dt> <dd> +<p>Only emit the Compiled Module Interface, inhibiting any object file. </p> </dd> <dt> +<span><code class="code">-fms-extensions</code><a class="copiable-link" href="#index-fms-extensions-1"> ¶</a></span> +</dt> <dd> +<p>Disable Wpedantic warnings about constructs used in MFC, such as implicit int and getting a pointer to member function via non-standard syntax. </p> </dd> <dt> +<span><code class="code">-fnew-inheriting-ctors</code><a class="copiable-link" href="#index-fnew-inheriting-ctors"> ¶</a></span> +</dt> <dd> +<p>Enable the P0136 adjustment to the semantics of C++11 constructor inheritance. This is part of C++17 but also considered to be a Defect Report against C++11 and C++14. This flag is enabled by default unless <samp class="option">-fabi-version=10</samp> or lower is specified. </p> </dd> <dt> +<span><code class="code">-fnew-ttp-matching</code><a class="copiable-link" href="#index-fnew-ttp-matching"> ¶</a></span> +</dt> <dd> +<p>Enable the P0522 resolution to Core issue 150, template template parameters and default arguments: this allows a template with default template arguments as an argument for a template template parameter with fewer template parameters. This flag is enabled by default for <samp class="option">-std=c++17</samp>. </p> </dd> <dt> + <span><code class="code">-fno-nonansi-builtins</code><a class="copiable-link" href="#index-fno-nonansi-builtins"> ¶</a></span> +</dt> <dd> +<p>Disable built-in declarations of functions that are not mandated by ANSI/ISO C. These include <code class="code">ffs</code>, <code class="code">alloca</code>, <code class="code">_exit</code>, <code class="code">index</code>, <code class="code">bzero</code>, <code class="code">conjf</code>, and other related functions. </p> </dd> <dt> +<span><code class="code">-fnothrow-opt</code><a class="copiable-link" href="#index-fnothrow-opt"> ¶</a></span> +</dt> <dd> +<p>Treat a <code class="code">throw()</code> exception specification as if it were a <code class="code">noexcept</code> specification to reduce or eliminate the text size overhead relative to a function with no exception specification. If the function has local variables of types with non-trivial destructors, the exception specification actually makes the function smaller because the EH cleanups for those variables can be optimized away. The semantic effect is that an exception thrown out of a function with such an exception specification results in a call to <code class="code">terminate</code> rather than <code class="code">unexpected</code>. </p> </dd> <dt> + <span><code class="code">-fno-operator-names</code><a class="copiable-link" href="#index-fno-operator-names"> ¶</a></span> +</dt> <dd> +<p>Do not treat the operator name keywords <code class="code">and</code>, <code class="code">bitand</code>, <code class="code">bitor</code>, <code class="code">compl</code>, <code class="code">not</code>, <code class="code">or</code> and <code class="code">xor</code> as synonyms as keywords. </p> </dd> <dt> + <span><code class="code">-fno-optional-diags</code><a class="copiable-link" href="#index-fno-optional-diags"> ¶</a></span> +</dt> <dd> +<p>Disable diagnostics that the standard says a compiler does not need to issue. Currently, the only such diagnostic issued by G++ is the one for a name having multiple meanings within a class. </p> </dd> <dt> +<span><code class="code">-fpermissive</code><a class="copiable-link" href="#index-fpermissive"> ¶</a></span> +</dt> <dd> +<p>Downgrade some diagnostics about nonconformant code from errors to warnings. Thus, using <samp class="option">-fpermissive</samp> allows some nonconforming code to compile. </p> </dd> <dt> + <span><code class="code">-fno-pretty-templates</code><a class="copiable-link" href="#index-fno-pretty-templates"> ¶</a></span> +</dt> <dd> +<p>When an error message refers to a specialization of a function template, the compiler normally prints the signature of the template followed by the template arguments and any typedefs or typenames in the signature (e.g. <code class="code">void f(T) [with T = int]</code> rather than <code class="code">void f(int)</code>) so that it’s clear which template is involved. When an error message refers to a specialization of a class template, the compiler omits any template arguments that match the default template arguments for that template. If either of these behaviors make it harder to understand the error message rather than easier, you can use <samp class="option">-fno-pretty-templates</samp> to disable them. </p> </dd> <dt> + <span><code class="code">-fno-rtti</code><a class="copiable-link" href="#index-fno-rtti"> ¶</a></span> +</dt> <dd> +<p>Disable generation of information about every class with virtual functions for use by the C++ run-time type identification features (<code class="code">dynamic_cast</code> and <code class="code">typeid</code>). If you don’t use those parts of the language, you can save some space by using this flag. Note that exception handling uses the same information, but G++ generates it as needed. The <code class="code">dynamic_cast</code> operator can still be used for casts that do not require run-time type information, i.e. casts to <code class="code">void *</code> or to unambiguous base classes. </p> <p>Mixing code compiled with <samp class="option">-frtti</samp> with that compiled with <samp class="option">-fno-rtti</samp> may not work. For example, programs may fail to link if a class compiled with <samp class="option">-fno-rtti</samp> is used as a base for a class compiled with <samp class="option">-frtti</samp>. </p> </dd> <dt> +<span><code class="code">-fsized-deallocation</code><a class="copiable-link" href="#index-fsized-deallocation"> ¶</a></span> +</dt> <dd> +<p>Enable the built-in global declarations </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void operator delete (void *, std::size_t) noexcept; +void operator delete[] (void *, std::size_t) noexcept;</pre> +</div> <p>as introduced in C++14. This is useful for user-defined replacement deallocation functions that, for example, use the size of the object to make deallocation faster. Enabled by default under <samp class="option">-std=c++14</samp> and above. The flag <samp class="option">-Wsized-deallocation</samp> warns about places that might want to add a definition. </p> </dd> <dt> +<span><code class="code">-fstrict-enums</code><a class="copiable-link" href="#index-fstrict-enums"> ¶</a></span> +</dt> <dd> +<p>Allow the compiler to optimize using the assumption that a value of enumerated type can only be one of the values of the enumeration (as defined in the C++ standard; basically, a value that can be represented in the minimum number of bits needed to represent all the enumerators). This assumption may not be valid if the program uses a cast to convert an arbitrary integer value to the enumerated type. </p> </dd> <dt> +<span><code class="code">-fstrong-eval-order</code><a class="copiable-link" href="#index-fstrong-eval-order"> ¶</a></span> +</dt> <dd> +<p>Evaluate member access, array subscripting, and shift expressions in left-to-right order, and evaluate assignment in right-to-left order, as adopted for C++17. Enabled by default with <samp class="option">-std=c++17</samp>. <samp class="option">-fstrong-eval-order=some</samp> enables just the ordering of member access and shift expressions, and is the default without <samp class="option">-std=c++17</samp>. </p> </dd> <dt> +<span><code class="code">-ftemplate-backtrace-limit=<var class="var">n</var></code><a class="copiable-link" href="#index-ftemplate-backtrace-limit"> ¶</a></span> +</dt> <dd> +<p>Set the maximum number of template instantiation notes for a single warning or error to <var class="var">n</var>. The default value is 10. </p> </dd> <dt> +<span><code class="code">-ftemplate-depth=<var class="var">n</var></code><a class="copiable-link" href="#index-ftemplate-depth"> ¶</a></span> +</dt> <dd> +<p>Set the maximum instantiation depth for template classes to <var class="var">n</var>. A limit on the template instantiation depth is needed to detect endless recursions during template class instantiation. ANSI/ISO C++ conforming programs must not rely on a maximum depth greater than 17 (changed to 1024 in C++11). The default value is 900, as the compiler can run out of stack space before hitting 1024 in some situations. </p> </dd> <dt> + <span><code class="code">-fno-threadsafe-statics</code><a class="copiable-link" href="#index-fno-threadsafe-statics"> ¶</a></span> +</dt> <dd> +<p>Do not emit the extra code to use the routines specified in the C++ ABI for thread-safe initialization of local statics. You can use this option to reduce code size slightly in code that doesn’t need to be thread-safe. </p> </dd> <dt> +<span><code class="code">-fuse-cxa-atexit</code><a class="copiable-link" href="#index-fuse-cxa-atexit"> ¶</a></span> +</dt> <dd> +<p>Register destructors for objects with static storage duration with the <code class="code">__cxa_atexit</code> function rather than the <code class="code">atexit</code> function. This option is required for fully standards-compliant handling of static destructors, but only works if your C library supports <code class="code">__cxa_atexit</code>. </p> </dd> <dt> + <span><code class="code">-fno-use-cxa-get-exception-ptr</code><a class="copiable-link" href="#index-fno-use-cxa-get-exception-ptr"> ¶</a></span> +</dt> <dd> +<p>Don’t use the <code class="code">__cxa_get_exception_ptr</code> runtime routine. This causes <code class="code">std::uncaught_exception</code> to be incorrect, but is necessary if the runtime routine is not available. </p> </dd> <dt> +<span><code class="code">-fvisibility-inlines-hidden</code><a class="copiable-link" href="#index-fvisibility-inlines-hidden"> ¶</a></span> +</dt> <dd> +<p>This switch declares that the user does not attempt to compare pointers to inline functions or methods where the addresses of the two functions are taken in different shared objects. </p> <p>The effect of this is that GCC may, effectively, mark inline methods with <code class="code">__attribute__ ((visibility ("hidden")))</code> so that they do not appear in the export table of a DSO and do not require a PLT indirection when used within the DSO. Enabling this option can have a dramatic effect on load and link times of a DSO as it massively reduces the size of the dynamic export table when the library makes heavy use of templates. </p> <p>The behavior of this switch is not quite the same as marking the methods as hidden directly, because it does not affect static variables local to the function or cause the compiler to deduce that the function is defined in only one shared object. </p> <p>You may mark a method as having a visibility explicitly to negate the effect of the switch for that method. For example, if you do want to compare pointers to a particular inline method, you might mark it as having default visibility. Marking the enclosing class with explicit visibility has no effect. </p> <p>Explicitly instantiated inline methods are unaffected by this option as their linkage might otherwise cross a shared library boundary. See <a class="xref" href="template-instantiation">Where’s the Template?</a>. </p> </dd> <dt> +<span><code class="code">-fvisibility-ms-compat</code><a class="copiable-link" href="#index-fvisibility-ms-compat"> ¶</a></span> +</dt> <dd> +<p>This flag attempts to use visibility settings to make GCC’s C++ linkage model compatible with that of Microsoft Visual Studio. </p> <p>The flag makes these changes to GCC’s linkage model: </p> <ol class="enumerate"> <li> It sets the default visibility to <code class="code">hidden</code>, like <samp class="option">-fvisibility=hidden</samp>. </li> +<li> Types, but not their members, are not hidden by default. </li> +<li> The One Definition Rule is relaxed for types without explicit visibility specifications that are defined in more than one shared object: those declarations are permitted if they are permitted when this option is not used. </li> +</ol> <p>In new code it is better to use <samp class="option">-fvisibility=hidden</samp> and export those classes that are intended to be externally visible. Unfortunately it is possible for code to rely, perhaps accidentally, on the Visual Studio behavior. </p> <p>Among the consequences of these changes are that static data members of the same type with the same name but defined in different shared objects are different, so changing one does not change the other; and that pointers to function members defined in different shared objects may not compare equal. When this flag is given, it is a violation of the ODR to define types with the same name differently. </p> </dd> <dt> + <span><code class="code">-fno-weak</code><a class="copiable-link" href="#index-fno-weak"> ¶</a></span> +</dt> <dd> +<p>Do not use weak symbol support, even if it is provided by the linker. By default, G++ uses weak symbols if they are available. This option exists only for testing, and should not be used by end-users; it results in inferior code and has no benefits. This option may be removed in a future release of G++. </p> </dd> <dt> + <span><code class="code">-fext-numeric-literals <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-fext-numeric-literals"> ¶</a></span> +</dt> <dd> +<p>Accept imaginary, fixed-point, or machine-defined literal number suffixes as GNU extensions. When this option is turned off these suffixes are treated as C++11 user-defined literal numeric suffixes. This is on by default for all pre-C++11 dialects and all GNU dialects: <samp class="option">-std=c++98</samp>, <samp class="option">-std=gnu++98</samp>, <samp class="option">-std=gnu++11</samp>, <samp class="option">-std=gnu++14</samp>. This option is off by default for ISO C++11 onwards (<samp class="option">-std=c++11</samp>, ...). </p> </dd> <dt> +<span><code class="code">-nostdinc++</code><a class="copiable-link" href="#index-nostdinc_002b_002b"> ¶</a></span> +</dt> <dd> +<p>Do not search for header files in the standard directories specific to C++, but do still search the other standard directories. (This option is used when building the C++ library.) </p> </dd> <dt> + <span><code class="code">-flang-info-include-translate</code><a class="copiable-link" href="#index-flang-info-include-translate"> ¶</a></span> +</dt> <dt><code class="code">-flang-info-include-translate-not</code></dt> <dt><code class="code">-flang-info-include-translate=<var class="var">header</var></code></dt> <dd> +<p>Inform of include translation events. The first will note accepted include translations, the second will note declined include translations. The <var class="var">header</var> form will inform of include translations relating to that specific header. If <var class="var">header</var> is of the form <code class="code">"user"</code> or <code class="code"><system></code> it will be resolved to a specific user or system header using the include path. </p> </dd> <dt> +<span><code class="code">-flang-info-module-cmi</code><a class="copiable-link" href="#index-flang-info-module-cmi"> ¶</a></span> +</dt> <dt><code class="code">-flang-info-module-cmi=<var class="var">module</var></code></dt> <dd> +<p>Inform of Compiled Module Interface pathnames. The first will note all read CMI pathnames. The <var class="var">module</var> form will not reading a specific module’s CMI. <var class="var">module</var> may be a named module or a header-unit (the latter indicated by either being a pathname containing directory separators or enclosed in <code class="code"><></code> or <code class="code">""</code>). </p> </dd> <dt> +<span><code class="code">-stdlib=<var class="var">libstdc++,libc++</var></code><a class="copiable-link" href="#index-stdlib"> ¶</a></span> +</dt> <dd><p>When G++ is configured to support this option, it allows specification of alternate C++ runtime libraries. Two options are available: <var class="var">libstdc++</var> (the default, native C++ runtime for G++) and <var class="var">libc++</var> which is the C++ runtime installed on some operating systems (e.g. Darwin versions from Darwin11 onwards). The option switches G++ to use the headers from the specified library and to emit <code class="code">-lstdc++</code> or <code class="code">-lc++</code> respectively, when a C++ runtime is required for linking. </p></dd> </dl> <p>In addition, these warning options have meanings only for C++ programs: </p> <dl class="table"> <dt> +<span><code class="code">-Wabi-tag <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wabi-tag"> ¶</a></span> +</dt> <dd> +<p>Warn when a type with an ABI tag is used in a context that does not have that ABI tag. See <a class="ref" href="c_002b_002b-attributes">C++-Specific Variable, Function, and Type Attributes</a> for more information about ABI tags. </p> </dd> <dt> + <span><code class="code">-Wcomma-subscript <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wcomma-subscript"> ¶</a></span> +</dt> <dd> +<p>Warn about uses of a comma expression within a subscripting expression. This usage was deprecated in C++20 and is going to be removed in C++23. However, a comma expression wrapped in <code class="code">( )</code> is not deprecated. Example: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">void f(int *a, int b, int c) { + a[b,c]; // deprecated in C++20, invalid in C++23 + a[(b,c)]; // OK +}</pre></div> +</div> <p>In C++23 it is valid to have comma separated expressions in a subscript when an overloaded subscript operator is found and supports the right number and types of arguments. G++ will accept the formerly valid syntax for code that is not valid in C++23 but used to be valid but deprecated in C++20 with a pedantic warning that can be disabled with <samp class="option">-Wno-comma-subscript</samp>. </p> <p>Enabled by default with <samp class="option">-std=c++20</samp> unless <samp class="option">-Wno-deprecated</samp>, and with <samp class="option">-std=c++23</samp> regardless of <samp class="option">-Wno-deprecated</samp>. </p> </dd> <dt> + <span><code class="code">-Wctad-maybe-unsupported <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wctad-maybe-unsupported"> ¶</a></span> +</dt> <dd> +<p>Warn when performing class template argument deduction (CTAD) on a type with no explicitly written deduction guides. This warning will point out cases where CTAD succeeded only because the compiler synthesized the implicit deduction guides, which might not be what the programmer intended. Certain style guides allow CTAD only on types that specifically "opt-in"; i.e., on types that are designed to support CTAD. This warning can be suppressed with the following pattern: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct allow_ctad_t; // any name works +template <typename T> struct S { + S(T) { } +}; +// Guide with incomplete parameter type will never be considered. +S(allow_ctad_t) -> S<void>;</pre> +</div> </dd> <dt> + <span><code class="code">-Wctor-dtor-privacy <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wctor-dtor-privacy"> ¶</a></span> +</dt> <dd> +<p>Warn when a class seems unusable because all the constructors or destructors in that class are private, and it has neither friends nor public static member functions. Also warn if there are no non-private methods, and there’s at least one private member function that isn’t a constructor or destructor. </p> </dd> <dt> + <span><code class="code">-Wdangling-reference <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wdangling-reference"> ¶</a></span> +</dt> <dd> +<p>Warn when a reference is bound to a temporary whose lifetime has ended. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int n = 1; +const int& r = std::max(n - 1, n + 1); // r is dangling</pre> +</div> <p>In the example above, two temporaries are created, one for each argument, and a reference to one of the temporaries is returned. However, both temporaries are destroyed at the end of the full expression, so the reference <code class="code">r</code> is dangling. This warning also detects dangling references in member initializer lists: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">const int& f(const int& i) { return i; } +struct S { + const int &r; // r is dangling + S() : r(f(10)) { } +};</pre> +</div> <p>Member functions are checked as well, but only their object argument: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct S { + const S& self () { return *this; } +}; +const S& s = S().self(); // s is dangling</pre> +</div> <p>Certain functions are safe in this respect, for example <code class="code">std::use_facet</code>: they take and return a reference, but they don’t return one of its arguments, which can fool the warning. Such functions can be excluded from the warning by wrapping them in a <code class="code">#pragma</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +const T& foo (const T&) { … } +#pragma GCC diagnostic pop</pre> +</div> <p><samp class="option">-Wdangling-reference</samp> also warns about code like </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">auto p = std::minmax(1, 2);</pre> +</div> <p>where <code class="code">std::minmax</code> returns <code class="code">std::pair<const int&, const int&></code>, and both references dangle after the end of the full expression that contains the call to <code class="code">std::minmax</code>. </p> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wdelete-non-virtual-dtor <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wdelete-non-virtual-dtor"> ¶</a></span> +</dt> <dd> +<p>Warn when <code class="code">delete</code> is used to destroy an instance of a class that has virtual functions and non-virtual destructor. It is unsafe to delete an instance of a derived class through a pointer to a base class if the base class does not have a virtual destructor. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wdeprecated-copy <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wdeprecated-copy"> ¶</a></span> +</dt> <dd> +<p>Warn that the implicit declaration of a copy constructor or copy assignment operator is deprecated if the class has a user-provided copy constructor or copy assignment operator, in C++11 and up. This warning is enabled by <samp class="option">-Wextra</samp>. With <samp class="option">-Wdeprecated-copy-dtor</samp>, also deprecate if the class has a user-provided destructor. </p> </dd> <dt> + <span><code class="code">-Wno-deprecated-enum-enum-conversion <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wdeprecated-enum-enum-conversion"> ¶</a></span> +</dt> <dd> +<p>Disable the warning about the case when the usual arithmetic conversions are applied on operands where one is of enumeration type and the other is of a different enumeration type. This conversion was deprecated in C++20. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">enum E1 { e }; +enum E2 { f }; +int k = f - e;</pre> +</div> <p><samp class="option">-Wdeprecated-enum-enum-conversion</samp> is enabled by default with <samp class="option">-std=c++20</samp>. In pre-C++20 dialects, this warning can be enabled by <samp class="option">-Wenum-conversion</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-deprecated-enum-float-conversion <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wdeprecated-enum-float-conversion"> ¶</a></span> +</dt> <dd> +<p>Disable the warning about the case when the usual arithmetic conversions are applied on operands where one is of enumeration type and the other is of a floating-point type. This conversion was deprecated in C++20. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">enum E1 { e }; +enum E2 { f }; +bool b = e <= 3.7;</pre> +</div> <p><samp class="option">-Wdeprecated-enum-float-conversion</samp> is enabled by default with <samp class="option">-std=c++20</samp>. In pre-C++20 dialects, this warning can be enabled by <samp class="option">-Wenum-conversion</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-init-list-lifetime <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Winit-list-lifetime"> ¶</a></span> +</dt> <dd> +<p>Do not warn about uses of <code class="code">std::initializer_list</code> that are likely to result in dangling pointers. Since the underlying array for an <code class="code">initializer_list</code> is handled like a normal C++ temporary object, it is easy to inadvertently keep a pointer to the array past the end of the array’s lifetime. For example: </p> <ul class="itemize mark-bullet"> <li>If a function returns a temporary <code class="code">initializer_list</code>, or a local <code class="code">initializer_list</code> variable, the array’s lifetime ends at the end of the return statement, so the value returned has a dangling pointer. </li> +<li>If a new-expression creates an <code class="code">initializer_list</code>, the array only lives until the end of the enclosing full-expression, so the <code class="code">initializer_list</code> in the heap has a dangling pointer. </li> +<li>When an <code class="code">initializer_list</code> variable is assigned from a brace-enclosed initializer list, the temporary array created for the right side of the assignment only lives until the end of the full-expression, so at the next statement the <code class="code">initializer_list</code> variable has a dangling pointer. <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">// li's initial underlying array lives as long as li +std::initializer_list<int> li = { 1,2,3 }; +// assignment changes li to point to a temporary array +li = { 4, 5 }; +// now the temporary is gone and li has a dangling pointer +int i = li.begin()[0] // undefined behavior</pre> +</div> </li> +<li>When a list constructor stores the <code class="code">begin</code> pointer from the <code class="code">initializer_list</code> argument, this doesn’t extend the lifetime of the array, so if a class variable is constructed from a temporary <code class="code">initializer_list</code>, the pointer is left dangling by the end of the variable declaration statement. </li> +</ul> </dd> <dt> + <span><code class="code">-Winvalid-constexpr</code><a class="copiable-link" href="#index-Winvalid-constexpr"> ¶</a></span> +</dt> <dd> <p>Warn when a function never produces a constant expression. In C++20 and earlier, for every <code class="code">constexpr</code> function and function template, there must be at least one set of function arguments in at least one instantiation such that an invocation of the function or constructor could be an evaluated subexpression of a core constant expression. C++23 removed this restriction, so it’s possible to have a function or a function template marked <code class="code">constexpr</code> for which no invocation satisfies the requirements of a core constant expression. </p> <p>This warning is enabled as a pedantic warning by default in C++20 and earlier. In C++23, <samp class="option">-Winvalid-constexpr</samp> can be turned on, in which case it will be an ordinary warning. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (int& i); +constexpr void +g (int& i) +{ + // Warns by default in C++20, in C++23 only with -Winvalid-constexpr. + f(i); +}</pre> +</div> </dd> <dt> + <span><code class="code">-Winvalid-imported-macros</code><a class="copiable-link" href="#index-Winvalid-imported-macros"> ¶</a></span> +</dt> <dd> +<p>Verify all imported macro definitions are valid at the end of compilation. This is not enabled by default, as it requires additional processing to determine. It may be useful when preparing sets of header-units to ensure consistent macros. </p> </dd> <dt> + <span><code class="code">-Wno-literal-suffix <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wliteral-suffix"> ¶</a></span> +</dt> <dd> +<p>Do not warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore. As a conforming extension, GCC treats such suffixes as separate preprocessing tokens in order to maintain backwards compatibility with code that uses formatting macros from <code class="code"><inttypes.h></code>. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define __STDC_FORMAT_MACROS +#include <inttypes.h> +#include <stdio.h> + +int main() { + int64_t i64 = 123; + printf("My int64: %" PRId64"\n", i64); +}</pre> +</div> <p>In this case, <code class="code">PRId64</code> is treated as a separate preprocessing token. </p> <p>This option also controls warnings when a user-defined literal operator is declared with a literal suffix identifier that doesn’t begin with an underscore. Literal suffix identifiers that don’t begin with an underscore are reserved for future standardization. </p> <p>These warnings are enabled by default. </p> </dd> <dt> + <span><code class="code">-Wno-narrowing <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wnarrowing"> ¶</a></span> +</dt> <dd> +<p>For C++11 and later standards, narrowing conversions are diagnosed by default, as required by the standard. A narrowing conversion from a constant produces an error, and a narrowing conversion from a non-constant produces a warning, but <samp class="option">-Wno-narrowing</samp> suppresses the diagnostic. Note that this does not affect the meaning of well-formed code; narrowing conversions are still considered ill-formed in SFINAE contexts. </p> <p>With <samp class="option">-Wnarrowing</samp> in C++98, warn when a narrowing conversion prohibited by C++11 occurs within ‘<samp class="samp">{ }</samp>’, e.g. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int i = { 2.2 }; // error: narrowing from double to int</pre> +</div> <p>This flag is included in <samp class="option">-Wall</samp> and <samp class="option">-Wc++11-compat</samp>. </p> </dd> <dt> + <span><code class="code">-Wnoexcept <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wnoexcept"> ¶</a></span> +</dt> <dd> +<p>Warn when a noexcept-expression evaluates to false because of a call to a function that does not have a non-throwing exception specification (i.e. <code class="code">throw()</code> or <code class="code">noexcept</code>) but is known by the compiler to never throw an exception. </p> </dd> <dt> + <span><code class="code">-Wnoexcept-type <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wnoexcept-type"> ¶</a></span> +</dt> <dd> +<p>Warn if the C++17 feature making <code class="code">noexcept</code> part of a function type changes the mangled name of a symbol relative to C++14. Enabled by <samp class="option">-Wabi</samp> and <samp class="option">-Wc++17-compat</samp>. </p> <p>As an example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">template <class T> void f(T t) { t(); }; +void g() noexcept; +void h() { f(g); }</pre> +</div> <p>In C++14, <code class="code">f</code> calls <code class="code">f<void(*)()></code>, but in C++17 it calls <code class="code">f<void(*)()noexcept></code>. </p> </dd> <dt> + <span><code class="code">-Wclass-memaccess <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wclass-memaccess"> ¶</a></span> +</dt> <dd> +<p>Warn when the destination of a call to a raw memory function such as <code class="code">memset</code> or <code class="code">memcpy</code> is an object of class type, and when writing into such an object might bypass the class non-trivial or deleted constructor or copy assignment, violate const-correctness or encapsulation, or corrupt virtual table pointers. Modifying the representation of such objects may violate invariants maintained by member functions of the class. For example, the call to <code class="code">memset</code> below is undefined because it modifies a non-trivial class object and is, therefore, diagnosed. The safe way to either initialize or clear the storage of objects of such types is by using the appropriate constructor or assignment operator, if one is available. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">std::string str = "abc"; +memset (&str, 0, sizeof str);</pre> +</div> <p>The <samp class="option">-Wclass-memaccess</samp> option is enabled by <samp class="option">-Wall</samp>. Explicitly casting the pointer to the class object to <code class="code">void *</code> or to a type that can be safely accessed by the raw memory function suppresses the warning. </p> </dd> <dt> + <span><code class="code">-Wnon-virtual-dtor <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wnon-virtual-dtor"> ¶</a></span> +</dt> <dd> +<p>Warn when a class has virtual functions and an accessible non-virtual destructor itself or in an accessible polymorphic base class, in which case it is possible but unsafe to delete an instance of a derived class through a pointer to the class itself or base class. This warning is automatically enabled if <samp class="option">-Weffc++</samp> is specified. The <samp class="option">-Wdelete-non-virtual-dtor</samp> option (enabled by <samp class="option">-Wall</samp>) should be preferred because it warns about the unsafe cases without false positives. </p> </dd> <dt> + <span><code class="code">-Wregister <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wregister"> ¶</a></span> +</dt> <dd> +<p>Warn on uses of the <code class="code">register</code> storage class specifier, except when it is part of the GNU <a class="ref" href="explicit-register-variables">Variables in Specified Registers</a> extension. The use of the <code class="code">register</code> keyword as storage class specifier has been deprecated in C++11 and removed in C++17. Enabled by default with <samp class="option">-std=c++17</samp>. </p> </dd> <dt> + <span><code class="code">-Wreorder <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wreorder"> ¶</a></span> +</dt> <dd> +<p>Warn when the order of member initializers given in the code does not match the order in which they must be executed. For instance: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct A { + int i; + int j; + A(): j (0), i (1) { } +};</pre> +</div> <p>The compiler rearranges the member initializers for <code class="code">i</code> and <code class="code">j</code> to match the declaration order of the members, emitting a warning to that effect. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-pessimizing-move <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wpessimizing-move"> ¶</a></span> +</dt> <dd> +<p>This warning warns when a call to <code class="code">std::move</code> prevents copy elision. A typical scenario when copy elision can occur is when returning in a function with a class return type, when the expression being returned is the name of a non-volatile automatic object, and is not a function parameter, and has the same type as the function return type. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct T { +… +}; +T fn() +{ + T t; + … + return std::move (t); +}</pre> +</div> <p>But in this example, the <code class="code">std::move</code> call prevents copy elision. </p> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-redundant-move <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wredundant-move"> ¶</a></span> +</dt> <dd> +<p>This warning warns about redundant calls to <code class="code">std::move</code>; that is, when a move operation would have been performed even without the <code class="code">std::move</code> call. This happens because the compiler is forced to treat the object as if it were an rvalue in certain situations such as returning a local variable, where copy elision isn’t applicable. Consider: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct T { +… +}; +T fn(T t) +{ + … + return std::move (t); +}</pre> +</div> <p>Here, the <code class="code">std::move</code> call is redundant. Because G++ implements Core Issue 1579, another example is: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct T { // convertible to U +… +}; +struct U { +… +}; +U fn() +{ + T t; + … + return std::move (t); +}</pre> +</div> <p>In this example, copy elision isn’t applicable because the type of the expression being returned and the function return type differ, yet G++ treats the return value as if it were designated by an rvalue. </p> <p>This warning is enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wrange-loop-construct <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wrange-loop-construct"> ¶</a></span> +</dt> <dd> +<p>This warning warns when a C++ range-based for-loop is creating an unnecessary copy. This can happen when the range declaration is not a reference, but probably should be. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct S { char arr[128]; }; +void fn () { + S arr[5]; + for (const auto x : arr) { … } +}</pre> +</div> <p>It does not warn when the type being copied is a trivially-copyable type whose size is less than 64 bytes. </p> <p>This warning also warns when a loop variable in a range-based for-loop is initialized with a value of a different type resulting in a copy. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void fn() { + int arr[10]; + for (const double &x : arr) { … } +}</pre> +</div> <p>In the example above, in every iteration of the loop a temporary value of type <code class="code">double</code> is created and destroyed, to which the reference <code class="code">const double &</code> is bound. </p> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wredundant-tags <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wredundant-tags"> ¶</a></span> +</dt> <dd> +<p>Warn about redundant class-key and enum-key in references to class types and enumerated types in contexts where the key can be eliminated without causing an ambiguity. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct foo; +struct foo *p; // warn that keyword struct can be eliminated</pre> +</div> <p>On the other hand, in this example there is no warning: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct foo; +void foo (); // "hides" struct foo +void bar (struct foo&); // no warning, keyword struct is necessary</pre> +</div> </dd> <dt> + <span><code class="code">-Wno-subobject-linkage <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wsubobject-linkage"> ¶</a></span> +</dt> <dd> +<p>Do not warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage. If a type A depends on a type B with no or internal linkage, defining it in multiple translation units would be an ODR violation because the meaning of B is different in each translation unit. If A only appears in a single translation unit, the best way to silence the warning is to give it internal linkage by putting it in an anonymous namespace as well. The compiler doesn’t give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions. <samp class="option">-Wsubobject-linkage</samp> is enabled by default. </p> </dd> <dt> + <span><code class="code">-Weffc++ <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Weffc_002b_002b"> ¶</a></span> +</dt> <dd> +<p>Warn about violations of the following style guidelines from Scott Meyers’ Effective C++ series of books: </p> <ul class="itemize mark-bullet"> <li>Define a copy constructor and an assignment operator for classes with dynamically-allocated memory. </li> +<li>Prefer initialization to assignment in constructors. </li> +<li>Have <code class="code">operator=</code> return a reference to <code class="code">*this</code>. </li> +<li>Don’t try to return a reference when you must return an object. </li> +<li>Distinguish between prefix and postfix forms of increment and decrement operators. </li> +<li>Never overload <code class="code">&&</code>, <code class="code">||</code>, or <code class="code">,</code>. </li> +</ul> <p>This option also enables <samp class="option">-Wnon-virtual-dtor</samp>, which is also one of the effective C++ recommendations. However, the check is extended to warn about the lack of virtual destructor in accessible non-polymorphic bases classes too. </p> <p>When selecting this option, be aware that the standard library headers do not obey all of these guidelines; use ‘<samp class="samp">grep -v</samp>’ to filter out those warnings. </p> </dd> <dt> + <span><code class="code">-Wno-exceptions <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wexceptions"> ¶</a></span> +</dt> <dd> +<p>Disable the warning about the case when an exception handler is shadowed by another handler, which can point out a wrong ordering of exception handlers. </p> </dd> <dt> + <span><code class="code">-Wstrict-null-sentinel <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wstrict-null-sentinel"> ¶</a></span> +</dt> <dd> +<p>Warn about the use of an uncasted <code class="code">NULL</code> as sentinel. When compiling only with GCC this is a valid sentinel, as <code class="code">NULL</code> is defined to <code class="code">__null</code>. Although it is a null pointer constant rather than a null pointer, it is guaranteed to be of the same size as a pointer. But this use is not portable across different compilers. </p> </dd> <dt> + <span><code class="code">-Wno-non-template-friend <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wno-non-template-friend"> ¶</a></span> +</dt> <dd> +<p>Disable warnings when non-template friend functions are declared within a template. In very old versions of GCC that predate implementation of the ISO standard, declarations such as ‘<samp class="samp">friend int foo(int)</samp>’, where the name of the friend is an unqualified-id, could be interpreted as a particular specialization of a template function; the warning exists to diagnose compatibility problems, and is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wold-style-cast <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wold-style-cast"> ¶</a></span> +</dt> <dd> +<p>Warn if an old-style (C-style) cast to a non-void type is used within a C++ program. The new-style casts (<code class="code">dynamic_cast</code>, <code class="code">static_cast</code>, <code class="code">reinterpret_cast</code>, and <code class="code">const_cast</code>) are less vulnerable to unintended effects and much easier to search for. </p> </dd> <dt> + <span><code class="code">-Woverloaded-virtual <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Woverloaded-virtual"> ¶</a></span> +</dt> <dt><code class="code">-Woverloaded-virtual=<var class="var">n</var></code></dt> <dd> +<p>Warn when a function declaration hides virtual functions from a base class. For example, in: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct A { + virtual void f(); +}; + +struct B: public A { + void f(int); // does not override +};</pre> +</div> <p>the <code class="code">A</code> class version of <code class="code">f</code> is hidden in <code class="code">B</code>, and code like: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">B* b; +b->f();</pre> +</div> <p>fails to compile. </p> <p>In cases where the different signatures are not an accident, the simplest solution is to add a using-declaration to the derived class to un-hide the base function, e.g. add <code class="code">using A::f;</code> to <code class="code">B</code>. </p> <p>The optional level suffix controls the behavior when all the declarations in the derived class override virtual functions in the base class, even if not all of the base functions are overridden: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct C { + virtual void f(); + virtual void f(int); +}; + +struct D: public C { + void f(int); // does override +}</pre> +</div> <p>This pattern is less likely to be a mistake; if D is only used virtually, the user might have decided that the base class semantics for some of the overloads are fine. </p> <p>At level 1, this case does not warn; at level 2, it does. <samp class="option">-Woverloaded-virtual</samp> by itself selects level 2. Level 1 is included in <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-pmf-conversions <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wno-pmf-conversions"> ¶</a></span> +</dt> <dd> +<p>Disable the diagnostic for converting a bound pointer to member function to a plain pointer. </p> </dd> <dt> + <span><code class="code">-Wsign-promo <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wsign-promo"> ¶</a></span> +</dt> <dd> +<p>Warn when overload resolution chooses a promotion from unsigned or enumerated type to a signed type, over a conversion to an unsigned type of the same size. Previous versions of G++ tried to preserve unsignedness, but the standard mandates the current behavior. </p> </dd> <dt> + <span><code class="code">-Wtemplates <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wtemplates"> ¶</a></span> +</dt> <dd> +<p>Warn when a primary template declaration is encountered. Some coding rules disallow templates, and this may be used to enforce that rule. The warning is inactive inside a system header file, such as the STL, so one can still use the STL. One may also instantiate or specialize templates. </p> </dd> <dt> + <span><code class="code">-Wmismatched-new-delete <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wmismatched-new-delete"> ¶</a></span> +</dt> <dd> +<p>Warn for mismatches between calls to <code class="code">operator new</code> or <code class="code">operator +delete</code> and the corresponding call to the allocation or deallocation function. This includes invocations of C++ <code class="code">operator delete</code> with pointers returned from either mismatched forms of <code class="code">operator new</code>, or from other functions that allocate objects for which the <code class="code">operator delete</code> isn’t a suitable deallocator, as well as calls to other deallocation functions with pointers returned from <code class="code">operator new</code> for which the deallocation function isn’t suitable. </p> <p>For example, the <code class="code">delete</code> expression in the function below is diagnosed because it doesn’t match the array form of the <code class="code">new</code> expression the pointer argument was returned from. Similarly, the call to <code class="code">free</code> is also diagnosed. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f () +{ + int *a = new int[n]; + delete a; // warning: mismatch in array forms of expressions + + char *p = new char[n]; + free (p); // warning: mismatch between new and free +}</pre> +</div> <p>The related option <samp class="option">-Wmismatched-dealloc</samp> diagnoses mismatches involving allocation and deallocation functions other than <code class="code">operator +new</code> and <code class="code">operator delete</code>. </p> <p><samp class="option">-Wmismatched-new-delete</samp> is included in <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wmismatched-tags <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wmismatched-tags"> ¶</a></span> +</dt> <dd> +<p>Warn for declarations of structs, classes, and class templates and their specializations with a class-key that does not match either the definition or the first declaration if no definition is provided. </p> <p>For example, the declaration of <code class="code">struct Object</code> in the argument list of <code class="code">draw</code> triggers the warning. To avoid it, either remove the redundant class-key <code class="code">struct</code> or replace it with <code class="code">class</code> to match its definition. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">class Object { +public: + virtual ~Object () = 0; +}; +void draw (struct Object*);</pre> +</div> <p>It is not wrong to declare a class with the class-key <code class="code">struct</code> as the example above shows. The <samp class="option">-Wmismatched-tags</samp> option is intended to help achieve a consistent style of class declarations. In code that is intended to be portable to Windows-based compilers the warning helps prevent unresolved references due to the difference in the mangling of symbols declared with different class-keys. The option can be used either on its own or in conjunction with <samp class="option">-Wredundant-tags</samp>. </p> </dd> <dt> + <span><code class="code">-Wmultiple-inheritance <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wmultiple-inheritance"> ¶</a></span> +</dt> <dd> +<p>Warn when a class is defined with multiple direct base classes. Some coding rules disallow multiple inheritance, and this may be used to enforce that rule. The warning is inactive inside a system header file, such as the STL, so one can still use the STL. One may also define classes that indirectly use multiple inheritance. </p> </dd> <dt> + <span><code class="code">-Wvirtual-inheritance</code><a class="copiable-link" href="#index-Wvirtual-inheritance"> ¶</a></span> +</dt> <dd> +<p>Warn when a class is defined with a virtual direct base class. Some coding rules disallow multiple inheritance, and this may be used to enforce that rule. The warning is inactive inside a system header file, such as the STL, so one can still use the STL. One may also define classes that indirectly use virtual inheritance. </p> </dd> <dt> + <span><code class="code">-Wno-virtual-move-assign</code><a class="copiable-link" href="#index-Wvirtual-move-assign"> ¶</a></span> +</dt> <dd> +<p>Suppress warnings about inheriting from a virtual base with a non-trivial C++11 move assignment operator. This is dangerous because if the virtual base is reachable along more than one path, it is moved multiple times, which can mean both objects end up in the moved-from state. If the move assignment operator is written to avoid moving from a moved-from object, this warning can be disabled. </p> </dd> <dt> + <span><code class="code">-Wnamespaces</code><a class="copiable-link" href="#index-Wnamespaces"> ¶</a></span> +</dt> <dd> +<p>Warn when a namespace definition is opened. Some coding rules disallow namespaces, and this may be used to enforce that rule. The warning is inactive inside a system header file, such as the STL, so one can still use the STL. One may also use using directives and qualified names. </p> </dd> <dt> + <span><code class="code">-Wno-terminate <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wterminate"> ¶</a></span> +</dt> <dd> +<p>Disable the warning about a throw-expression that will immediately result in a call to <code class="code">terminate</code>. </p> </dd> <dt> + <span><code class="code">-Wno-vexing-parse <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wvexing-parse"> ¶</a></span> +</dt> <dd> +<p>Warn about the most vexing parse syntactic ambiguity. This warns about the cases when a declaration looks like a variable definition, but the C++ language requires it to be interpreted as a function declaration. For instance: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f(double a) { + int i(); // extern int i (void); + int n(int(a)); // extern int n (int); +}</pre> +</div> <p>Another example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct S { S(int); }; +void f(double a) { + S x(int(a)); // extern struct S x (int); + S y(int()); // extern struct S y (int (*) (void)); + S z(); // extern struct S z (void); +}</pre> +</div> <p>The warning will suggest options how to deal with such an ambiguity; e.g., it can suggest removing the parentheses or using braces instead. </p> <p>This warning is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wno-class-conversion <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wno-class-conversion"> ¶</a></span> +</dt> <dd> +<p>Do not warn when a conversion function converts an object to the same type, to a base class of that type, or to void; such a conversion function will never be called. </p> </dd> <dt> + <span><code class="code">-Wvolatile <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wvolatile"> ¶</a></span> +</dt> <dd> +<p>Warn about deprecated uses of the <code class="code">volatile</code> qualifier. This includes postfix and prefix <code class="code">++</code> and <code class="code">--</code> expressions of <code class="code">volatile</code>-qualified types, using simple assignments where the left operand is a <code class="code">volatile</code>-qualified non-class type for their value, compound assignments where the left operand is a <code class="code">volatile</code>-qualified non-class type, <code class="code">volatile</code>-qualified function return type, <code class="code">volatile</code>-qualified parameter type, and structured bindings of a <code class="code">volatile</code>-qualified type. This usage was deprecated in C++20. </p> <p>Enabled by default with <samp class="option">-std=c++20</samp>. </p> </dd> <dt> + <span><code class="code">-Wzero-as-null-pointer-constant <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wzero-as-null-pointer-constant"> ¶</a></span> +</dt> <dd> +<p>Warn when a literal ‘<samp class="samp">0</samp>’ is used as null pointer constant. This can be useful to facilitate the conversion to <code class="code">nullptr</code> in C++11. </p> </dd> <dt> + <span><code class="code">-Waligned-new</code><a class="copiable-link" href="#index-Waligned-new"> ¶</a></span> +</dt> <dd> +<p>Warn about a new-expression of a type that requires greater alignment than the <code class="code">alignof(std::max_align_t)</code> but uses an allocation function without an explicit alignment parameter. This option is enabled by <samp class="option">-Wall</samp>. </p> <p>Normally this only warns about global allocation functions, but <samp class="option">-Waligned-new=all</samp> also warns about class member allocation functions. </p> </dd> <dt> + <span><code class="code">-Wno-placement-new</code><a class="copiable-link" href="#index-Wplacement-new"> ¶</a></span> +</dt> <dt><code class="code">-Wplacement-new=<var class="var">n</var></code></dt> <dd> +<p>Warn about placement new expressions with undefined behavior, such as constructing an object in a buffer that is smaller than the type of the object. For example, the placement new expression below is diagnosed because it attempts to construct an array of 64 integers in a buffer only 64 bytes large. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">char buf [64]; +new (buf) int[64];</pre> +</div> <p>This warning is enabled by default. </p> <dl class="table"> <dt><code class="code">-Wplacement-new=1</code></dt> <dd> +<p>This is the default warning level of <samp class="option">-Wplacement-new</samp>. At this level the warning is not issued for some strictly undefined constructs that GCC allows as extensions for compatibility with legacy code. For example, the following <code class="code">new</code> expression is not diagnosed at this level even though it has undefined behavior according to the C++ standard because it writes past the end of the one-element array. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct S { int n, a[1]; }; +S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]); +new (s->a)int [32]();</pre> +</div> </dd> <dt><code class="code">-Wplacement-new=2</code></dt> <dd> +<p>At this level, in addition to diagnosing all the same constructs as at level 1, a diagnostic is also issued for placement new expressions that construct an object in the last member of structure whose type is an array of a single element and whose size is less than the size of the object being constructed. While the previous example would be diagnosed, the following construct makes use of the flexible member array extension to avoid the warning at level 2. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct S { int n, a[]; }; +S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]); +new (s->a)int [32]();</pre> +</div> </dd> </dl> </dd> <dt> + <span><code class="code">-Wcatch-value</code><a class="copiable-link" href="#index-Wcatch-value"> ¶</a></span> +</dt> <dt><code class="code">-Wcatch-value=<var class="var">n</var> <span class="r">(C++ and Objective-C++ only)</span></code></dt> <dd> +<p>Warn about catch handlers that do not catch via reference. With <samp class="option">-Wcatch-value=1</samp> (or <samp class="option">-Wcatch-value</samp> for short) warn about polymorphic class types that are caught by value. With <samp class="option">-Wcatch-value=2</samp> warn about all class types that are caught by value. With <samp class="option">-Wcatch-value=3</samp> warn about all types that are not caught by reference. <samp class="option">-Wcatch-value</samp> is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wconditionally-supported <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wconditionally-supported"> ¶</a></span> +</dt> <dd> +<p>Warn for conditionally-supported (C++11 [intro.defs]) constructs. </p> </dd> <dt> + <span><code class="code">-Wno-delete-incomplete <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wdelete-incomplete"> ¶</a></span> +</dt> <dd> +<p>Do not warn when deleting a pointer to incomplete type, which may cause undefined behavior at runtime. This warning is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wextra-semi <span class="r">(C++, Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wextra-semi"> ¶</a></span> +</dt> <dd> +<p>Warn about redundant semicolons after in-class function definitions. </p> </dd> <dt> + <span><code class="code">-Wno-inaccessible-base <span class="r">(C++, Objective-C++ only)</span></code><a class="copiable-link" href="#index-Winaccessible-base"> ¶</a></span> +</dt> <dd> +<p>This option controls warnings when a base class is inaccessible in a class derived from it due to ambiguity. The warning is enabled by default. Note that the warning for ambiguous virtual bases is enabled by the <samp class="option">-Wextra</samp> option. </p> +<div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">struct A { int a; }; + +struct B : A { }; + +struct C : B, A { };</pre></div> +</div> </dd> <dt> + <span><code class="code">-Wno-inherited-variadic-ctor</code><a class="copiable-link" href="#index-Winherited-variadic-ctor"> ¶</a></span> +</dt> <dd> +<p>Suppress warnings about use of C++11 inheriting constructors when the base class inherited from has a C variadic constructor; the warning is on by default because the ellipsis is not inherited. </p> </dd> <dt> + <span><code class="code">-Wno-invalid-offsetof <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wno-invalid-offsetof"> ¶</a></span> +</dt> <dd> +<p>Suppress warnings from applying the <code class="code">offsetof</code> macro to a non-POD type. According to the 2014 ISO C++ standard, applying <code class="code">offsetof</code> to a non-standard-layout type is undefined. In existing C++ implementations, however, <code class="code">offsetof</code> typically gives meaningful results. This flag is for users who are aware that they are writing nonportable code and who have deliberately chosen to ignore the warning about it. </p> <p>The restrictions on <code class="code">offsetof</code> may be relaxed in a future version of the C++ standard. </p> </dd> <dt> + <span><code class="code">-Wsized-deallocation <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wsized-deallocation"> ¶</a></span> +</dt> <dd> +<p>Warn about a definition of an unsized deallocation function </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void operator delete (void *) noexcept; +void operator delete[] (void *) noexcept;</pre> +</div> <p>without a definition of the corresponding sized deallocation function </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void operator delete (void *, std::size_t) noexcept; +void operator delete[] (void *, std::size_t) noexcept;</pre> +</div> <p>or vice versa. Enabled by <samp class="option">-Wextra</samp> along with <samp class="option">-fsized-deallocation</samp>. </p> </dd> <dt> + <span><code class="code">-Wsuggest-final-types</code><a class="copiable-link" href="#index-Wno-suggest-final-types"> ¶</a></span> +</dt> <dd> +<p>Warn about types with virtual methods where code quality would be improved if the type were declared with the C++11 <code class="code">final</code> specifier, or, if possible, declared in an anonymous namespace. This allows GCC to more aggressively devirtualize the polymorphic calls. This warning is more effective with link-time optimization, where the information about the class hierarchy graph is more complete. </p> </dd> <dt> + <span><code class="code">-Wsuggest-final-methods</code><a class="copiable-link" href="#index-Wno-suggest-final-methods"> ¶</a></span> +</dt> <dd> +<p>Warn about virtual methods where code quality would be improved if the method were declared with the C++11 <code class="code">final</code> specifier, or, if possible, its type were declared in an anonymous namespace or with the <code class="code">final</code> specifier. This warning is more effective with link-time optimization, where the information about the class hierarchy graph is more complete. It is recommended to first consider suggestions of <samp class="option">-Wsuggest-final-types</samp> and then rebuild with new annotations. </p> </dd> <dt> + <span><code class="code">-Wsuggest-override</code><a class="copiable-link" href="#index-Wsuggest-override"> ¶</a></span> +</dt> <dd> +<p>Warn about overriding virtual functions that are not marked with the <code class="code">override</code> keyword. </p> </dd> <dt> + <span><code class="code">-Wuse-after-free</code><a class="copiable-link" href="#index-Wuse-after-free"> ¶</a></span> +</dt> <dt><code class="code">-Wuse-after-free=<var class="var">n</var></code></dt> <dd> +<p>Warn about uses of pointers to dynamically allocated objects that have been rendered indeterminate by a call to a deallocation function. The warning is enabled at all optimization levels but may yield different results with optimization than without. </p> <dl class="table"> <dt><code class="code">-Wuse-after-free=1</code></dt> <dd><p>At level 1 the warning attempts to diagnose only unconditional uses of pointers made indeterminate by a deallocation call or a successful call to <code class="code">realloc</code>, regardless of whether or not the call resulted in an actual reallocatio of memory. This includes double-<code class="code">free</code> calls as well as uses in arithmetic and relational expressions. Although undefined, uses of indeterminate pointers in equality (or inequality) expressions are not diagnosed at this level. </p></dd> <dt><code class="code">-Wuse-after-free=2</code></dt> <dd> +<p>At level 2, in addition to unconditional uses, the warning also diagnoses conditional uses of pointers made indeterminate by a deallocation call. As at level 2, uses in equality (or inequality) expressions are not diagnosed. For example, the second call to <code class="code">free</code> in the following function is diagnosed at this level: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct A { int refcount; void *data; }; + +void release (struct A *p) +{ + int refcount = --p->refcount; + free (p); + if (refcount == 0) + free (p->data); // warning: p may be used after free +}</pre> +</div> </dd> <dt><code class="code">-Wuse-after-free=3</code></dt> <dd> +<p>At level 3, the warning also diagnoses uses of indeterminate pointers in equality expressions. All uses of indeterminate pointers are undefined but equality tests sometimes appear after calls to <code class="code">realloc</code> as an attempt to determine whether the call resulted in relocating the object to a different address. They are diagnosed at a separate level to aid legacy code gradually transition to safe alternatives. For example, the equality test in the function below is diagnosed at this level: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void adjust_pointers (int**, int); + +void grow (int **p, int n) +{ + int **q = (int**)realloc (p, n *= 2); + if (q == p) + return; + adjust_pointers ((int**)q, n); +}</pre> +</div> <p>To avoid the warning at this level, store offsets into allocated memory instead of pointers. This approach obviates needing to adjust the stored pointers after reallocation. </p> +</dd> </dl> <p><samp class="option">-Wuse-after-free=2</samp> is included in <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wuseless-cast <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wuseless-cast"> ¶</a></span> +</dt> <dd> +<p>Warn when an expression is cast to its own type. This warning does not occur when a class object is converted to a non-reference type as that is a way to create a temporary: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct S { }; +void g (S&&); +void f (S&& arg) +{ + g (S(arg)); // make arg prvalue so that it can bind to S&& +}</pre> +</div> </dd> <dt> + <span><code class="code">-Wno-conversion-null <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wconversion-null"> ¶</a></span> +</dt> <dd> +<p>Do not warn for conversions between <code class="code">NULL</code> and non-pointer types. <samp class="option">-Wconversion-null</samp> is enabled by default. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="objective-c-and-objective-c_002b_002b-dialect-options">Options Controlling Objective-C and Objective-C++ Dialects</a>, Previous: <a href="c-dialect-options">Options Controlling C Dialect</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Dialect-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Dialect-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-extensions.html b/devdocs/gcc~13/c_002b_002b-extensions.html new file mode 100644 index 00000000..57d50502 --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-extensions.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="C_002b_002b-Extensions"> <div class="nav-panel"> <p> Next: <a href="objective-c" accesskey="n" rel="next">GNU Objective-C Features</a>, Previous: <a href="c-extensions" accesskey="p" rel="prev">Extensions to the C Language Family</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="Extensions-to-the-C_002b_002b-Language"><span>7 Extensions to the C++ Language<a class="copiable-link" href="#Extensions-to-the-C_002b_002b-Language"> ¶</a></span></h1> <p>The GNU compiler provides these extensions to the C++ language (and you can also use most of the C language extensions in your C++ programs). If you want to write code that checks whether these features are available, you can test for the GNU compiler the same way as for C programs: check for a predefined macro <code class="code">__GNUC__</code>. You can also use <code class="code">__GNUG__</code> to test specifically for GNU C++ (see <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros">Predefined Macros</a> in The GNU C Preprocessor). </p> <ul class="mini-toc"> <li><a href="c_002b_002b-volatiles" accesskey="1">When is a Volatile C++ Object Accessed?</a></li> <li><a href="restricted-pointers" accesskey="2">Restricting Pointer Aliasing</a></li> <li><a href="vague-linkage" accesskey="3">Vague Linkage</a></li> <li><a href="c_002b_002b-interface" accesskey="4">C++ Interface and Implementation Pragmas</a></li> <li><a href="template-instantiation" accesskey="5">Where’s the Template?</a></li> <li><a href="bound-member-functions" accesskey="6">Extracting the Function Pointer from a Bound Pointer to Member Function</a></li> <li><a href="c_002b_002b-attributes" accesskey="7">C++-Specific Variable, Function, and Type Attributes</a></li> <li><a href="function-multiversioning" accesskey="8">Function Multiversioning</a></li> <li><a href="type-traits" accesskey="9">Type Traits</a></li> <li><a href="c_002b_002b-concepts">C++ Concepts</a></li> <li><a href="deprecated-features">Deprecated Features</a></li> <li><a href="backwards-compatibility">Backwards Compatibility</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Extensions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Extensions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-implementation.html b/devdocs/gcc~13/c_002b_002b-implementation.html new file mode 100644 index 00000000..c95f0825 --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-implementation.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="C_002b_002b-Implementation"> <div class="nav-panel"> <p> Next: <a href="c-extensions" accesskey="n" rel="next">Extensions to the C Language Family</a>, Previous: <a href="c-implementation" accesskey="p" rel="prev">C Implementation-Defined Behavior</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="C_002b_002b-Implementation-Defined-Behavior"><span>5 C++ Implementation-Defined Behavior<a class="copiable-link" href="#C_002b_002b-Implementation-Defined-Behavior"> ¶</a></span></h1> <p>A conforming implementation of ISO C++ is required to document its choice of behavior in each of the areas that are designated “implementation defined”. The following lists all such areas, along with the section numbers from the ISO/IEC 14882:1998 and ISO/IEC 14882:2003 standards. Some areas are only implementation-defined in one version of the standard. </p> <p>Some choices depend on the externally determined ABI for the platform (including standard character encodings) which GCC follows; these are listed as “determined by ABI” below. See <a class="xref" href="compatibility">Binary Compatibility</a>, and <a class="uref" href="https://gcc.gnu.org/readings.html">https://gcc.gnu.org/readings.html</a>. Some choices are documented in the preprocessor manual. See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. Some choices are documented in the corresponding document for the C language. See <a class="xref" href="c-implementation">C Implementation-Defined Behavior</a>. Some choices are made by the library and operating system (or other environment when compiling for a freestanding environment); refer to their documentation for details. </p> <ul class="mini-toc"> <li><a href="conditionally-supported-behavior" accesskey="1">Conditionally-Supported Behavior</a></li> <li><a href="exception-handling" accesskey="2">Exception Handling</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-interface.html b/devdocs/gcc~13/c_002b_002b-interface.html new file mode 100644 index 00000000..1f831006 --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-interface.html @@ -0,0 +1,13 @@ +<div class="section-level-extent" id="C_002b_002b-Interface"> <div class="nav-panel"> <p> Next: <a href="template-instantiation" accesskey="n" rel="next">Where’s the Template?</a>, Previous: <a href="vague-linkage" accesskey="p" rel="prev">Vague Linkage</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="C_002b_002b-Interface-and-Implementation-Pragmas"><span>7.4 C++ Interface and Implementation Pragmas<a class="copiable-link" href="#C_002b_002b-Interface-and-Implementation-Pragmas"> ¶</a></span></h1> <p><code class="code">#pragma interface</code> and <code class="code">#pragma implementation</code> provide the user with a way of explicitly directing the compiler to emit entities with vague linkage (and debugging information) in a particular translation unit. </p> <p><em class="emph">Note:</em> These <code class="code">#pragma</code>s have been superceded as of GCC 2.7.2 by COMDAT support and the “key method” heuristic mentioned in <a class="ref" href="vague-linkage">Vague Linkage</a>. Using them can actually cause your program to grow due to unnecessary out-of-line copies of inline functions. </p> <dl class="table"> <dt> +<span><code class="code">#pragma interface</code><a class="copiable-link" href="#index-_0023pragma-interface"> ¶</a></span> +</dt> <dt><code class="code">#pragma interface "<var class="var">subdir</var>/<var class="var">objects</var>.h"</code></dt> <dd> +<p>Use this directive in <em class="emph">header files</em> that define object classes, to save space in most of the object files that use those classes. Normally, local copies of certain information (backup copies of inline member functions, debugging information, and the internal tables that implement virtual functions) must be kept in each object file that includes class definitions. You can use this pragma to avoid such duplication. When a header file containing ‘<samp class="samp">#pragma interface</samp>’ is included in a compilation, this auxiliary information is not generated (unless the main input source file itself uses ‘<samp class="samp">#pragma implementation</samp>’). Instead, the object files contain references to be resolved at link time. </p> <p>The second form of this directive is useful for the case where you have multiple headers with the same name in different directories. If you use this form, you must specify the same string to ‘<samp class="samp">#pragma implementation</samp>’. </p> </dd> <dt> +<span><code class="code">#pragma implementation</code><a class="copiable-link" href="#index-_0023pragma-implementation"> ¶</a></span> +</dt> <dt><code class="code">#pragma implementation "<var class="var">objects</var>.h"</code></dt> <dd> +<p>Use this pragma in a <em class="emph">main input file</em>, when you want full output from included header files to be generated (and made globally visible). The included header file, in turn, should use ‘<samp class="samp">#pragma interface</samp>’. Backup copies of inline member functions, debugging information, and the internal tables used to implement virtual functions are all generated in implementation files. </p> <p>If you use ‘<samp class="samp">#pragma implementation</samp>’ with no argument, it applies to an include file with the same basename<a class="footnote" id="DOCF8" href="#FOOT8"><sup>8</sup></a> as your source file. For example, in <samp class="file">allclass.cc</samp>, giving just ‘<samp class="samp">#pragma implementation</samp>’ by itself is equivalent to ‘<samp class="samp">#pragma implementation "allclass.h"</samp>’. </p> <p>Use the string argument if you want a single implementation file to include code from multiple header files. (You must also use ‘<samp class="samp">#include</samp>’ to include the header file; ‘<samp class="samp">#pragma implementation</samp>’ only specifies how to use the file—it doesn’t actually include it.) </p> <p>There is no way to split up the contents of a single header file into multiple implementation files. </p> +</dd> </dl> <p>‘<samp class="samp">#pragma implementation</samp>’ and ‘<samp class="samp">#pragma interface</samp>’ also have an effect on function inlining. </p> <p>If you define a class in a header file marked with ‘<samp class="samp">#pragma interface</samp>’, the effect on an inline function defined in that class is similar to an explicit <code class="code">extern</code> declaration—the compiler emits no code at all to define an independent version of the function. Its definition is used only for inlining with its callers. </p> <p>Conversely, when you include the same header file in a main source file that declares it as ‘<samp class="samp">#pragma implementation</samp>’, the compiler emits code for the function itself; this defines a version of the function that can be found via pointers (or by callers compiled without inlining). If all calls to the function can be inlined, you can avoid emitting the function by compiling with <samp class="option">-fno-implement-inlines</samp>. If any calls are not inlined, you will get linker errors. </p> </div> <div class="footnotes-segment"> <h2 class="footnotes-heading">Footnotes</h2> <h3 class="footnote-body-heading"><a id="FOOT8" href="#DOCF8">(8)</a></h3> <p>A file’s <em class="dfn">basename</em> is the name stripped of all leading path information and of trailing suffixes, such as ‘<samp class="samp">.h</samp>’ or ‘<samp class="samp">.C</samp>’ or ‘<samp class="samp">.cc</samp>’.</p> </div> <div class="nav-panel"> <p> Next: <a href="template-instantiation">Where’s the Template?</a>, Previous: <a href="vague-linkage">Vague Linkage</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Interface.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Interface.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-misunderstandings.html b/devdocs/gcc~13/c_002b_002b-misunderstandings.html new file mode 100644 index 00000000..c9d0e59d --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-misunderstandings.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="C_002b_002b-Misunderstandings"> <div class="nav-panel"> <p> Next: <a href="non-bugs" accesskey="n" rel="next">Certain Changes We Don’t Want to Make</a>, Previous: <a href="disappointments" accesskey="p" rel="prev">Disappointments and Misunderstandings</a>, Up: <a href="trouble" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Common-Misunderstandings-with-GNU-C_002b_002b"><span>14.7 Common Misunderstandings with GNU C++<a class="copiable-link" href="#Common-Misunderstandings-with-GNU-C_002b_002b"> ¶</a></span></h1> <p>C++ is a complex language and an evolving one, and its standard definition (the ISO C++ standard) was only recently completed. As a result, your C++ compiler may occasionally surprise you, even when its behavior is correct. This section discusses some areas that frequently give rise to questions of this sort. </p> <ul class="mini-toc"> <li><a href="static-definitions" accesskey="1">Declare <em class="emph">and</em> Define Static Members</a></li> <li><a href="name-lookup" accesskey="2">Name Lookup, Templates, and Accessing Members of Base Classes</a></li> <li><a href="temporaries" accesskey="3">Temporaries May Vanish Before You Expect</a></li> <li><a href="copy-assignment" accesskey="4">Implicit Copy-Assignment for Virtual Bases</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Misunderstandings.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Misunderstandings.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-module-mapper.html b/devdocs/gcc~13/c_002b_002b-module-mapper.html new file mode 100644 index 00000000..301a5483 --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-module-mapper.html @@ -0,0 +1,11 @@ +<div class="subsection-level-extent" id="C_002b_002b-Module-Mapper"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-module-preprocessing" accesskey="n" rel="next">Module Preprocessing</a>, Up: <a href="c_002b_002b-modules" accesskey="u" rel="up">C++ Modules</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Module-Mapper"><span>3.23.1 Module Mapper<a class="copiable-link" href="#Module-Mapper"> ¶</a></span></h1> <p>A module mapper provides a server or file that the compiler queries to determine the mapping between module names and CMI files. It is also used to build CMIs on demand. <em class="emph">Mapper functionality is in its infancy and is intended for experimentation with build system interactions.</em> </p> <p>You can specify a mapper with the <samp class="option">-fmodule-mapper=<var class="var">val</var></samp> option or <code class="env">CXX_MODULE_MAPPER</code> environment variable. The value may have one of the following forms: </p> <dl class="table"> <dt><code class="code"><span class="r">[</span><var class="var">hostname</var><span class="r">]</span>:<var class="var">port</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dd> +<p>An optional hostname and a numeric port number to connect to. If the hostname is omitted, the loopback address is used. If the hostname corresponds to multiple IPV6 addresses, these are tried in turn, until one is successful. If your host lacks IPv6, this form is non-functional. If you must use IPv4 use <samp class="option">-fmodule-mapper='|ncat <var class="var">ipv4host</var> <var class="var">port</var>'</samp>. </p> </dd> <dt><code class="code">=<var class="var">socket</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dd> +<p>A local domain socket. If your host lacks local domain sockets, this form is non-functional. </p> </dd> <dt><code class="code">|<var class="var">program</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span> <span class="r">[</span><var class="var">args...</var><span class="r">]</span></code></dt> <dd> +<p>A program to spawn, and communicate with on its stdin/stdout streams. Your <var class="var">PATH</var> environment variable is searched for the program. Arguments are separated by space characters, (it is not possible for one of the arguments delivered to the program to contain a space). An exception is if <var class="var">program</var> begins with @. In that case <var class="var">program</var> (sans @) is looked for in the compiler’s internal binary directory. Thus the sample mapper-server can be specified with <code class="code">@g++-mapper-server</code>. </p> </dd> <dt><code class="code"><><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dt><code class="code"><><var class="var">inout</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dt><code class="code"><<var class="var">in</var>><var class="var">out</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dd> +<p>Named pipes or file descriptors to communicate over. The first form, <samp class="option"><></samp>, communicates over stdin and stdout. The other forms allow you to specify a file descriptor or name a pipe. A numeric value is interpreted as a file descriptor, otherwise named pipe is opened. The second form specifies a bidirectional pipe and the last form allows specifying two independent pipes. Using file descriptors directly in this manner is fragile in general, as it can require the cooperation of intermediate processes. In particular using stdin & stdout is fraught with danger as other compiler options might also cause the compiler to read stdin or write stdout, and it can have unfortunate interactions with signal delivery from the terminal. </p> </dd> <dt><code class="code"><var class="var">file</var><span class="r">[</span>?<var class="var">ident</var><span class="r">]</span></code></dt> <dd> +<p>A mapping file consisting of space-separated module-name, filename pairs, one per line. Only the mappings for the direct imports and any module export name need be provided. If other mappings are provided, they override those stored in any imported CMI files. A repository root may be specified in the mapping file by using ‘<samp class="samp">$root</samp>’ as the module name in the first active line. Use of this option will disable any default module->CMI name mapping. </p> </dd> </dl> <p>As shown, an optional <var class="var">ident</var> may suffix the first word of the option, indicated by a ‘<samp class="samp">?</samp>’ prefix. The value is used in the initial handshake with the module server, or to specify a prefix on mapping file lines. In the server case, the main source file name is used if no <var class="var">ident</var> is specified. In the file case, all non-blank lines are significant, unless a value is specified, in which case only lines beginning with <var class="var">ident</var> are significant. The <var class="var">ident</var> must be separated by whitespace from the module name. Be aware that ‘<samp class="samp"><</samp>’, ‘<samp class="samp">></samp>’, ‘<samp class="samp">?</samp>’, and ‘<samp class="samp">|</samp>’ characters are often significant to the shell, and therefore may need quoting. </p> <p>The mapper is connected to or loaded lazily, when the first module mapping is required. The networking protocols are only supported on hosts that provide networking. If no mapper is specified a default is provided. </p> <p>A project-specific mapper is expected to be provided by the build system that invokes the compiler. It is not expected that a general-purpose server is provided for all compilations. As such, the server will know the build configuration, the compiler it invoked, and the environment (such as working directory) in which that is operating. As it may parallelize builds, several compilations may connect to the same socket. </p> <p>The default mapper generates CMI files in a ‘<samp class="samp">gcm.cache</samp>’ directory. CMI files have a ‘<samp class="samp">.gcm</samp>’ suffix. The module unit name is used directly to provide the basename. Header units construct a relative path using the underlying header file name. If the path is already relative, a ‘<samp class="samp">,</samp>’ directory is prepended. Internal ‘<samp class="samp">..</samp>’ components are translated to ‘<samp class="samp">,,</samp>’. No attempt is made to canonicalize these filenames beyond that done by the preprocessor’s include search algorithm, as in general it is ambiguous when symbolic links are present. </p> <p>The mapper protocol was published as “A Module Mapper” <a class="uref" href="https://wg21.link/p1184">https://wg21.link/p1184</a>. The implementation is provided by <code class="command">libcody</code>, <a class="uref" href="https://github.com/urnathan/libcody">https://github.com/urnathan/libcody</a>, which specifies the canonical protocol definition. A proof of concept server implementation embedded in <code class="command">make</code> was described in ”Make Me A Module”, <a class="uref" href="https://wg21.link/p1602">https://wg21.link/p1602</a>. </p> </div> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-module-preprocessing">Module Preprocessing</a>, Up: <a href="c_002b_002b-modules">C++ Modules</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Module-Mapper.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Module-Mapper.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-module-preprocessing.html b/devdocs/gcc~13/c_002b_002b-module-preprocessing.html new file mode 100644 index 00000000..aa56fe74 --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-module-preprocessing.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="C_002b_002b-Module-Preprocessing"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-compiled-module-interface" accesskey="n" rel="next">Compiled Module Interface</a>, Previous: <a href="c_002b_002b-module-mapper" accesskey="p" rel="prev">Module Mapper</a>, Up: <a href="c_002b_002b-modules" accesskey="u" rel="up">C++ Modules</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Module-Preprocessing"><span>3.23.2 Module Preprocessing<a class="copiable-link" href="#Module-Preprocessing"> ¶</a></span></h1> <p>Modules affect preprocessing because of header units and include translation. Some uses of the preprocessor as a separate step either do not produce a correct output, or require CMIs to be available. </p> <p>Header units import macros. These macros can affect later conditional inclusion, which therefore can cascade to differing import sets. When preprocessing, it is necessary to load the CMI. If a header unit is unavailable, the preprocessor issues a warning and continue (when not just preprocessing, an error is emitted). Detecting such imports requires preprocessor tokenization of the input stream to phase 4 (macro expansion). </p> <p>Include translation converts <code class="code">#include</code>, <code class="code">#include_next</code> and <code class="code">#import</code> directives to internal <code class="code">import</code> declarations. Whether a particular directive is translated is controlled by the module mapper. Header unit names are canonicalized during preprocessing. </p> <p>Dependency information can be emitted for macro import, extending the functionality of <samp class="option">-MD</samp> and <samp class="option">-MMD</samp> options. Detection of import declarations also requires phase 4 preprocessing, and thus requires full preprocessing (or compilation). </p> <p>The <samp class="option">-M</samp>, <samp class="option">-MM</samp> and <samp class="option">-E -fdirectives-only</samp> options halt preprocessing before phase 4. </p> <p>The <samp class="option">-save-temps</samp> option uses <samp class="option">-fdirectives-only</samp> for preprocessing, and preserve the macro definitions in the preprocessed output. Usually you also want to use this option when explicitly preprocessing a header-unit, or consuming such preprocessed output: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii +g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Module-Preprocessing.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Module-Preprocessing.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-modules.html b/devdocs/gcc~13/c_002b_002b-modules.html new file mode 100644 index 00000000..28ea4cef --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-modules.html @@ -0,0 +1,11 @@ +<div class="section-level-extent" id="C_002b_002b-Modules"> <div class="nav-panel"> <p> Previous: <a href="precompiled-headers" accesskey="p" rel="prev">Using Precompiled Headers</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="C_002b_002b-Modules-1"><span>3.23 C++ Modules<a class="copiable-link" href="#C_002b_002b-Modules-1"> ¶</a></span></h1> <p>Modules are a C++20 language feature. As the name suggests, they provides a modular compilation system, intending to provide both faster builds and better library isolation. The “Merging Modules” paper <a class="uref" href="https://wg21.link/p1103">https://wg21.link/p1103</a>, provides the easiest to read set of changes to the standard, although it does not capture later changes. </p> <p><em class="emph">G++’s modules support is not complete.</em> Other than bugs, the known missing pieces are: </p> <dl class="table"> <dt>Private Module Fragment</dt> <dd> +<p>The Private Module Fragment is recognized, but an error is emitted. </p> </dd> <dt>Partition definition visibility rules</dt> <dd> +<p>Entities may be defined in implementation partitions, and those definitions are not available outside of the module. This is not implemented, and the definitions are available to extra-module use. </p> </dd> <dt>Textual merging of reachable GM entities</dt> <dd> +<p>Entities may be multiply defined across different header-units. These must be de-duplicated, and this is implemented across imports, or when an import redefines a textually-defined entity. However the reverse is not implemented—textually redefining an entity that has been defined in an imported header-unit. A redefinition error is emitted. </p> </dd> <dt>Translation-Unit local referencing rules</dt> <dd> +<p>Papers p1815 (<a class="uref" href="https://wg21.link/p1815">https://wg21.link/p1815</a>) and p2003 (<a class="uref" href="https://wg21.link/p2003">https://wg21.link/p2003</a>) add limitations on which entities an exported region may reference (for instance, the entities an exported template definition may reference). These are not fully implemented. </p> </dd> <dt>Standard Library Header Units</dt> <dd> +<p>The Standard Library is not provided as importable header units. If you want to import such units, you must explicitly build them first. If you do not do this with care, you may have multiple declarations, which the module machinery must merge—compiler resource usage can be affected by how you partition header files into header units. </p> </dd> </dl> <p>Modular compilation is <em class="emph">not</em> enabled with just the <samp class="option">-std=c++20</samp> option. You must explicitly enable it with the <samp class="option">-fmodules-ts</samp> option. It is independent of the language version selected, although in pre-C++20 versions, it is of course an extension. </p> <p>No new source file suffixes are required or supported. If you wish to use a non-standard suffix (see <a class="pxref" href="overall-options">Options Controlling the Kind of Output</a>), you also need to provide a <samp class="option">-x c++</samp> option too.<a class="footnote" id="DOCF2" href="#FOOT2"><sup>2</sup></a> </p> <p>Compiling a module interface unit produces an additional output (to the assembly or object file), called a Compiled Module Interface (CMI). This encodes the exported declarations of the module. Importing a module reads in the CMI. The import graph is a Directed Acyclic Graph (DAG). You must build imports before the importer. </p> <p>Header files may themselves be compiled to header units, which are a transitional ability aiming at faster compilation. The <samp class="option">-fmodule-header</samp> option is used to enable this, and implies the <samp class="option">-fmodules-ts</samp> option. These CMIs are named by the fully resolved underlying header file, and thus may be a complete pathname containing subdirectories. If the header file is found at an absolute pathname, the CMI location is still relative to a CMI root directory. </p> <p>As header files often have no suffix, you commonly have to specify a <samp class="option">-x</samp> option to tell the compiler the source is a header file. You may use <samp class="option">-x c++-header</samp>, <samp class="option">-x c++-user-header</samp> or <samp class="option">-x c++-system-header</samp>. When used in conjunction with <samp class="option">-fmodules-ts</samp>, these all imply an appropriate <samp class="option">-fmodule-header</samp> option. The latter two variants use the user or system include path to search for the file specified. This allows you to, for instance, compile standard library header files as header units, without needing to know exactly where they are installed. Specifying the language as one of these variants also inhibits output of the object file, as header files have no associated object file. </p> <p>The <samp class="option">-fmodule-only</samp> option disables generation of the associated object file for compiling a module interface. Only the CMI is generated. This option is implied when using the <samp class="option">-fmodule-header</samp> option. </p> <p>The <samp class="option">-flang-info-include-translate</samp> and <samp class="option">-flang-info-include-translate-not</samp> options notes whether include translation occurs or not. With no argument, the first will note all include translation. The second will note all non-translations of include files not known to intentionally be textual. With an argument, queries about include translation of a header files with that particular trailing pathname are noted. You may repeat this form to cover several different header files. This option may be helpful in determining whether include translation is happening—if it is working correctly, it behaves as if it isn’t there at all. </p> <p>The <samp class="option">-flang-info-module-cmi</samp> option can be used to determine where the compiler is reading a CMI from. Without the option, the compiler is silent when such a read is successful. This option has an optional argument, which will restrict the notification to just the set of named modules or header units specified. </p> <p>The <samp class="option">-Winvalid-imported-macros</samp> option causes all imported macros to be resolved at the end of compilation. Without this, imported macros are only resolved when expanded or (re)defined. This option detects conflicting import definitions for all macros. </p> <p>For details of the <samp class="option">-fmodule-mapper</samp> family of options, see <a class="pxref" href="c_002b_002b-module-mapper">Module Mapper</a>. </p> <ul class="mini-toc"> <li><a href="c_002b_002b-module-mapper" accesskey="1">Module Mapper</a></li> <li><a href="c_002b_002b-module-preprocessing" accesskey="2">Module Preprocessing</a></li> <li><a href="c_002b_002b-compiled-module-interface" accesskey="3">Compiled Module Interface</a></li> </ul> </div> <div class="footnotes-segment"> <h2 class="footnotes-heading">Footnotes</h2> <h3 class="footnote-body-heading"><a id="FOOT2" href="#DOCF2">(2)</a></h3> <p>Some users like to distinguish module interface files with a new suffix, such as naming the source <code class="code">module.cppm</code>, which involves teaching all tools about the new suffix. A different scheme, such as naming <code class="code">module-m.cpp</code> would be less invasive.</p> </div> <div class="nav-panel"> <p> Previous: <a href="precompiled-headers">Using Precompiled Headers</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Modules.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Modules.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b-volatiles.html b/devdocs/gcc~13/c_002b_002b-volatiles.html new file mode 100644 index 00000000..41afd0c2 --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b-volatiles.html @@ -0,0 +1,10 @@ +<div class="section-level-extent" id="C_002b_002b-Volatiles"> <div class="nav-panel"> <p> Next: <a href="restricted-pointers" accesskey="n" rel="next">Restricting Pointer Aliasing</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="When-is-a-Volatile-C_002b_002b-Object-Accessed_003f"><span>7.1 When is a Volatile C++ Object Accessed?<a class="copiable-link" href="#When-is-a-Volatile-C_002b_002b-Object-Accessed_003f"> ¶</a></span></h1> <p>The C++ standard differs from the C standard in its treatment of volatile objects. It fails to specify what constitutes a volatile access, except to say that C++ should behave in a similar manner to C with respect to volatiles, where possible. However, the different lvalueness of expressions between C and C++ complicate the behavior. G++ behaves the same as GCC for volatile access, See <a class="xref" href="c-extensions">Volatiles</a>, for a description of GCC’s behavior. </p> <p>The C and C++ language specifications differ when an object is accessed in a void context: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">volatile int *src = <var class="var">somevalue</var>; +*src;</pre> +</div> <p>The C++ standard specifies that such expressions do not undergo lvalue to rvalue conversion, and that the type of the dereferenced object may be incomplete. The C++ standard does not specify explicitly that it is lvalue to rvalue conversion that is responsible for causing an access. There is reason to believe that it is, because otherwise certain simple expressions become undefined. However, because it would surprise most programmers, G++ treats dereferencing a pointer to volatile object of complete type as GCC would do for an equivalent type in C. When the object has incomplete type, G++ issues a warning; if you wish to force an error, you must force a conversion to rvalue with, for instance, a static cast. </p> <p>When using a reference to volatile, G++ does not treat equivalent expressions as accesses to volatiles, but instead issues a warning that no volatile is accessed. The rationale for this is that otherwise it becomes difficult to determine where volatile access occur, and not possible to ignore the return value from functions returning volatile references. Again, if you wish to force a read, cast the reference to an rvalue. </p> <p>G++ implements the same behavior as GCC does when assigning to a volatile object—there is no reread of the assigned-to object, the assigned rvalue is reused. Note that in C++ assignment expressions are lvalues, and if used as an lvalue, the volatile object is referred to. For instance, <var class="var">vref</var> refers to <var class="var">vobj</var>, as expected, in the following example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">volatile int vobj; +volatile int &vref = vobj = <var class="var">something</var>;</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="restricted-pointers">Restricting Pointer Aliasing</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Volatiles.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Volatiles.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/c_002b_002b98-thread-local-edits.html b/devdocs/gcc~13/c_002b_002b98-thread-local-edits.html new file mode 100644 index 00000000..52bc84da --- /dev/null +++ b/devdocs/gcc~13/c_002b_002b98-thread-local-edits.html @@ -0,0 +1,37 @@ +<div class="subsection-level-extent" id="C_002b_002b98-Thread-Local-Edits"> <div class="nav-panel"> <p> Previous: <a href="c99-thread-local-edits" accesskey="p" rel="prev">ISO/IEC 9899:1999 Edits for Thread-Local Storage</a>, Up: <a href="thread-local" accesskey="u" rel="up">Thread-Local Storage</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="ISO_002fIEC-14882_003a1998-Edits-for-Thread-Local-Storage"><span>6.64.2 ISO/IEC 14882:1998 Edits for Thread-Local Storage<a class="copiable-link" href="#ISO_002fIEC-14882_003a1998-Edits-for-Thread-Local-Storage"> ¶</a></span></h1> <p>The following are a set of changes to ISO/IEC 14882:1998 (aka C++98) that document the exact semantics of the language extension. </p> <ul class="itemize mark-bullet"> <li> +<b class="b">[intro.execution]</b> <p>New text after paragraph 4 </p> <blockquote class="quotation"> <p>A <em class="dfn">thread</em> is a flow of control within the abstract machine. It is implementation defined whether or not there may be more than one thread. </p> +</blockquote> <p>New text after paragraph 7 </p> <blockquote class="quotation"> <p>It is unspecified whether additional action must be taken to ensure when and whether side effects are visible to other threads. </p> +</blockquote> </li> +<li> +<b class="b">[lex.key]</b> <p>Add <code class="code">__thread</code>. </p> </li> +<li> +<b class="b">[basic.start.main]</b> <p>Add after paragraph 5 </p> <blockquote class="quotation"> <p>The thread that begins execution at the <code class="code">main</code> function is called the <em class="dfn">main thread</em>. It is implementation defined how functions beginning threads other than the main thread are designated or typed. A function so designated, as well as the <code class="code">main</code> function, is called a <em class="dfn">thread startup function</em>. It is implementation defined what happens if a thread startup function returns. It is implementation defined what happens to other threads when any thread calls <code class="code">exit</code>. </p> +</blockquote> </li> +<li> +<b class="b">[basic.start.init]</b> <p>Add after paragraph 4 </p> <blockquote class="quotation"> <p>The storage for an object of thread storage duration shall be statically initialized before the first statement of the thread startup function. An object of thread storage duration shall not require dynamic initialization. </p> +</blockquote> </li> +<li> +<b class="b">[basic.start.term]</b> <p>Add after paragraph 3 </p> <blockquote class="quotation"> <p>The type of an object with thread storage duration shall not have a non-trivial destructor, nor shall it be an array type whose elements (directly or indirectly) have non-trivial destructors. </p> +</blockquote> </li> +<li> +<b class="b">[basic.stc]</b> <p>Add “thread storage duration” to the list in paragraph 1. </p> <p>Change paragraph 2 </p> <blockquote class="quotation"> <p>Thread, static, and automatic storage durations are associated with objects introduced by declarations […]. </p> +</blockquote> <p>Add <code class="code">__thread</code> to the list of specifiers in paragraph 3. </p> </li> +<li> +<b class="b">[basic.stc.thread]</b> <p>New section before <b class="b">[basic.stc.static]</b> </p> <blockquote class="quotation"> <p>The keyword <code class="code">__thread</code> applied to a non-local object gives the object thread storage duration. </p> <p>A local variable or class data member declared both <code class="code">static</code> and <code class="code">__thread</code> gives the variable or member thread storage duration. </p> +</blockquote> </li> +<li> +<b class="b">[basic.stc.static]</b> <p>Change paragraph 1 </p> <blockquote class="quotation"> <p>All objects that have neither thread storage duration, dynamic storage duration nor are local […]. </p> +</blockquote> </li> +<li> +<b class="b">[dcl.stc]</b> <p>Add <code class="code">__thread</code> to the list in paragraph 1. </p> <p>Change paragraph 1 </p> <blockquote class="quotation"> <p>With the exception of <code class="code">__thread</code>, at most one <var class="var">storage-class-specifier</var> shall appear in a given <var class="var">decl-specifier-seq</var>. The <code class="code">__thread</code> specifier may be used alone, or immediately following the <code class="code">extern</code> or <code class="code">static</code> specifiers. […] </p> +</blockquote> <p>Add after paragraph 5 </p> <blockquote class="quotation"> <p>The <code class="code">__thread</code> specifier can be applied only to the names of objects and to anonymous unions. </p> +</blockquote> </li> +<li> +<b class="b">[class.mem]</b> <p>Add after paragraph 6 </p> <blockquote class="quotation"> <p>Non-<code class="code">static</code> members shall not be <code class="code">__thread</code>. </p> +</blockquote> </li> +</ul> </div> <div class="nav-panel"> <p> Previous: <a href="c99-thread-local-edits">ISO/IEC 9899:1999 Edits for Thread-Local Storage</a>, Up: <a href="thread-local">Thread-Local Storage</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b98-Thread-Local-Edits.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b98-Thread-Local-Edits.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/case-ranges.html b/devdocs/gcc~13/case-ranges.html new file mode 100644 index 00000000..9473195d --- /dev/null +++ b/devdocs/gcc~13/case-ranges.html @@ -0,0 +1,10 @@ +<div class="section-level-extent" id="Case-Ranges"> <div class="nav-panel"> <p> Next: <a href="cast-to-union" accesskey="n" rel="next">Cast to a Union Type</a>, Previous: <a href="designated-inits" accesskey="p" rel="prev">Designated Initializers</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Case-Ranges-1"><span>6.30 Case Ranges<a class="copiable-link" href="#Case-Ranges-1"> ¶</a></span></h1> <p>You can specify a range of consecutive values in a single <code class="code">case</code> label, like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">case <var class="var">low</var> ... <var class="var">high</var>:</pre> +</div> <p>This has the same effect as the proper number of individual <code class="code">case</code> labels, one for each integer value from <var class="var">low</var> to <var class="var">high</var>, inclusive. </p> <p>This feature is especially useful for ranges of ASCII character codes: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">case 'A' ... 'Z':</pre> +</div> <p><strong class="strong">Be careful:</strong> Write spaces around the <code class="code">...</code>, for otherwise it may be parsed wrong when you use it with integer values. For example, write this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">case 1 ... 5:</pre> +</div> <p>rather than this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">case 1...5:</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Case-Ranges.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Case-Ranges.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/cast-to-union.html b/devdocs/gcc~13/cast-to-union.html new file mode 100644 index 00000000..db9be2ba --- /dev/null +++ b/devdocs/gcc~13/cast-to-union.html @@ -0,0 +1,23 @@ +<div class="section-level-extent" id="Cast-to-Union"> <div class="nav-panel"> <p> Next: <a href="mixed-labels-and-declarations" accesskey="n" rel="next">Mixed Declarations, Labels and Code</a>, Previous: <a href="case-ranges" accesskey="p" rel="prev">Case Ranges</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Cast-to-a-Union-Type"><span>6.31 Cast to a Union Type<a class="copiable-link" href="#Cast-to-a-Union-Type"> ¶</a></span></h1> <p>A cast to a union type is a C extension not available in C++. It looks just like ordinary casts with the constraint that the type specified is a union type. You can specify the type either with the <code class="code">union</code> keyword or with a <code class="code">typedef</code> name that refers to a union. The result of a cast to a union is a temporary rvalue of the union type with a member whose type matches that of the operand initialized to the value of the operand. The effect of a cast to a union is similar to a compound literal except that it yields an rvalue like standard casts do. See <a class="xref" href="compound-literals">Compound Literals</a>. </p> <p>Expressions that may be cast to the union type are those whose type matches at least one of the members of the union. Thus, given the following union and variables: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">union foo { int i; double d; }; +int x; +double y; +union foo z;</pre> +</div> <p>both <code class="code">x</code> and <code class="code">y</code> can be cast to type <code class="code">union foo</code> and the following assignments </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">z = (union foo) x; +z = (union foo) y;</pre> +</div> <p>are shorthand equivalents of these </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">z = (union foo) { .i = x }; +z = (union foo) { .d = y };</pre> +</div> <p>However, <code class="code">(union foo) FLT_MAX;</code> is not a valid cast because the union has no member of type <code class="code">float</code>. </p> <p>Using the cast as the right-hand side of an assignment to a variable of union type is equivalent to storing in a member of the union with the same type </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">union foo u; +/* <span class="r">…</span> */ +u = (union foo) x ≡ u.i = x +u = (union foo) y ≡ u.d = y</pre> +</div> <p>You can also use the union cast as a function argument: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void hack (union foo); +/* <span class="r">…</span> */ +hack ((union foo) x);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="mixed-labels-and-declarations">Mixed Declarations, Labels and Code</a>, Previous: <a href="case-ranges">Case Ranges</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Cast-to-Union.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Cast-to-Union.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/character-escapes.html b/devdocs/gcc~13/character-escapes.html new file mode 100644 index 00000000..ec57400e --- /dev/null +++ b/devdocs/gcc~13/character-escapes.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Character-Escapes"> <div class="nav-panel"> <p> Next: <a href="alignment" accesskey="n" rel="next">Determining the Alignment of Functions, Types or Variables</a>, Previous: <a href="dollar-signs" accesskey="p" rel="prev">Dollar Signs in Identifier Names</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="The-Character-ESC-in-Constants"><span>6.43 The Character <kbd class="key">ESC</kbd> in Constants<a class="copiable-link" href="#The-Character-ESC-in-Constants"> ¶</a></span></h1> <p>You can use the sequence ‘<samp class="samp">\e</samp>’ in a string or character constant to stand for the ASCII character <kbd class="key">ESC</kbd>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Character-Escapes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Character-Escapes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/characters-implementation.html b/devdocs/gcc~13/characters-implementation.html new file mode 100644 index 00000000..5eccf00a --- /dev/null +++ b/devdocs/gcc~13/characters-implementation.html @@ -0,0 +1,19 @@ +<div class="section-level-extent" id="Characters-implementation"> <div class="nav-panel"> <p> Next: <a href="integers-implementation" accesskey="n" rel="next">Integers</a>, Previous: <a href="identifiers-implementation" accesskey="p" rel="prev">Identifiers</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Characters"><span>4.4 Characters<a class="copiable-link" href="#Characters"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>The number of bits in a byte (C90 3.4, C99 and C11 3.6). <p>Determined by ABI. </p> </li> +<li>The values of the members of the execution character set (C90, C99 and C11 5.2.1). <p>Determined by ABI. </p> </li> +<li>The unique value of the member of the execution character set produced for each of the standard alphabetic escape sequences (C90, C99 and C11 5.2.2). <p>Determined by ABI. </p> </li> +<li>The value of a <code class="code">char</code> object into which has been stored any character other than a member of the basic execution character set (C90 6.1.2.5, C99 and C11 6.2.5). <p>Determined by ABI. </p> </li> +<li>Which of <code class="code">signed char</code> or <code class="code">unsigned char</code> has the same range, representation, and behavior as “plain” <code class="code">char</code> (C90 6.1.2.5, C90 6.2.1.1, C99 and C11 6.2.5, C99 and C11 6.3.1.1). <p>Determined by ABI. The options <samp class="option">-funsigned-char</samp> and <samp class="option">-fsigned-char</samp> change the default. See <a class="xref" href="c-dialect-options">Options Controlling C Dialect</a>. </p> </li> +<li>The mapping of members of the source character set (in character constants and string literals) to members of the execution character set (C90 6.1.3.4, C99 and C11 6.4.4.4, C90, C99 and C11 5.1.1.2). <p>Determined by ABI. </p> </li> +<li>The value of an integer character constant containing more than one character or containing a character or escape sequence that does not map to a single-byte execution character (C90 6.1.3.4, C99 and C11 6.4.4.4). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. </p> </li> +<li>The value of a wide character constant containing more than one multibyte character or a single multibyte character that maps to multiple members of the extended execution character set, or containing a multibyte character or escape sequence not represented in the extended execution character set (C90 6.1.3.4, C99 and C11 6.4.4.4). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. </p> </li> +<li>The current locale used to convert a wide character constant consisting of a single multibyte character that maps to a member of the extended execution character set into a corresponding wide character code (C90 6.1.3.4, C99 and C11 6.4.4.4). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. </p> </li> +<li>Whether differently-prefixed wide string literal tokens can be concatenated and, if so, the treatment of the resulting multibyte character sequence (C11 6.4.5). <p>Such tokens may not be concatenated. </p> </li> +<li>The current locale used to convert a wide string literal into corresponding wide character codes (C90 6.1.4, C99 and C11 6.4.5). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. </p> </li> +<li>The value of a string literal containing a multibyte character or escape sequence not represented in the execution character set (C90 6.1.4, C99 and C11 6.4.5). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. </p> </li> +<li>The encoding of any of <code class="code">wchar_t</code>, <code class="code">char16_t</code>, and <code class="code">char32_t</code> where the corresponding standard encoding macro (<code class="code">__STDC_ISO_10646__</code>, <code class="code">__STDC_UTF_16__</code>, or <code class="code">__STDC_UTF_32__</code>) is not defined (C11 6.10.8.2). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. <code class="code">char16_t</code> and <code class="code">char32_t</code> literals are always encoded in UTF-16 and UTF-32 respectively. </p> </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="integers-implementation">Integers</a>, Previous: <a href="identifiers-implementation">Identifiers</a>, Up: <a href="c-implementation">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Characters-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Characters-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/code-gen-options.html b/devdocs/gcc~13/code-gen-options.html new file mode 100644 index 00000000..d76c3f23 --- /dev/null +++ b/devdocs/gcc~13/code-gen-options.html @@ -0,0 +1,209 @@ +<div class="section-level-extent" id="Code-Gen-Options"> <div class="nav-panel"> <p> Next: <a href="developer-options" accesskey="n" rel="next">GCC Developer Options</a>, Previous: <a href="directory-options" accesskey="p" rel="prev">Options for Directory Search</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-for-Code-Generation-Conventions"><span>3.17 Options for Code Generation Conventions<a class="copiable-link" href="#Options-for-Code-Generation-Conventions"> ¶</a></span></h1> <p>These machine-independent options control the interface conventions used in code generation. </p> <p>Most of them have both positive and negative forms; the negative form of <samp class="option">-ffoo</samp> is <samp class="option">-fno-foo</samp>. In the table below, only one of the forms is listed—the one that is not the default. You can figure out the other form by either removing ‘<samp class="samp">no-</samp>’ or adding it. </p> <dl class="table"> <dt> +<span><code class="code">-fstack-reuse=<var class="var">reuse-level</var></code><a class="copiable-link" href="#index-fstack_005freuse"> ¶</a></span> +</dt> <dd> +<p>This option controls stack space reuse for user declared local/auto variables and compiler generated temporaries. <var class="var">reuse_level</var> can be ‘<samp class="samp">all</samp>’, ‘<samp class="samp">named_vars</samp>’, or ‘<samp class="samp">none</samp>’. ‘<samp class="samp">all</samp>’ enables stack reuse for all local variables and temporaries, ‘<samp class="samp">named_vars</samp>’ enables the reuse only for user defined local variables with names, and ‘<samp class="samp">none</samp>’ disables stack reuse completely. The default value is ‘<samp class="samp">all</samp>’. The option is needed when the program extends the lifetime of a scoped local variable or a compiler generated temporary beyond the end point defined by the language. When a lifetime of a variable ends, and if the variable lives in memory, the optimizing compiler has the freedom to reuse its stack space with other temporaries or scoped local variables whose live range does not overlap with it. Legacy code extending local lifetime is likely to break with the stack reuse optimization. </p> <p>For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int *p; +{ + int local1; + + p = &local1; + local1 = 10; + .... +} +{ + int local2; + local2 = 20; + ... +} + +if (*p == 10) // out of scope use of local1 + { + + }</pre> +</div> <p>Another example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct A +{ + A(int k) : i(k), j(k) { } + int i; + int j; +}; + +A *ap; + +void foo(const A& ar) +{ + ap = &ar; +} + +void bar() +{ + foo(A(10)); // temp object's lifetime ends when foo returns + + { + A a(20); + .... + } + ap->i+= 10; // ap references out of scope temp whose space + // is reused with a. What is the value of ap->i? +}</pre> +</div> <p>The lifetime of a compiler generated temporary is well defined by the C++ standard. When a lifetime of a temporary ends, and if the temporary lives in memory, the optimizing compiler has the freedom to reuse its stack space with other temporaries or scoped local variables whose live range does not overlap with it. However some of the legacy code relies on the behavior of older compilers in which temporaries’ stack space is not reused, the aggressive stack reuse can lead to runtime errors. This option is used to control the temporary stack reuse optimization. </p> </dd> <dt> +<span><code class="code">-ftrapv</code><a class="copiable-link" href="#index-ftrapv"> ¶</a></span> +</dt> <dd> +<p>This option generates traps for signed overflow on addition, subtraction, multiplication operations. The options <samp class="option">-ftrapv</samp> and <samp class="option">-fwrapv</samp> override each other, so using <samp class="option">-ftrapv</samp> <samp class="option">-fwrapv</samp> on the command-line results in <samp class="option">-fwrapv</samp> being effective. Note that only active options override, so using <samp class="option">-ftrapv</samp> <samp class="option">-fwrapv</samp> <samp class="option">-fno-wrapv</samp> on the command-line results in <samp class="option">-ftrapv</samp> being effective. </p> </dd> <dt> +<span><code class="code">-fwrapv</code><a class="copiable-link" href="#index-fwrapv"> ¶</a></span> +</dt> <dd> +<p>This option instructs the compiler to assume that signed arithmetic overflow of addition, subtraction and multiplication wraps around using twos-complement representation. This flag enables some optimizations and disables others. The options <samp class="option">-ftrapv</samp> and <samp class="option">-fwrapv</samp> override each other, so using <samp class="option">-ftrapv</samp> <samp class="option">-fwrapv</samp> on the command-line results in <samp class="option">-fwrapv</samp> being effective. Note that only active options override, so using <samp class="option">-ftrapv</samp> <samp class="option">-fwrapv</samp> <samp class="option">-fno-wrapv</samp> on the command-line results in <samp class="option">-ftrapv</samp> being effective. </p> </dd> <dt> +<span><code class="code">-fwrapv-pointer</code><a class="copiable-link" href="#index-fwrapv-pointer"> ¶</a></span> +</dt> <dd> +<p>This option instructs the compiler to assume that pointer arithmetic overflow on addition and subtraction wraps around using twos-complement representation. This flag disables some optimizations which assume pointer overflow is invalid. </p> </dd> <dt> +<span><code class="code">-fstrict-overflow</code><a class="copiable-link" href="#index-fstrict-overflow"> ¶</a></span> +</dt> <dd> +<p>This option implies <samp class="option">-fno-wrapv</samp> <samp class="option">-fno-wrapv-pointer</samp> and when negated implies <samp class="option">-fwrapv</samp> <samp class="option">-fwrapv-pointer</samp>. </p> </dd> <dt> +<span><code class="code">-fexceptions</code><a class="copiable-link" href="#index-fexceptions"> ¶</a></span> +</dt> <dd> +<p>Enable exception handling. Generates extra code needed to propagate exceptions. For some targets, this implies GCC generates frame unwind information for all functions, which can produce significant data size overhead, although it does not affect execution. If you do not specify this option, GCC enables it by default for languages like C++ that normally require exception handling, and disables it for languages like C that do not normally require it. However, you may need to enable this option when compiling C code that needs to interoperate properly with exception handlers written in C++. You may also wish to disable this option if you are compiling older C++ programs that don’t use exception handling. </p> </dd> <dt> +<span><code class="code">-fnon-call-exceptions</code><a class="copiable-link" href="#index-fnon-call-exceptions"> ¶</a></span> +</dt> <dd> +<p>Generate code that allows trapping instructions to throw exceptions. Note that this requires platform-specific runtime support that does not exist everywhere. Moreover, it only allows <em class="emph">trapping</em> instructions to throw exceptions, i.e. memory references or floating-point instructions. It does not allow exceptions to be thrown from arbitrary signal handlers such as <code class="code">SIGALRM</code>. This enables <samp class="option">-fexceptions</samp>. </p> </dd> <dt> +<span><code class="code">-fdelete-dead-exceptions</code><a class="copiable-link" href="#index-fdelete-dead-exceptions"> ¶</a></span> +</dt> <dd> +<p>Consider that instructions that may throw exceptions but don’t otherwise contribute to the execution of the program can be optimized away. This does not affect calls to functions except those with the <code class="code">pure</code> or <code class="code">const</code> attributes. This option is enabled by default for the Ada and C++ compilers, as permitted by the language specifications. Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels. </p> </dd> <dt> +<span><code class="code">-funwind-tables</code><a class="copiable-link" href="#index-funwind-tables"> ¶</a></span> +</dt> <dd> +<p>Similar to <samp class="option">-fexceptions</samp>, except that it just generates any needed static data, but does not affect the generated code in any other way. You normally do not need to enable this option; instead, a language processor that needs this handling enables it on your behalf. </p> </dd> <dt> +<span><code class="code">-fasynchronous-unwind-tables</code><a class="copiable-link" href="#index-fasynchronous-unwind-tables"> ¶</a></span> +</dt> <dd> +<p>Generate unwind table in DWARF format, if supported by target machine. The table is exact at each instruction boundary, so it can be used for stack unwinding from asynchronous events (such as debugger or garbage collector). </p> </dd> <dt> + <span><code class="code">-fno-gnu-unique</code><a class="copiable-link" href="#index-fno-gnu-unique"> ¶</a></span> +</dt> <dd> +<p>On systems with recent GNU assembler and C library, the C++ compiler uses the <code class="code">STB_GNU_UNIQUE</code> binding to make sure that definitions of template static data members and static local variables in inline functions are unique even in the presence of <code class="code">RTLD_LOCAL</code>; this is necessary to avoid problems with a library used by two different <code class="code">RTLD_LOCAL</code> plugins depending on a definition in one of them and therefore disagreeing with the other one about the binding of the symbol. But this causes <code class="code">dlclose</code> to be ignored for affected DSOs; if your program relies on reinitialization of a DSO via <code class="code">dlclose</code> and <code class="code">dlopen</code>, you can use <samp class="option">-fno-gnu-unique</samp>. </p> </dd> <dt> +<span><code class="code">-fpcc-struct-return</code><a class="copiable-link" href="#index-fpcc-struct-return"> ¶</a></span> +</dt> <dd> +<p>Return “short” <code class="code">struct</code> and <code class="code">union</code> values in memory like longer ones, rather than in registers. This convention is less efficient, but it has the advantage of allowing intercallability between GCC-compiled files and files compiled with other compilers, particularly the Portable C Compiler (pcc). </p> <p>The precise convention for returning structures in memory depends on the target configuration macros. </p> <p>Short structures and unions are those whose size and alignment match that of some integer type. </p> <p><strong class="strong">Warning:</strong> code compiled with the <samp class="option">-fpcc-struct-return</samp> switch is not binary compatible with code compiled with the <samp class="option">-freg-struct-return</samp> switch. Use it to conform to a non-default application binary interface. </p> </dd> <dt> +<span><code class="code">-freg-struct-return</code><a class="copiable-link" href="#index-freg-struct-return"> ¶</a></span> +</dt> <dd> +<p>Return <code class="code">struct</code> and <code class="code">union</code> values in registers when possible. This is more efficient for small structures than <samp class="option">-fpcc-struct-return</samp>. </p> <p>If you specify neither <samp class="option">-fpcc-struct-return</samp> nor <samp class="option">-freg-struct-return</samp>, GCC defaults to whichever convention is standard for the target. If there is no standard convention, GCC defaults to <samp class="option">-fpcc-struct-return</samp>, except on targets where GCC is the principal compiler. In those cases, we can choose the standard, and we chose the more efficient register return alternative. </p> <p><strong class="strong">Warning:</strong> code compiled with the <samp class="option">-freg-struct-return</samp> switch is not binary compatible with code compiled with the <samp class="option">-fpcc-struct-return</samp> switch. Use it to conform to a non-default application binary interface. </p> </dd> <dt> +<span><code class="code">-fshort-enums</code><a class="copiable-link" href="#index-fshort-enums"> ¶</a></span> +</dt> <dd> +<p>Allocate to an <code class="code">enum</code> type only as many bytes as it needs for the declared range of possible values. Specifically, the <code class="code">enum</code> type is equivalent to the smallest integer type that has enough room. </p> <p><strong class="strong">Warning:</strong> the <samp class="option">-fshort-enums</samp> switch causes GCC to generate code that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. </p> </dd> <dt> +<span><code class="code">-fshort-wchar</code><a class="copiable-link" href="#index-fshort-wchar"> ¶</a></span> +</dt> <dd> +<p>Override the underlying type for <code class="code">wchar_t</code> to be <code class="code">short +unsigned int</code> instead of the default for the target. This option is useful for building programs to run under WINE. </p> <p><strong class="strong">Warning:</strong> the <samp class="option">-fshort-wchar</samp> switch causes GCC to generate code that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. </p> </dd> <dt> + <span><code class="code">-fcommon</code><a class="copiable-link" href="#index-fcommon"> ¶</a></span> +</dt> <dd> +<p>In C code, this option controls the placement of global variables defined without an initializer, known as <em class="dfn">tentative definitions</em> in the C standard. Tentative definitions are distinct from declarations of a variable with the <code class="code">extern</code> keyword, which do not allocate storage. </p> <p>The default is <samp class="option">-fno-common</samp>, which specifies that the compiler places uninitialized global variables in the BSS section of the object file. This inhibits the merging of tentative definitions by the linker so you get a multiple-definition error if the same variable is accidentally defined in more than one compilation unit. </p> <p>The <samp class="option">-fcommon</samp> places uninitialized global variables in a common block. This allows the linker to resolve all tentative definitions of the same variable in different compilation units to the same object, or to a non-tentative definition. This behavior is inconsistent with C++, and on many targets implies a speed and code size penalty on global variable references. It is mainly useful to enable legacy code to link without errors. </p> </dd> <dt> + <span><code class="code">-fno-ident</code><a class="copiable-link" href="#index-fno-ident"> ¶</a></span> +</dt> <dd> +<p>Ignore the <code class="code">#ident</code> directive. </p> </dd> <dt> +<span><code class="code">-finhibit-size-directive</code><a class="copiable-link" href="#index-finhibit-size-directive"> ¶</a></span> +</dt> <dd> +<p>Don’t output a <code class="code">.size</code> assembler directive, or anything else that would cause trouble if the function is split in the middle, and the two halves are placed at locations far apart in memory. This option is used when compiling <samp class="file">crtstuff.c</samp>; you should not need to use it for anything else. </p> </dd> <dt> +<span><code class="code">-fverbose-asm</code><a class="copiable-link" href="#index-fverbose-asm"> ¶</a></span> +</dt> <dd> +<p>Put extra commentary information in the generated assembly code to make it more readable. This option is generally only of use to those who actually need to read the generated assembly code (perhaps while debugging the compiler itself). </p> <p><samp class="option">-fno-verbose-asm</samp>, the default, causes the extra information to be omitted and is useful when comparing two assembler files. </p> <p>The added comments include: </p> <ul class="itemize mark-bullet"> <li>information on the compiler version and command-line options, </li> +<li>the source code lines associated with the assembly instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE, </li> +<li>hints on which high-level expressions correspond to the various assembly instruction operands. </li> +</ul> <p>For example, given this C source file: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int test (int n) +{ + int i; + int total = 0; + + for (i = 0; i < n; i++) + total += i * i; + + return total; +}</pre> +</div> <p>compiling to (x86_64) assembly via <samp class="option">-S</samp> and emitting the result direct to stdout via <samp class="option">-o</samp> <samp class="option">-</samp> </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -S test.c -fverbose-asm -Os -o -</pre> +</div> <p>gives output similar to this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">.file "test.c" +# GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu) + [...snip...] +# options passed: + [...snip...] + + .text + .globl test + .type test, @function +test: +.LFB0: + .cfi_startproc +# test.c:4: int total = 0; + xorl %eax, %eax # <retval> +# test.c:6: for (i = 0; i < n; i++) + xorl %edx, %edx # i +.L2: +# test.c:6: for (i = 0; i < n; i++) + cmpl %edi, %edx # n, i + jge .L5 #, +# test.c:7: total += i * i; + movl %edx, %ecx # i, tmp92 + imull %edx, %ecx # i, tmp92 +# test.c:6: for (i = 0; i < n; i++) + incl %edx # i +# test.c:7: total += i * i; + addl %ecx, %eax # tmp92, <retval> + jmp .L2 # +.L5: +# test.c:10: } + ret + .cfi_endproc +.LFE0: + .size test, .-test + .ident "GCC: (GNU) 7.0.0 20160809 (experimental)" + .section .note.GNU-stack,"",@progbits</pre> +</div> <p>The comments are intended for humans rather than machines and hence the precise format of the comments is subject to change. </p> </dd> <dt> +<span><code class="code">-frecord-gcc-switches</code><a class="copiable-link" href="#index-frecord-gcc-switches"> ¶</a></span> +</dt> <dd> +<p>This switch causes the command line used to invoke the compiler to be recorded into the object file that is being created. This switch is only implemented on some targets and the exact format of the recording is target and binary file format dependent, but it usually takes the form of a section containing ASCII text. This switch is related to the <samp class="option">-fverbose-asm</samp> switch, but that switch only records information in the assembler output file as comments, so it never reaches the object file. See also <samp class="option">-grecord-gcc-switches</samp> for another way of storing compiler options into the object file. </p> </dd> <dt> + <span><code class="code">-fpic</code><a class="copiable-link" href="#index-fpic"> ¶</a></span> +</dt> <dd> +<p>Generate position-independent code (PIC) suitable for use in a shared library, if supported for the target machine. Such code accesses all constant addresses through a global offset table (GOT). The dynamic loader resolves the GOT entries when the program starts (the dynamic loader is not part of GCC; it is part of the operating system). If the GOT size for the linked executable exceeds a machine-specific maximum size, you get an error message from the linker indicating that <samp class="option">-fpic</samp> does not work; in that case, recompile with <samp class="option">-fPIC</samp> instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The x86 has no such limit.) </p> <p>Position-independent code requires special support, and therefore works only on certain machines. For the x86, GCC supports PIC for System V but not for the Sun 386i. Code generated for the IBM RS/6000 is always position-independent. </p> <p>When this flag is set, the macros <code class="code">__pic__</code> and <code class="code">__PIC__</code> are defined to 1. </p> </dd> <dt> +<span><code class="code">-fPIC</code><a class="copiable-link" href="#index-fPIC"> ¶</a></span> +</dt> <dd> +<p>If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table. This option makes a difference on AArch64, m68k, PowerPC and SPARC. </p> <p>Position-independent code requires special support, and therefore works only on certain machines. </p> <p>When this flag is set, the macros <code class="code">__pic__</code> and <code class="code">__PIC__</code> are defined to 2. </p> </dd> <dt> + <span><code class="code">-fpie</code><a class="copiable-link" href="#index-fpie"> ¶</a></span> +</dt> <dt><code class="code">-fPIE</code></dt> <dd> +<p>These options are similar to <samp class="option">-fpic</samp> and <samp class="option">-fPIC</samp>, but the generated position-independent code can be only linked into executables. Usually these options are used to compile code that will be linked using the <samp class="option">-pie</samp> GCC option. </p> <p><samp class="option">-fpie</samp> and <samp class="option">-fPIE</samp> both define the macros <code class="code">__pie__</code> and <code class="code">__PIE__</code>. The macros have the value 1 for <samp class="option">-fpie</samp> and 2 for <samp class="option">-fPIE</samp>. </p> </dd> <dt> + <span><code class="code">-fno-plt</code><a class="copiable-link" href="#index-fno-plt"> ¶</a></span> +</dt> <dd> +<p>Do not use the PLT for external function calls in position-independent code. Instead, load the callee address at call sites from the GOT and branch to it. This leads to more efficient code by eliminating PLT stubs and exposing GOT loads to optimizations. On architectures such as 32-bit x86 where PLT stubs expect the GOT pointer in a specific register, this gives more register allocation freedom to the compiler. Lazy binding requires use of the PLT; with <samp class="option">-fno-plt</samp> all external symbols are resolved at load time. </p> <p>Alternatively, the function attribute <code class="code">noplt</code> can be used to avoid calls through the PLT for specific external functions. </p> <p>In position-dependent code, a few targets also convert calls to functions that are marked to not use the PLT to use the GOT instead. </p> </dd> <dt> + <span><code class="code">-fno-jump-tables</code><a class="copiable-link" href="#index-fno-jump-tables"> ¶</a></span> +</dt> <dd> +<p>Do not use jump tables for switch statements even where it would be more efficient than other code generation strategies. This option is of use in conjunction with <samp class="option">-fpic</samp> or <samp class="option">-fPIC</samp> for building code that forms part of a dynamic linker and cannot reference the address of a jump table. On some targets, jump tables do not require a GOT and this option is not needed. </p> </dd> <dt> + <span><code class="code">-fno-bit-tests</code><a class="copiable-link" href="#index-fno-bit-tests"> ¶</a></span> +</dt> <dd> +<p>Do not use bit tests for switch statements even where it would be more efficient than other code generation strategies. </p> </dd> <dt> +<span><code class="code">-ffixed-<var class="var">reg</var></code><a class="copiable-link" href="#index-ffixed"> ¶</a></span> +</dt> <dd> +<p>Treat the register named <var class="var">reg</var> as a fixed register; generated code should never refer to it (except perhaps as a stack pointer, frame pointer or in some other fixed role). </p> <p><var class="var">reg</var> must be the name of a register. The register names accepted are machine-specific and are defined in the <code class="code">REGISTER_NAMES</code> macro in the machine description macro file. </p> <p>This flag does not have a negative form, because it specifies a three-way choice. </p> </dd> <dt> +<span><code class="code">-fcall-used-<var class="var">reg</var></code><a class="copiable-link" href="#index-fcall-used"> ¶</a></span> +</dt> <dd> +<p>Treat the register named <var class="var">reg</var> as an allocable register that is clobbered by function calls. It may be allocated for temporaries or variables that do not live across a call. Functions compiled this way do not save and restore the register <var class="var">reg</var>. </p> <p>It is an error to use this flag with the frame pointer or stack pointer. Use of this flag for other registers that have fixed pervasive roles in the machine’s execution model produces disastrous results. </p> <p>This flag does not have a negative form, because it specifies a three-way choice. </p> </dd> <dt> +<span><code class="code">-fcall-saved-<var class="var">reg</var></code><a class="copiable-link" href="#index-fcall-saved"> ¶</a></span> +</dt> <dd> +<p>Treat the register named <var class="var">reg</var> as an allocable register saved by functions. It may be allocated even for temporaries or variables that live across a call. Functions compiled this way save and restore the register <var class="var">reg</var> if they use it. </p> <p>It is an error to use this flag with the frame pointer or stack pointer. Use of this flag for other registers that have fixed pervasive roles in the machine’s execution model produces disastrous results. </p> <p>A different sort of disaster results from the use of this flag for a register in which function values may be returned. </p> <p>This flag does not have a negative form, because it specifies a three-way choice. </p> </dd> <dt> +<span><code class="code">-fpack-struct[=<var class="var">n</var>]</code><a class="copiable-link" href="#index-fpack-struct"> ¶</a></span> +</dt> <dd> +<p>Without a value specified, pack all structure members together without holes. When a value is specified (which must be a small power of two), pack structure members according to this value, representing the maximum alignment (that is, objects with default alignment requirements larger than this are output potentially unaligned at the next fitting location. </p> <p><strong class="strong">Warning:</strong> the <samp class="option">-fpack-struct</samp> switch causes GCC to generate code that is not binary compatible with code generated without that switch. Additionally, it makes the code suboptimal. Use it to conform to a non-default application binary interface. </p> </dd> <dt> +<span><code class="code">-fleading-underscore</code><a class="copiable-link" href="#index-fleading-underscore"> ¶</a></span> +</dt> <dd> +<p>This option and its counterpart, <samp class="option">-fno-leading-underscore</samp>, forcibly change the way C symbols are represented in the object file. One use is to help link with legacy assembly code. </p> <p><strong class="strong">Warning:</strong> the <samp class="option">-fleading-underscore</samp> switch causes GCC to generate code that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. Not all targets provide complete support for this switch. </p> </dd> <dt> +<span><code class="code">-ftls-model=<var class="var">model</var></code><a class="copiable-link" href="#index-ftls-model"> ¶</a></span> +</dt> <dd> +<p>Alter the thread-local storage model to be used (see <a class="pxref" href="thread-local">Thread-Local Storage</a>). The <var class="var">model</var> argument should be one of ‘<samp class="samp">global-dynamic</samp>’, ‘<samp class="samp">local-dynamic</samp>’, ‘<samp class="samp">initial-exec</samp>’ or ‘<samp class="samp">local-exec</samp>’. Note that the choice is subject to optimization: the compiler may use a more efficient model for symbols not visible outside of the translation unit, or if <samp class="option">-fpic</samp> is not given on the command line. </p> <p>The default without <samp class="option">-fpic</samp> is ‘<samp class="samp">initial-exec</samp>’; with <samp class="option">-fpic</samp> the default is ‘<samp class="samp">global-dynamic</samp>’. </p> </dd> <dt> +<span><code class="code">-ftrampolines</code><a class="copiable-link" href="#index-ftrampolines"> ¶</a></span> +</dt> <dd> +<p>For targets that normally need trampolines for nested functions, always generate them instead of using descriptors. Otherwise, for targets that do not need them, like for example HP-PA or IA-64, do nothing. </p> <p>A trampoline is a small piece of code that is created at run time on the stack when the address of a nested function is taken, and is used to call the nested function indirectly. Therefore, it requires the stack to be made executable in order for the program to work properly. </p> <p><samp class="option">-fno-trampolines</samp> is enabled by default on a language by language basis to let the compiler avoid generating them, if it computes that this is safe, and replace them with descriptors. Descriptors are made up of data only, but the generated code must be prepared to deal with them. As of this writing, <samp class="option">-fno-trampolines</samp> is enabled by default only for Ada. </p> <p>Moreover, code compiled with <samp class="option">-ftrampolines</samp> and code compiled with <samp class="option">-fno-trampolines</samp> are not binary compatible if nested functions are present. This option must therefore be used on a program-wide basis and be manipulated with extreme care. </p> <p>For languages other than Ada, the <code class="code">-ftrampolines</code> and <code class="code">-fno-trampolines</code> options currently have no effect, and trampolines are always generated on platforms that need them for nested functions. </p> </dd> <dt> +<span><code class="code">-fvisibility=<span class="r">[</span>default<span class="r">|</span>internal<span class="r">|</span>hidden<span class="r">|</span>protected<span class="r">]</span></code><a class="copiable-link" href="#index-fvisibility"> ¶</a></span> +</dt> <dd> +<p>Set the default ELF image symbol visibility to the specified option—all symbols are marked with this unless overridden within the code. Using this feature can very substantially improve linking and load times of shared object libraries, produce more optimized code, provide near-perfect API export and prevent symbol clashes. It is <strong class="strong">strongly</strong> recommended that you use this in any shared objects you distribute. </p> <p>Despite the nomenclature, ‘<samp class="samp">default</samp>’ always means public; i.e., available to be linked against from outside the shared object. ‘<samp class="samp">protected</samp>’ and ‘<samp class="samp">internal</samp>’ are pretty useless in real-world usage so the only other commonly used option is ‘<samp class="samp">hidden</samp>’. The default if <samp class="option">-fvisibility</samp> isn’t specified is ‘<samp class="samp">default</samp>’, i.e., make every symbol public. </p> <p>A good explanation of the benefits offered by ensuring ELF symbols have the correct visibility is given by “How To Write Shared Libraries” by Ulrich Drepper (which can be found at <a class="uref" href="https://www.akkadia.org/drepper/">https://www.akkadia.org/drepper/</a>)—however a superior solution made possible by this option to marking things hidden when the default is public is to make the default hidden and mark things public. This is the norm with DLLs on Windows and with <samp class="option">-fvisibility=hidden</samp> and <code class="code">__attribute__ ((visibility("default")))</code> instead of <code class="code">__declspec(dllexport)</code> you get almost identical semantics with identical syntax. This is a great boon to those working with cross-platform projects. </p> <p>For those adding visibility support to existing code, you may find <code class="code">#pragma GCC visibility</code> of use. This works by you enclosing the declarations you wish to set visibility for with (for example) <code class="code">#pragma GCC visibility push(hidden)</code> and <code class="code">#pragma GCC visibility pop</code>. Bear in mind that symbol visibility should be viewed <strong class="strong">as part of the API interface contract</strong> and thus all new code should always specify visibility when it is not the default; i.e., declarations only for use within the local DSO should <strong class="strong">always</strong> be marked explicitly as hidden as so to avoid PLT indirection overheads—making this abundantly clear also aids readability and self-documentation of the code. Note that due to ISO C++ specification requirements, <code class="code">operator new</code> and <code class="code">operator delete</code> must always be of default visibility. </p> <p>Be aware that headers from outside your project, in particular system headers and headers from any other library you use, may not be expecting to be compiled with visibility other than the default. You may need to explicitly say <code class="code">#pragma GCC visibility push(default)</code> before including any such headers. </p> <p><code class="code">extern</code> declarations are not affected by <samp class="option">-fvisibility</samp>, so a lot of code can be recompiled with <samp class="option">-fvisibility=hidden</samp> with no modifications. However, this means that calls to <code class="code">extern</code> functions with no explicit visibility use the PLT, so it is more effective to use <code class="code">__attribute ((visibility))</code> and/or <code class="code">#pragma GCC visibility</code> to tell the compiler which <code class="code">extern</code> declarations should be treated as hidden. </p> <p>Note that <samp class="option">-fvisibility</samp> does affect C++ vague linkage entities. This means that, for instance, an exception class that is be thrown between DSOs must be explicitly marked with default visibility so that the ‘<samp class="samp">type_info</samp>’ nodes are unified between the DSOs. </p> <p>An overview of these techniques, their benefits and how to use them is at <a class="uref" href="https://gcc.gnu.org/wiki/Visibility">https://gcc.gnu.org/wiki/Visibility</a>. </p> </dd> <dt> +<span><code class="code">-fstrict-volatile-bitfields</code><a class="copiable-link" href="#index-fstrict-volatile-bitfields"> ¶</a></span> +</dt> <dd> +<p>This option should be used if accesses to volatile bit-fields (or other structure fields, although the compiler usually honors those types anyway) should use a single access of the width of the field’s type, aligned to a natural alignment if possible. For example, targets with memory-mapped peripheral registers might require all such accesses to be 16 bits wide; with this flag you can declare all peripheral bit-fields as <code class="code">unsigned short</code> (assuming short is 16 bits on these targets) to force GCC to use 16-bit accesses instead of, perhaps, a more efficient 32-bit access. </p> <p>If this option is disabled, the compiler uses the most efficient instruction. In the previous example, that might be a 32-bit load instruction, even though that accesses bytes that do not contain any portion of the bit-field, or memory-mapped registers unrelated to the one being updated. </p> <p>In some cases, such as when the <code class="code">packed</code> attribute is applied to a structure field, it may not be possible to access the field with a single read or write that is correctly aligned for the target machine. In this case GCC falls back to generating multiple accesses rather than code that will fault or truncate the result at run time. </p> <p>Note: Due to restrictions of the C/C++11 memory model, write accesses are not allowed to touch non bit-field members. It is therefore recommended to define all bits of the field’s type as bit-field members. </p> <p>The default value of this option is determined by the application binary interface for the target processor. </p> </dd> <dt> +<span><code class="code">-fsync-libcalls</code><a class="copiable-link" href="#index-fsync-libcalls"> ¶</a></span> +</dt> <dd> +<p>This option controls whether any out-of-line instance of the <code class="code">__sync</code> family of functions may be used to implement the C++11 <code class="code">__atomic</code> family of functions. </p> <p>The default value of this option is enabled, thus the only useful form of the option is <samp class="option">-fno-sync-libcalls</samp>. This option is used in the implementation of the <samp class="file">libatomic</samp> runtime library. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="developer-options">GCC Developer Options</a>, Previous: <a href="directory-options">Options for Directory Search</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Code-Gen-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Code-Gen-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/common-function-attributes.html b/devdocs/gcc~13/common-function-attributes.html new file mode 100644 index 00000000..097ad354 --- /dev/null +++ b/devdocs/gcc~13/common-function-attributes.html @@ -0,0 +1,405 @@ +<div class="subsection-level-extent" id="Common-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="aarch64-function-attributes" accesskey="n" rel="next">AArch64 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Common-Function-Attributes-1"><span>6.33.1 Common Function Attributes<a class="copiable-link" href="#Common-Function-Attributes-1"> ¶</a></span></h1> <p>The following attributes are supported on most targets. </p> <dl class="table"> <dt><code class="code">access (<var class="var">access-mode</var>, <var class="var">ref-index</var>)</code></dt> <dt><code class="code">access (<var class="var">access-mode</var>, <var class="var">ref-index</var>, <var class="var">size-index</var>)</code></dt> <dd> <p>The <code class="code">access</code> attribute enables the detection of invalid or unsafe accesses by functions to which they apply or their callers, as well as write-only accesses to objects that are never read from. Such accesses may be diagnosed by warnings such as <samp class="option">-Wstringop-overflow</samp>, <samp class="option">-Wuninitialized</samp>, <samp class="option">-Wunused</samp>, and others. </p> <p>The <code class="code">access</code> attribute specifies that a function to whose by-reference arguments the attribute applies accesses the referenced object according to <var class="var">access-mode</var>. The <var class="var">access-mode</var> argument is required and must be one of four names: <code class="code">read_only</code>, <code class="code">read_write</code>, <code class="code">write_only</code>, or <code class="code">none</code>. The remaining two are positional arguments. </p> <p>The required <var class="var">ref-index</var> positional argument denotes a function argument of pointer (or in C++, reference) type that is subject to the access. The same pointer argument can be referenced by at most one distinct <code class="code">access</code> attribute. </p> <p>The optional <var class="var">size-index</var> positional argument denotes a function argument of integer type that specifies the maximum size of the access. The size is the number of elements of the type referenced by <var class="var">ref-index</var>, or the number of bytes when the pointer type is <code class="code">void*</code>. When no <var class="var">size-index</var> argument is specified, the pointer argument must be either null or point to a space that is suitably aligned and large for at least one object of the referenced type (this implies that a past-the-end pointer is not a valid argument). The actual size of the access may be less but it must not be more. </p> <p>The <code class="code">read_only</code> access mode specifies that the pointer to which it applies is used to read the referenced object but not write to it. Unless the argument specifying the size of the access denoted by <var class="var">size-index</var> is zero, the referenced object must be initialized. The mode implies a stronger guarantee than the <code class="code">const</code> qualifier which, when cast away from a pointer, does not prevent the pointed-to object from being modified. Examples of the use of the <code class="code">read_only</code> access mode is the argument to the <code class="code">puts</code> function, or the second and third arguments to the <code class="code">memcpy</code> function. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((access (read_only, 1))) +int puts (const char*); + +__attribute__ ((access (read_only, 2, 3))) +void* memcpy (void*, const void*, size_t);</pre> +</div> <p>The <code class="code">read_write</code> access mode applies to arguments of pointer types without the <code class="code">const</code> qualifier. It specifies that the pointer to which it applies is used to both read and write the referenced object. Unless the argument specifying the size of the access denoted by <var class="var">size-index</var> is zero, the object referenced by the pointer must be initialized. An example of the use of the <code class="code">read_write</code> access mode is the first argument to the <code class="code">strcat</code> function. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((access (read_write, 1), access (read_only, 2))) +char* strcat (char*, const char*);</pre> +</div> <p>The <code class="code">write_only</code> access mode applies to arguments of pointer types without the <code class="code">const</code> qualifier. It specifies that the pointer to which it applies is used to write to the referenced object but not read from it. The object referenced by the pointer need not be initialized. An example of the use of the <code class="code">write_only</code> access mode is the first argument to the <code class="code">strcpy</code> function, or the first two arguments to the <code class="code">fgets</code> function. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((access (write_only, 1), access (read_only, 2))) +char* strcpy (char*, const char*); + +__attribute__ ((access (write_only, 1, 2), access (read_write, 3))) +int fgets (char*, int, FILE*);</pre> +</div> <p>The access mode <code class="code">none</code> specifies that the pointer to which it applies is not used to access the referenced object at all. Unless the pointer is null the pointed-to object must exist and have at least the size as denoted by the <var class="var">size-index</var> argument. When the optional <var class="var">size-index</var> argument is omitted for an argument of <code class="code">void*</code> type the actual pointer agument is ignored. The referenced object need not be initialized. The mode is intended to be used as a means to help validate the expected object size, for example in functions that call <code class="code">__builtin_object_size</code>. See <a class="xref" href="object-size-checking">Object Size Checking</a>. </p> <p>Note that the <code class="code">access</code> attribute merely specifies how an object referenced by the pointer argument can be accessed; it does not imply that an access <strong class="strong">will</strong> happen. Also, the <code class="code">access</code> attribute does not imply the attribute <code class="code">nonnull</code>; it may be appropriate to add both attributes at the declaration of a function that unconditionally manipulates a buffer via a pointer argument. See the <code class="code">nonnull</code> attribute for more information and caveats. </p> </dd> <dt> +<span><code class="code">alias ("<var class="var">target</var>")</code><a class="copiable-link" href="#index-alias-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">alias</code> attribute causes the declaration to be emitted as an alias for another symbol, which must have been previously declared with the same type, and for variables, also the same size and alignment. Declaring an alias with a different type than the target is undefined and may be diagnosed. As an example, the following declarations: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __f () { /* <span class="r">Do something.</span> */; } +void f () __attribute__ ((weak, alias ("__f")));</pre> +</div> <p>define ‘<samp class="samp">f</samp>’ to be a weak alias for ‘<samp class="samp">__f</samp>’. In C++, the mangled name for the target must be used. It is an error if ‘<samp class="samp">__f</samp>’ is not defined in the same translation unit. </p> <p>This attribute requires assembler and object file support, and may not be available on all targets. </p> </dd> <dt> +<span><code class="code">aligned</code><a class="copiable-link" href="#index-aligned-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">aligned (<var class="var">alignment</var>)</code></dt> <dd> +<p>The <code class="code">aligned</code> attribute specifies a minimum alignment for the first instruction of the function, measured in bytes. When specified, <var class="var">alignment</var> must be an integer constant power of 2. Specifying no <var class="var">alignment</var> argument implies the ideal alignment for the target. The <code class="code">__alignof__</code> operator can be used to determine what that is (see <a class="pxref" href="alignment">Determining the Alignment of Functions, Types or Variables</a>). The attribute has no effect when a definition for the function is not provided in the same translation unit. </p> <p>The attribute cannot be used to decrease the alignment of a function previously declared with a more restrictive alignment; only to increase it. Attempts to do otherwise are diagnosed. Some targets specify a minimum default alignment for functions that is greater than 1. On such targets, specifying a less restrictive alignment is silently ignored. Using the attribute overrides the effect of the <samp class="option">-falign-functions</samp> (see <a class="pxref" href="optimize-options">Options That Control Optimization</a>) option for this function. </p> <p>Note that the effectiveness of <code class="code">aligned</code> attributes may be limited by inherent limitations in the system linker and/or object file format. On some systems, the linker is only able to arrange for functions to be aligned up to a certain maximum alignment. (For some linkers, the maximum supported alignment may be very very small.) See your linker documentation for further information. </p> <p>The <code class="code">aligned</code> attribute can also be used for variables and fields (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>.) </p> </dd> <dt> +<span><code class="code">alloc_align (<var class="var">position</var>)</code><a class="copiable-link" href="#index-alloc_005falign-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">alloc_align</code> attribute may be applied to a function that returns a pointer and takes at least one argument of an integer or enumerated type. It indicates that the returned pointer is aligned on a boundary given by the function argument at <var class="var">position</var>. Meaningful alignments are powers of 2 greater than one. GCC uses this information to improve pointer alignment analysis. </p> <p>The function parameter denoting the allocated alignment is specified by one constant integer argument whose number is the argument of the attribute. Argument numbering starts at one. </p> <p>For instance, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void* my_memalign (size_t, size_t) __attribute__ ((alloc_align (1)));</pre> +</div> <p>declares that <code class="code">my_memalign</code> returns memory with minimum alignment given by parameter 1. </p> </dd> <dt> +<span><code class="code">alloc_size (<var class="var">position</var>)</code><a class="copiable-link" href="#index-alloc_005fsize-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">alloc_size (<var class="var">position-1</var>, <var class="var">position-2</var>)</code></dt> <dd> +<p>The <code class="code">alloc_size</code> attribute may be applied to a function that returns a pointer and takes at least one argument of an integer or enumerated type. It indicates that the returned pointer points to memory whose size is given by the function argument at <var class="var">position-1</var>, or by the product of the arguments at <var class="var">position-1</var> and <var class="var">position-2</var>. Meaningful sizes are positive values less than <code class="code">PTRDIFF_MAX</code>. GCC uses this information to improve the results of <code class="code">__builtin_object_size</code>. </p> <p>The function parameter(s) denoting the allocated size are specified by one or two integer arguments supplied to the attribute. The allocated size is either the value of the single function argument specified or the product of the two function arguments specified. Argument numbering starts at one for ordinary functions, and at two for C++ non-static member functions. </p> <p>For instance, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void* my_calloc (size_t, size_t) __attribute__ ((alloc_size (1, 2))); +void* my_realloc (void*, size_t) __attribute__ ((alloc_size (2)));</pre> +</div> <p>declares that <code class="code">my_calloc</code> returns memory of the size given by the product of parameter 1 and 2 and that <code class="code">my_realloc</code> returns memory of the size given by parameter 2. </p> </dd> <dt> +<span><code class="code">always_inline</code><a class="copiable-link" href="#index-always_005finline-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function independent of any restrictions that otherwise apply to inlining. Failure to inline such a function is diagnosed as an error. Note that if such a function is called indirectly the compiler may or may not inline it depending on optimization level and a failure to inline an indirect call may or may not be diagnosed. </p> </dd> <dt> +<span><code class="code">artificial</code><a class="copiable-link" href="#index-artificial-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute is useful for small inline wrappers that if possible should appear during debugging as a unit. Depending on the debug info format it either means marking the function as artificial or using the caller location for all instructions within the inlined body. </p> </dd> <dt> +<span><code class="code">assume_aligned (<var class="var">alignment</var>)</code><a class="copiable-link" href="#index-assume_005faligned-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">assume_aligned (<var class="var">alignment</var>, <var class="var">offset</var>)</code></dt> <dd> +<p>The <code class="code">assume_aligned</code> attribute may be applied to a function that returns a pointer. It indicates that the returned pointer is aligned on a boundary given by <var class="var">alignment</var>. If the attribute has two arguments, the second argument is misalignment <var class="var">offset</var>. Meaningful values of <var class="var">alignment</var> are powers of 2 greater than one. Meaningful values of <var class="var">offset</var> are greater than zero and less than <var class="var">alignment</var>. </p> <p>For instance </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void* my_alloc1 (size_t) __attribute__((assume_aligned (16))); +void* my_alloc2 (size_t) __attribute__((assume_aligned (32, 8)));</pre> +</div> <p>declares that <code class="code">my_alloc1</code> returns 16-byte aligned pointers and that <code class="code">my_alloc2</code> returns a pointer whose value modulo 32 is equal to 8. </p> </dd> <dt> +<span><code class="code">cold</code><a class="copiable-link" href="#index-cold-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">cold</code> attribute on functions is used to inform the compiler that the function is unlikely to be executed. The function is optimized for size rather than speed and on many targets it is placed into a special subsection of the text section so all cold functions appear close together, improving code locality of non-cold parts of program. The paths leading to calls of cold functions within code are marked as unlikely by the branch prediction mechanism. It is thus useful to mark functions used to handle unlikely conditions, such as <code class="code">perror</code>, as cold to improve optimization of hot functions that do call marked functions in rare occasions. </p> <p>When profile feedback is available, via <samp class="option">-fprofile-use</samp>, cold functions are automatically detected and this attribute is ignored. </p> </dd> <dt> + <span><code class="code">const</code><a class="copiable-link" href="#index-const-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Calls to functions whose return value is not affected by changes to the observable state of the program and that have no observable effects on such state other than to return a value may lend themselves to optimizations such as common subexpression elimination. Declaring such functions with the <code class="code">const</code> attribute allows GCC to avoid emitting some calls in repeated invocations of the function with the same argument values. </p> <p>For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int square (int) __attribute__ ((const));</pre> +</div> <p>tells GCC that subsequent calls to function <code class="code">square</code> with the same argument value can be replaced by the result of the first call regardless of the statements in between. </p> <p>The <code class="code">const</code> attribute prohibits a function from reading objects that affect its return value between successive invocations. However, functions declared with the attribute can safely read objects that do not change their return value, such as non-volatile constants. </p> <p>The <code class="code">const</code> attribute imposes greater restrictions on a function’s definition than the similar <code class="code">pure</code> attribute. Declaring the same function with both the <code class="code">const</code> and the <code class="code">pure</code> attribute is diagnosed. Because a const function cannot have any observable side effects it does not make sense for it to return <code class="code">void</code>. Declaring such a function is diagnosed. </p> <p>Note that a function that has pointer arguments and examines the data pointed to must <em class="emph">not</em> be declared <code class="code">const</code> if the pointed-to data might change between successive invocations of the function. In general, since a function cannot distinguish data that might change from data that cannot, const functions should never take pointer or, in C++, reference arguments. Likewise, a function that calls a non-const function usually must not be const itself. </p> </dd> <dt> + <span><code class="code">constructor</code><a class="copiable-link" href="#index-constructor-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">destructor</code></dt> <dt><code class="code">constructor (<var class="var">priority</var>)</code></dt> <dt><code class="code">destructor (<var class="var">priority</var>)</code></dt> <dd> +<p>The <code class="code">constructor</code> attribute causes the function to be called automatically before execution enters <code class="code">main ()</code>. Similarly, the <code class="code">destructor</code> attribute causes the function to be called automatically after <code class="code">main ()</code> completes or <code class="code">exit ()</code> is called. Functions with these attributes are useful for initializing data that is used implicitly during the execution of the program. </p> <p>On some targets the attributes also accept an integer argument to specify a priority to control the order in which constructor and destructor functions are run. A constructor with a smaller priority number runs before a constructor with a larger priority number; the opposite relationship holds for destructors. Note that priorities 0-100 are reserved. So, if you have a constructor that allocates a resource and a destructor that deallocates the same resource, both functions typically have the same priority. The priorities for constructor and destructor functions are the same as those specified for namespace-scope C++ objects (see <a class="pxref" href="c_002b_002b-attributes">C++-Specific Variable, Function, and Type Attributes</a>). However, at present, the order in which constructors for C++ objects with static storage duration and functions decorated with attribute <code class="code">constructor</code> are invoked is unspecified. In mixed declarations, attribute <code class="code">init_priority</code> can be used to impose a specific ordering. </p> <p>Using the argument forms of the <code class="code">constructor</code> and <code class="code">destructor</code> attributes on targets where the feature is not supported is rejected with an error. </p> </dd> <dt> +<span><code class="code">copy</code><a class="copiable-link" href="#index-copy-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">copy (<var class="var">function</var>)</code></dt> <dd> +<p>The <code class="code">copy</code> attribute applies the set of attributes with which <var class="var">function</var> has been declared to the declaration of the function to which the attribute is applied. The attribute is designed for libraries that define aliases or function resolvers that are expected to specify the same set of attributes as their targets. The <code class="code">copy</code> attribute can be used with functions, variables, or types. However, the kind of symbol to which the attribute is applied (either function or variable) must match the kind of symbol to which the argument refers. The <code class="code">copy</code> attribute copies only syntactic and semantic attributes but not attributes that affect a symbol’s linkage or visibility such as <code class="code">alias</code>, <code class="code">visibility</code>, or <code class="code">weak</code>. The <code class="code">deprecated</code> and <code class="code">target_clones</code> attribute are also not copied. See <a class="xref" href="common-type-attributes">Common Type Attributes</a>. See <a class="xref" href="common-variable-attributes">Common Variable Attributes</a>. </p> <p>For example, the <var class="var">StrongAlias</var> macro below makes use of the <code class="code">alias</code> and <code class="code">copy</code> attributes to define an alias named <var class="var">alloc</var> for function <var class="var">allocate</var> declared with attributes <var class="var">alloc_size</var>, <var class="var">malloc</var>, and <var class="var">nothrow</var>. Thanks to the <code class="code">__typeof__</code> operator the alias has the same type as the target function. As a result of the <code class="code">copy</code> attribute the alias also shares the same attributes as the target. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define StrongAlias(TargetFunc, AliasDecl) \ + extern __typeof__ (TargetFunc) AliasDecl \ + __attribute__ ((alias (#TargetFunc), copy (TargetFunc))); + +extern __attribute__ ((alloc_size (1), malloc, nothrow)) + void* allocate (size_t); +StrongAlias (allocate, alloc);</pre> +</div> </dd> <dt> +<span><code class="code">deprecated</code><a class="copiable-link" href="#index-deprecated-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">deprecated (<var class="var">msg</var>)</code></dt> <dd> +<p>The <code class="code">deprecated</code> attribute results in a warning if the function is used anywhere in the source file. This is useful when identifying functions that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated function, to enable users to easily find further information about why the function is deprecated, or what they should do instead. Note that the warnings only occurs for uses: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int old_fn () __attribute__ ((deprecated)); +int old_fn (); +int (*fn_ptr)() = old_fn;</pre> +</div> <p>results in a warning on line 3 but not line 2. The optional <var class="var">msg</var> argument, which must be a string, is printed in the warning if present. </p> <p>The <code class="code">deprecated</code> attribute can also be used for variables and types (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>, see <a class="pxref" href="type-attributes">Specifying Attributes of Types</a>.) </p> <p>The message attached to the attribute is affected by the setting of the <samp class="option">-fmessage-length</samp> option. </p> </dd> <dt> +<span><code class="code">unavailable</code><a class="copiable-link" href="#index-unavailable-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">unavailable (<var class="var">msg</var>)</code></dt> <dd> +<p>The <code class="code">unavailable</code> attribute results in an error if the function is used anywhere in the source file. This is useful when identifying functions that have been removed from a particular variation of an interface. Other than emitting an error rather than a warning, the <code class="code">unavailable</code> attribute behaves in the same manner as <code class="code">deprecated</code>. </p> <p>The <code class="code">unavailable</code> attribute can also be used for variables and types (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>, see <a class="pxref" href="type-attributes">Specifying Attributes of Types</a>.) </p> </dd> <dt> + <span><code class="code">error ("<var class="var">message</var>")</code><a class="copiable-link" href="#index-error-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">warning ("<var class="var">message</var>")</code></dt> <dd> +<p>If the <code class="code">error</code> or <code class="code">warning</code> attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, an error or warning (respectively) that includes <var class="var">message</var> is diagnosed. This is useful for compile-time checking, especially together with <code class="code">__builtin_constant_p</code> and inline functions where checking the inline function arguments is not possible through <code class="code">extern char [(condition) ? 1 : -1];</code> tricks. </p> <p>While it is possible to leave the function undefined and thus invoke a link failure (to define the function with a message in <code class="code">.gnu.warning*</code> section), when using these attributes the problem is diagnosed earlier and with exact location of the call even in presence of inline functions or when not emitting debugging information. </p> </dd> <dt> +<span><code class="code">externally_visible</code><a class="copiable-link" href="#index-externally_005fvisible-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute, attached to a global variable or function, nullifies the effect of the <samp class="option">-fwhole-program</samp> command-line option, so the object remains visible outside the current compilation unit. </p> <p>If <samp class="option">-fwhole-program</samp> is used together with <samp class="option">-flto</samp> and <code class="command">gold</code> is used as the linker plugin, <code class="code">externally_visible</code> attributes are automatically added to functions (not variable yet due to a current <code class="command">gold</code> issue) that are accessed outside of LTO objects according to resolution file produced by <code class="command">gold</code>. For other linkers that cannot generate resolution file, explicit <code class="code">externally_visible</code> attributes are still necessary. </p> </dd> <dt> +<span><code class="code">fd_arg</code><a class="copiable-link" href="#index-fd_005farg-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">fd_arg (<var class="var">N</var>)</code></dt> <dd> +<p>The <code class="code">fd_arg</code> attribute may be applied to a function that takes an open file descriptor at referenced argument <var class="var">N</var>. </p> <p>It indicates that the passed filedescriptor must not have been closed. Therefore, when the analyzer is enabled with <samp class="option">-fanalyzer</samp>, the analyzer may emit a <samp class="option">-Wanalyzer-fd-use-after-close</samp> diagnostic if it detects a code path in which a function with this attribute is called with a closed file descriptor. </p> <p>The attribute also indicates that the file descriptor must have been checked for validity before usage. Therefore, analyzer may emit <samp class="option">-Wanalyzer-fd-use-without-check</samp> diagnostic if it detects a code path in which a function with this attribute is called with a file descriptor that has not been checked for validity. </p> </dd> <dt> +<span><code class="code">fd_arg_read</code><a class="copiable-link" href="#index-fd_005farg_005fread-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">fd_arg_read (<var class="var">N</var>)</code></dt> <dd> +<p>The <code class="code">fd_arg_read</code> is identical to <code class="code">fd_arg</code>, but with the additional requirement that it might read from the file descriptor, and thus, the file descriptor must not have been opened as write-only. </p> <p>The analyzer may emit a <samp class="option">-Wanalyzer-access-mode-mismatch</samp> diagnostic if it detects a code path in which a function with this attribute is called on a file descriptor opened with <code class="code">O_WRONLY</code>. </p> </dd> <dt> +<span><code class="code">fd_arg_write</code><a class="copiable-link" href="#index-fd_005farg_005fwrite-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">fd_arg_write (<var class="var">N</var>)</code></dt> <dd> +<p>The <code class="code">fd_arg_write</code> is identical to <code class="code">fd_arg_read</code> except that the analyzer may emit a <samp class="option">-Wanalyzer-access-mode-mismatch</samp> diagnostic if it detects a code path in which a function with this attribute is called on a file descriptor opened with <code class="code">O_RDONLY</code>. </p> </dd> <dt> +<span><code class="code">flatten</code><a class="copiable-link" href="#index-flatten-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Generally, inlining into a function is limited. For a function marked with this attribute, every call inside this function is inlined, if possible. Functions declared with attribute <code class="code">noinline</code> and similar are not inlined. Whether the function itself is considered for inlining depends on its size and the current inlining parameters. </p> </dd> <dt> + <span><code class="code">format (<var class="var">archetype</var>, <var class="var">string-index</var>, <var class="var">first-to-check</var>)</code><a class="copiable-link" href="#index-format-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">format</code> attribute specifies that a function takes <code class="code">printf</code>, <code class="code">scanf</code>, <code class="code">strftime</code> or <code class="code">strfmon</code> style arguments that should be type-checked against a format string. For example, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern int +my_printf (void *my_object, const char *my_format, ...) + __attribute__ ((format (printf, 2, 3)));</pre> +</div> <p>causes the compiler to check the arguments in calls to <code class="code">my_printf</code> for consistency with the <code class="code">printf</code> style format string argument <code class="code">my_format</code>. </p> <p>The parameter <var class="var">archetype</var> determines how the format string is interpreted, and should be <code class="code">printf</code>, <code class="code">scanf</code>, <code class="code">strftime</code>, <code class="code">gnu_printf</code>, <code class="code">gnu_scanf</code>, <code class="code">gnu_strftime</code> or <code class="code">strfmon</code>. (You can also use <code class="code">__printf__</code>, <code class="code">__scanf__</code>, <code class="code">__strftime__</code> or <code class="code">__strfmon__</code>.) On MinGW targets, <code class="code">ms_printf</code>, <code class="code">ms_scanf</code>, and <code class="code">ms_strftime</code> are also present. <var class="var">archetype</var> values such as <code class="code">printf</code> refer to the formats accepted by the system’s C runtime library, while values prefixed with ‘<samp class="samp">gnu_</samp>’ always refer to the formats accepted by the GNU C Library. On Microsoft Windows targets, values prefixed with ‘<samp class="samp">ms_</samp>’ refer to the formats accepted by the <samp class="file">msvcrt.dll</samp> library. The parameter <var class="var">string-index</var> specifies which argument is the format string argument (starting from 1), while <var class="var">first-to-check</var> is the number of the first argument to check against the format string. For functions where the arguments are not available to be checked (such as <code class="code">vprintf</code>), specify the third parameter as zero. In this case the compiler only checks the format string for consistency. For <code class="code">strftime</code> formats, the third parameter is required to be zero. Since non-static C++ methods have an implicit <code class="code">this</code> argument, the arguments of such methods should be counted from two, not one, when giving values for <var class="var">string-index</var> and <var class="var">first-to-check</var>. </p> <p>In the example above, the format string (<code class="code">my_format</code>) is the second argument of the function <code class="code">my_print</code>, and the arguments to check start with the third argument, so the correct parameters for the format attribute are 2 and 3. </p> <p>The <code class="code">format</code> attribute allows you to identify your own functions that take format strings as arguments, so that GCC can check the calls to these functions for errors. The compiler always (unless <samp class="option">-ffreestanding</samp> or <samp class="option">-fno-builtin</samp> is used) checks formats for the standard library functions <code class="code">printf</code>, <code class="code">fprintf</code>, <code class="code">sprintf</code>, <code class="code">scanf</code>, <code class="code">fscanf</code>, <code class="code">sscanf</code>, <code class="code">strftime</code>, <code class="code">vprintf</code>, <code class="code">vfprintf</code> and <code class="code">vsprintf</code> whenever such warnings are requested (using <samp class="option">-Wformat</samp>), so there is no need to modify the header file <samp class="file">stdio.h</samp>. In C99 mode, the functions <code class="code">snprintf</code>, <code class="code">vsnprintf</code>, <code class="code">vscanf</code>, <code class="code">vfscanf</code> and <code class="code">vsscanf</code> are also checked. Except in strictly conforming C standard modes, the X/Open function <code class="code">strfmon</code> is also checked as are <code class="code">printf_unlocked</code> and <code class="code">fprintf_unlocked</code>. See <a class="xref" href="c-dialect-options">Options Controlling C Dialect</a>. </p> <p>For Objective-C dialects, <code class="code">NSString</code> (or <code class="code">__NSString__</code>) is recognized in the same context. Declarations including these format attributes are parsed for correct syntax, however the result of checking of such format strings is not yet defined, and is not carried out by this version of the compiler. </p> <p>The target may also provide additional types of format checks. See <a class="xref" href="target-format-checks">Format Checks Specific to Particular Target Machines</a>. </p> </dd> <dt> + <span><code class="code">format_arg (<var class="var">string-index</var>)</code><a class="copiable-link" href="#index-format_005farg-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">format_arg</code> attribute specifies that a function takes one or more format strings for a <code class="code">printf</code>, <code class="code">scanf</code>, <code class="code">strftime</code> or <code class="code">strfmon</code> style function and modifies it (for example, to translate it into another language), so the result can be passed to a <code class="code">printf</code>, <code class="code">scanf</code>, <code class="code">strftime</code> or <code class="code">strfmon</code> style function (with the remaining arguments to the format function the same as they would have been for the unmodified string). Multiple <code class="code">format_arg</code> attributes may be applied to the same function, each designating a distinct parameter as a format string. For example, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern char * +my_dgettext (char *my_domain, const char *my_format) + __attribute__ ((format_arg (2)));</pre> +</div> <p>causes the compiler to check the arguments in calls to a <code class="code">printf</code>, <code class="code">scanf</code>, <code class="code">strftime</code> or <code class="code">strfmon</code> type function, whose format string argument is a call to the <code class="code">my_dgettext</code> function, for consistency with the format string argument <code class="code">my_format</code>. If the <code class="code">format_arg</code> attribute had not been specified, all the compiler could tell in such calls to format functions would be that the format string argument is not constant; this would generate a warning when <samp class="option">-Wformat-nonliteral</samp> is used, but the calls could not be checked without the attribute. </p> <p>In calls to a function declared with more than one <code class="code">format_arg</code> attribute, each with a distinct argument value, the corresponding actual function arguments are checked against all format strings designated by the attributes. This capability is designed to support the GNU <code class="code">ngettext</code> family of functions. </p> <p>The parameter <var class="var">string-index</var> specifies which argument is the format string argument (starting from one). Since non-static C++ methods have an implicit <code class="code">this</code> argument, the arguments of such methods should be counted from two. </p> <p>The <code class="code">format_arg</code> attribute allows you to identify your own functions that modify format strings, so that GCC can check the calls to <code class="code">printf</code>, <code class="code">scanf</code>, <code class="code">strftime</code> or <code class="code">strfmon</code> type function whose operands are a call to one of your own function. The compiler always treats <code class="code">gettext</code>, <code class="code">dgettext</code>, and <code class="code">dcgettext</code> in this manner except when strict ISO C support is requested by <samp class="option">-ansi</samp> or an appropriate <samp class="option">-std</samp> option, or <samp class="option">-ffreestanding</samp> or <samp class="option">-fno-builtin</samp> is used. See <a class="xref" href="c-dialect-options">Options Controlling C Dialect</a>. </p> <p>For Objective-C dialects, the <code class="code">format-arg</code> attribute may refer to an <code class="code">NSString</code> reference for compatibility with the <code class="code">format</code> attribute above. </p> <p>The target may also allow additional types in <code class="code">format-arg</code> attributes. See <a class="xref" href="target-format-checks">Format Checks Specific to Particular Target Machines</a>. </p> </dd> <dt> +<span><code class="code">gnu_inline</code><a class="copiable-link" href="#index-gnu_005finline-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute should be used with a function that is also declared with the <code class="code">inline</code> keyword. It directs GCC to treat the function as if it were defined in gnu90 mode even when compiling in C99 or gnu99 mode. </p> <p>If the function is declared <code class="code">extern</code>, then this definition of the function is used only for inlining. In no case is the function compiled as a standalone function, not even if you take its address explicitly. Such an address becomes an external reference, as if you had only declared the function, and had not defined it. This has almost the effect of a macro. The way to use this is to put a function definition in a header file with this attribute, and put another copy of the function, without <code class="code">extern</code>, in a library file. The definition in the header file causes most calls to the function to be inlined. If any uses of the function remain, they refer to the single copy in the library. Note that the two definitions of the functions need not be precisely the same, although if they do not have the same effect your program may behave oddly. </p> <p>In C, if the function is neither <code class="code">extern</code> nor <code class="code">static</code>, then the function is compiled as a standalone function, as well as being inlined where possible. </p> <p>This is how GCC traditionally handled functions declared <code class="code">inline</code>. Since ISO C99 specifies a different semantics for <code class="code">inline</code>, this function attribute is provided as a transition measure and as a useful feature in its own right. This attribute is available in GCC 4.1.3 and later. It is available if either of the preprocessor macros <code class="code">__GNUC_GNU_INLINE__</code> or <code class="code">__GNUC_STDC_INLINE__</code> are defined. See <a class="xref" href="inline">An Inline Function is As Fast As a Macro</a>. </p> <p>In C++, this attribute does not depend on <code class="code">extern</code> in any way, but it still requires the <code class="code">inline</code> keyword to enable its special behavior. </p> </dd> <dt> +<span><code class="code">hot</code><a class="copiable-link" href="#index-hot-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">hot</code> attribute on a function is used to inform the compiler that the function is a hot spot of the compiled program. The function is optimized more aggressively and on many targets it is placed into a special subsection of the text section so all hot functions appear close together, improving locality. </p> <p>When profile feedback is available, via <samp class="option">-fprofile-use</samp>, hot functions are automatically detected and this attribute is ignored. </p> </dd> <dt> + <span><code class="code">ifunc ("<var class="var">resolver</var>")</code><a class="copiable-link" href="#index-ifunc-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">ifunc</code> attribute is used to mark a function as an indirect function using the STT_GNU_IFUNC symbol type extension to the ELF standard. This allows the resolution of the symbol value to be determined dynamically at load time, and an optimized version of the routine to be selected for the particular processor or other system characteristics determined then. To use this attribute, first define the implementation functions available, and a resolver function that returns a pointer to the selected implementation function. The implementation functions’ declarations must match the API of the function being implemented. The resolver should be declared to be a function taking no arguments and returning a pointer to a function of the same type as the implementation. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void *my_memcpy (void *dst, const void *src, size_t len) +{ + … + return dst; +} + +static void * (*resolve_memcpy (void))(void *, const void *, size_t) +{ + return my_memcpy; // we will just always select this routine +}</pre> +</div> <p>The exported header file declaring the function the user calls would contain: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern void *memcpy (void *, const void *, size_t);</pre> +</div> <p>allowing the user to call <code class="code">memcpy</code> as a regular function, unaware of the actual implementation. Finally, the indirect function needs to be defined in the same translation unit as the resolver function: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void *memcpy (void *, const void *, size_t) + __attribute__ ((ifunc ("resolve_memcpy")));</pre> +</div> <p>In C++, the <code class="code">ifunc</code> attribute takes a string that is the mangled name of the resolver function. A C++ resolver for a non-static member function of class <code class="code">C</code> should be declared to return a pointer to a non-member function taking pointer to <code class="code">C</code> as the first argument, followed by the same arguments as of the implementation function. G++ checks the signatures of the two functions and issues a <samp class="option">-Wattribute-alias</samp> warning for mismatches. To suppress a warning for the necessary cast from a pointer to the implementation member function to the type of the corresponding non-member function use the <samp class="option">-Wno-pmf-conversions</samp> option. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">class S +{ +private: + int debug_impl (int); + int optimized_impl (int); + + typedef int Func (S*, int); + + static Func* resolver (); +public: + + int interface (int); +}; + +int S::debug_impl (int) { /* <span class="r">…</span> */ } +int S::optimized_impl (int) { /* <span class="r">…</span> */ } + +S::Func* S::resolver () +{ + int (S::*pimpl) (int) + = getenv ("DEBUG") ? &S::debug_impl : &S::optimized_impl; + + // Cast triggers -Wno-pmf-conversions. + return reinterpret_cast<Func*>(pimpl); +} + +int S::interface (int) __attribute__ ((ifunc ("_ZN1S8resolverEv")));</pre> +</div> <p>Indirect functions cannot be weak. Binutils version 2.20.1 or higher and GNU C Library version 2.11.1 are required to use this feature. </p> </dd> <dt><code class="code">interrupt</code></dt> <dt><code class="code">interrupt_handler</code></dt> <dd> +<p>Many GCC back ends support attributes to indicate that a function is an interrupt handler, which tells the compiler to generate function entry and exit sequences that differ from those from regular functions. The exact syntax and behavior are target-specific; refer to the following subsections for details. </p> </dd> <dt> +<span><code class="code">leaf</code><a class="copiable-link" href="#index-leaf-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Calls to external functions with this attribute must return to the current compilation unit only by return or by exception handling. In particular, a leaf function is not allowed to invoke callback functions passed to it from the current compilation unit, directly call functions exported by the unit, or <code class="code">longjmp</code> into the unit. Leaf functions might still call functions from other compilation units and thus they are not necessarily leaf in the sense that they contain no function calls at all. </p> <p>The attribute is intended for library functions to improve dataflow analysis. The compiler takes the hint that any data not escaping the current compilation unit cannot be used or modified by the leaf function. For example, the <code class="code">sin</code> function is a leaf function, but <code class="code">qsort</code> is not. </p> <p>Note that leaf functions might indirectly run a signal handler defined in the current compilation unit that uses static variables. Similarly, when lazy symbol resolution is in effect, leaf functions might invoke indirect functions whose resolver function or implementation function is defined in the current compilation unit and uses static variables. There is no standard-compliant way to write such a signal handler, resolver function, or implementation function, and the best that you can do is to remove the <code class="code">leaf</code> attribute or mark all such static variables <code class="code">volatile</code>. Lastly, for ELF-based systems that support symbol interposition, care should be taken that functions defined in the current compilation unit do not unexpectedly interpose other symbols based on the defined standards mode and defined feature test macros; otherwise an inadvertent callback would be added. </p> <p>The attribute has no effect on functions defined within the current compilation unit. This is to allow easy merging of multiple compilation units into one, for example, by using the link-time optimization. For this reason the attribute is not allowed on types to annotate indirect calls. </p> </dd> <dt> + <span><code class="code">malloc</code><a class="copiable-link" href="#index-malloc-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">malloc (<var class="var">deallocator</var>)</code></dt> <dt><code class="code">malloc (<var class="var">deallocator</var>, <var class="var">ptr-index</var>)</code></dt> <dd> +<p>Attribute <code class="code">malloc</code> indicates that a function is <code class="code">malloc</code>-like, i.e., that the pointer <var class="var">P</var> returned by the function cannot alias any other pointer valid when the function returns, and moreover no pointers to valid objects occur in any storage addressed by <var class="var">P</var>. In addition, GCC predicts that a function with the attribute returns non-null in most cases. </p> <p>Independently, the form of the attribute with one or two arguments associates <code class="code">deallocator</code> as a suitable deallocation function for pointers returned from the <code class="code">malloc</code>-like function. <var class="var">ptr-index</var> denotes the positional argument to which when the pointer is passed in calls to <code class="code">deallocator</code> has the effect of deallocating it. </p> <p>Using the attribute with no arguments is designed to improve optimization by relying on the aliasing property it implies. Functions like <code class="code">malloc</code> and <code class="code">calloc</code> have this property because they return a pointer to uninitialized or zeroed-out, newly obtained storage. However, functions like <code class="code">realloc</code> do not have this property, as they may return pointers to storage containing pointers to existing objects. Additionally, since all such functions are assumed to return null only infrequently, callers can be optimized based on that assumption. </p> <p>Associating a function with a <var class="var">deallocator</var> helps detect calls to mismatched allocation and deallocation functions and diagnose them under the control of options such as <samp class="option">-Wmismatched-dealloc</samp>. It also makes it possible to diagnose attempts to deallocate objects that were not allocated dynamically, by <samp class="option">-Wfree-nonheap-object</samp>. To indicate that an allocation function both satisifies the nonaliasing property and has a deallocator associated with it, both the plain form of the attribute and the one with the <var class="var">deallocator</var> argument must be used. The same function can be both an allocator and a deallocator. Since inlining one of the associated functions but not the other could result in apparent mismatches, this form of attribute <code class="code">malloc</code> is not accepted on inline functions. For the same reason, using the attribute prevents both the allocation and deallocation functions from being expanded inline. </p> <p>For example, besides stating that the functions return pointers that do not alias any others, the following declarations make <code class="code">fclose</code> a suitable deallocator for pointers returned from all functions except <code class="code">popen</code>, and <code class="code">pclose</code> as the only suitable deallocator for pointers returned from <code class="code">popen</code>. The deallocator functions must be declared before they can be referenced in the attribute. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int fclose (FILE*); +int pclose (FILE*); + +__attribute__ ((malloc, malloc (fclose, 1))) + FILE* fdopen (int, const char*); +__attribute__ ((malloc, malloc (fclose, 1))) + FILE* fopen (const char*, const char*); +__attribute__ ((malloc, malloc (fclose, 1))) + FILE* fmemopen(void *, size_t, const char *); +__attribute__ ((malloc, malloc (pclose, 1))) + FILE* popen (const char*, const char*); +__attribute__ ((malloc, malloc (fclose, 1))) + FILE* tmpfile (void);</pre> +</div> <p>The warnings guarded by <samp class="option">-fanalyzer</samp> respect allocation and deallocation pairs marked with the <code class="code">malloc</code>. In particular: </p> <ul class="itemize mark-bullet"> <li>The analyzer emits a <samp class="option">-Wanalyzer-mismatching-deallocation</samp> diagnostic if there is an execution path in which the result of an allocation call is passed to a different deallocator. </li> +<li>The analyzer emits a <samp class="option">-Wanalyzer-double-free</samp> diagnostic if there is an execution path in which a value is passed more than once to a deallocation call. </li> +<li>The analyzer considers the possibility that an allocation function could fail and return null. If there are execution paths in which an unchecked result of an allocation call is dereferenced or passed to a function requiring a non-null argument, it emits <samp class="option">-Wanalyzer-possible-null-dereference</samp> and <samp class="option">-Wanalyzer-possible-null-argument</samp> diagnostics. If the allocator always returns non-null, use <code class="code">__attribute__ ((returns_nonnull))</code> to suppress these warnings. For example: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">char *xstrdup (const char *) + __attribute__((malloc (free), returns_nonnull));</pre> +</div> </li> +<li>The analyzer emits a <samp class="option">-Wanalyzer-use-after-free</samp> diagnostic if there is an execution path in which the memory passed by pointer to a deallocation call is used after the deallocation. </li> +<li>The analyzer emits a <samp class="option">-Wanalyzer-malloc-leak</samp> diagnostic if there is an execution path in which the result of an allocation call is leaked (without being passed to the deallocation function). </li> +<li>The analyzer emits a <samp class="option">-Wanalyzer-free-of-non-heap</samp> diagnostic if a deallocation function is used on a global or on-stack variable. </li> +</ul> <p>The analyzer assumes that deallocators can gracefully handle the null pointer. If this is not the case, the deallocator can be marked with <code class="code">__attribute__((nonnull))</code> so that <samp class="option">-fanalyzer</samp> can emit a <samp class="option">-Wanalyzer-possible-null-argument</samp> diagnostic for code paths in which the deallocator is called with null. </p> </dd> <dt> +<span><code class="code">no_icf</code><a class="copiable-link" href="#index-no_005ficf-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This function attribute prevents a functions from being merged with another semantically equivalent function. </p> </dd> <dt> + <span><code class="code">no_instrument_function</code><a class="copiable-link" href="#index-no_005finstrument_005ffunction-function-attribute"> ¶</a></span> +</dt> <dd> +<p>If any of <samp class="option">-finstrument-functions</samp>, <samp class="option">-p</samp>, or <samp class="option">-pg</samp> are given, profiling function calls are generated at entry and exit of most user-compiled functions. Functions with this attribute are not so instrumented. </p> </dd> <dt> +<span><code class="code">no_profile_instrument_function</code><a class="copiable-link" href="#index-no_005fprofile_005finstrument_005ffunction-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">no_profile_instrument_function</code> attribute on functions is used to inform the compiler that it should not process any profile feedback based optimization code instrumentation. </p> </dd> <dt> +<span><code class="code">no_reorder</code><a class="copiable-link" href="#index-no_005freorder-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Do not reorder functions or variables marked <code class="code">no_reorder</code> against each other or top level assembler statements the executable. The actual order in the program will depend on the linker command line. Static variables marked like this are also not removed. This has a similar effect as the <samp class="option">-fno-toplevel-reorder</samp> option, but only applies to the marked symbols. </p> </dd> <dt> +<span><code class="code">no_sanitize ("<var class="var">sanitize_option</var>")</code><a class="copiable-link" href="#index-no_005fsanitize-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">no_sanitize</code> attribute on functions is used to inform the compiler that it should not do sanitization of any option mentioned in <var class="var">sanitize_option</var>. A list of values acceptable by the <samp class="option">-fsanitize</samp> option can be provided. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __attribute__ ((no_sanitize ("alignment", "object-size"))) +f () { /* <span class="r">Do something.</span> */; } +void __attribute__ ((no_sanitize ("alignment,object-size"))) +g () { /* <span class="r">Do something.</span> */; }</pre> +</div> </dd> <dt> +<span><code class="code">no_sanitize_address</code><a class="copiable-link" href="#index-no_005fsanitize_005faddress-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">no_address_safety_analysis</code></dt> <dd> +<p>The <code class="code">no_sanitize_address</code> attribute on functions is used to inform the compiler that it should not instrument memory accesses in the function when compiling with the <samp class="option">-fsanitize=address</samp> option. The <code class="code">no_address_safety_analysis</code> is a deprecated alias of the <code class="code">no_sanitize_address</code> attribute, new code should use <code class="code">no_sanitize_address</code>. </p> </dd> <dt> +<span><code class="code">no_sanitize_thread</code><a class="copiable-link" href="#index-no_005fsanitize_005fthread-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">no_sanitize_thread</code> attribute on functions is used to inform the compiler that it should not instrument memory accesses in the function when compiling with the <samp class="option">-fsanitize=thread</samp> option. </p> </dd> <dt> +<span><code class="code">no_sanitize_undefined</code><a class="copiable-link" href="#index-no_005fsanitize_005fundefined-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">no_sanitize_undefined</code> attribute on functions is used to inform the compiler that it should not check for undefined behavior in the function when compiling with the <samp class="option">-fsanitize=undefined</samp> option. </p> </dd> <dt> +<span><code class="code">no_sanitize_coverage</code><a class="copiable-link" href="#index-no_005fsanitize_005fcoverage-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">no_sanitize_coverage</code> attribute on functions is used to inform the compiler that it should not do coverage-guided fuzzing code instrumentation (<samp class="option">-fsanitize-coverage</samp>). </p> </dd> <dt> + <span><code class="code">no_split_stack</code><a class="copiable-link" href="#index-no_005fsplit_005fstack-function-attribute"> ¶</a></span> +</dt> <dd> +<p>If <samp class="option">-fsplit-stack</samp> is given, functions have a small prologue which decides whether to split the stack. Functions with the <code class="code">no_split_stack</code> attribute do not have that prologue, and thus may run with only a small amount of stack space available. </p> </dd> <dt> +<span><code class="code">no_stack_limit</code><a class="copiable-link" href="#index-no_005fstack_005flimit-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute locally overrides the <samp class="option">-fstack-limit-register</samp> and <samp class="option">-fstack-limit-symbol</samp> command-line options; it has the effect of disabling stack limit checking in the function it applies to. </p> </dd> <dt> +<span><code class="code">noclone</code><a class="copiable-link" href="#index-noclone-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This function attribute prevents a function from being considered for cloning—a mechanism that produces specialized copies of functions and which is (currently) performed by interprocedural constant propagation. </p> </dd> <dt> +<span><code class="code">noinline</code><a class="copiable-link" href="#index-noinline-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This function attribute prevents a function from being considered for inlining. If the function does not have side effects, there are optimizations other than inlining that cause function calls to be optimized away, although the function call is live. To keep such calls from being optimized away, put </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("");</pre> +</div> <p>(see <a class="pxref" href="extended-asm">Extended Asm - Assembler Instructions with C Expression Operands</a>) in the called function, to serve as a special side effect. </p> </dd> <dt> +<span><code class="code">noipa</code><a class="copiable-link" href="#index-noipa-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Disable interprocedural optimizations between the function with this attribute and its callers, as if the body of the function is not available when optimizing callers and the callers are unavailable when optimizing the body. This attribute implies <code class="code">noinline</code>, <code class="code">noclone</code> and <code class="code">no_icf</code> attributes. However, this attribute is not equivalent to a combination of other attributes, because its purpose is to suppress existing and future optimizations employing interprocedural analysis, including those that do not have an attribute suitable for disabling them individually. This attribute is supported mainly for the purpose of testing the compiler. </p> </dd> <dt> + <span><code class="code">nonnull</code><a class="copiable-link" href="#index-nonnull-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">nonnull (<var class="var">arg-index</var>, …)</code></dt> <dd> +<p>The <code class="code">nonnull</code> attribute may be applied to a function that takes at least one argument of a pointer type. It indicates that the referenced arguments must be non-null pointers. For instance, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern void * +my_memcpy (void *dest, const void *src, size_t len) + __attribute__((nonnull (1, 2)));</pre> +</div> <p>informs the compiler that, in calls to <code class="code">my_memcpy</code>, arguments <var class="var">dest</var> and <var class="var">src</var> must be non-null. </p> <p>The attribute has an effect both on functions calls and function definitions. </p> <p>For function calls: </p> +<ul class="itemize mark-bullet"> <li>If the compiler determines that a null pointer is passed in an argument slot marked as non-null, and the <samp class="option">-Wnonnull</samp> option is enabled, a warning is issued. See <a class="xref" href="warning-options">Options to Request or Suppress Warnings</a>. </li> +<li>The <samp class="option">-fisolate-erroneous-paths-attribute</samp> option can be specified to have GCC transform calls with null arguments to non-null functions into traps. See <a class="xref" href="optimize-options">Options That Control Optimization</a>. </li> +<li>The compiler may also perform optimizations based on the knowledge that certain function arguments cannot be null. These optimizations can be disabled by the <samp class="option">-fno-delete-null-pointer-checks</samp> option. See <a class="xref" href="optimize-options">Options That Control Optimization</a>. </li> +</ul> <p>For function definitions: </p> +<ul class="itemize mark-bullet"> <li>If the compiler determines that a function parameter that is marked with nonnull is compared with null, and <samp class="option">-Wnonnull-compare</samp> option is enabled, a warning is issued. See <a class="xref" href="warning-options">Options to Request or Suppress Warnings</a>. </li> +<li>The compiler may also perform optimizations based on the knowledge that <code class="code">nonnull</code> parameters cannot be null. This can currently not be disabled other than by removing the nonnull attribute. </li> +</ul> <p>If no <var class="var">arg-index</var> is given to the <code class="code">nonnull</code> attribute, all pointer arguments are marked as non-null. To illustrate, the following declaration is equivalent to the previous example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern void * +my_memcpy (void *dest, const void *src, size_t len) + __attribute__((nonnull));</pre> +</div> </dd> <dt> +<span><code class="code">noplt</code><a class="copiable-link" href="#index-noplt-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">noplt</code> attribute is the counterpart to option <samp class="option">-fno-plt</samp>. Calls to functions marked with this attribute in position-independent code do not use the PLT. </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">/* Externally defined function foo. */ +int foo () __attribute__ ((noplt)); + +int +main (/* <span class="r">…</span> */) +{ + /* <span class="r">…</span> */ + foo (); + /* <span class="r">…</span> */ +}</pre></div> +</div> <p>The <code class="code">noplt</code> attribute on function <code class="code">foo</code> tells the compiler to assume that the function <code class="code">foo</code> is externally defined and that the call to <code class="code">foo</code> must avoid the PLT in position-independent code. </p> <p>In position-dependent code, a few targets also convert calls to functions that are marked to not use the PLT to use the GOT instead. </p> </dd> <dt> + <span><code class="code">noreturn</code><a class="copiable-link" href="#index-noreturn-function-attribute"> ¶</a></span> +</dt> <dd> +<p>A few standard library functions, such as <code class="code">abort</code> and <code class="code">exit</code>, cannot return. GCC knows this automatically. Some programs define their own functions that never return. You can declare them <code class="code">noreturn</code> to tell the compiler this fact. For example, </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">void fatal () __attribute__ ((noreturn)); + +void +fatal (/* <span class="r">…</span> */) +{ + /* <span class="r">…</span> */ /* <span class="r">Print error message.</span> */ /* <span class="r">…</span> */ + exit (1); +}</pre></div> +</div> <p>The <code class="code">noreturn</code> keyword tells the compiler to assume that <code class="code">fatal</code> cannot return. It can then optimize without regard to what would happen if <code class="code">fatal</code> ever did return. This makes slightly better code. More importantly, it helps avoid spurious warnings of uninitialized variables. </p> <p>The <code class="code">noreturn</code> keyword does not affect the exceptional path when that applies: a <code class="code">noreturn</code>-marked function may still return to the caller by throwing an exception or calling <code class="code">longjmp</code>. </p> <p>In order to preserve backtraces, GCC will never turn calls to <code class="code">noreturn</code> functions into tail calls. </p> <p>Do not assume that registers saved by the calling function are restored before calling the <code class="code">noreturn</code> function. </p> <p>It does not make sense for a <code class="code">noreturn</code> function to have a return type other than <code class="code">void</code>. </p> </dd> <dt> +<span><code class="code">nothrow</code><a class="copiable-link" href="#index-nothrow-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">nothrow</code> attribute is used to inform the compiler that a function cannot throw an exception. For example, most functions in the standard C library can be guaranteed not to throw an exception with the notable exceptions of <code class="code">qsort</code> and <code class="code">bsearch</code> that take function pointer arguments. </p> </dd> <dt> +<span><code class="code">optimize (<var class="var">level</var>, …)</code><a class="copiable-link" href="#index-optimize-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">optimize (<var class="var">string</var>, …)</code></dt> <dd> +<p>The <code class="code">optimize</code> attribute is used to specify that a function is to be compiled with different optimization options than specified on the command line. The optimize attribute arguments of a function behave as if appended to the command-line. </p> <p>Valid arguments are constant non-negative integers and strings. Each numeric argument specifies an optimization <var class="var">level</var>. Each <var class="var">string</var> argument consists of one or more comma-separated substrings. Each substring that begins with the letter <code class="code">O</code> refers to an optimization option such as <samp class="option">-O0</samp> or <samp class="option">-Os</samp>. Other substrings are taken as suffixes to the <code class="code">-f</code> prefix jointly forming the name of an optimization option. See <a class="xref" href="optimize-options">Options That Control Optimization</a>. </p> <p>‘<samp class="samp">#pragma GCC optimize</samp>’ can be used to set optimization options for more than one function. See <a class="xref" href="function-specific-option-pragmas">Function Specific Option Pragmas</a>, for details about the pragma. </p> <p>Providing multiple strings as arguments separated by commas to specify multiple options is equivalent to separating the option suffixes with a comma (‘<samp class="samp">,</samp>’) within a single string. Spaces are not permitted within the strings. </p> <p>Not every optimization option that starts with the <var class="var">-f</var> prefix specified by the attribute necessarily has an effect on the function. The <code class="code">optimize</code> attribute should be used for debugging purposes only. It is not suitable in production code. </p> </dd> <dt> + <span><code class="code">patchable_function_entry</code><a class="copiable-link" href="#index-patchable_005ffunction_005fentry-function-attribute"> ¶</a></span> +</dt> <dd> +<p>In case the target’s text segment can be made writable at run time by any means, padding the function entry with a number of NOPs can be used to provide a universal tool for instrumentation. </p> <p>The <code class="code">patchable_function_entry</code> function attribute can be used to change the number of NOPs to any desired value. The two-value syntax is the same as for the command-line switch <samp class="option">-fpatchable-function-entry=N,M</samp>, generating <var class="var">N</var> NOPs, with the function entry point before the <var class="var">M</var>th NOP instruction. <var class="var">M</var> defaults to 0 if omitted e.g. function entry point is before the first NOP. </p> <p>If patchable function entries are enabled globally using the command-line option <samp class="option">-fpatchable-function-entry=N,M</samp>, then you must disable instrumentation on all functions that are part of the instrumentation framework with the attribute <code class="code">patchable_function_entry (0)</code> to prevent recursion. </p> </dd> <dt> + <span><code class="code">pure</code><a class="copiable-link" href="#index-pure-function-attribute"> ¶</a></span> +</dt> <dd> <p>Calls to functions that have no observable effects on the state of the program other than to return a value may lend themselves to optimizations such as common subexpression elimination. Declaring such functions with the <code class="code">pure</code> attribute allows GCC to avoid emitting some calls in repeated invocations of the function with the same argument values. </p> <p>The <code class="code">pure</code> attribute prohibits a function from modifying the state of the program that is observable by means other than inspecting the function’s return value. However, functions declared with the <code class="code">pure</code> attribute can safely read any non-volatile objects, and modify the value of objects in a way that does not affect their return value or the observable state of the program. </p> <p>For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int hash (char *) __attribute__ ((pure));</pre> +</div> <p>tells GCC that subsequent calls to the function <code class="code">hash</code> with the same string can be replaced by the result of the first call provided the state of the program observable by <code class="code">hash</code>, including the contents of the array itself, does not change in between. Even though <code class="code">hash</code> takes a non-const pointer argument it must not modify the array it points to, or any other object whose value the rest of the program may depend on. However, the caller may safely change the contents of the array between successive calls to the function (doing so disables the optimization). The restriction also applies to member objects referenced by the <code class="code">this</code> pointer in C++ non-static member functions. </p> <p>Some common examples of pure functions are <code class="code">strlen</code> or <code class="code">memcmp</code>. Interesting non-pure functions are functions with infinite loops or those depending on volatile memory or other system resource, that may change between consecutive calls (such as the standard C <code class="code">feof</code> function in a multithreading environment). </p> <p>The <code class="code">pure</code> attribute imposes similar but looser restrictions on a function’s definition than the <code class="code">const</code> attribute: <code class="code">pure</code> allows the function to read any non-volatile memory, even if it changes in between successive invocations of the function. Declaring the same function with both the <code class="code">pure</code> and the <code class="code">const</code> attribute is diagnosed. Because a pure function cannot have any observable side effects it does not make sense for such a function to return <code class="code">void</code>. Declaring such a function is diagnosed. </p> </dd> <dt> +<span><code class="code">returns_nonnull</code><a class="copiable-link" href="#index-returns_005fnonnull-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">returns_nonnull</code> attribute specifies that the function return value should be a non-null pointer. For instance, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern void * +mymalloc (size_t len) __attribute__((returns_nonnull));</pre> +</div> <p>lets the compiler optimize callers based on the knowledge that the return value will never be null. </p> </dd> <dt> + <span><code class="code">returns_twice</code><a class="copiable-link" href="#index-returns_005ftwice-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">returns_twice</code> attribute tells the compiler that a function may return more than one time. The compiler ensures that all registers are dead before calling such a function and emits a warning about the variables that may be clobbered after the second return from the function. Examples of such functions are <code class="code">setjmp</code> and <code class="code">vfork</code>. The <code class="code">longjmp</code>-like counterpart of such function, if any, might need to be marked with the <code class="code">noreturn</code> attribute. </p> </dd> <dt> + <span><code class="code">section ("<var class="var">section-name</var>")</code><a class="copiable-link" href="#index-section-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Normally, the compiler places the code it generates in the <code class="code">text</code> section. Sometimes, however, you need additional sections, or you need certain particular functions to appear in special sections. The <code class="code">section</code> attribute specifies that a function lives in a particular section. For example, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern void foobar (void) __attribute__ ((section ("bar")));</pre> +</div> <p>puts the function <code class="code">foobar</code> in the <code class="code">bar</code> section. </p> <p>Some file formats do not support arbitrary sections so the <code class="code">section</code> attribute is not available on all platforms. If you need to map the entire contents of a module to a particular section, consider using the facilities of the linker instead. </p> </dd> <dt> +<span><code class="code">sentinel</code><a class="copiable-link" href="#index-sentinel-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">sentinel (<var class="var">position</var>)</code></dt> <dd> +<p>This function attribute indicates that an argument in a call to the function is expected to be an explicit <code class="code">NULL</code>. The attribute is only valid on variadic functions. By default, the sentinel is expected to be the last argument of the function call. If the optional <var class="var">position</var> argument is specified to the attribute, the sentinel must be located at <var class="var">position</var> counting backwards from the end of the argument list. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((sentinel)) +is equivalent to +__attribute__ ((sentinel(0)))</pre> +</div> <p>The attribute is automatically set with a position of 0 for the built-in functions <code class="code">execl</code> and <code class="code">execlp</code>. The built-in function <code class="code">execle</code> has the attribute set with a position of 1. </p> <p>A valid <code class="code">NULL</code> in this context is defined as zero with any object pointer type. If your system defines the <code class="code">NULL</code> macro with an integer type then you need to add an explicit cast. During installation GCC replaces the system <code class="code"><stddef.h></code> header with a copy that redefines NULL appropriately. </p> <p>The warnings for missing or incorrect sentinels are enabled with <samp class="option">-Wformat</samp>. </p> </dd> <dt> +<span><code class="code">simd</code><a class="copiable-link" href="#index-simd-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">simd("<var class="var">mask</var>")</code></dt> <dd> +<p>This attribute enables creation of one or more function versions that can process multiple arguments using SIMD instructions from a single invocation. Specifying this attribute allows compiler to assume that such versions are available at link time (provided in the same or another translation unit). Generated versions are target-dependent and described in the corresponding Vector ABI document. For x86_64 target this document can be found <a class="uref" href="https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt">here</a>. </p> <p>The optional argument <var class="var">mask</var> may have the value <code class="code">notinbranch</code> or <code class="code">inbranch</code>, and instructs the compiler to generate non-masked or masked clones correspondingly. By default, all clones are generated. </p> <p>If the attribute is specified and <code class="code">#pragma omp declare simd</code> is present on a declaration and the <samp class="option">-fopenmp</samp> or <samp class="option">-fopenmp-simd</samp> switch is specified, then the attribute is ignored. </p> </dd> <dt> +<span><code class="code">stack_protect</code><a class="copiable-link" href="#index-stack_005fprotect-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute adds stack protection code to the function if flags <samp class="option">-fstack-protector</samp>, <samp class="option">-fstack-protector-strong</samp> or <samp class="option">-fstack-protector-explicit</samp> are set. </p> </dd> <dt> +<span><code class="code">no_stack_protector</code><a class="copiable-link" href="#index-no_005fstack_005fprotector-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute prevents stack protection code for the function. </p> </dd> <dt> +<span><code class="code">target (<var class="var">string</var>, …)</code><a class="copiable-link" href="#index-target-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Multiple target back ends implement the <code class="code">target</code> attribute to specify that a function is to be compiled with different target options than specified on the command line. The original target command-line options are ignored. One or more strings can be provided as arguments. Each string consists of one or more comma-separated suffixes to the <code class="code">-m</code> prefix jointly forming the name of a machine-dependent option. See <a class="xref" href="submodel-options">Machine-Dependent Options</a>. </p> <p>The <code class="code">target</code> attribute can be used for instance to have a function compiled with a different ISA (instruction set architecture) than the default. ‘<samp class="samp">#pragma GCC target</samp>’ can be used to specify target-specific options for more than one function. See <a class="xref" href="function-specific-option-pragmas">Function Specific Option Pragmas</a>, for details about the pragma. </p> <p>For instance, on an x86, you could declare one function with the <code class="code">target("sse4.1,arch=core2")</code> attribute and another with <code class="code">target("sse4a,arch=amdfam10")</code>. This is equivalent to compiling the first function with <samp class="option">-msse4.1</samp> and <samp class="option">-march=core2</samp> options, and the second function with <samp class="option">-msse4a</samp> and <samp class="option">-march=amdfam10</samp> options. It is up to you to make sure that a function is only invoked on a machine that supports the particular ISA it is compiled for (for example by using <code class="code">cpuid</code> on x86 to determine what feature bits and architecture family are used). </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int core2_func (void) __attribute__ ((__target__ ("arch=core2"))); +int sse3_func (void) __attribute__ ((__target__ ("sse3")));</pre> +</div> <p>Providing multiple strings as arguments separated by commas to specify multiple options is equivalent to separating the option suffixes with a comma (‘<samp class="samp">,</samp>’) within a single string. Spaces are not permitted within the strings. </p> <p>The options supported are specific to each target; refer to <a class="ref" href="x86-function-attributes">x86 Function Attributes</a>, <a class="ref" href="powerpc-function-attributes">PowerPC Function Attributes</a>, <a class="ref" href="arm-function-attributes">ARM Function Attributes</a>, <a class="ref" href="aarch64-function-attributes">AArch64 Function Attributes</a>, <a class="ref" href="nios-ii-function-attributes">Nios II Function Attributes</a>, and <a class="ref" href="s_002f390-function-attributes">S/390 Function Attributes</a> for details. </p> </dd> <dt> +<span><code class="code">symver ("<var class="var">name2</var>@<var class="var">nodename</var>")</code><a class="copiable-link" href="#index-symver-function-attribute"> ¶</a></span> +</dt> <dd> +<p>On ELF targets this attribute creates a symbol version. The <var class="var">name2</var> part of the parameter is the actual name of the symbol by which it will be externally referenced. The <code class="code">nodename</code> portion should be the name of a node specified in the version script supplied to the linker when building a shared library. Versioned symbol must be defined and must be exported with default visibility. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((__symver__ ("foo@VERS_1"))) int +foo_v1 (void) +{ +}</pre> +</div> <p>Will produce a <code class="code">.symver foo_v1, foo@VERS_1</code> directive in the assembler output. </p> <p>One can also define multiple version for a given symbol (starting from binutils 2.35). </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((__symver__ ("foo@VERS_2"), __symver__ ("foo@VERS_3"))) +int symver_foo_v1 (void) +{ +}</pre> +</div> <p>This example creates a symbol name <code class="code">symver_foo_v1</code> which will be version <code class="code">VERS_2</code> and <code class="code">VERS_3</code> of <code class="code">foo</code>. </p> <p>If you have an older release of binutils, then symbol alias needs to be used: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((__symver__ ("foo@VERS_2"))) +int foo_v1 (void) +{ + return 0; +} + +__attribute__ ((__symver__ ("foo@VERS_3"))) +__attribute__ ((alias ("foo_v1"))) +int symver_foo_v1 (void);</pre> +</div> <p>Finally if the parameter is <code class="code">"<var class="var">name2</var>@@<var class="var">nodename</var>"</code> then in addition to creating a symbol version (as if <code class="code">"<var class="var">name2</var>@<var class="var">nodename</var>"</code> was used) the version will be also used to resolve <var class="var">name2</var> by the linker. </p> </dd> <dt> +<span><code class="code">tainted_args</code><a class="copiable-link" href="#index-tainted_005fargs-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">tainted_args</code> attribute is used to specify that a function is called in a way that requires sanitization of its arguments, such as a system call in an operating system kernel. Such a function can be considered part of the “attack surface” of the program. The attribute can be used both on function declarations, and on field declarations containing function pointers. In the latter case, any function used as an initializer of such a callback field will be treated as being called with tainted arguments. </p> <p>The analyzer will pay particular attention to such functions when both <samp class="option">-fanalyzer</samp> and <samp class="option">-fanalyzer-checker=taint</samp> are supplied, potentially issuing warnings guarded by <samp class="option">-Wanalyzer-tainted-allocation-size</samp>, <samp class="option">-Wanalyzer-tainted-array-index</samp>, <samp class="option">-Wanalyzer-tainted-divisor</samp>, <samp class="option">-Wanalyzer-tainted-offset</samp>, and <samp class="option">-Wanalyzer-tainted-size</samp>. </p> </dd> <dt> +<span><code class="code">target_clones (<var class="var">options</var>)</code><a class="copiable-link" href="#index-target_005fclones-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">target_clones</code> attribute is used to specify that a function be cloned into multiple versions compiled with different target options than specified on the command line. The supported options and restrictions are the same as for <code class="code">target</code> attribute. </p> <p>For instance, on an x86, you could compile a function with <code class="code">target_clones("sse4.1,avx")</code>. GCC creates two function clones, one compiled with <samp class="option">-msse4.1</samp> and another with <samp class="option">-mavx</samp>. </p> <p>On a PowerPC, you can compile a function with <code class="code">target_clones("cpu=power9,default")</code>. GCC will create two function clones, one compiled with <samp class="option">-mcpu=power9</samp> and another with the default options. GCC must be configured to use GLIBC 2.23 or newer in order to use the <code class="code">target_clones</code> attribute. </p> <p>It also creates a resolver function (see the <code class="code">ifunc</code> attribute above) that dynamically selects a clone suitable for current architecture. The resolver is created only if there is a usage of a function with <code class="code">target_clones</code> attribute. </p> <p>Note that any subsequent call of a function without <code class="code">target_clone</code> from a <code class="code">target_clone</code> caller will not lead to copying (target clone) of the called function. If you want to enforce such behaviour, we recommend declaring the calling function with the <code class="code">flatten</code> attribute? </p> </dd> <dt> +<span><code class="code">unused</code><a class="copiable-link" href="#index-unused-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute, attached to a function, means that the function is meant to be possibly unused. GCC does not produce a warning for this function. </p> </dd> <dt> +<span><code class="code">used</code><a class="copiable-link" href="#index-used-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute, attached to a function, means that code must be emitted for the function even if it appears that the function is not referenced. This is useful, for example, when the function is referenced only in inline assembly. </p> <p>When applied to a member function of a C++ class template, the attribute also means that the function is instantiated if the class itself is instantiated. </p> </dd> <dt> +<span><code class="code">retain</code><a class="copiable-link" href="#index-retain-function-attribute"> ¶</a></span> +</dt> <dd> +<p>For ELF targets that support the GNU or FreeBSD OSABIs, this attribute will save the function from linker garbage collection. To support this behavior, functions that have not been placed in specific sections (e.g. by the <code class="code">section</code> attribute, or the <code class="code">-ffunction-sections</code> option), will be placed in new, unique sections. </p> <p>This additional functionality requires Binutils version 2.36 or later. </p> </dd> <dt> +<span><code class="code">visibility ("<var class="var">visibility_type</var>")</code><a class="copiable-link" href="#index-visibility-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute affects the linkage of the declaration to which it is attached. It can be applied to variables (see <a class="pxref" href="common-variable-attributes">Common Variable Attributes</a>) and types (see <a class="pxref" href="common-type-attributes">Common Type Attributes</a>) as well as functions. </p> <p>There are four supported <var class="var">visibility_type</var> values: default, hidden, protected or internal visibility. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __attribute__ ((visibility ("protected"))) +f () { /* <span class="r">Do something.</span> */; } +int i __attribute__ ((visibility ("hidden")));</pre> +</div> <p>The possible values of <var class="var">visibility_type</var> correspond to the visibility settings in the ELF gABI. </p> <dl class="table"> <dt><code class="code">default</code></dt> <dd> +<p>Default visibility is the normal case for the object file format. This value is available for the visibility attribute to override other options that may change the assumed visibility of entities. </p> <p>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. </p> <p>On Darwin, default visibility means that the declaration is visible to other modules. </p> <p>Default visibility corresponds to “external linkage” in the language. </p> </dd> <dt><code class="code">hidden</code></dt> <dd> +<p>Hidden visibility indicates that the entity declared has a new form of linkage, which we call “hidden linkage”. Two declarations of an object with hidden linkage refer to the same object if they are in the same shared object. </p> </dd> <dt><code class="code">internal</code></dt> <dd> +<p>Internal visibility is like hidden visibility, but with additional processor specific semantics. Unless otherwise specified by the psABI, GCC defines internal visibility to mean that a function is <em class="emph">never</em> called from another module. Compare this with hidden functions which, while they cannot be referenced directly by other modules, can be referenced indirectly via function pointers. By indicating that a function cannot be called from outside the module, GCC may for instance omit the load of a PIC register since it is known that the calling function loaded the correct value. </p> </dd> <dt><code class="code">protected</code></dt> <dd> +<p>Protected visibility is like default visibility except that it indicates that references within the defining module bind to the definition in that module. That is, the declared entity cannot be overridden by another module. </p> </dd> </dl> <p>All visibilities are supported on many, but not all, ELF targets (supported when the assembler supports the ‘<samp class="samp">.visibility</samp>’ pseudo-op). Default visibility is supported everywhere. Hidden visibility is supported on Darwin targets. </p> <p>The visibility attribute should be applied only to declarations that would otherwise have external linkage. The attribute should be applied consistently, so that the same entity should not be declared with different settings of the attribute. </p> <p>In C++, the visibility attribute applies to types as well as functions and objects, because in C++ types have linkage. A class must not have greater visibility than its non-static data member types and bases, and class members default to the visibility of their class. Also, a declaration without explicit visibility is limited to the visibility of its type. </p> <p>In C++, you can mark member functions and static member variables of a class with the visibility attribute. This is useful if you know a particular method or static member variable should only be used from one shared object; then you can mark it hidden while the rest of the class has default visibility. Care must be taken to avoid breaking the One Definition Rule; for example, it is usually not useful to mark an inline method as hidden without marking the whole class as hidden. </p> <p>A C++ namespace declaration can also have the visibility attribute. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">namespace nspace1 __attribute__ ((visibility ("protected"))) +{ /* <span class="r">Do something.</span> */; }</pre> +</div> <p>This attribute applies only to the particular namespace body, not to other definitions of the same namespace; it is equivalent to using ‘<samp class="samp">#pragma GCC visibility</samp>’ before and after the namespace definition (see <a class="pxref" href="visibility-pragmas">Visibility Pragmas</a>). </p> <p>In C++, if a template argument has limited visibility, this restriction is implicitly propagated to the template instantiation. Otherwise, template instantiations and specializations default to the visibility of their template. </p> <p>If both the template and enclosing class have explicit visibility, the visibility from the template is used. </p> </dd> <dt> +<span><code class="code">warn_unused_result</code><a class="copiable-link" href="#index-warn_005funused_005fresult-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">warn_unused_result</code> attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug, such as <code class="code">realloc</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int fn () __attribute__ ((warn_unused_result)); +int foo () +{ + if (fn () < 0) return -1; + fn (); + return 0; +}</pre> +</div> <p>results in warning on line 5. </p> </dd> <dt> +<span><code class="code">weak</code><a class="copiable-link" href="#index-weak-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">weak</code> attribute causes a declaration of an external symbol to be emitted as a weak symbol rather than a global. This is primarily useful in defining library functions that can be overridden in user code, though it can also be used with non-function declarations. The overriding symbol must have the same type as the weak symbol. In addition, if it designates a variable it must also have the same size and alignment as the weak symbol. Weak symbols are supported for ELF targets, and also for a.out targets when using the GNU assembler and linker. </p> </dd> <dt> +<span><code class="code">weakref</code><a class="copiable-link" href="#index-weakref-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">weakref ("<var class="var">target</var>")</code></dt> <dd> +<p>The <code class="code">weakref</code> attribute marks a declaration as a weak reference. Without arguments, it should be accompanied by an <code class="code">alias</code> attribute naming the target symbol. Alternatively, <var class="var">target</var> may be given as an argument to <code class="code">weakref</code> itself, naming the target definition of the alias. The <var class="var">target</var> must have the same type as the declaration. In addition, if it designates a variable it must also have the same size and alignment as the declaration. In either form of the declaration <code class="code">weakref</code> implicitly marks the declared symbol as <code class="code">weak</code>. Without a <var class="var">target</var> given as an argument to <code class="code">weakref</code> or to <code class="code">alias</code>, <code class="code">weakref</code> is equivalent to <code class="code">weak</code> (in that case the declaration may be <code class="code">extern</code>). </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">/* Given the declaration: */ +extern int y (void); + +/* the following... */ +static int x (void) __attribute__ ((weakref ("y"))); + +/* is equivalent to... */ +static int x (void) __attribute__ ((weakref, alias ("y"))); + +/* or, alternatively, to... */ +static int x (void) __attribute__ ((weakref)); +static int x (void) __attribute__ ((alias ("y")));</pre> +</div> <p>A weak reference is an alias that does not by itself require a definition to be given for the target symbol. If the target symbol is only referenced through weak references, then it becomes a <code class="code">weak</code> undefined symbol. If it is directly referenced, however, then such strong references prevail, and a definition is required for the symbol, not necessarily in the same translation unit. </p> <p>The effect is equivalent to moving all references to the alias to a separate translation unit, renaming the alias to the aliased symbol, declaring it as weak, compiling the two separate translation units and performing a link with relocatable output (i.e. <code class="code">ld -r</code>) on them. </p> <p>A declaration to which <code class="code">weakref</code> is attached and that is associated with a named <code class="code">target</code> must be <code class="code">static</code>. </p> </dd> <dt> +<span><code class="code">zero_call_used_regs ("<var class="var">choice</var>")</code><a class="copiable-link" href="#index-zero_005fcall_005fused_005fregs-function-attribute"> ¶</a></span> +</dt> <dd> <p>The <code class="code">zero_call_used_regs</code> attribute causes the compiler to zero a subset of all call-used registers<a class="footnote" id="DOCF7" href="#FOOT7"><sup>7</sup></a> at function return. This is used to increase program security by either mitigating Return-Oriented Programming (ROP) attacks or preventing information leakage through registers. </p> <p>In order to satisfy users with different security needs and control the run-time overhead at the same time, the <var class="var">choice</var> parameter provides a flexible way to choose the subset of the call-used registers to be zeroed. The three basic values of <var class="var">choice</var> are: </p> <ul class="itemize mark-bullet"> <li>‘<samp class="samp">skip</samp>’ doesn’t zero any call-used registers. </li> +<li>‘<samp class="samp">used</samp>’ only zeros call-used registers that are used in the function. A “used” register is one whose content has been set or referenced in the function. </li> +<li>‘<samp class="samp">all</samp>’ zeros all call-used registers. </li> +</ul> <p>In addition to these three basic choices, it is possible to modify ‘<samp class="samp">used</samp>’ or ‘<samp class="samp">all</samp>’ as follows: </p> <ul class="itemize mark-bullet"> <li>Adding ‘<samp class="samp">-gpr</samp>’ restricts the zeroing to general-purpose registers. </li> +<li>Adding ‘<samp class="samp">-arg</samp>’ restricts the zeroing to registers that can sometimes be used to pass function arguments. This includes all argument registers defined by the platform’s calling conversion, regardless of whether the function uses those registers for function arguments or not. </li> +</ul> <p>The modifiers can be used individually or together. If they are used together, they must appear in the order above. </p> <p>The full list of <var class="var">choice</var>s is therefore: </p> <dl class="table"> <dt><code class="code">skip</code></dt> <dd> +<p>doesn’t zero any call-used register. </p> </dd> <dt><code class="code">used</code></dt> <dd> +<p>only zeros call-used registers that are used in the function. </p> </dd> <dt><code class="code">used-gpr</code></dt> <dd> +<p>only zeros call-used general purpose registers that are used in the function. </p> </dd> <dt><code class="code">used-arg</code></dt> <dd> +<p>only zeros call-used registers that are used in the function and pass arguments. </p> </dd> <dt><code class="code">used-gpr-arg</code></dt> <dd> +<p>only zeros call-used general purpose registers that are used in the function and pass arguments. </p> </dd> <dt><code class="code">all</code></dt> <dd> +<p>zeros all call-used registers. </p> </dd> <dt><code class="code">all-gpr</code></dt> <dd> +<p>zeros all call-used general purpose registers. </p> </dd> <dt><code class="code">all-arg</code></dt> <dd> +<p>zeros all call-used registers that pass arguments. </p> </dd> <dt><code class="code">all-gpr-arg</code></dt> <dd><p>zeros all call-used general purpose registers that pass arguments. </p></dd> </dl> <p>Of this list, ‘<samp class="samp">used-arg</samp>’, ‘<samp class="samp">used-gpr-arg</samp>’, ‘<samp class="samp">all-arg</samp>’, and ‘<samp class="samp">all-gpr-arg</samp>’ are mainly used for ROP mitigation. </p> <p>The default for the attribute is controlled by <samp class="option">-fzero-call-used-regs</samp>. </p> +</dd> </dl> </div> <div class="footnotes-segment"> <h1 class="footnotes-heading">Footnotes</h1> <h2 class="footnote-body-heading"><a id="FOOT7" href="#DOCF7">(7)</a></h2> <p>A “call-used” register is a register whose contents can be changed by a function call; therefore, a caller cannot assume that the register has the same contents on return from the function as it had before calling the function. Such registers are also called “call-clobbered”, “caller-saved”, or “volatile”.</p> </div> <div class="nav-panel"> <p> Next: <a href="aarch64-function-attributes">AArch64 Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Common-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Common-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/common-type-attributes.html b/devdocs/gcc~13/common-type-attributes.html new file mode 100644 index 00000000..271b9b1a --- /dev/null +++ b/devdocs/gcc~13/common-type-attributes.html @@ -0,0 +1,139 @@ +<div class="subsection-level-extent" id="Common-Type-Attributes"> <div class="nav-panel"> <p> Next: <a href="arc-type-attributes" accesskey="n" rel="next">ARC Type Attributes</a>, Up: <a href="type-attributes" accesskey="u" rel="up">Specifying Attributes of Types</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Common-Type-Attributes-1"><span>6.35.1 Common Type Attributes<a class="copiable-link" href="#Common-Type-Attributes-1"> ¶</a></span></h1> <p>The following type attributes are supported on most targets. </p> <dl class="table"> <dt> +<span><code class="code">aligned</code><a class="copiable-link" href="#index-aligned-type-attribute"> ¶</a></span> +</dt> <dt><code class="code">aligned (<var class="var">alignment</var>)</code></dt> <dd> +<p>The <code class="code">aligned</code> attribute specifies a minimum alignment (in bytes) for variables of the specified type. When specified, <var class="var">alignment</var> must be a power of 2. Specifying no <var class="var">alignment</var> argument implies the maximum alignment for the target, which is often, but by no means always, 8 or 16 bytes. For example, the declarations: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct __attribute__ ((aligned (8))) S { short f[3]; }; +typedef int more_aligned_int __attribute__ ((aligned (8)));</pre> +</div> <p>force the compiler to ensure (as far as it can) that each variable whose type is <code class="code">struct S</code> or <code class="code">more_aligned_int</code> is allocated and aligned <em class="emph">at least</em> on a 8-byte boundary. On a SPARC, having all variables of type <code class="code">struct S</code> aligned to 8-byte boundaries allows the compiler to use the <code class="code">ldd</code> and <code class="code">std</code> (doubleword load and store) instructions when copying one variable of type <code class="code">struct S</code> to another, thus improving run-time efficiency. </p> <p>Note that the alignment of any given <code class="code">struct</code> or <code class="code">union</code> type is required by the ISO C standard to be at least a perfect multiple of the lowest common multiple of the alignments of all of the members of the <code class="code">struct</code> or <code class="code">union</code> in question. This means that you <em class="emph">can</em> effectively adjust the alignment of a <code class="code">struct</code> or <code class="code">union</code> type by attaching an <code class="code">aligned</code> attribute to any one of the members of such a type, but the notation illustrated in the example above is a more obvious, intuitive, and readable way to request the compiler to adjust the alignment of an entire <code class="code">struct</code> or <code class="code">union</code> type. </p> <p>As in the preceding example, you can explicitly specify the alignment (in bytes) that you wish the compiler to use for a given <code class="code">struct</code> or <code class="code">union</code> type. Alternatively, you can leave out the alignment factor and just ask the compiler to align a type to the maximum useful alignment for the target machine you are compiling for. For example, you could write: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct __attribute__ ((aligned)) S { short f[3]; };</pre> +</div> <p>Whenever you leave out the alignment factor in an <code class="code">aligned</code> attribute specification, the compiler automatically sets the alignment for the type to the largest alignment that is ever used for any data type on the target machine you are compiling for. Doing this can often make copy operations more efficient, because the compiler can use whatever instructions copy the biggest chunks of memory when performing copies to or from the variables that have types that you have aligned this way. </p> <p>In the example above, if the size of each <code class="code">short</code> is 2 bytes, then the size of the entire <code class="code">struct S</code> type is 6 bytes. The smallest power of two that is greater than or equal to that is 8, so the compiler sets the alignment for the entire <code class="code">struct S</code> type to 8 bytes. </p> <p>Note that although you can ask the compiler to select a time-efficient alignment for a given type and then declare only individual stand-alone objects of that type, the compiler’s ability to select a time-efficient alignment is primarily useful only when you plan to create arrays of variables having the relevant (efficiently aligned) type. If you declare or use arrays of variables of an efficiently-aligned type, then it is likely that your program also does pointer arithmetic (or subscripting, which amounts to the same thing) on pointers to the relevant type, and the code that the compiler generates for these pointer arithmetic operations is often more efficient for efficiently-aligned types than for other types. </p> <p>Note that the effectiveness of <code class="code">aligned</code> attributes may be limited by inherent limitations in your linker. On many systems, the linker is only able to arrange for variables to be aligned up to a certain maximum alignment. (For some linkers, the maximum supported alignment may be very very small.) If your linker is only able to align variables up to a maximum of 8-byte alignment, then specifying <code class="code">aligned (16)</code> in an <code class="code">__attribute__</code> still only provides you with 8-byte alignment. See your linker documentation for further information. </p> <p>When used on a struct, or struct member, the <code class="code">aligned</code> attribute can only increase the alignment; in order to decrease it, the <code class="code">packed</code> attribute must be specified as well. When used as part of a typedef, the <code class="code">aligned</code> attribute can both increase and decrease alignment, and specifying the <code class="code">packed</code> attribute generates a warning. </p> </dd> <dt> +<span><code class="code">warn_if_not_aligned (<var class="var">alignment</var>)</code><a class="copiable-link" href="#index-warn_005fif_005fnot_005faligned-type-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute specifies a threshold for the structure field, measured in bytes. If the structure field is aligned below the threshold, a warning will be issued. For example, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef unsigned long long __u64 + __attribute__((aligned (4), warn_if_not_aligned (8))); + +struct foo +{ + int i1; + int i2; + __u64 x; +};</pre> +</div> <p>causes the compiler to issue an warning on <code class="code">struct foo</code>, like ‘<samp class="samp">warning: alignment 4 of 'struct foo' is less than 8</samp>’. It is used to define <code class="code">struct foo</code> in such a way that <code class="code">struct foo</code> has the same layout and the structure field <code class="code">x</code> has the same alignment when <code class="code">__u64</code> is aligned at either 4 or 8 bytes. Align <code class="code">struct foo</code> to 8 bytes: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct __attribute__ ((aligned (8))) foo +{ + int i1; + int i2; + __u64 x; +};</pre> +</div> <p>silences the warning. The compiler also issues a warning, like ‘<samp class="samp">warning: 'x' offset 12 in 'struct foo' isn't aligned to 8</samp>’, when the structure field has the misaligned offset: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct __attribute__ ((aligned (8))) foo +{ + int i1; + int i2; + int i3; + __u64 x; +};</pre> +</div> <p>This warning can be disabled by <samp class="option">-Wno-if-not-aligned</samp>. </p> </dd> <dt> +<span><code class="code">alloc_size (<var class="var">position</var>)</code><a class="copiable-link" href="#index-alloc_005fsize-type-attribute"> ¶</a></span> +</dt> <dt><code class="code">alloc_size (<var class="var">position-1</var>, <var class="var">position-2</var>)</code></dt> <dd> +<p>The <code class="code">alloc_size</code> type attribute may be applied to the definition of a type of a function that returns a pointer and takes at least one argument of an integer type. It indicates that the returned pointer points to an object whose size is given by the function argument at <var class="var">position-1</var>, or by the product of the arguments at <var class="var">position-1</var> and <var class="var">position-2</var>. Meaningful sizes are positive values less than <code class="code">PTRDIFF_MAX</code>. Other sizes are disagnosed when detected. GCC uses this information to improve the results of <code class="code">__builtin_object_size</code>. </p> <p>For instance, the following declarations </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef __attribute__ ((alloc_size (1, 2))) void* + calloc_type (size_t, size_t); +typedef __attribute__ ((alloc_size (1))) void* + malloc_type (size_t);</pre> +</div> <p>specify that <code class="code">calloc_type</code> is a type of a function that, like the standard C function <code class="code">calloc</code>, returns an object whose size is given by the product of arguments 1 and 2, and that <code class="code">malloc_type</code>, like the standard C function <code class="code">malloc</code>, returns an object whose size is given by argument 1 to the function. </p> </dd> <dt> +<span><code class="code">copy</code><a class="copiable-link" href="#index-copy-type-attribute"> ¶</a></span> +</dt> <dt><code class="code">copy (<var class="var">expression</var>)</code></dt> <dd> +<p>The <code class="code">copy</code> attribute applies the set of attributes with which the type of the <var class="var">expression</var> has been declared to the declaration of the type to which the attribute is applied. The attribute is designed for libraries that define aliases that are expected to specify the same set of attributes as the aliased symbols. The <code class="code">copy</code> attribute can be used with types, variables, or functions. However, the kind of symbol to which the attribute is applied (either varible or function) must match the kind of symbol to which the argument refers. The <code class="code">copy</code> attribute copies only syntactic and semantic attributes but not attributes that affect a symbol’s linkage or visibility such as <code class="code">alias</code>, <code class="code">visibility</code>, or <code class="code">weak</code>. The <code class="code">deprecated</code> attribute is also not copied. See <a class="xref" href="common-function-attributes">Common Function Attributes</a>. See <a class="xref" href="common-variable-attributes">Common Variable Attributes</a>. </p> <p>For example, suppose <code class="code">struct A</code> below is defined in some third party library header to have the alignment requirement <code class="code">N</code> and to force a warning whenever a variable of the type is not so aligned due to attribute <code class="code">packed</code>. Specifying the <code class="code">copy</code> attribute on the definition on the unrelated <code class="code">struct B</code> has the effect of copying all relevant attributes from the type referenced by the pointer expression to <code class="code">struct B</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct __attribute__ ((aligned (N), warn_if_not_aligned (N))) +A { /* <span class="r">…</span> */ }; +struct __attribute__ ((copy ( (struct A *)0)) B { /* <span class="r">…</span> */ };</pre> +</div> </dd> <dt> +<span><code class="code">deprecated</code><a class="copiable-link" href="#index-deprecated-type-attribute"> ¶</a></span> +</dt> <dt><code class="code">deprecated (<var class="var">msg</var>)</code></dt> <dd> +<p>The <code class="code">deprecated</code> attribute results in a warning if the type is used anywhere in the source file. This is useful when identifying types that are expected to be removed in a future version of a program. If possible, the warning also includes the location of the declaration of the deprecated type, to enable users to easily find further information about why the type is deprecated, or what they should do instead. Note that the warnings only occur for uses and then only if the type is being applied to an identifier that itself is not being declared as deprecated. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int T1 __attribute__ ((deprecated)); +T1 x; +typedef T1 T2; +T2 y; +typedef T1 T3 __attribute__ ((deprecated)); +T3 z __attribute__ ((deprecated));</pre> +</div> <p>results in a warning on line 2 and 3 but not lines 4, 5, or 6. No warning is issued for line 4 because T2 is not explicitly deprecated. Line 5 has no warning because T3 is explicitly deprecated. Similarly for line 6. The optional <var class="var">msg</var> argument, which must be a string, is printed in the warning if present. Control characters in the string will be replaced with escape sequences, and if the <samp class="option">-fmessage-length</samp> option is set to 0 (its default value) then any newline characters will be ignored. </p> <p>The <code class="code">deprecated</code> attribute can also be used for functions and variables (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>, see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>.) </p> <p>The message attached to the attribute is affected by the setting of the <samp class="option">-fmessage-length</samp> option. </p> </dd> <dt> +<span><code class="code">unavailable</code><a class="copiable-link" href="#index-unavailable-type-attribute"> ¶</a></span> +</dt> <dt><code class="code">unavailable (<var class="var">msg</var>)</code></dt> <dd> +<p>The <code class="code">unavailable</code> attribute behaves in the same manner as the <code class="code">deprecated</code> one, but emits an error rather than a warning. It is used to indicate that a (perhaps previously <code class="code">deprecated</code>) type is no longer usable. </p> <p>The <code class="code">unavailable</code> attribute can also be used for functions and variables (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>, see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>.) </p> </dd> <dt> +<span><code class="code">designated_init</code><a class="copiable-link" href="#index-designated_005finit-type-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute may only be applied to structure types. It indicates that any initialization of an object of this type must use designated initializers rather than positional initializers. The intent of this attribute is to allow the programmer to indicate that a structure’s layout may change, and that therefore relying on positional initialization will result in future breakage. </p> <p>GCC emits warnings based on this attribute by default; use <samp class="option">-Wno-designated-init</samp> to suppress them. </p> </dd> <dt> +<span><code class="code">may_alias</code><a class="copiable-link" href="#index-may_005falias-type-attribute"> ¶</a></span> +</dt> <dd> +<p>Accesses through pointers to types with this attribute are not subject to type-based alias analysis, but are instead assumed to be able to alias any other type of objects. In the context of section 6.5 paragraph 7 of the C99 standard, an lvalue expression dereferencing such a pointer is treated like having a character type. See <samp class="option">-fstrict-aliasing</samp> for more information on aliasing issues. This extension exists to support some vector APIs, in which pointers to one vector type are permitted to alias pointers to a different vector type. </p> <p>Note that an object of a type with this attribute does not have any special semantics. </p> <p>Example of use: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef short __attribute__ ((__may_alias__)) short_a; + +int +main (void) +{ + int a = 0x12345678; + short_a *b = (short_a *) &a; + + b[1] = 0; + + if (a == 0x12345678) + abort(); + + exit(0); +}</pre> +</div> <p>If you replaced <code class="code">short_a</code> with <code class="code">short</code> in the variable declaration, the above program would abort when compiled with <samp class="option">-fstrict-aliasing</samp>, which is on by default at <samp class="option">-O2</samp> or above. </p> </dd> <dt> +<span><code class="code">mode (<var class="var">mode</var>)</code><a class="copiable-link" href="#index-mode-type-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute specifies the data type for the declaration—whichever type corresponds to the mode <var class="var">mode</var>. This in effect lets you request an integer or floating-point type according to its width. </p> <p>See <a data-manual="gccint" href="https://gcc.gnu.org/onlinedocs/gccint/Machine-Modes.html#Machine-Modes">Machine Modes</a> in GNU Compiler Collection (GCC) Internals, for a list of the possible keywords for <var class="var">mode</var>. You may also specify a mode of <code class="code">byte</code> or <code class="code">__byte__</code> to indicate the mode corresponding to a one-byte integer, <code class="code">word</code> or <code class="code">__word__</code> for the mode of a one-word integer, and <code class="code">pointer</code> or <code class="code">__pointer__</code> for the mode used to represent pointers. </p> </dd> <dt> +<span><code class="code">packed</code><a class="copiable-link" href="#index-packed-type-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute, attached to a <code class="code">struct</code>, <code class="code">union</code>, or C++ <code class="code">class</code> type definition, specifies that each of its members (other than zero-width bit-fields) is placed to minimize the memory required. This is equivalent to specifying the <code class="code">packed</code> attribute on each of the members. </p> <p>When attached to an <code class="code">enum</code> definition, the <code class="code">packed</code> attribute indicates that the smallest integral type should be used. Specifying the <samp class="option">-fshort-enums</samp> flag on the command line is equivalent to specifying the <code class="code">packed</code> attribute on all <code class="code">enum</code> definitions. </p> <p>In the following example <code class="code">struct my_packed_struct</code>’s members are packed closely together, but the internal layout of its <code class="code">s</code> member is not packed—to do that, <code class="code">struct my_unpacked_struct</code> needs to be packed too. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct my_unpacked_struct + { + char c; + int i; + }; + +struct __attribute__ ((__packed__)) my_packed_struct + { + char c; + int i; + struct my_unpacked_struct s; + };</pre> +</div> <p>You may only specify the <code class="code">packed</code> attribute on the definition of an <code class="code">enum</code>, <code class="code">struct</code>, <code class="code">union</code>, or <code class="code">class</code>, not on a <code class="code">typedef</code> that does not also define the enumerated type, structure, union, or class. </p> </dd> <dt> +<span><code class="code">scalar_storage_order ("<var class="var">endianness</var>")</code><a class="copiable-link" href="#index-scalar_005fstorage_005forder-type-attribute"> ¶</a></span> +</dt> <dd> +<p>When attached to a <code class="code">union</code> or a <code class="code">struct</code>, this attribute sets the storage order, aka endianness, of the scalar fields of the type, as well as the array fields whose component is scalar. The supported endiannesses are <code class="code">big-endian</code> and <code class="code">little-endian</code>. The attribute has no effects on fields which are themselves a <code class="code">union</code>, a <code class="code">struct</code> or an array whose component is a <code class="code">union</code> or a <code class="code">struct</code>, and it is possible for these fields to have a different scalar storage order than the enclosing type. </p> <p>Note that neither pointer nor vector fields are considered scalar fields in this context, so the attribute has no effects on these fields. </p> <p>This attribute is supported only for targets that use a uniform default scalar storage order (fortunately, most of them), i.e. targets that store the scalars either all in big-endian or all in little-endian. </p> <p>Additional restrictions are enforced for types with the reverse scalar storage order with regard to the scalar storage order of the target: </p> <ul class="itemize mark-bullet"> <li>Taking the address of a scalar field of a <code class="code">union</code> or a <code class="code">struct</code> with reverse scalar storage order is not permitted and yields an error. </li> +<li>Taking the address of an array field, whose component is scalar, of a <code class="code">union</code> or a <code class="code">struct</code> with reverse scalar storage order is permitted but yields a warning, unless <samp class="option">-Wno-scalar-storage-order</samp> is specified. </li> +<li>Taking the address of a <code class="code">union</code> or a <code class="code">struct</code> with reverse scalar storage order is permitted. </li> +</ul> <p>These restrictions exist because the storage order attribute is lost when the address of a scalar or the address of an array with scalar component is taken, so storing indirectly through this address generally does not work. The second case is nevertheless allowed to be able to perform a block copy from or to the array. </p> <p>Moreover, the use of type punning or aliasing to toggle the storage order is not supported; that is to say, if a given scalar object can be accessed through distinct types that assign a different storage order to it, then the behavior is undefined. </p> </dd> <dt> +<span><code class="code">transparent_union</code><a class="copiable-link" href="#index-transparent_005funion-type-attribute"> ¶</a></span> +</dt> <dd> <p>This attribute, attached to a <code class="code">union</code> type definition, indicates that any function parameter having that union type causes calls to that function to be treated in a special way. </p> <p>First, the argument corresponding to a transparent union type can be of any type in the union; no cast is required. Also, if the union contains a pointer type, the corresponding argument can be a null pointer constant or a void pointer expression; and if the union contains a void pointer type, the corresponding argument can be any pointer expression. If the union member type is a pointer, qualifiers like <code class="code">const</code> on the referenced type must be respected, just as with normal pointer conversions. </p> <p>Second, the argument is passed to the function using the calling conventions of the first member of the transparent union, not the calling conventions of the union itself. All members of the union must have the same machine representation; this is necessary for this argument passing to work properly. </p> <p>Transparent unions are designed for library functions that have multiple interfaces for compatibility reasons. For example, suppose the <code class="code">wait</code> function must accept either a value of type <code class="code">int *</code> to comply with POSIX, or a value of type <code class="code">union wait *</code> to comply with the 4.1BSD interface. If <code class="code">wait</code>’s parameter were <code class="code">void *</code>, <code class="code">wait</code> would accept both kinds of arguments, but it would also accept any other pointer type and this would make argument type checking less useful. Instead, <code class="code"><sys/wait.h></code> might define the interface as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef union __attribute__ ((__transparent_union__)) + { + int *__ip; + union wait *__up; + } wait_status_ptr_t; + +pid_t wait (wait_status_ptr_t);</pre> +</div> <p>This interface allows either <code class="code">int *</code> or <code class="code">union wait *</code> arguments to be passed, using the <code class="code">int *</code> calling convention. The program can call <code class="code">wait</code> with arguments of either type: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int w1 () { int w; return wait (&w); } +int w2 () { union wait w; return wait (&w); }</pre> +</div> <p>With this interface, <code class="code">wait</code>’s implementation might look like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">pid_t wait (wait_status_ptr_t p) +{ + return waitpid (-1, p.__ip, 0); +}</pre> +</div> </dd> <dt> +<span><code class="code">unused</code><a class="copiable-link" href="#index-unused-type-attribute"> ¶</a></span> +</dt> <dd> +<p>When attached to a type (including a <code class="code">union</code> or a <code class="code">struct</code>), this attribute means that variables of that type are meant to appear possibly unused. GCC does not produce a warning for any variables of that type, even if the variable appears to do nothing. This is often the case with lock or thread classes, which are usually defined and then not referenced, but contain constructors and destructors that have nontrivial bookkeeping functions. </p> </dd> <dt> +<span><code class="code">vector_size (<var class="var">bytes</var>)</code><a class="copiable-link" href="#index-vector_005fsize-type-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute specifies the vector size for the type, measured in bytes. The type to which it applies is known as the <em class="dfn">base type</em>. The <var class="var">bytes</var> argument must be a positive power-of-two multiple of the base type size. For example, the following declarations: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef __attribute__ ((vector_size (32))) int int_vec32_t ; +typedef __attribute__ ((vector_size (32))) int* int_vec32_ptr_t; +typedef __attribute__ ((vector_size (32))) int int_vec32_arr3_t[3];</pre> +</div> <p>define <code class="code">int_vec32_t</code> to be a 32-byte vector type composed of <code class="code">int</code> sized units. With <code class="code">int</code> having a size of 4 bytes, the type defines a vector of eight units, four bytes each. The mode of variables of type <code class="code">int_vec32_t</code> is <code class="code">V8SI</code>. <code class="code">int_vec32_ptr_t</code> is then defined to be a pointer to such a vector type, and <code class="code">int_vec32_arr3_t</code> to be an array of three such vectors. See <a class="xref" href="vector-extensions">Using Vector Instructions through Built-in Functions</a>, for details of manipulating objects of vector types. </p> <p>This attribute is only applicable to integral and floating scalar types. In function declarations the attribute applies to the function return type. </p> <p>For example, the following: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((vector_size (16))) float get_flt_vec16 (void);</pre> +</div> <p>declares <code class="code">get_flt_vec16</code> to be a function returning a 16-byte vector with the base type <code class="code">float</code>. </p> </dd> <dt> +<span><code class="code">visibility</code><a class="copiable-link" href="#index-visibility-type-attribute"> ¶</a></span> +</dt> <dd> +<p>In C++, attribute visibility (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>) can also be applied to class, struct, union and enum types. Unlike other type attributes, the attribute must appear between the initial keyword and the name of the type; it cannot appear after the body of the type. </p> <p>Note that the type visibility is applied to vague linkage entities associated with the class (vtable, typeinfo node, etc.). In particular, if a class is thrown as an exception in one shared object and caught in another, the class must have default visibility. Otherwise the two shared objects are unable to use the same typeinfo node and exception handling will break. </p> </dd> <dt> +<span><code class="code">objc_root_class <span class="r">(Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-objc_005froot_005fclass-type-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute marks a class as being a root class, and thus allows the compiler to elide any warnings about a missing superclass and to make additional checks for mandatory methods as needed. </p> </dd> </dl> <p>To specify multiple attributes, separate them by commas within the double parentheses: for example, ‘<samp class="samp">__attribute__ ((aligned (16), packed))</samp>’. </p> </div> <div class="nav-panel"> <p> Next: <a href="arc-type-attributes">ARC Type Attributes</a>, Up: <a href="type-attributes">Specifying Attributes of Types</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Common-Type-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Common-Type-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/common-variable-attributes.html b/devdocs/gcc~13/common-variable-attributes.html new file mode 100644 index 00000000..3351c861 --- /dev/null +++ b/devdocs/gcc~13/common-variable-attributes.html @@ -0,0 +1,141 @@ +<div class="subsection-level-extent" id="Common-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="arc-variable-attributes" accesskey="n" rel="next">ARC Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Common-Variable-Attributes-1"><span>6.34.1 Common Variable Attributes<a class="copiable-link" href="#Common-Variable-Attributes-1"> ¶</a></span></h1> <p>The following attributes are supported on most targets. </p> <dl class="table"> <dt> +<span><code class="code">alias ("<var class="var">target</var>")</code><a class="copiable-link" href="#index-alias-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">alias</code> variable attribute causes the declaration to be emitted as an alias for another symbol known as an <em class="dfn">alias target</em>. Except for top-level qualifiers the alias target must have the same type as the alias. For instance, the following </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int var_target; +extern int __attribute__ ((alias ("var_target"))) var_alias;</pre> +</div> <p>defines <code class="code">var_alias</code> to be an alias for the <code class="code">var_target</code> variable. </p> <p>It is an error if the alias target is not defined in the same translation unit as the alias. </p> <p>Note that in the absence of the attribute GCC assumes that distinct declarations with external linkage denote distinct objects. Using both the alias and the alias target to access the same object is undefined in a translation unit without a declaration of the alias with the attribute. </p> <p>This attribute requires assembler and object file support, and may not be available on all targets. </p> </dd> <dt> +<span><code class="code">aligned</code><a class="copiable-link" href="#index-aligned-variable-attribute"> ¶</a></span> +</dt> <dt><code class="code">aligned (<var class="var">alignment</var>)</code></dt> <dd> +<p>The <code class="code">aligned</code> attribute specifies a minimum alignment for the variable or structure field, measured in bytes. When specified, <var class="var">alignment</var> must be an integer constant power of 2. Specifying no <var class="var">alignment</var> argument implies the maximum alignment for the target, which is often, but by no means always, 8 or 16 bytes. </p> <p>For example, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int x __attribute__ ((aligned (16))) = 0;</pre> +</div> <p>causes the compiler to allocate the global variable <code class="code">x</code> on a 16-byte boundary. On a 68040, this could be used in conjunction with an <code class="code">asm</code> expression to access the <code class="code">move16</code> instruction which requires 16-byte aligned operands. </p> <p>You can also specify the alignment of structure fields. For example, to create a double-word aligned <code class="code">int</code> pair, you could write: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct foo { int x[2] __attribute__ ((aligned (8))); };</pre> +</div> <p>This is an alternative to creating a union with a <code class="code">double</code> member, which forces the union to be double-word aligned. </p> <p>As in the preceding examples, you can explicitly specify the alignment (in bytes) that you wish the compiler to use for a given variable or structure field. Alternatively, you can leave out the alignment factor and just ask the compiler to align a variable or field to the default alignment for the target architecture you are compiling for. The default alignment is sufficient for all scalar types, but may not be enough for all vector types on a target that supports vector operations. The default alignment is fixed for a particular target ABI. </p> <p>GCC also provides a target specific macro <code class="code">__BIGGEST_ALIGNMENT__</code>, which is the largest alignment ever used for any data type on the target machine you are compiling for. For example, you could write: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">short array[3] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)));</pre> +</div> <p>The compiler automatically sets the alignment for the declared variable or field to <code class="code">__BIGGEST_ALIGNMENT__</code>. Doing this can often make copy operations more efficient, because the compiler can use whatever instructions copy the biggest chunks of memory when performing copies to or from the variables or fields that you have aligned this way. Note that the value of <code class="code">__BIGGEST_ALIGNMENT__</code> may change depending on command-line options. </p> <p>When used on a struct, or struct member, the <code class="code">aligned</code> attribute can only increase the alignment; in order to decrease it, the <code class="code">packed</code> attribute must be specified as well. When used as part of a typedef, the <code class="code">aligned</code> attribute can both increase and decrease alignment, and specifying the <code class="code">packed</code> attribute generates a warning. </p> <p>Note that the effectiveness of <code class="code">aligned</code> attributes for static variables may be limited by inherent limitations in the system linker and/or object file format. On some systems, the linker is only able to arrange for variables to be aligned up to a certain maximum alignment. (For some linkers, the maximum supported alignment may be very very small.) If your linker is only able to align variables up to a maximum of 8-byte alignment, then specifying <code class="code">aligned(16)</code> in an <code class="code">__attribute__</code> still only provides you with 8-byte alignment. See your linker documentation for further information. </p> <p>Stack variables are not affected by linker restrictions; GCC can properly align them on any target. </p> <p>The <code class="code">aligned</code> attribute can also be used for functions (see <a class="pxref" href="common-function-attributes">Common Function Attributes</a>.) </p> </dd> <dt> +<span><code class="code">warn_if_not_aligned (<var class="var">alignment</var>)</code><a class="copiable-link" href="#index-warn_005fif_005fnot_005faligned-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute specifies a threshold for the structure field, measured in bytes. If the structure field is aligned below the threshold, a warning will be issued. For example, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct foo +{ + int i1; + int i2; + unsigned long long x __attribute__ ((warn_if_not_aligned (16))); +};</pre> +</div> <p>causes the compiler to issue an warning on <code class="code">struct foo</code>, like ‘<samp class="samp">warning: alignment 8 of 'struct foo' is less than 16</samp>’. The compiler also issues a warning, like ‘<samp class="samp">warning: 'x' offset 8 in 'struct foo' isn't aligned to 16</samp>’, when the structure field has the misaligned offset: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct __attribute__ ((aligned (16))) foo +{ + int i1; + int i2; + unsigned long long x __attribute__ ((warn_if_not_aligned (16))); +};</pre> +</div> <p>This warning can be disabled by <samp class="option">-Wno-if-not-aligned</samp>. The <code class="code">warn_if_not_aligned</code> attribute can also be used for types (see <a class="pxref" href="common-type-attributes">Common Type Attributes</a>.) </p> </dd> <dt> +<span><code class="code">strict_flex_array (<var class="var">level</var>)</code><a class="copiable-link" href="#index-strict_005fflex_005farray-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">strict_flex_array</code> attribute should be attached to the trailing array field of a structure. It controls when to treat the trailing array field of a structure as a flexible array member for the purposes of accessing the elements of such an array. <var class="var">level</var> must be an integer betwen 0 to 3. </p> <p><var class="var">level</var>=0 is the least strict level, all trailing arrays of structures are treated as flexible array members. <var class="var">level</var>=3 is the strictest level, only when the trailing array is declared as a flexible array member per C99 standard onwards (‘<samp class="samp">[]</samp>’), it is treated as a flexible array member. </p> <p>There are two more levels in between 0 and 3, which are provided to support older codes that use GCC zero-length array extension (‘<samp class="samp">[0]</samp>’) or one-element array as flexible array members (‘<samp class="samp">[1]</samp>’): When <var class="var">level</var> is 1, the trailing array is treated as a flexible array member when it is declared as either ‘<samp class="samp">[]</samp>’, ‘<samp class="samp">[0]</samp>’, or ‘<samp class="samp">[1]</samp>’; When <var class="var">level</var> is 2, the trailing array is treated as a flexible array member when it is declared as either ‘<samp class="samp">[]</samp>’, or ‘<samp class="samp">[0]</samp>’. </p> <p>This attribute can be used with or without the <samp class="option">-fstrict-flex-arrays</samp>. When both the attribute and the option present at the same time, the level of the strictness for the specific trailing array field is determined by the attribute. </p> </dd> <dt> +<span><code class="code">alloc_size (<var class="var">position</var>)</code><a class="copiable-link" href="#index-alloc_005fsize-variable-attribute"> ¶</a></span> +</dt> <dt><code class="code">alloc_size (<var class="var">position-1</var>, <var class="var">position-2</var>)</code></dt> <dd> +<p>The <code class="code">alloc_size</code> variable attribute may be applied to the declaration of a pointer to a function that returns a pointer and takes at least one argument of an integer type. It indicates that the returned pointer points to an object whose size is given by the function argument at <var class="var">position</var>, or by the product of the arguments at <var class="var">position-1</var> and <var class="var">position-2</var>. Meaningful sizes are positive values less than <code class="code">PTRDIFF_MAX</code>. Other sizes are diagnosed when detected. GCC uses this information to improve the results of <code class="code">__builtin_object_size</code>. </p> <p>For instance, the following declarations </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef __attribute__ ((alloc_size (1, 2))) void* + (*calloc_ptr) (size_t, size_t); +typedef __attribute__ ((alloc_size (1))) void* + (*malloc_ptr) (size_t);</pre> +</div> <p>specify that <code class="code">calloc_ptr</code> is a pointer of a function that, like the standard C function <code class="code">calloc</code>, returns an object whose size is given by the product of arguments 1 and 2, and similarly, that <code class="code">malloc_ptr</code>, like the standard C function <code class="code">malloc</code>, returns an object whose size is given by argument 1 to the function. </p> </dd> <dt> +<span><code class="code">cleanup (<var class="var">cleanup_function</var>)</code><a class="copiable-link" href="#index-cleanup-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">cleanup</code> attribute runs a function when the variable goes out of scope. This attribute can only be applied to auto function scope variables; it may not be applied to parameters or variables with static storage duration. The function must take one parameter, a pointer to a type compatible with the variable. The return value of the function (if any) is ignored. </p> <p>If <samp class="option">-fexceptions</samp> is enabled, then <var class="var">cleanup_function</var> is run during the stack unwinding that happens during the processing of the exception. Note that the <code class="code">cleanup</code> attribute does not allow the exception to be caught, only to perform an action. It is undefined what happens if <var class="var">cleanup_function</var> does not return normally. </p> </dd> <dt> + <span><code class="code">common</code><a class="copiable-link" href="#index-common-variable-attribute"> ¶</a></span> +</dt> <dt><code class="code">nocommon</code></dt> <dd> +<p>The <code class="code">common</code> attribute requests GCC to place a variable in “common” storage. The <code class="code">nocommon</code> attribute requests the opposite—to allocate space for it directly. </p> <p>These attributes override the default chosen by the <samp class="option">-fno-common</samp> and <samp class="option">-fcommon</samp> flags respectively. </p> </dd> <dt> +<span><code class="code">copy</code><a class="copiable-link" href="#index-copy-variable-attribute"> ¶</a></span> +</dt> <dt><code class="code">copy (<var class="var">variable</var>)</code></dt> <dd> +<p>The <code class="code">copy</code> attribute applies the set of attributes with which <var class="var">variable</var> has been declared to the declaration of the variable to which the attribute is applied. The attribute is designed for libraries that define aliases that are expected to specify the same set of attributes as the aliased symbols. The <code class="code">copy</code> attribute can be used with variables, functions or types. However, the kind of symbol to which the attribute is applied (either varible or function) must match the kind of symbol to which the argument refers. The <code class="code">copy</code> attribute copies only syntactic and semantic attributes but not attributes that affect a symbol’s linkage or visibility such as <code class="code">alias</code>, <code class="code">visibility</code>, or <code class="code">weak</code>. The <code class="code">deprecated</code> attribute is also not copied. See <a class="xref" href="common-function-attributes">Common Function Attributes</a>. See <a class="xref" href="common-type-attributes">Common Type Attributes</a>. </p> </dd> <dt> +<span><code class="code">deprecated</code><a class="copiable-link" href="#index-deprecated-variable-attribute"> ¶</a></span> +</dt> <dt><code class="code">deprecated (<var class="var">msg</var>)</code></dt> <dd> +<p>The <code class="code">deprecated</code> attribute results in a warning if the variable is used anywhere in the source file. This is useful when identifying variables that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated variable, to enable users to easily find further information about why the variable is deprecated, or what they should do instead. Note that the warning only occurs for uses: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern int old_var __attribute__ ((deprecated)); +extern int old_var; +int new_fn () { return old_var; }</pre> +</div> <p>results in a warning on line 3 but not line 2. The optional <var class="var">msg</var> argument, which must be a string, is printed in the warning if present. </p> <p>The <code class="code">deprecated</code> attribute can also be used for functions and types (see <a class="pxref" href="common-function-attributes">Common Function Attributes</a>, see <a class="pxref" href="common-type-attributes">Common Type Attributes</a>). </p> <p>The message attached to the attribute is affected by the setting of the <samp class="option">-fmessage-length</samp> option. </p> </dd> <dt> +<span><code class="code">unavailable</code><a class="copiable-link" href="#index-unavailable-variable-attribute"> ¶</a></span> +</dt> <dt><code class="code">unavailable (<var class="var">msg</var>)</code></dt> <dd> +<p>The <code class="code">unavailable</code> attribute indicates that the variable so marked is not available, if it is used anywhere in the source file. It behaves in the same manner as the <code class="code">deprecated</code> attribute except that the compiler will emit an error rather than a warning. </p> <p>It is expected that items marked as <code class="code">deprecated</code> will eventually be withdrawn from interfaces, and then become unavailable. This attribute allows for marking them appropriately. </p> <p>The <code class="code">unavailable</code> attribute can also be used for functions and types (see <a class="pxref" href="common-function-attributes">Common Function Attributes</a>, see <a class="pxref" href="common-type-attributes">Common Type Attributes</a>). </p> </dd> <dt> +<span><code class="code">mode (<var class="var">mode</var>)</code><a class="copiable-link" href="#index-mode-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute specifies the data type for the declaration—whichever type corresponds to the mode <var class="var">mode</var>. This in effect lets you request an integer or floating-point type according to its width. </p> <p>See <a data-manual="gccint" href="https://gcc.gnu.org/onlinedocs/gccint/Machine-Modes.html#Machine-Modes">Machine Modes</a> in GNU Compiler Collection (GCC) Internals, for a list of the possible keywords for <var class="var">mode</var>. You may also specify a mode of <code class="code">byte</code> or <code class="code">__byte__</code> to indicate the mode corresponding to a one-byte integer, <code class="code">word</code> or <code class="code">__word__</code> for the mode of a one-word integer, and <code class="code">pointer</code> or <code class="code">__pointer__</code> for the mode used to represent pointers. </p> </dd> <dt> +<span><code class="code">nonstring</code><a class="copiable-link" href="#index-nonstring-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">nonstring</code> variable attribute specifies that an object or member declaration with type array of <code class="code">char</code>, <code class="code">signed char</code>, or <code class="code">unsigned char</code>, or pointer to such a type is intended to store character arrays that do not necessarily contain a terminating <code class="code">NUL</code>. This is useful in detecting uses of such arrays or pointers with functions that expect <code class="code">NUL</code>-terminated strings, and to avoid warnings when such an array or pointer is used as an argument to a bounded string manipulation function such as <code class="code">strncpy</code>. For example, without the attribute, GCC will issue a warning for the <code class="code">strncpy</code> call below because it may truncate the copy without appending the terminating <code class="code">NUL</code> character. Using the attribute makes it possible to suppress the warning. However, when the array is declared with the attribute the call to <code class="code">strlen</code> is diagnosed because when the array doesn’t contain a <code class="code">NUL</code>-terminated string the call is undefined. To copy, compare, of search non-string character arrays use the <code class="code">memcpy</code>, <code class="code">memcmp</code>, <code class="code">memchr</code>, and other functions that operate on arrays of bytes. In addition, calling <code class="code">strnlen</code> and <code class="code">strndup</code> with such arrays is safe provided a suitable bound is specified, and not diagnosed. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct Data +{ + char name [32] __attribute__ ((nonstring)); +}; + +int f (struct Data *pd, const char *s) +{ + strncpy (pd->name, s, sizeof pd->name); + … + return strlen (pd->name); // unsafe, gets a warning +}</pre> +</div> </dd> <dt> +<span><code class="code">packed</code><a class="copiable-link" href="#index-packed-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">packed</code> attribute specifies that a structure member should have the smallest possible alignment—one bit for a bit-field and one byte otherwise, unless a larger value is specified with the <code class="code">aligned</code> attribute. The attribute does not apply to non-member objects. </p> <p>For example in the structure below, the member array <code class="code">x</code> is packed so that it immediately follows <code class="code">a</code> with no intervening padding: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct foo +{ + char a; + int x[2] __attribute__ ((packed)); +};</pre> +</div> <p><em class="emph">Note:</em> The 4.1, 4.2 and 4.3 series of GCC ignore the <code class="code">packed</code> attribute on bit-fields of type <code class="code">char</code>. This has been fixed in GCC 4.4 but the change can lead to differences in the structure layout. See the documentation of <samp class="option">-Wpacked-bitfield-compat</samp> for more information. </p> </dd> <dt> +<span><code class="code">section ("<var class="var">section-name</var>")</code><a class="copiable-link" href="#index-section-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>Normally, the compiler places the objects it generates in sections like <code class="code">data</code> and <code class="code">bss</code>. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The <code class="code">section</code> attribute specifies that a variable (or function) lives in a particular section. For example, this small program uses several specific section names: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct duart a __attribute__ ((section ("DUART_A"))) = { 0 }; +struct duart b __attribute__ ((section ("DUART_B"))) = { 0 }; +char stack[10000] __attribute__ ((section ("STACK"))) = { 0 }; +int init_data __attribute__ ((section ("INITDATA"))); + +main() +{ + /* <span class="r">Initialize stack pointer</span> */ + init_sp (stack + sizeof (stack)); + + /* <span class="r">Initialize initialized data</span> */ + memcpy (&init_data, &data, &edata - &data); + + /* <span class="r">Turn on the serial ports</span> */ + init_duart (&a); + init_duart (&b); +}</pre> +</div> <p>Use the <code class="code">section</code> attribute with <em class="emph">global</em> variables and not <em class="emph">local</em> variables, as shown in the example. </p> <p>You may use the <code class="code">section</code> attribute with initialized or uninitialized global variables but the linker requires each object be defined once, with the exception that uninitialized variables tentatively go in the <code class="code">common</code> (or <code class="code">bss</code>) section and can be multiply “defined”. Using the <code class="code">section</code> attribute changes what section the variable goes into and may cause the linker to issue an error if an uninitialized variable has multiple definitions. You can force a variable to be initialized with the <samp class="option">-fno-common</samp> flag or the <code class="code">nocommon</code> attribute. </p> <p>Some file formats do not support arbitrary sections so the <code class="code">section</code> attribute is not available on all platforms. If you need to map the entire contents of a module to a particular section, consider using the facilities of the linker instead. </p> </dd> <dt> +<span><code class="code">tls_model ("<var class="var">tls_model</var>")</code><a class="copiable-link" href="#index-tls_005fmodel-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">tls_model</code> attribute sets thread-local storage model (see <a class="pxref" href="thread-local">Thread-Local Storage</a>) of a particular <code class="code">__thread</code> variable, overriding <samp class="option">-ftls-model=</samp> command-line switch on a per-variable basis. The <var class="var">tls_model</var> argument should be one of <code class="code">global-dynamic</code>, <code class="code">local-dynamic</code>, <code class="code">initial-exec</code> or <code class="code">local-exec</code>. </p> <p>Not all targets support this attribute. </p> </dd> <dt> +<span><code class="code">unused</code><a class="copiable-link" href="#index-unused-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute, attached to a variable or structure field, means that the variable or field is meant to be possibly unused. GCC does not produce a warning for this variable or field. </p> </dd> <dt> +<span><code class="code">used</code><a class="copiable-link" href="#index-used-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute, attached to a variable with static storage, means that the variable must be emitted even if it appears that the variable is not referenced. </p> <p>When applied to a static data member of a C++ class template, the attribute also means that the member is instantiated if the class itself is instantiated. </p> </dd> <dt> +<span><code class="code">retain</code><a class="copiable-link" href="#index-retain-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>For ELF targets that support the GNU or FreeBSD OSABIs, this attribute will save the variable from linker garbage collection. To support this behavior, variables that have not been placed in specific sections (e.g. by the <code class="code">section</code> attribute, or the <code class="code">-fdata-sections</code> option), will be placed in new, unique sections. </p> <p>This additional functionality requires Binutils version 2.36 or later. </p> </dd> <dt> +<span><code class="code">uninitialized</code><a class="copiable-link" href="#index-uninitialized-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute, attached to a variable with automatic storage, means that the variable should not be automatically initialized by the compiler when the option <code class="code">-ftrivial-auto-var-init</code> presents. </p> <p>With the option <code class="code">-ftrivial-auto-var-init</code>, all the automatic variables that do not have explicit initializers will be initialized by the compiler. These additional compiler initializations might incur run-time overhead, sometimes dramatically. This attribute can be used to mark some variables to be excluded from such automatical initialization in order to reduce runtime overhead. </p> <p>This attribute has no effect when the option <code class="code">-ftrivial-auto-var-init</code> does not present. </p> </dd> <dt> +<span><code class="code">vector_size (<var class="var">bytes</var>)</code><a class="copiable-link" href="#index-vector_005fsize-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute specifies the vector size for the type of the declared variable, measured in bytes. The type to which it applies is known as the <em class="dfn">base type</em>. The <var class="var">bytes</var> argument must be a positive power-of-two multiple of the base type size. For example, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int foo __attribute__ ((vector_size (16)));</pre> +</div> <p>causes the compiler to set the mode for <code class="code">foo</code>, to be 16 bytes, divided into <code class="code">int</code> sized units. Assuming a 32-bit <code class="code">int</code>, <code class="code">foo</code>’s type is a vector of four units of four bytes each, and the corresponding mode of <code class="code">foo</code> is <code class="code">V4SI</code>. See <a class="xref" href="vector-extensions">Using Vector Instructions through Built-in Functions</a>, for details of manipulating vector variables. </p> <p>This attribute is only applicable to integral and floating scalars, although arrays, pointers, and function return values are allowed in conjunction with this construct. </p> <p>Aggregates with this attribute are invalid, even if they are of the same size as a corresponding scalar. For example, the declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct S { int a; }; +struct S __attribute__ ((vector_size (16))) foo;</pre> +</div> <p>is invalid even if the size of the structure is the same as the size of the <code class="code">int</code>. </p> </dd> <dt> +<span><code class="code">visibility ("<var class="var">visibility_type</var>")</code><a class="copiable-link" href="#index-visibility-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute affects the linkage of the declaration to which it is attached. The <code class="code">visibility</code> attribute is described in <a class="ref" href="common-function-attributes">Common Function Attributes</a>. </p> </dd> <dt> +<span><code class="code">weak</code><a class="copiable-link" href="#index-weak-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">weak</code> attribute is described in <a class="ref" href="common-function-attributes">Common Function Attributes</a>. </p> </dd> <dt> +<span><code class="code">noinit</code><a class="copiable-link" href="#index-noinit-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>Any data with the <code class="code">noinit</code> attribute will not be initialized by the C runtime startup code, or the program loader. Not initializing data in this way can reduce program startup times. </p> <p>This attribute is specific to ELF targets and relies on the linker script to place sections with the <code class="code">.noinit</code> prefix in the right location. </p> </dd> <dt> +<span><code class="code">persistent</code><a class="copiable-link" href="#index-persistent-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>Any data with the <code class="code">persistent</code> attribute will not be initialized by the C runtime startup code, but will be initialized by the program loader. This enables the value of the variable to ‘<samp class="samp">persist</samp>’ between processor resets. </p> <p>This attribute is specific to ELF targets and relies on the linker script to place the sections with the <code class="code">.persistent</code> prefix in the right location. Specifically, some type of non-volatile, writeable memory is required. </p> </dd> <dt> +<span><code class="code">objc_nullability (<var class="var">nullability kind</var>) <span class="r">(Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-objc_005fnullability-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute applies to pointer variables only. It allows marking the pointer with one of four possible values describing the conditions under which the pointer might have a <code class="code">nil</code> value. In most cases, the attribute is intended to be an internal representation for property and method nullability (specified by language keywords); it is not recommended to use it directly. </p> <p>When <var class="var">nullability kind</var> is <code class="code">"unspecified"</code> or <code class="code">0</code>, nothing is known about the conditions in which the pointer might be <code class="code">nil</code>. Making this state specific serves to avoid false positives in diagnostics. </p> <p>When <var class="var">nullability kind</var> is <code class="code">"nonnull"</code> or <code class="code">1</code>, the pointer has no meaning if it is <code class="code">nil</code> and thus the compiler is free to emit diagnostics if it can be determined that the value will be <code class="code">nil</code>. </p> <p>When <var class="var">nullability kind</var> is <code class="code">"nullable"</code> or <code class="code">2</code>, the pointer might be <code class="code">nil</code> and carry meaning as such. </p> <p>When <var class="var">nullability kind</var> is <code class="code">"resettable"</code> or <code class="code">3</code> (used only in the context of property attribute lists) this describes the case in which a property setter may take the value <code class="code">nil</code> (which perhaps causes the property to be reset in some manner to a default) but for which the property getter will never validly return <code class="code">nil</code>. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="arc-variable-attributes">ARC Variable Attributes</a>, Up: <a href="variable-attributes">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Common-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Common-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/compatibility.html b/devdocs/gcc~13/compatibility.html new file mode 100644 index 00000000..3562263b --- /dev/null +++ b/devdocs/gcc~13/compatibility.html @@ -0,0 +1,25 @@ +<div class="chapter-level-extent" id="Compatibility"> <div class="nav-panel"> <p> Next: <a href="gcov" accesskey="n" rel="next"><code class="command">gcov</code>—a Test Coverage Program</a>, Previous: <a href="objective-c" accesskey="p" rel="prev">GNU Objective-C Features</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="Binary-Compatibility"><span>9 Binary Compatibility<a class="copiable-link" href="#Binary-Compatibility"> ¶</a></span></h1> <p>Binary compatibility encompasses several related concepts: </p> <dl class="table"> <dt>application binary interface (ABI)</dt> <dd> +<p>The set of runtime conventions followed by all of the tools that deal with binary representations of a program, including compilers, assemblers, linkers, and language runtime support. Some ABIs are formal with a written specification, possibly designed by multiple interested parties. Others are simply the way things are actually done by a particular set of tools. </p> </dd> <dt>ABI conformance</dt> <dd> +<p>A compiler conforms to an ABI if it generates code that follows all of the specifications enumerated by that ABI. A library conforms to an ABI if it is implemented according to that ABI. An application conforms to an ABI if it is built using tools that conform to that ABI and does not contain source code that specifically changes behavior specified by the ABI. </p> </dd> <dt>calling conventions</dt> <dd> +<p>Calling conventions are a subset of an ABI that specify of how arguments are passed and function results are returned. </p> </dd> <dt>interoperability</dt> <dd> +<p>Different sets of tools are interoperable if they generate files that can be used in the same program. The set of tools includes compilers, assemblers, linkers, libraries, header files, startup files, and debuggers. Binaries produced by different sets of tools are not interoperable unless they implement the same ABI. This applies to different versions of the same tools as well as tools from different vendors. </p> </dd> <dt>intercallability</dt> <dd> +<p>Whether a function in a binary built by one set of tools can call a function in a binary built by a different set of tools is a subset of interoperability. </p> </dd> <dt>implementation-defined features</dt> <dd> +<p>Language standards include lists of implementation-defined features whose behavior can vary from one implementation to another. Some of these features are normally covered by a platform’s ABI and others are not. The features that are not covered by an ABI generally affect how a program behaves, but not intercallability. </p> </dd> <dt>compatibility</dt> <dd><p>Conformance to the same ABI and the same behavior of implementation-defined features are both relevant for compatibility. </p></dd> </dl> <p>The application binary interface implemented by a C or C++ compiler affects code generation and runtime support for: </p> <ul class="itemize mark-bullet"> <li>size and alignment of data types </li> +<li>layout of structured types </li> +<li>calling conventions </li> +<li>register usage conventions </li> +<li>interfaces for runtime arithmetic support </li> +<li>object file formats </li> +</ul> <p>In addition, the application binary interface implemented by a C++ compiler affects code generation and runtime support for: </p> +<ul class="itemize mark-bullet"> <li>name mangling </li> +<li>exception handling </li> +<li>invoking constructors and destructors </li> +<li>layout, alignment, and padding of classes </li> +<li>layout and alignment of virtual tables </li> +</ul> <p>Some GCC compilation options cause the compiler to generate code that does not conform to the platform’s default ABI. Other options cause different program behavior for implementation-defined features that are not covered by an ABI. These options are provided for consistency with other compilers that do not follow the platform’s default ABI or the usual behavior of implementation-defined features for the platform. Be very careful about using such options. </p> <p>Most platforms have a well-defined ABI that covers C code, but ABIs that cover C++ functionality are not yet common. </p> <p>Starting with GCC 3.2, GCC binary conventions for C++ are based on a written, vendor-neutral C++ ABI that was designed to be specific to 64-bit Itanium but also includes generic specifications that apply to any platform. This C++ ABI is also implemented by other compiler vendors on some platforms, notably GNU/Linux and BSD systems. We have tried hard to provide a stable ABI that will be compatible with future GCC releases, but it is possible that we will encounter problems that make this difficult. Such problems could include different interpretations of the C++ ABI by different vendors, bugs in the ABI, or bugs in the implementation of the ABI in different compilers. GCC’s <samp class="option">-Wabi</samp> switch warns when G++ generates code that is probably not compatible with the C++ ABI. </p> <p>The C++ library used with a C++ compiler includes the Standard C++ Library, with functionality defined in the C++ Standard, plus language runtime support. The runtime support is included in a C++ ABI, but there is no formal ABI for the Standard C++ Library. Two implementations of that library are interoperable if one follows the de-facto ABI of the other and if they are both built with the same compiler, or with compilers that conform to the same ABI for C++ compiler and runtime support. </p> <p>When G++ and another C++ compiler conform to the same C++ ABI, but the implementations of the Standard C++ Library that they normally use do not follow the same ABI for the Standard C++ Library, object files built with those compilers can be used in the same program only if they use the same C++ library. This requires specifying the location of the C++ library header files when invoking the compiler whose usual library is not being used. The location of GCC’s C++ header files depends on how the GCC build was configured, but can be seen by using the G++ <samp class="option">-v</samp> option. With default configuration options for G++ 3.3 the compile line for a different C++ compiler needs to include </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-I<var class="var">gcc_install_directory</var>/include/c++/3.3</pre> +</div> <p>Similarly, compiling code with G++ that must use a C++ library other than the GNU C++ library requires specifying the location of the header files for that other library. </p> <p>The most straightforward way to link a program to use a particular C++ library is to use a C++ driver that specifies that C++ library by default. The <code class="command">g++</code> driver, for example, tells the linker where to find GCC’s C++ library (<samp class="file">libstdc++</samp>) plus the other libraries and startup files it needs, in the proper order. </p> <p>If a program must use a different C++ library and it’s not possible to do the final link using a C++ driver that uses that library by default, it is necessary to tell <code class="command">g++</code> the location and name of that library. It might also be necessary to specify different startup files and other runtime support libraries, and to suppress the use of GCC’s support libraries with one or more of the options <samp class="option">-nostdlib</samp>, <samp class="option">-nostartfiles</samp>, and <samp class="option">-nodefaultlibs</samp>. </p> </div> <div class="nav-panel"> <p> Next: <a href="gcov"><code class="command">gcov</code>—a Test Coverage Program</a>, Previous: <a href="objective-c">GNU Objective-C Features</a>, Up: <a href="index">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Compatibility.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Compatibility.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/compatibility_005falias.html b/devdocs/gcc~13/compatibility_005falias.html new file mode 100644 index 00000000..aebd3e04 --- /dev/null +++ b/devdocs/gcc~13/compatibility_005falias.html @@ -0,0 +1,11 @@ +<div class="section-level-extent" id="compatibility_005falias"> <div class="nav-panel"> <p> Next: <a href="exceptions" accesskey="n" rel="next">Exceptions</a>, Previous: <a href="constant-string-objects" accesskey="p" rel="prev">Constant String Objects</a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="compatibility_005falias-1"><span>8.6 compatibility_alias<a class="copiable-link" href="#compatibility_005falias-1"> ¶</a></span></h1> <p>The keyword <code class="code">@compatibility_alias</code> allows you to define a class name as equivalent to another class name. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">@compatibility_alias WOApplication GSWApplication;</pre> +</div> <p>tells the compiler that each time it encounters <code class="code">WOApplication</code> as a class name, it should replace it with <code class="code">GSWApplication</code> (that is, <code class="code">WOApplication</code> is just an alias for <code class="code">GSWApplication</code>). </p> <p>There are some constraints on how this can be used— </p> <ul class="itemize mark-bullet"> <li> +<code class="code">WOApplication</code> (the alias) must not be an existing class; </li> +<li> +<code class="code">GSWApplication</code> (the real class) must be an existing class. </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/compatibility_005falias.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/compatibility_005falias.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/complex.html b/devdocs/gcc~13/complex.html new file mode 100644 index 00000000..1f2e6b86 --- /dev/null +++ b/devdocs/gcc~13/complex.html @@ -0,0 +1,35 @@ +<div class="section-level-extent" id="Complex"> <div class="nav-panel"> <p> Next: <a href="floating-types" accesskey="n" rel="next">Additional Floating Types</a>, Previous: <a href="long-long" accesskey="p" rel="prev">Double-Word Integers</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Complex-Numbers"><span>6.11 Complex Numbers<a class="copiable-link" href="#Complex-Numbers"> ¶</a></span></h1> <p>ISO C99 supports complex floating data types, and as an extension GCC supports them in C90 mode and in C++. GCC also supports complex integer data types which are not part of ISO C99. You can declare complex types using the keyword <code class="code">_Complex</code>. As an extension, the older GNU keyword <code class="code">__complex__</code> is also supported. </p> <p>For example, ‘<samp class="samp">_Complex double x;</samp>’ declares <code class="code">x</code> as a variable whose real part and imaginary part are both of type <code class="code">double</code>. ‘<samp class="samp">_Complex short int y;</samp>’ declares <code class="code">y</code> to have real and imaginary parts of type <code class="code">short int</code>; this is not likely to be useful, but it shows that the set of complex types is complete. </p> <p>To write a constant with a complex data type, use the suffix ‘<samp class="samp">i</samp>’ or ‘<samp class="samp">j</samp>’ (either one; they are equivalent). For example, <code class="code">2.5fi</code> has type <code class="code">_Complex float</code> and <code class="code">3i</code> has type <code class="code">_Complex int</code>. Such a constant always has a pure imaginary value, but you can form any complex value you like by adding one to a real constant. This is a GNU extension; if you have an ISO C99 conforming C library (such as the GNU C Library), and want to construct complex constants of floating type, you should include <code class="code"><complex.h></code> and use the macros <code class="code">I</code> or <code class="code">_Complex_I</code> instead. </p> <p>The ISO C++14 library also defines the ‘<samp class="samp">i</samp>’ suffix, so C++14 code that includes the ‘<samp class="samp"><complex></samp>’ header cannot use ‘<samp class="samp">i</samp>’ for the GNU extension. The ‘<samp class="samp">j</samp>’ suffix still has the GNU meaning. </p> <p>GCC can handle both implicit and explicit casts between the <code class="code">_Complex</code> types and other <code class="code">_Complex</code> types as casting both the real and imaginary parts to the scalar type. GCC can handle implicit and explicit casts from a scalar type to a <code class="code">_Complex</code> type and where the imaginary part will be considered zero. The C front-end can handle implicit and explicit casts from a <code class="code">_Complex</code> type to a scalar type where the imaginary part will be ignored. In C++ code, this cast is considered illformed and G++ will error out. </p> <p>GCC provides a built-in function <code class="code">__builtin_complex</code> will can be used to construct a complex value. </p> <p>GCC has a few extensions which can be used to extract the real and the imaginary part of the complex-valued expression. Note these expressions are lvalues if the <var class="var">exp</var> is an lvalue. These expressions operands have the type of a complex type which might get prompoted to a complex type from a scalar type. E.g. <code class="code">__real__ (int)<var class="var">x</var></code> is the same as casting to <code class="code">_Complex int</code> before <code class="code">__real__</code> is done. </p> <table class="multitable"> <thead><tr> +<th width="40%">Expression</th> +<th width="60%">Description</th> +</tr></thead> <tbody> +<tr> +<td width="40%"><code class="code">__real__ <var class="var">exp</var></code></td> +<td width="60%">Extract the real part of <var class="var">exp</var>.</td> +</tr> <tr> +<td width="40%"><code class="code">__imag__ <var class="var">exp</var></code></td> +<td width="60%">Extract the imaginary part of <var class="var">exp</var>.</td> +</tr> </tbody> </table> <p>For values of floating point, you should use the ISO C99 functions, declared in <code class="code"><complex.h></code> and also provided as built-in functions by GCC. </p> <table class="multitable"> <thead><tr> +<th width="40%">Expression</th> +<th width="20%">float</th> +<th width="20%">double</th> +<th width="20%">long double</th> +</tr></thead> <tbody> +<tr> +<td width="40%"><code class="code">__real__ <var class="var">exp</var></code></td> +<td width="20%"><code class="code">crealf</code></td> +<td width="20%"><code class="code">creal</code></td> +<td width="20%"><code class="code">creall</code></td> +</tr> <tr> +<td width="40%"><code class="code">__imag__ <var class="var">exp</var></code></td> +<td width="20%"><code class="code">cimagf</code></td> +<td width="20%"><code class="code">cimag</code></td> +<td width="20%"><code class="code">cimagl</code></td> +</tr> </tbody> </table> <p>The operator ‘<samp class="samp">~</samp>’ performs complex conjugation when used on a value with a complex type. This is a GNU extension; for values of floating type, you should use the ISO C99 functions <code class="code">conjf</code>, <code class="code">conj</code> and <code class="code">conjl</code>, declared in <code class="code"><complex.h></code> and also provided as built-in functions by GCC. Note unlike the <code class="code">__real__</code> and <code class="code">__imag__</code> operators, this operator will not do an implicit cast to the complex type because the ‘<samp class="samp">~</samp>’ is already a normal operator. </p> <p>GCC can allocate complex automatic variables in a noncontiguous fashion; it’s even possible for the real part to be in a register while the imaginary part is on the stack (or vice versa). Only the DWARF debug info format can represent this, so use of DWARF is recommended. If you are using the stabs debug info format, GCC describes a noncontiguous complex variable as if it were two separate variables of noncomplex type. If the variable’s actual name is <code class="code">foo</code>, the two fictitious variables are named <code class="code">foo$real</code> and <code class="code">foo$imag</code>. You can examine and set these two fictitious variables with your debugger. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcomplex"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__builtin_complex</strong> <code class="def-code-arguments">(<var class="var">real</var>, <var class="var">imag</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcomplex"> ¶</a></span> +</dt> <dd> <p>The built-in function <code class="code">__builtin_complex</code> is provided for use in implementing the ISO C11 macros <code class="code">CMPLXF</code>, <code class="code">CMPLX</code> and <code class="code">CMPLXL</code>. <var class="var">real</var> and <var class="var">imag</var> must have the same type, a real binary floating-point type, and the result has the corresponding complex type with real and imaginary parts <var class="var">real</var> and <var class="var">imag</var>. Unlike ‘<samp class="samp"><var class="var">real</var> + I * <var class="var">imag</var></samp>’, this works even when infinities, NaNs and negative zeros are involved. </p> </dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="floating-types">Additional Floating Types</a>, Previous: <a href="long-long">Double-Word Integers</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Complex.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Complex.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/compound-literals.html b/devdocs/gcc~13/compound-literals.html new file mode 100644 index 00000000..e351ee45 --- /dev/null +++ b/devdocs/gcc~13/compound-literals.html @@ -0,0 +1,21 @@ +<div class="section-level-extent" id="Compound-Literals"> <div class="nav-panel"> <p> Next: <a href="designated-inits" accesskey="n" rel="next">Designated Initializers</a>, Previous: <a href="initializers" accesskey="p" rel="prev">Non-Constant Initializers</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Compound-Literals-1"><span>6.28 Compound Literals<a class="copiable-link" href="#Compound-Literals-1"> ¶</a></span></h1> <p>A compound literal looks like a cast of a brace-enclosed aggregate initializer list. Its value is an object of the type specified in the cast, containing the elements specified in the initializer. Unlike the result of a cast, a compound literal is an lvalue. ISO C99 and later support compound literals. As an extension, GCC supports compound literals also in C90 mode and in C++, although as explained below, the C++ semantics are somewhat different. </p> <p>Usually, the specified type of a compound literal is a structure. Assume that <code class="code">struct foo</code> and <code class="code">structure</code> are declared as shown: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct foo {int a; char b[2];} structure;</pre> +</div> <p>Here is an example of constructing a <code class="code">struct foo</code> with a compound literal: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">structure = ((struct foo) {x + y, 'a', 0});</pre> +</div> <p>This is equivalent to writing the following: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + struct foo temp = {x + y, 'a', 0}; + structure = temp; +}</pre> +</div> <p>You can also construct an array, though this is dangerous in C++, as explained below. If all the elements of the compound literal are (made up of) simple constant expressions suitable for use in initializers of objects of static storage duration, then the compound literal can be coerced to a pointer to its first element and used in such an initializer, as shown here: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">char **foo = (char *[]) { "x", "y", "z" };</pre> +</div> <p>Compound literals for scalar types and union types are also allowed. In the following example the variable <code class="code">i</code> is initialized to the value <code class="code">2</code>, the result of incrementing the unnamed object created by the compound literal. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int i = ++(int) { 1 };</pre> +</div> <p>As a GNU extension, GCC allows initialization of objects with static storage duration by compound literals (which is not possible in ISO C99 because the initializer is not a constant). It is handled as if the object were initialized only with the brace-enclosed list if the types of the compound literal and the object match. The elements of the compound literal must be constant. If the object being initialized has array type of unknown size, the size is determined by the size of the compound literal. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static struct foo x = (struct foo) {1, 'a', 'b'}; +static int y[] = (int []) {1, 2, 3}; +static int z[] = (int [3]) {1};</pre> +</div> <p>The above lines are equivalent to the following: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static struct foo x = {1, 'a', 'b'}; +static int y[] = {1, 2, 3}; +static int z[] = {1, 0, 0};</pre> +</div> <p>In C, a compound literal designates an unnamed object with static or automatic storage duration. In C++, a compound literal designates a temporary object that only lives until the end of its full-expression. As a result, well-defined C code that takes the address of a subobject of a compound literal can be undefined in C++, so G++ rejects the conversion of a temporary array to a pointer. For instance, if the array compound literal example above appeared inside a function, any subsequent use of <code class="code">foo</code> in C++ would have undefined behavior because the lifetime of the array ends after the declaration of <code class="code">foo</code>. </p> <p>As an optimization, G++ sometimes gives array compound literals longer lifetimes: when the array either appears outside a function or has a <code class="code">const</code>-qualified type. If <code class="code">foo</code> and its initializer had elements of type <code class="code">char *const</code> rather than <code class="code">char *</code>, or if <code class="code">foo</code> were a global variable, the array would have static storage duration. But it is probably safest just to avoid the use of array compound literals in C++ code. </p> </div> <div class="nav-panel"> <p> Next: <a href="designated-inits">Designated Initializers</a>, Previous: <a href="initializers">Non-Constant Initializers</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Compound-Literals.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Compound-Literals.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/conditionally-supported-behavior.html b/devdocs/gcc~13/conditionally-supported-behavior.html new file mode 100644 index 00000000..9bc066c7 --- /dev/null +++ b/devdocs/gcc~13/conditionally-supported-behavior.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Conditionally-supported-behavior"> <div class="nav-panel"> <p> Next: <a href="exception-handling" accesskey="n" rel="next">Exception Handling</a>, Up: <a href="c_002b_002b-implementation" accesskey="u" rel="up">C++ Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Conditionally-Supported-Behavior"><span>5.1 Conditionally-Supported Behavior<a class="copiable-link" href="#Conditionally-Supported-Behavior"> ¶</a></span></h1> <p>Each implementation shall include documentation that identifies all conditionally-supported constructs that it does not support (C++0x 1.4). </p> <ul class="itemize mark-bullet"> <li>Whether an argument of class type with a non-trivial copy constructor or destructor can be passed to ... (C++0x 5.2.2). <p>Such argument passing is supported, using the same pass-by-invisible-reference approach used for normal function arguments of such types. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Conditionally-supported-behavior.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Conditionally-supported-behavior.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/conditionals.html b/devdocs/gcc~13/conditionals.html new file mode 100644 index 00000000..9dd49a0d --- /dev/null +++ b/devdocs/gcc~13/conditionals.html @@ -0,0 +1,8 @@ +<div class="section-level-extent" id="Conditionals"> <div class="nav-panel"> <p> Next: <a href="_005f_005fint128" accesskey="n" rel="next">128-bit Integers</a>, Previous: <a href="typeof" accesskey="p" rel="prev">Referring to a Type with <code class="code">typeof</code></a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Conditionals-with-Omitted-Operands"><span>6.8 Conditionals with Omitted Operands<a class="copiable-link" href="#Conditionals-with-Omitted-Operands"> ¶</a></span></h1> <p>The middle operand in a conditional expression may be omitted. Then if the first operand is nonzero, its value is the value of the conditional expression. </p> <p>Therefore, the expression </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">x ? : y</pre> +</div> <p>has the value of <code class="code">x</code> if that is nonzero; otherwise, the value of <code class="code">y</code>. </p> <p>This example is perfectly equivalent to </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">x ? x : y</pre> +</div> <p>In this simple case, the ability to omit the middle operand is not especially useful. When it becomes useful is when the first operand does, or may (if it is a macro argument), contain a side effect. Then repeating the operand in the middle would perform the side effect twice. Omitting the middle operand uses the value already computed without the undesirable effects of recomputing it. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Conditionals.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Conditionals.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/constant-string-objects.html b/devdocs/gcc~13/constant-string-objects.html new file mode 100644 index 00000000..afed19e8 --- /dev/null +++ b/devdocs/gcc~13/constant-string-objects.html @@ -0,0 +1,14 @@ +<div class="section-level-extent" id="Constant-string-objects"> <div class="nav-panel"> <p> Next: <a href="compatibility_005falias" accesskey="n" rel="next"><code class="code">compatibility_alias</code></a>, Previous: <a href="garbage-collection" accesskey="p" rel="prev">Garbage Collection</a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Constant-String-Objects"><span>8.5 Constant String Objects<a class="copiable-link" href="#Constant-String-Objects"> ¶</a></span></h1> <p>GNU Objective-C provides constant string objects that are generated directly by the compiler. You declare a constant string object by prefixing a C constant string with the character ‘<samp class="samp">@</samp>’: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">id myString = @"this is a constant string object";</pre> +</div> <p>The constant string objects are by default instances of the <code class="code">NXConstantString</code> class which is provided by the GNU Objective-C runtime. To get the definition of this class you must include the <samp class="file">objc/NXConstStr.h</samp> header file. </p> <p>User defined libraries may want to implement their own constant string class. To be able to support them, the GNU Objective-C compiler provides a new command line options <samp class="option">-fconstant-string-class=<var class="var">class-name</var></samp>. The provided class should adhere to a strict structure, the same as <code class="code">NXConstantString</code>’s structure: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">@interface MyConstantStringClass +{ + Class isa; + char *c_string; + unsigned int len; +} +@end</pre> +</div> <p><code class="code">NXConstantString</code> inherits from <code class="code">Object</code>; user class libraries may choose to inherit the customized constant string class from a different class than <code class="code">Object</code>. There is no requirement in the methods the constant string class has to implement, but the final ivar layout of the class must be the compatible with the given structure. </p> <p>When the compiler creates the statically allocated constant string object, the <code class="code">c_string</code> field will be filled by the compiler with the string; the <code class="code">length</code> field will be filled by the compiler with the string length; the <code class="code">isa</code> pointer will be filled with <code class="code">NULL</code> by the compiler, and it will later be fixed up automatically at runtime by the GNU Objective-C runtime library to point to the class which was set by the <samp class="option">-fconstant-string-class</samp> option when the object file is loaded (if you wonder how it works behind the scenes, the name of the class to use, and the list of static objects to fixup, are stored by the compiler in the object file in a place where the GNU runtime library will find them at runtime). </p> <p>As a result, when a file is compiled with the <samp class="option">-fconstant-string-class</samp> option, all the constant string objects will be instances of the class specified as argument to this option. It is possible to have multiple compilation units referring to different constant string classes, neither the compiler nor the linker impose any restrictions in doing this. </p> </div> <div class="nav-panel"> <p> Next: <a href="compatibility_005falias"><code class="code">compatibility_alias</code></a>, Previous: <a href="garbage-collection">Garbage Collection</a>, Up: <a href="objective-c">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Constant-string-objects.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Constant-string-objects.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/constraints.html b/devdocs/gcc~13/constraints.html new file mode 100644 index 00000000..2a6256cf --- /dev/null +++ b/devdocs/gcc~13/constraints.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="Constraints"> <div class="nav-panel"> <p> Next: <a href="asm-labels" accesskey="n" rel="next">Controlling Names Used in Assembler Code</a>, Previous: <a href="extended-asm" accesskey="p" rel="prev">Extended Asm - Assembler Instructions with C Expression Operands</a>, Up: <a href="using-assembly-language-with-c" accesskey="u" rel="up">How to Use Inline Assembly Language in C Code</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection section-level-set-subsection" id="Constraints-for-asm-Operands"><span>6.47.3 Constraints for asm Operands<a class="copiable-link" href="#Constraints-for-asm-Operands"> ¶</a></span></h1> <p>Here are specific details on what constraint letters you can use with <code class="code">asm</code> operands. Constraints can say whether an operand may be in a register, and which kinds of register; whether the operand can be a memory reference, and which kinds of address; whether the operand may be an immediate constant, and which possible values it may have. Constraints can also require two operands to match. Side-effects aren’t allowed in operands of inline <code class="code">asm</code>, unless ‘<samp class="samp"><</samp>’ or ‘<samp class="samp">></samp>’ constraints are used, because there is no guarantee that the side effects will happen exactly once in an instruction that can update the addressing register. </p> <ul class="mini-toc"> <li><a href="simple-constraints" accesskey="1">Simple Constraints</a></li> <li><a href="multi-alternative" accesskey="2">Multiple Alternative Constraints</a></li> <li><a href="modifiers" accesskey="3">Constraint Modifier Characters</a></li> <li><a href="machine-constraints" accesskey="4">Constraints for Particular Machines</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Constraints.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Constraints.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/constructing-calls.html b/devdocs/gcc~13/constructing-calls.html new file mode 100644 index 00000000..9cf68bec --- /dev/null +++ b/devdocs/gcc~13/constructing-calls.html @@ -0,0 +1,64 @@ +<div class="section-level-extent" id="Constructing-Calls"> <div class="nav-panel"> <p> Next: <a href="typeof" accesskey="n" rel="next">Referring to a Type with <code class="code">typeof</code></a>, Previous: <a href="nonlocal-gotos" accesskey="p" rel="prev">Nonlocal Gotos</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Constructing-Function-Calls"><span>6.6 Constructing Function Calls<a class="copiable-link" href="#Constructing-Function-Calls"> ¶</a></span></h1> <p>Using the built-in functions described below, you can record the arguments a function received, and call another function with the same arguments, without knowing the number or types of the arguments. </p> <p>You can also record the return value of that function call, and later return that value, without knowing what data type the function tried to return (as long as your caller expects that data type). </p> <p>However, these built-in functions may interact badly with some sophisticated features or other extensions of the language. It is, therefore, not recommended to use them outside very simple functions acting as mere forwarders for their arguments. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fapply_005fargs"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_apply_args</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fapply_005fargs"> ¶</a></span> +</dt> <dd> +<p>This built-in function returns a pointer to data describing how to perform a call with the same arguments as are passed to the current function. </p> <p>The function saves the arg pointer register, structure value address, and all registers that might be used to pass arguments to a function into a block of memory allocated on the stack. Then it returns the address of that block. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fapply"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_apply</strong> <code class="def-code-arguments">(void (*<var class="var">function</var>)(), void *<var class="var">arguments</var>, size_t <var class="var">size</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fapply"> ¶</a></span> +</dt> <dd> +<p>This built-in function invokes <var class="var">function</var> with a copy of the parameters described by <var class="var">arguments</var> and <var class="var">size</var>. </p> <p>The value of <var class="var">arguments</var> should be the value returned by <code class="code">__builtin_apply_args</code>. The argument <var class="var">size</var> specifies the size of the stack argument data, in bytes. </p> <p>This function returns a pointer to data describing how to return whatever value is returned by <var class="var">function</var>. The data is saved in a block of memory allocated on the stack. </p> <p>It is not always simple to compute the proper value for <var class="var">size</var>. The value is used by <code class="code">__builtin_apply</code> to compute the amount of data that should be pushed on the stack and copied from the incoming argument area. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005freturn"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_return</strong> <code class="def-code-arguments">(void *<var class="var">result</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005freturn"> ¶</a></span> +</dt> <dd><p>This built-in function returns the value described by <var class="var">result</var> from the containing function. You should specify, for <var class="var">result</var>, a value returned by <code class="code">__builtin_apply</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fva_005farg_005fpack"> +<span class="category-def">Built-in Function: </span><span><strong class="def-name">__builtin_va_arg_pack</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fva_005farg_005fpack"> ¶</a></span> +</dt> <dd> +<p>This built-in function represents all anonymous arguments of an inline function. It can be used only in inline functions that are always inlined, never compiled as a separate function, such as those using <code class="code">__attribute__ ((__always_inline__))</code> or <code class="code">__attribute__ ((__gnu_inline__))</code> extern inline functions. It must be only passed as last argument to some other function with variable arguments. This is useful for writing small wrapper inlines for variable argument functions, when using preprocessor macros is undesirable. For example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern int myprintf (FILE *f, const char *format, ...); +extern inline __attribute__ ((__gnu_inline__)) int +myprintf (FILE *f, const char *format, ...) +{ + int r = fprintf (f, "myprintf: "); + if (r < 0) + return r; + int s = fprintf (f, format, __builtin_va_arg_pack ()); + if (s < 0) + return s; + return r + s; +}</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fva_005farg_005fpack_005flen"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_va_arg_pack_len</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fva_005farg_005fpack_005flen"> ¶</a></span> +</dt> <dd> +<p>This built-in function returns the number of anonymous arguments of an inline function. It can be used only in inline functions that are always inlined, never compiled as a separate function, such as those using <code class="code">__attribute__ ((__always_inline__))</code> or <code class="code">__attribute__ ((__gnu_inline__))</code> extern inline functions. For example following does link- or run-time checking of open arguments for optimized code: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#ifdef __OPTIMIZE__ +extern inline __attribute__((__gnu_inline__)) int +myopen (const char *path, int oflag, ...) +{ + if (__builtin_va_arg_pack_len () > 1) + warn_open_too_many_arguments (); + + if (__builtin_constant_p (oflag)) + { + if ((oflag & O_CREAT) != 0 && __builtin_va_arg_pack_len () < 1) + { + warn_open_missing_mode (); + return __open_2 (path, oflag); + } + return open (path, oflag, __builtin_va_arg_pack ()); + } + + if (__builtin_va_arg_pack_len () < 1) + return __open_2 (path, oflag); + + return open (path, oflag, __builtin_va_arg_pack ()); +} +#endif</pre> +</div> </dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="typeof">Referring to a Type with <code class="code">typeof</code></a>, Previous: <a href="nonlocal-gotos">Nonlocal Gotos</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Constructing-Calls.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Constructing-Calls.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/copy-assignment.html b/devdocs/gcc~13/copy-assignment.html new file mode 100644 index 00000000..540d6119 --- /dev/null +++ b/devdocs/gcc~13/copy-assignment.html @@ -0,0 +1,34 @@ +<div class="subsection-level-extent" id="Copy-Assignment"> <div class="nav-panel"> <p> Previous: <a href="temporaries" accesskey="p" rel="prev">Temporaries May Vanish Before You Expect</a>, Up: <a href="c_002b_002b-misunderstandings" accesskey="u" rel="up">Common Misunderstandings with GNU C++</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Implicit-Copy-Assignment-for-Virtual-Bases"><span>14.7.4 Implicit Copy-Assignment for Virtual Bases<a class="copiable-link" href="#Implicit-Copy-Assignment-for-Virtual-Bases"> ¶</a></span></h1> <p>When a base class is virtual, only one subobject of the base class belongs to each full object. Also, the constructors and destructors are invoked only once, and called from the most-derived class. However, such objects behave unspecified when being assigned. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct Base{ + char *name; + Base(const char *n) : name(strdup(n)){} + Base& operator= (const Base& other){ + free (name); + name = strdup (other.name); + return *this; + } +}; + +struct A:virtual Base{ + int val; + A():Base("A"){} +}; + +struct B:virtual Base{ + int bval; + B():Base("B"){} +}; + +struct Derived:public A, public B{ + Derived():Base("Derived"){} +}; + +void func(Derived &d1, Derived &d2) +{ + d1 = d2; +}</pre> +</div> <p>The C++ standard specifies that ‘<samp class="samp">Base::Base</samp>’ is only called once when constructing or copy-constructing a Derived object. It is unspecified whether ‘<samp class="samp">Base::operator=</samp>’ is called more than once when the implicit copy-assignment for Derived objects is invoked (as it is inside ‘<samp class="samp">func</samp>’ in the example). </p> <p>G++ implements the “intuitive” algorithm for copy-assignment: assign all direct bases, then assign all members. In that algorithm, the virtual base subobject can be encountered more than once. In the example, copying proceeds in the following order: ‘<samp class="samp">name</samp>’ (via <code class="code">strdup</code>), ‘<samp class="samp">val</samp>’, ‘<samp class="samp">name</samp>’ again, and ‘<samp class="samp">bval</samp>’. </p> <p>If application code relies on copy-assignment, a user-defined copy-assignment operator removes any uncertainties. With such an operator, the application can define whether and how the virtual base subobject is assigned. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Copy-Assignment.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Copy-Assignment.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/cris-options.html b/devdocs/gcc~13/cris-options.html new file mode 100644 index 00000000..53ece3b2 --- /dev/null +++ b/devdocs/gcc~13/cris-options.html @@ -0,0 +1,47 @@ +<div class="subsection-level-extent" id="CRIS-Options"> <div class="nav-panel"> <p> Next: <a href="c-sky-options" accesskey="n" rel="next">C-SKY Options</a>, Previous: <a href="c6x-options" accesskey="p" rel="prev">C6X Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="CRIS-Options-1"><span>3.19.9 CRIS Options<a class="copiable-link" href="#CRIS-Options-1"> ¶</a></span></h1> <p>These options are defined specifically for the CRIS ports. </p> <dl class="table"> <dt> + <span><code class="code">-march=<var class="var">architecture-type</var></code><a class="copiable-link" href="#index-march-4"> ¶</a></span> +</dt> <dt><code class="code">-mcpu=<var class="var">architecture-type</var></code></dt> <dd> +<p>Generate code for the specified architecture. The choices for <var class="var">architecture-type</var> are ‘<samp class="samp">v3</samp>’, ‘<samp class="samp">v8</samp>’ and ‘<samp class="samp">v10</samp>’ for respectively ETRAX 4, ETRAX 100, and ETRAX 100 LX. Default is ‘<samp class="samp">v0</samp>’. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">architecture-type</var></code><a class="copiable-link" href="#index-mtune-5"> ¶</a></span> +</dt> <dd> +<p>Tune to <var class="var">architecture-type</var> everything applicable about the generated code, except for the ABI and the set of available instructions. The choices for <var class="var">architecture-type</var> are the same as for <samp class="option">-march=<var class="var">architecture-type</var></samp>. </p> </dd> <dt> +<span><code class="code">-mmax-stack-frame=<var class="var">n</var></code><a class="copiable-link" href="#index-mmax-stack-frame"> ¶</a></span> +</dt> <dd> +<p>Warn when the stack frame of a function exceeds <var class="var">n</var> bytes. </p> </dd> <dt> + <span><code class="code">-metrax4</code><a class="copiable-link" href="#index-metrax4"> ¶</a></span> +</dt> <dt><code class="code">-metrax100</code></dt> <dd> +<p>The options <samp class="option">-metrax4</samp> and <samp class="option">-metrax100</samp> are synonyms for <samp class="option">-march=v3</samp> and <samp class="option">-march=v8</samp> respectively. </p> </dd> <dt> + <span><code class="code">-mmul-bug-workaround</code><a class="copiable-link" href="#index-mmul-bug-workaround"> ¶</a></span> +</dt> <dt><code class="code">-mno-mul-bug-workaround</code></dt> <dd> +<p>Work around a bug in the <code class="code">muls</code> and <code class="code">mulu</code> instructions for CPU models where it applies. This option is disabled by default. </p> </dd> <dt> +<span><code class="code">-mpdebug</code><a class="copiable-link" href="#index-mpdebug"> ¶</a></span> +</dt> <dd> +<p>Enable CRIS-specific verbose debug-related information in the assembly code. This option also has the effect of turning off the ‘<samp class="samp">#NO_APP</samp>’ formatted-code indicator to the assembler at the beginning of the assembly file. </p> </dd> <dt> +<span><code class="code">-mcc-init</code><a class="copiable-link" href="#index-mcc-init"> ¶</a></span> +</dt> <dd> +<p>Do not use condition-code results from previous instruction; always emit compare and test instructions before use of condition codes. </p> </dd> <dt> + <span><code class="code">-mno-side-effects</code><a class="copiable-link" href="#index-mno-side-effects"> ¶</a></span> +</dt> <dd> +<p>Do not emit instructions with side effects in addressing modes other than post-increment. </p> </dd> <dt> + <span><code class="code">-mstack-align</code><a class="copiable-link" href="#index-mstack-align"> ¶</a></span> +</dt> <dt><code class="code">-mno-stack-align</code></dt> <dt><code class="code">-mdata-align</code></dt> <dt><code class="code">-mno-data-align</code></dt> <dt><code class="code">-mconst-align</code></dt> <dt><code class="code">-mno-const-align</code></dt> <dd> +<p>These options (‘<samp class="samp">no-</samp>’ options) arrange (eliminate arrangements) for the stack frame, individual data and constants to be aligned for the maximum single data access size for the chosen CPU model. The default is to arrange for 32-bit alignment. ABI details such as structure layout are not affected by these options. </p> </dd> <dt> + <span><code class="code">-m32-bit</code><a class="copiable-link" href="#index-m32-bit"> ¶</a></span> +</dt> <dt><code class="code">-m16-bit</code></dt> <dt><code class="code">-m8-bit</code></dt> <dd> +<p>Similar to the stack- data- and const-align options above, these options arrange for stack frame, writable data and constants to all be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit alignment. </p> </dd> <dt> + <span><code class="code">-mno-prologue-epilogue</code><a class="copiable-link" href="#index-mno-prologue-epilogue"> ¶</a></span> +</dt> <dt><code class="code">-mprologue-epilogue</code></dt> <dd> +<p>With <samp class="option">-mno-prologue-epilogue</samp>, the normal function prologue and epilogue which set up the stack frame are omitted and no return instructions or return sequences are generated in the code. Use this option only together with visual inspection of the compiled code: no warnings or errors are generated when call-saved registers must be saved, or storage for local variables needs to be allocated. </p> </dd> <dt> +<span><code class="code">-melf</code><a class="copiable-link" href="#index-melf"> ¶</a></span> +</dt> <dd> +<p>Legacy no-op option. </p> </dd> <dt> +<span><code class="code">-sim</code><a class="copiable-link" href="#index-sim"> ¶</a></span> +</dt> <dd> +<p>This option arranges to link with input-output functions from a simulator library. Code, initialized data and zero-initialized data are allocated consecutively. </p> </dd> <dt> +<span><code class="code">-sim2</code><a class="copiable-link" href="#index-sim2"> ¶</a></span> +</dt> <dd><p>Like <samp class="option">-sim</samp>, but pass linker options to locate initialized data at 0x40000000 and zero-initialized data at 0x80000000. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="c-sky-options">C-SKY Options</a>, Previous: <a href="c6x-options">C6X Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/CRIS-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/CRIS-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/cross-profiling.html b/devdocs/gcc~13/cross-profiling.html new file mode 100644 index 00000000..65b432f6 --- /dev/null +++ b/devdocs/gcc~13/cross-profiling.html @@ -0,0 +1,9 @@ +<div class="section-level-extent" id="Cross-profiling"> <div class="nav-panel"> <p> Next: <a href="freestanding-environments" accesskey="n" rel="next">Profiling and Test Coverage in Freestanding Environments</a>, Previous: <a href="gcov-data-files" accesskey="p" rel="prev">Brief Description of <code class="command">gcov</code> Data Files</a>, Up: <a href="gcov" accesskey="u" rel="up"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Data-File-Relocation-to-Support-Cross-Profiling"><span>10.5 Data File Relocation to Support Cross-Profiling<a class="copiable-link" href="#Data-File-Relocation-to-Support-Cross-Profiling"> ¶</a></span></h1> <p>Running the program will cause profile output to be generated. For each source file compiled with <samp class="option">-fprofile-arcs</samp>, an accompanying <samp class="file">.gcda</samp> file will be placed in the object file directory. That implicitly requires running the program on the same system as it was built or having the same absolute directory structure on the target system. The program will try to create the needed directory structure, if it is not already present. </p> <p>To support cross-profiling, a program compiled with <samp class="option">-fprofile-arcs</samp> can relocate the data files based on two environment variables: </p> <ul class="itemize mark-bullet"> <li>GCOV_PREFIX contains the prefix to add to the absolute paths in the object file. Prefix can be absolute, or relative. The default is no prefix. </li> +<li>GCOV_PREFIX_STRIP indicates the how many initial directory names to strip off the hardwired absolute paths. Default value is 0. <p><em class="emph">Note:</em> If GCOV_PREFIX_STRIP is set without GCOV_PREFIX is undefined, then a relative path is made out of the hardwired absolute paths. </p> +</li> +</ul> <p>For example, if the object file <samp class="file">/user/build/foo.o</samp> was built with <samp class="option">-fprofile-arcs</samp>, the final executable will try to create the data file <samp class="file">/user/build/foo.gcda</samp> when running on the target system. This will fail if the corresponding directory does not exist and it is unable to create it. This can be overcome by, for example, setting the environment as ‘<samp class="samp">GCOV_PREFIX=/target/run</samp>’ and ‘<samp class="samp">GCOV_PREFIX_STRIP=1</samp>’. Such a setting will name the data file <samp class="file">/target/run/build/foo.gcda</samp>. </p> <p>You must move the data files to the expected directory tree in order to use them for profile directed optimizations (<samp class="option">-fprofile-use</samp>), or to use the <code class="command">gcov</code> tool. </p> </div> <div class="nav-panel"> <p> Next: <a href="freestanding-environments">Profiling and Test Coverage in Freestanding Environments</a>, Previous: <a href="gcov-data-files">Brief Description of <code class="command">gcov</code> Data Files</a>, Up: <a href="gcov"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Cross-profiling.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Cross-profiling.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/darwin-format-checks.html b/devdocs/gcc~13/darwin-format-checks.html new file mode 100644 index 00000000..29cabff4 --- /dev/null +++ b/devdocs/gcc~13/darwin-format-checks.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="Darwin-Format-Checks"> <div class="nav-panel"> <p> Previous: <a href="solaris-format-checks" accesskey="p" rel="prev">Solaris Format Checks</a>, Up: <a href="target-format-checks" accesskey="u" rel="up">Format Checks Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Darwin-Format-Checks-1"><span>6.61.2 Darwin Format Checks<a class="copiable-link" href="#Darwin-Format-Checks-1"> ¶</a></span></h1> <p>In addition to the full set of format archetypes (attribute format style arguments such as <code class="code">printf</code>, <code class="code">scanf</code>, <code class="code">strftime</code>, and <code class="code">strfmon</code>), Darwin targets also support the <code class="code">CFString</code> (or <code class="code">__CFString__</code>) archetype in the <code class="code">format</code> attribute. Declarations with this archetype are parsed for correct syntax and argument types. However, parsing of the format string itself and validating arguments against it in calls to such functions is currently not performed. </p> <p>Additionally, <code class="code">CFStringRefs</code> (defined by the <code class="code">CoreFoundation</code> headers) may also be used as format arguments. Note that the relevant headers are only likely to be available on Darwin (OSX) installations. On such installations, the XCode and system documentation provide descriptions of <code class="code">CFString</code>, <code class="code">CFStringRefs</code> and associated functions. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Darwin-Format-Checks.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Darwin-Format-Checks.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/darwin-options.html b/devdocs/gcc~13/darwin-options.html new file mode 100644 index 00000000..a2a633dc --- /dev/null +++ b/devdocs/gcc~13/darwin-options.html @@ -0,0 +1,51 @@ +<div class="subsection-level-extent" id="Darwin-Options"> <div class="nav-panel"> <p> Next: <a href="dec-alpha-options" accesskey="n" rel="next">DEC Alpha Options</a>, Previous: <a href="c-sky-options" accesskey="p" rel="prev">C-SKY Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Darwin-Options-1"><span>3.19.11 Darwin Options<a class="copiable-link" href="#Darwin-Options-1"> ¶</a></span></h1> <p>These options are defined for all architectures running the Darwin operating system. </p> <p>FSF GCC on Darwin does not create “fat” object files; it creates an object file for the single architecture that GCC was built to target. Apple’s GCC on Darwin does create “fat” files if multiple <samp class="option">-arch</samp> options are used; it does so by running the compiler or linker multiple times and joining the results together with <samp class="file">lipo</samp>. </p> <p>The subtype of the file created (like ‘<samp class="samp">ppc7400</samp>’ or ‘<samp class="samp">ppc970</samp>’ or ‘<samp class="samp">i686</samp>’) is determined by the flags that specify the ISA that GCC is targeting, like <samp class="option">-mcpu</samp> or <samp class="option">-march</samp>. The <samp class="option">-force_cpusubtype_ALL</samp> option can be used to override this. </p> <p>The Darwin tools vary in their behavior when presented with an ISA mismatch. The assembler, <samp class="file">as</samp>, only permits instructions to be used that are valid for the subtype of the file it is generating, so you cannot put 64-bit instructions in a ‘<samp class="samp">ppc750</samp>’ object file. The linker for shared libraries, <samp class="file">/usr/bin/libtool</samp>, fails and prints an error if asked to create a shared library with a less restrictive subtype than its input files (for instance, trying to put a ‘<samp class="samp">ppc970</samp>’ object file in a ‘<samp class="samp">ppc7400</samp>’ library). The linker for executables, <code class="command">ld</code>, quietly gives the executable the most restrictive subtype of any of its input files. </p> <dl class="table"> <dt> +<span><code class="code">-F<var class="var">dir</var></code><a class="copiable-link" href="#index-F"> ¶</a></span> +</dt> <dd> +<p>Add the framework directory <var class="var">dir</var> to the head of the list of directories to be searched for header files. These directories are interleaved with those specified by <samp class="option">-I</samp> options and are scanned in a left-to-right order. </p> <p>A framework directory is a directory with frameworks in it. A framework is a directory with a <samp class="file">Headers</samp> and/or <samp class="file">PrivateHeaders</samp> directory contained directly in it that ends in <samp class="file">.framework</samp>. The name of a framework is the name of this directory excluding the <samp class="file">.framework</samp>. Headers associated with the framework are found in one of those two directories, with <samp class="file">Headers</samp> being searched first. A subframework is a framework directory that is in a framework’s <samp class="file">Frameworks</samp> directory. Includes of subframework headers can only appear in a header of a framework that contains the subframework, or in a sibling subframework header. Two subframeworks are siblings if they occur in the same framework. A subframework should not have the same name as a framework; a warning is issued if this is violated. Currently a subframework cannot have subframeworks; in the future, the mechanism may be extended to support this. The standard frameworks can be found in <samp class="file">/System/Library/Frameworks</samp> and <samp class="file">/Library/Frameworks</samp>. An example include looks like <code class="code">#include <Framework/header.h></code>, where <samp class="file">Framework</samp> denotes the name of the framework and <samp class="file">header.h</samp> is found in the <samp class="file">PrivateHeaders</samp> or <samp class="file">Headers</samp> directory. </p> </dd> <dt> +<span><code class="code">-iframework<var class="var">dir</var></code><a class="copiable-link" href="#index-iframework"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-F</samp> except the directory is a treated as a system directory. The main difference between this <samp class="option">-iframework</samp> and <samp class="option">-F</samp> is that with <samp class="option">-iframework</samp> the compiler does not warn about constructs contained within header files found via <var class="var">dir</var>. This option is valid only for the C family of languages. </p> </dd> <dt> +<span><code class="code">-gused</code><a class="copiable-link" href="#index-gused"> ¶</a></span> +</dt> <dd> +<p>Emit debugging information for symbols that are used. For stabs debugging format, this enables <samp class="option">-feliminate-unused-debug-symbols</samp>. This is by default ON. </p> </dd> <dt> +<span><code class="code">-gfull</code><a class="copiable-link" href="#index-gfull"> ¶</a></span> +</dt> <dd> +<p>Emit debugging information for all symbols and types. </p> </dd> <dt><code class="code">-mmacosx-version-min=<var class="var">version</var></code></dt> <dd> +<p>The earliest version of MacOS X that this executable will run on is <var class="var">version</var>. Typical values of <var class="var">version</var> include <code class="code">10.1</code>, <code class="code">10.2</code>, and <code class="code">10.3.9</code>. </p> <p>If the compiler was built to use the system’s headers by default, then the default for this option is the system version on which the compiler is running, otherwise the default is to make choices that are compatible with as many systems and code bases as possible. </p> </dd> <dt> +<span><code class="code">-mkernel</code><a class="copiable-link" href="#index-mkernel"> ¶</a></span> +</dt> <dd> +<p>Enable kernel development mode. The <samp class="option">-mkernel</samp> option sets <samp class="option">-static</samp>, <samp class="option">-fno-common</samp>, <samp class="option">-fno-use-cxa-atexit</samp>, <samp class="option">-fno-exceptions</samp>, <samp class="option">-fno-non-call-exceptions</samp>, <samp class="option">-fapple-kext</samp>, <samp class="option">-fno-weak</samp> and <samp class="option">-fno-rtti</samp> where applicable. This mode also sets <samp class="option">-mno-altivec</samp>, <samp class="option">-msoft-float</samp>, <samp class="option">-fno-builtin</samp> and <samp class="option">-mlong-branch</samp> for PowerPC targets. </p> </dd> <dt> +<span><code class="code">-mone-byte-bool</code><a class="copiable-link" href="#index-mone-byte-bool"> ¶</a></span> +</dt> <dd> +<p>Override the defaults for <code class="code">bool</code> so that <code class="code">sizeof(bool)==1</code>. By default <code class="code">sizeof(bool)</code> is <code class="code">4</code> when compiling for Darwin/PowerPC and <code class="code">1</code> when compiling for Darwin/x86, so this option has no effect on x86. </p> <p><strong class="strong">Warning:</strong> The <samp class="option">-mone-byte-bool</samp> switch causes GCC to generate code that is not binary compatible with code generated without that switch. Using this switch may require recompiling all other modules in a program, including system libraries. Use this switch to conform to a non-default data model. </p> </dd> <dt> + <span><code class="code">-mfix-and-continue</code><a class="copiable-link" href="#index-mfix-and-continue"> ¶</a></span> +</dt> <dt><code class="code">-ffix-and-continue</code></dt> <dt><code class="code">-findirect-data</code></dt> <dd> +<p>Generate code suitable for fast turnaround development, such as to allow GDB to dynamically load <samp class="file">.o</samp> files into already-running programs. <samp class="option">-findirect-data</samp> and <samp class="option">-ffix-and-continue</samp> are provided for backwards compatibility. </p> </dd> <dt> +<span><code class="code">-all_load</code><a class="copiable-link" href="#index-all_005fload"> ¶</a></span> +</dt> <dd> +<p>Loads all members of static archive libraries. See man ld(1) for more information. </p> </dd> <dt> +<span><code class="code">-arch_errors_fatal</code><a class="copiable-link" href="#index-arch_005ferrors_005ffatal"> ¶</a></span> +</dt> <dd> +<p>Cause the errors having to do with files that have the wrong architecture to be fatal. </p> </dd> <dt> +<span><code class="code">-bind_at_load</code><a class="copiable-link" href="#index-bind_005fat_005fload"> ¶</a></span> +</dt> <dd> +<p>Causes the output file to be marked such that the dynamic linker will bind all undefined references when the file is loaded or launched. </p> </dd> <dt> +<span><code class="code">-bundle</code><a class="copiable-link" href="#index-bundle"> ¶</a></span> +</dt> <dd> +<p>Produce a Mach-o bundle format file. See man ld(1) for more information. </p> </dd> <dt> +<span><code class="code">-bundle_loader <var class="var">executable</var></code><a class="copiable-link" href="#index-bundle_005floader"> ¶</a></span> +</dt> <dd> +<p>This option specifies the <var class="var">executable</var> that will load the build output file being linked. See man ld(1) for more information. </p> </dd> <dt> +<span><code class="code">-dynamiclib</code><a class="copiable-link" href="#index-dynamiclib"> ¶</a></span> +</dt> <dd> +<p>When passed this option, GCC produces a dynamic library instead of an executable when linking, using the Darwin <samp class="file">libtool</samp> command. </p> </dd> <dt> +<span><code class="code">-force_cpusubtype_ALL</code><a class="copiable-link" href="#index-force_005fcpusubtype_005fALL"> ¶</a></span> +</dt> <dd> +<p>This causes GCC’s output file to have the ‘<samp class="samp">ALL</samp>’ subtype, instead of one controlled by the <samp class="option">-mcpu</samp> or <samp class="option">-march</samp> option. </p> </dd> <dt> +<span><code class="code">-allowable_client <var class="var">client_name</var></code><a class="copiable-link" href="#index-allowable_005fclient"> ¶</a></span> +</dt> <dt><code class="code">-client_name</code></dt> <dt><code class="code">-compatibility_version</code></dt> <dt><code class="code">-current_version</code></dt> <dt><code class="code">-dead_strip</code></dt> <dt><code class="code">-dependency-file</code></dt> <dt><code class="code">-dylib_file</code></dt> <dt><code class="code">-dylinker_install_name</code></dt> <dt><code class="code">-dynamic</code></dt> <dt><code class="code">-exported_symbols_list</code></dt> <dt><code class="code">-filelist</code></dt> <dt><code class="code">-flat_namespace</code></dt> <dt><code class="code">-force_flat_namespace</code></dt> <dt><code class="code">-headerpad_max_install_names</code></dt> <dt><code class="code">-image_base</code></dt> <dt><code class="code">-init</code></dt> <dt><code class="code">-install_name</code></dt> <dt><code class="code">-keep_private_externs</code></dt> <dt><code class="code">-multi_module</code></dt> <dt><code class="code">-multiply_defined</code></dt> <dt><code class="code">-multiply_defined_unused</code></dt> <dt><code class="code">-noall_load</code></dt> <dt><code class="code">-no_dead_strip_inits_and_terms</code></dt> <dt><code class="code">-nofixprebinding</code></dt> <dt><code class="code">-nomultidefs</code></dt> <dt><code class="code">-noprebind</code></dt> <dt><code class="code">-noseglinkedit</code></dt> <dt><code class="code">-pagezero_size</code></dt> <dt><code class="code">-prebind</code></dt> <dt><code class="code">-prebind_all_twolevel_modules</code></dt> <dt><code class="code">-private_bundle</code></dt> <dt><code class="code">-read_only_relocs</code></dt> <dt><code class="code">-sectalign</code></dt> <dt><code class="code">-sectobjectsymbols</code></dt> <dt><code class="code">-whyload</code></dt> <dt><code class="code">-seg1addr</code></dt> <dt><code class="code">-sectcreate</code></dt> <dt><code class="code">-sectobjectsymbols</code></dt> <dt><code class="code">-sectorder</code></dt> <dt><code class="code">-segaddr</code></dt> <dt><code class="code">-segs_read_only_addr</code></dt> <dt><code class="code">-segs_read_write_addr</code></dt> <dt><code class="code">-seg_addr_table</code></dt> <dt><code class="code">-seg_addr_table_filename</code></dt> <dt><code class="code">-seglinkedit</code></dt> <dt><code class="code">-segprot</code></dt> <dt><code class="code">-segs_read_only_addr</code></dt> <dt><code class="code">-segs_read_write_addr</code></dt> <dt><code class="code">-single_module</code></dt> <dt><code class="code">-static</code></dt> <dt><code class="code">-sub_library</code></dt> <dt><code class="code">-sub_umbrella</code></dt> <dt><code class="code">-twolevel_namespace</code></dt> <dt><code class="code">-umbrella</code></dt> <dt><code class="code">-undefined</code></dt> <dt><code class="code">-unexported_symbols_list</code></dt> <dt><code class="code">-weak_reference_mismatches</code></dt> <dt><code class="code">-whatsloaded</code></dt> <dd><p>These options are passed to the Darwin linker. The Darwin linker man page describes them in detail. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="dec-alpha-options">DEC Alpha Options</a>, Previous: <a href="c-sky-options">C-SKY Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Darwin-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Darwin-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/darwin-pragmas.html b/devdocs/gcc~13/darwin-pragmas.html new file mode 100644 index 00000000..488d9a13 --- /dev/null +++ b/devdocs/gcc~13/darwin-pragmas.html @@ -0,0 +1,17 @@ +<div class="subsection-level-extent" id="Darwin-Pragmas"> <div class="nav-panel"> <p> Next: <a href="solaris-pragmas" accesskey="n" rel="next">Solaris Pragmas</a>, Previous: <a href="s_002f390-pragmas" accesskey="p" rel="prev">S/390 Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Darwin-Pragmas-1"><span>6.62.7 Darwin Pragmas<a class="copiable-link" href="#Darwin-Pragmas-1"> ¶</a></span></h1> <p>The following pragmas are available for all architectures running the Darwin operating system. These are useful for compatibility with other Mac OS compilers. </p> <dl class="table"> <dt> +<span><code class="code">mark <var class="var">tokens</var>…</code><a class="copiable-link" href="#index-pragma_002c-mark"> ¶</a></span> +</dt> <dd> +<p>This pragma is accepted, but has no effect. </p> </dd> <dt> +<span><code class="code">options align=<var class="var">alignment</var></code><a class="copiable-link" href="#index-pragma_002c-options-align"> ¶</a></span> +</dt> <dd> +<p>This pragma sets the alignment of fields in structures. The values of <var class="var">alignment</var> may be <code class="code">mac68k</code>, to emulate m68k alignment, or <code class="code">power</code>, to emulate PowerPC alignment. Uses of this pragma nest properly; to restore the previous setting, use <code class="code">reset</code> for the <var class="var">alignment</var>. </p> </dd> <dt> +<span><code class="code">segment <var class="var">tokens</var>…</code><a class="copiable-link" href="#index-pragma_002c-segment"> ¶</a></span> +</dt> <dd> +<p>This pragma is accepted, but has no effect. </p> </dd> <dt> +<span><code class="code">unused (<var class="var">var</var> [, <var class="var">var</var>]…)</code><a class="copiable-link" href="#index-pragma_002c-unused"> ¶</a></span> +</dt> <dd><p>This pragma declares variables to be possibly unused. GCC does not produce warnings for the listed variables. The effect is similar to that of the <code class="code">unused</code> attribute, except that this pragma may appear anywhere within the variables’ scopes. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Darwin-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Darwin-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/debugging-options.html b/devdocs/gcc~13/debugging-options.html new file mode 100644 index 00000000..2c7174db --- /dev/null +++ b/devdocs/gcc~13/debugging-options.html @@ -0,0 +1,112 @@ +<div class="section-level-extent" id="Debugging-Options"> <div class="nav-panel"> <p> Next: <a href="optimize-options" accesskey="n" rel="next">Options That Control Optimization</a>, Previous: <a href="static-analyzer-options" accesskey="p" rel="prev">Options That Control Static Analysis</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-for-Debugging-Your-Program"><span>3.10 Options for Debugging Your Program<a class="copiable-link" href="#Options-for-Debugging-Your-Program"> ¶</a></span></h1> <p>To tell GCC to emit extra information for use by a debugger, in almost all cases you need only to add <samp class="option">-g</samp> to your other options. Some debug formats can co-exist (like DWARF with CTF) when each of them is enabled explicitly by adding the respective command line option to your other options. </p> <p>GCC allows you to use <samp class="option">-g</samp> with <samp class="option">-O</samp>. The shortcuts taken by optimized code may occasionally be surprising: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values are already at hand; some statements may execute in different places because they have been moved out of loops. Nevertheless it is possible to debug optimized output. This makes it reasonable to use the optimizer for programs that might have bugs. </p> <p>If you are not using some other optimization option, consider using <samp class="option">-Og</samp> (see <a class="pxref" href="optimize-options">Options That Control Optimization</a>) with <samp class="option">-g</samp>. With no <samp class="option">-O</samp> option at all, some compiler passes that collect information useful for debugging do not run at all, so that <samp class="option">-Og</samp> may result in a better debugging experience. </p> <dl class="table"> <dt> +<span><code class="code">-g</code><a class="copiable-link" href="#index-g"> ¶</a></span> +</dt> <dd> +<p>Produce debugging information in the operating system’s native format (stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging information. </p> <p>On most systems that use stabs format, <samp class="option">-g</samp> enables use of extra debugging information that only GDB can use; this extra information makes debugging work better in GDB but probably makes other debuggers crash or refuse to read the program. If you want to control for certain whether to generate the extra information, use <samp class="option">-gvms</samp> (see below). </p> </dd> <dt> +<span><code class="code">-ggdb</code><a class="copiable-link" href="#index-ggdb"> ¶</a></span> +</dt> <dd> +<p>Produce debugging information for use by GDB. This means to use the most expressive format available (DWARF, stabs, or the native format if neither of those are supported), including GDB extensions if at all possible. </p> </dd> <dt> +<span><code class="code">-gdwarf</code><a class="copiable-link" href="#index-gdwarf"> ¶</a></span> +</dt> <dt><code class="code">-gdwarf-<var class="var">version</var></code></dt> <dd> +<p>Produce debugging information in DWARF format (if that is supported). The value of <var class="var">version</var> may be either 2, 3, 4 or 5; the default version for most targets is 5 (with the exception of VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and AIX, which defaults to version 4). </p> <p>Note that with DWARF Version 2, some ports require and always use some non-conflicting DWARF 3 extensions in the unwind tables. </p> <p>Version 4 may require GDB 7.0 and <samp class="option">-fvar-tracking-assignments</samp> for maximum benefit. Version 5 requires GDB 8.0 or higher. </p> <p>GCC no longer supports DWARF Version 1, which is substantially different than Version 2 and later. For historical reasons, some other DWARF-related options such as <samp class="option">-fno-dwarf2-cfi-asm</samp>) retain a reference to DWARF Version 2 in their names, but apply to all currently-supported versions of DWARF. </p> </dd> <dt> +<span><code class="code">-gbtf</code><a class="copiable-link" href="#index-gbtf"> ¶</a></span> +</dt> <dd> +<p>Request BTF debug information. BTF is the default debugging format for the eBPF target. On other targets, like x86, BTF debug information can be generated along with DWARF debug information when both of the debug formats are enabled explicitly via their respective command line options. </p> </dd> <dt> +<span><code class="code">-gctf</code><a class="copiable-link" href="#index-gctf"> ¶</a></span> +</dt> <dt><code class="code">-gctf<var class="var">level</var></code></dt> <dd> +<p>Request CTF debug information and use level to specify how much CTF debug information should be produced. If <samp class="option">-gctf</samp> is specified without a value for level, the default level of CTF debug information is 2. </p> <p>CTF debug information can be generated along with DWARF debug information when both of the debug formats are enabled explicitly via their respective command line options. </p> <p>Level 0 produces no CTF debug information at all. Thus, <samp class="option">-gctf0</samp> negates <samp class="option">-gctf</samp>. </p> <p>Level 1 produces CTF information for tracebacks only. This includes callsite information, but does not include type information. </p> <p>Level 2 produces type information for entities (functions, data objects etc.) at file-scope or global-scope only. </p> </dd> <dt> +<span><code class="code">-gvms</code><a class="copiable-link" href="#index-gvms"> ¶</a></span> +</dt> <dd> +<p>Produce debugging information in Alpha/VMS debug format (if that is supported). This is the format used by DEBUG on Alpha/VMS systems. </p> </dd> <dt><code class="code">-g<var class="var">level</var></code></dt> <dt><code class="code">-ggdb<var class="var">level</var></code></dt> <dt><code class="code">-gvms<var class="var">level</var></code></dt> <dd> +<p>Request debugging information and also use <var class="var">level</var> to specify how much information. The default level is 2. </p> <p>Level 0 produces no debug information at all. Thus, <samp class="option">-g0</samp> negates <samp class="option">-g</samp>. </p> <p>Level 1 produces minimal information, enough for making backtraces in parts of the program that you don’t plan to debug. This includes descriptions of functions and external variables, and line number tables, but no information about local variables. </p> <p>Level 3 includes extra information, such as all the macro definitions present in the program. Some debuggers support macro expansion when you use <samp class="option">-g3</samp>. </p> <p>If you use multiple <samp class="option">-g</samp> options, with or without level numbers, the last such option is the one that is effective. </p> <p><samp class="option">-gdwarf</samp> does not accept a concatenated debug level, to avoid confusion with <samp class="option">-gdwarf-<var class="var">level</var></samp>. Instead use an additional <samp class="option">-g<var class="var">level</var></samp> option to change the debug level for DWARF. </p> </dd> <dt> + <span><code class="code">-fno-eliminate-unused-debug-symbols</code><a class="copiable-link" href="#index-feliminate-unused-debug-symbols"> ¶</a></span> +</dt> <dd> +<p>By default, no debug information is produced for symbols that are not actually used. Use this option if you want debug information for all symbols. </p> </dd> <dt> +<span><code class="code">-femit-class-debug-always</code><a class="copiable-link" href="#index-femit-class-debug-always"> ¶</a></span> +</dt> <dd> +<p>Instead of emitting debugging information for a C++ class in only one object file, emit it in all object files using the class. This option should be used only with debuggers that are unable to handle the way GCC normally emits debugging information for classes because using this option increases the size of debugging information by as much as a factor of two. </p> </dd> <dt> + <span><code class="code">-fno-merge-debug-strings</code><a class="copiable-link" href="#index-fmerge-debug-strings"> ¶</a></span> +</dt> <dd> +<p>Direct the linker to not merge together strings in the debugging information that are identical in different object files. Merging is not supported by all assemblers or linkers. Merging decreases the size of the debug information in the output file at the cost of increasing link processing time. Merging is enabled by default. </p> </dd> <dt> +<span><code class="code">-fdebug-prefix-map=<var class="var">old</var>=<var class="var">new</var></code><a class="copiable-link" href="#index-fdebug-prefix-map"> ¶</a></span> +</dt> <dd> +<p>When compiling files residing in directory <samp class="file"><var class="var">old</var></samp>, record debugging information describing them as if the files resided in directory <samp class="file"><var class="var">new</var></samp> instead. This can be used to replace a build-time path with an install-time path in the debug info. It can also be used to change an absolute path to a relative path by using <samp class="file">.</samp> for <var class="var">new</var>. This can give more reproducible builds, which are location independent, but may require an extra command to tell GDB where to find the source files. See also <samp class="option">-ffile-prefix-map</samp> and <samp class="option">-fcanon-prefix-map</samp>. </p> </dd> <dt> +<span><code class="code">-fvar-tracking</code><a class="copiable-link" href="#index-fvar-tracking"> ¶</a></span> +</dt> <dd> +<p>Run variable tracking pass. It computes where variables are stored at each position in code. Better debugging information is then generated (if the debugging information format supports this information). </p> <p>It is enabled by default when compiling with optimization (<samp class="option">-Os</samp>, <samp class="option">-O</samp>, <samp class="option">-O2</samp>, …), debugging information (<samp class="option">-g</samp>) and the debug info format supports it. </p> </dd> <dt> + <span><code class="code">-fvar-tracking-assignments</code><a class="copiable-link" href="#index-fvar-tracking-assignments"> ¶</a></span> +</dt> <dd> +<p>Annotate assignments to user variables early in the compilation and attempt to carry the annotations over throughout the compilation all the way to the end, in an attempt to improve debug information while optimizing. Use of <samp class="option">-gdwarf-4</samp> is recommended along with it. </p> <p>It can be enabled even if var-tracking is disabled, in which case annotations are created and maintained, but discarded at the end. By default, this flag is enabled together with <samp class="option">-fvar-tracking</samp>, except when selective scheduling is enabled. </p> </dd> <dt> +<span><code class="code">-gsplit-dwarf</code><a class="copiable-link" href="#index-gsplit-dwarf"> ¶</a></span> +</dt> <dd> +<p>If DWARF debugging information is enabled, separate as much debugging information as possible into a separate output file with the extension <samp class="file">.dwo</samp>. This option allows the build system to avoid linking files with debug information. To be useful, this option requires a debugger capable of reading <samp class="file">.dwo</samp> files. </p> </dd> <dt> + <span><code class="code">-gdwarf32</code><a class="copiable-link" href="#index-gdwarf32"> ¶</a></span> +</dt> <dt><code class="code">-gdwarf64</code></dt> <dd> +<p>If DWARF debugging information is enabled, the <samp class="option">-gdwarf32</samp> selects the 32-bit DWARF format and the <samp class="option">-gdwarf64</samp> selects the 64-bit DWARF format. The default is target specific, on most targets it is <samp class="option">-gdwarf32</samp> though. The 32-bit DWARF format is smaller, but can’t support more than 2GiB of debug information in any of the DWARF debug information sections. The 64-bit DWARF format allows larger debug information and might not be well supported by all consumers yet. </p> </dd> <dt> +<span><code class="code">-gdescribe-dies</code><a class="copiable-link" href="#index-gdescribe-dies"> ¶</a></span> +</dt> <dd> +<p>Add description attributes to some DWARF DIEs that have no name attribute, such as artificial variables, external references and call site parameter DIEs. </p> </dd> <dt> +<span><code class="code">-gpubnames</code><a class="copiable-link" href="#index-gpubnames"> ¶</a></span> +</dt> <dd> +<p>Generate DWARF <code class="code">.debug_pubnames</code> and <code class="code">.debug_pubtypes</code> sections. </p> </dd> <dt> +<span><code class="code">-ggnu-pubnames</code><a class="copiable-link" href="#index-ggnu-pubnames"> ¶</a></span> +</dt> <dd> +<p>Generate <code class="code">.debug_pubnames</code> and <code class="code">.debug_pubtypes</code> sections in a format suitable for conversion into a GDB index. This option is only useful with a linker that can produce GDB index version 7. </p> </dd> <dt> + <span><code class="code">-fdebug-types-section</code><a class="copiable-link" href="#index-fdebug-types-section"> ¶</a></span> +</dt> <dd> +<p>When using DWARF Version 4 or higher, type DIEs can be put into their own <code class="code">.debug_types</code> section instead of making them part of the <code class="code">.debug_info</code> section. It is more efficient to put them in a separate comdat section since the linker can then remove duplicates. But not all DWARF consumers support <code class="code">.debug_types</code> sections yet and on some objects <code class="code">.debug_types</code> produces larger instead of smaller debugging information. </p> </dd> <dt> + <span><code class="code">-grecord-gcc-switches</code><a class="copiable-link" href="#index-grecord-gcc-switches"> ¶</a></span> +</dt> <dt><code class="code">-gno-record-gcc-switches</code></dt> <dd> +<p>This switch causes the command-line options used to invoke the compiler that may affect code generation to be appended to the DW_AT_producer attribute in DWARF debugging information. The options are concatenated with spaces separating them from each other and from the compiler version. It is enabled by default. See also <samp class="option">-frecord-gcc-switches</samp> for another way of storing compiler options into the object file. </p> </dd> <dt> +<span><code class="code">-gstrict-dwarf</code><a class="copiable-link" href="#index-gstrict-dwarf"> ¶</a></span> +</dt> <dd> +<p>Disallow using extensions of later DWARF standard version than selected with <samp class="option">-gdwarf-<var class="var">version</var></samp>. On most targets using non-conflicting DWARF extensions from later standard versions is allowed. </p> </dd> <dt> +<span><code class="code">-gno-strict-dwarf</code><a class="copiable-link" href="#index-gno-strict-dwarf"> ¶</a></span> +</dt> <dd> +<p>Allow using extensions of later DWARF standard version than selected with <samp class="option">-gdwarf-<var class="var">version</var></samp>. </p> </dd> <dt> +<span><code class="code">-gas-loc-support</code><a class="copiable-link" href="#index-gas-loc-support"> ¶</a></span> +</dt> <dd> +<p>Inform the compiler that the assembler supports <code class="code">.loc</code> directives. It may then use them for the assembler to generate DWARF2+ line number tables. </p> <p>This is generally desirable, because assembler-generated line-number tables are a lot more compact than those the compiler can generate itself. </p> <p>This option will be enabled by default if, at GCC configure time, the assembler was found to support such directives. </p> </dd> <dt> +<span><code class="code">-gno-as-loc-support</code><a class="copiable-link" href="#index-gno-as-loc-support"> ¶</a></span> +</dt> <dd> +<p>Force GCC to generate DWARF2+ line number tables internally, if DWARF2+ line number tables are to be generated. </p> </dd> <dt> +<span><code class="code">-gas-locview-support</code><a class="copiable-link" href="#index-gas-locview-support"> ¶</a></span> +</dt> <dd> +<p>Inform the compiler that the assembler supports <code class="code">view</code> assignment and reset assertion checking in <code class="code">.loc</code> directives. </p> <p>This option will be enabled by default if, at GCC configure time, the assembler was found to support them. </p> </dd> <dt><code class="code">-gno-as-locview-support</code></dt> <dd> +<p>Force GCC to assign view numbers internally, if <samp class="option">-gvariable-location-views</samp> are explicitly requested. </p> </dd> <dt> + <span><code class="code">-gcolumn-info</code><a class="copiable-link" href="#index-gcolumn-info"> ¶</a></span> +</dt> <dt><code class="code">-gno-column-info</code></dt> <dd> +<p>Emit location column information into DWARF debugging information, rather than just file and line. This option is enabled by default. </p> </dd> <dt> + <span><code class="code">-gstatement-frontiers</code><a class="copiable-link" href="#index-gstatement-frontiers"> ¶</a></span> +</dt> <dt><code class="code">-gno-statement-frontiers</code></dt> <dd> +<p>This option causes GCC to create markers in the internal representation at the beginning of statements, and to keep them roughly in place throughout compilation, using them to guide the output of <code class="code">is_stmt</code> markers in the line number table. This is enabled by default when compiling with optimization (<samp class="option">-Os</samp>, <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, …), and outputting DWARF 2 debug information at the normal level. </p> </dd> <dt> + <span><code class="code">-gvariable-location-views</code><a class="copiable-link" href="#index-gvariable-location-views"> ¶</a></span> +</dt> <dt><code class="code">-gvariable-location-views=incompat5</code></dt> <dt><code class="code">-gno-variable-location-views</code></dt> <dd> +<p>Augment variable location lists with progressive view numbers implied from the line number table. This enables debug information consumers to inspect state at certain points of the program, even if no instructions associated with the corresponding source locations are present at that point. If the assembler lacks support for view numbers in line number tables, this will cause the compiler to emit the line number table, which generally makes them somewhat less compact. The augmented line number tables and location lists are fully backward-compatible, so they can be consumed by debug information consumers that are not aware of these augmentations, but they won’t derive any benefit from them either. </p> <p>This is enabled by default when outputting DWARF 2 debug information at the normal level, as long as there is assembler support, <samp class="option">-fvar-tracking-assignments</samp> is enabled and <samp class="option">-gstrict-dwarf</samp> is not. When assembler support is not available, this may still be enabled, but it will force GCC to output internal line number tables, and if <samp class="option">-ginternal-reset-location-views</samp> is not enabled, that will most certainly lead to silently mismatching location views. </p> <p>There is a proposed representation for view numbers that is not backward compatible with the location list format introduced in DWARF 5, that can be enabled with <samp class="option">-gvariable-location-views=incompat5</samp>. This option may be removed in the future, is only provided as a reference implementation of the proposed representation. Debug information consumers are not expected to support this extended format, and they would be rendered unable to decode location lists using it. </p> </dd> <dt> + <span><code class="code">-ginternal-reset-location-views</code><a class="copiable-link" href="#index-ginternal-reset-location-views"> ¶</a></span> +</dt> <dt><code class="code">-gno-internal-reset-location-views</code></dt> <dd> +<p>Attempt to determine location views that can be omitted from location view lists. This requires the compiler to have very accurate insn length estimates, which isn’t always the case, and it may cause incorrect view lists to be generated silently when using an assembler that does not support location view lists. The GNU assembler will flag any such error as a <code class="code">view number mismatch</code>. This is only enabled on ports that define a reliable estimation function. </p> </dd> <dt> + <span><code class="code">-ginline-points</code><a class="copiable-link" href="#index-ginline-points"> ¶</a></span> +</dt> <dt><code class="code">-gno-inline-points</code></dt> <dd> +<p>Generate extended debug information for inlined functions. Location view tracking markers are inserted at inlined entry points, so that address and view numbers can be computed and output in debug information. This can be enabled independently of location views, in which case the view numbers won’t be output, but it can only be enabled along with statement frontiers, and it is only enabled by default if location views are enabled. </p> </dd> <dt> +<span><code class="code">-gz<span class="r">[</span>=<var class="var">type</var><span class="r">]</span></code><a class="copiable-link" href="#index-gz"> ¶</a></span> +</dt> <dd> +<p>Produce compressed debug sections in DWARF format, if that is supported. If <var class="var">type</var> is not given, the default type depends on the capabilities of the assembler and linker used. <var class="var">type</var> may be one of ‘<samp class="samp">none</samp>’ (don’t compress debug sections), or ‘<samp class="samp">zlib</samp>’ (use zlib compression in ELF gABI format). If the linker doesn’t support writing compressed debug sections, the option is rejected. Otherwise, if the assembler does not support them, <samp class="option">-gz</samp> is silently ignored when producing object files. </p> </dd> <dt> +<span><code class="code">-femit-struct-debug-baseonly</code><a class="copiable-link" href="#index-femit-struct-debug-baseonly"> ¶</a></span> +</dt> <dd> +<p>Emit debug information for struct-like types only when the base name of the compilation source file matches the base name of file in which the struct is defined. </p> <p>This option substantially reduces the size of debugging information, but at significant potential loss in type information to the debugger. See <samp class="option">-femit-struct-debug-reduced</samp> for a less aggressive option. See <samp class="option">-femit-struct-debug-detailed</samp> for more detailed control. </p> <p>This option works only with DWARF debug output. </p> </dd> <dt> +<span><code class="code">-femit-struct-debug-reduced</code><a class="copiable-link" href="#index-femit-struct-debug-reduced"> ¶</a></span> +</dt> <dd> +<p>Emit debug information for struct-like types only when the base name of the compilation source file matches the base name of file in which the type is defined, unless the struct is a template or defined in a system header. </p> <p>This option significantly reduces the size of debugging information, with some potential loss in type information to the debugger. See <samp class="option">-femit-struct-debug-baseonly</samp> for a more aggressive option. See <samp class="option">-femit-struct-debug-detailed</samp> for more detailed control. </p> <p>This option works only with DWARF debug output. </p> </dd> <dt> +<span><code class="code">-femit-struct-debug-detailed<span class="r">[</span>=<var class="var">spec-list</var><span class="r">]</span></code><a class="copiable-link" href="#index-femit-struct-debug-detailed"> ¶</a></span> +</dt> <dd> +<p>Specify the struct-like types for which the compiler generates debug information. The intent is to reduce duplicate struct debug information between different object files within the same program. </p> <p>This option is a detailed version of <samp class="option">-femit-struct-debug-reduced</samp> and <samp class="option">-femit-struct-debug-baseonly</samp>, which serves for most needs. </p> <p>A specification has the syntax [‘<samp class="samp">dir:</samp>’|‘<samp class="samp">ind:</samp>’][‘<samp class="samp">ord:</samp>’|‘<samp class="samp">gen:</samp>’](‘<samp class="samp">any</samp>’|‘<samp class="samp">sys</samp>’|‘<samp class="samp">base</samp>’|‘<samp class="samp">none</samp>’) </p> <p>The optional first word limits the specification to structs that are used directly (‘<samp class="samp">dir:</samp>’) or used indirectly (‘<samp class="samp">ind:</samp>’). A struct type is used directly when it is the type of a variable, member. Indirect uses arise through pointers to structs. That is, when use of an incomplete struct is valid, the use is indirect. An example is ‘<samp class="samp">struct one direct; struct two * indirect;</samp>’. </p> <p>The optional second word limits the specification to ordinary structs (‘<samp class="samp">ord:</samp>’) or generic structs (‘<samp class="samp">gen:</samp>’). Generic structs are a bit complicated to explain. For C++, these are non-explicit specializations of template classes, or non-template classes within the above. Other programming languages have generics, but <samp class="option">-femit-struct-debug-detailed</samp> does not yet implement them. </p> <p>The third word specifies the source files for those structs for which the compiler should emit debug information. The values ‘<samp class="samp">none</samp>’ and ‘<samp class="samp">any</samp>’ have the normal meaning. The value ‘<samp class="samp">base</samp>’ means that the base of name of the file in which the type declaration appears must match the base of the name of the main compilation file. In practice, this means that when compiling <samp class="file">foo.c</samp>, debug information is generated for types declared in that file and <samp class="file">foo.h</samp>, but not other header files. The value ‘<samp class="samp">sys</samp>’ means those types satisfying ‘<samp class="samp">base</samp>’ or declared in system or compiler headers. </p> <p>You may need to experiment to determine the best settings for your application. </p> <p>The default is <samp class="option">-femit-struct-debug-detailed=all</samp>. </p> <p>This option works only with DWARF debug output. </p> </dd> <dt> + <span><code class="code">-fno-dwarf2-cfi-asm</code><a class="copiable-link" href="#index-fdwarf2-cfi-asm"> ¶</a></span> +</dt> <dd> +<p>Emit DWARF unwind info as compiler generated <code class="code">.eh_frame</code> section instead of using GAS <code class="code">.cfi_*</code> directives. </p> </dd> <dt> + <span><code class="code">-fno-eliminate-unused-debug-types</code><a class="copiable-link" href="#index-feliminate-unused-debug-types"> ¶</a></span> +</dt> <dd><p>Normally, when producing DWARF output, GCC avoids producing debug symbol output for types that are nowhere used in the source file being compiled. Sometimes it is useful to have GCC emit debugging information for all types declared in a compilation unit, regardless of whether or not they are actually used in that compilation unit, for example if, in the debugger, you want to cast a value to a type that is not actually used in your program (but is declared). More often, however, this results in a significant amount of wasted space. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="optimize-options">Options That Control Optimization</a>, Previous: <a href="static-analyzer-options">Options That Control Static Analysis</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Debugging-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Debugging-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/dec-alpha-options.html b/devdocs/gcc~13/dec-alpha-options.html new file mode 100644 index 00000000..2bdfd5e9 --- /dev/null +++ b/devdocs/gcc~13/dec-alpha-options.html @@ -0,0 +1,72 @@ +<div class="subsection-level-extent" id="DEC-Alpha-Options"> <div class="nav-panel"> <p> Next: <a href="ebpf-options" accesskey="n" rel="next">eBPF Options</a>, Previous: <a href="darwin-options" accesskey="p" rel="prev">Darwin Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="DEC-Alpha-Options-1"><span>3.19.12 DEC Alpha Options<a class="copiable-link" href="#DEC-Alpha-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for the DEC Alpha implementations: </p> <dl class="table"> <dt> + <span><code class="code">-mno-soft-float</code><a class="copiable-link" href="#index-mno-soft-float"> ¶</a></span> +</dt> <dt><code class="code">-msoft-float</code></dt> <dd> +<p>Use (do not use) the hardware floating-point instructions for floating-point operations. When <samp class="option">-msoft-float</samp> is specified, functions in <samp class="file">libgcc.a</samp> are used to perform floating-point operations. Unless they are replaced by routines that emulate the floating-point operations, or compiled in such a way as to call such emulations routines, these routines issue floating-point operations. If you are compiling for an Alpha without floating-point operations, you must ensure that the library is built so as not to call them. </p> <p>Note that Alpha implementations without floating-point operations are required to have floating-point registers. </p> </dd> <dt> + <span><code class="code">-mfp-reg</code><a class="copiable-link" href="#index-mfp-reg"> ¶</a></span> +</dt> <dt><code class="code">-mno-fp-regs</code></dt> <dd> +<p>Generate code that uses (does not use) the floating-point register set. <samp class="option">-mno-fp-regs</samp> implies <samp class="option">-msoft-float</samp>. If the floating-point register set is not used, floating-point operands are passed in integer registers as if they were integers and floating-point results are passed in <code class="code">$0</code> instead of <code class="code">$f0</code>. This is a non-standard calling sequence, so any function with a floating-point argument or return value called by code compiled with <samp class="option">-mno-fp-regs</samp> must also be compiled with that option. </p> <p>A typical use of this option is building a kernel that does not use, and hence need not save and restore, any floating-point registers. </p> </dd> <dt> +<span><code class="code">-mieee</code><a class="copiable-link" href="#index-mieee"> ¶</a></span> +</dt> <dd> +<p>The Alpha architecture implements floating-point hardware optimized for maximum performance. It is mostly compliant with the IEEE floating-point standard. However, for full compliance, software assistance is required. This option generates code fully IEEE-compliant code <em class="emph">except</em> that the <var class="var">inexact-flag</var> is not maintained (see below). If this option is turned on, the preprocessor macro <code class="code">_IEEE_FP</code> is defined during compilation. The resulting code is less efficient but is able to correctly support denormalized numbers and exceptional IEEE values such as not-a-number and plus/minus infinity. Other Alpha compilers call this option <samp class="option">-ieee_with_no_inexact</samp>. </p> </dd> <dt> +<span><code class="code">-mieee-with-inexact</code><a class="copiable-link" href="#index-mieee-with-inexact"> ¶</a></span> +</dt> <dd> +<p>This is like <samp class="option">-mieee</samp> except the generated code also maintains the IEEE <var class="var">inexact-flag</var>. Turning on this option causes the generated code to implement fully-compliant IEEE math. In addition to <code class="code">_IEEE_FP</code>, <code class="code">_IEEE_FP_EXACT</code> is defined as a preprocessor macro. On some Alpha implementations the resulting code may execute significantly slower than the code generated by default. Since there is very little code that depends on the <var class="var">inexact-flag</var>, you should normally not specify this option. Other Alpha compilers call this option <samp class="option">-ieee_with_inexact</samp>. </p> </dd> <dt> +<span><code class="code">-mfp-trap-mode=<var class="var">trap-mode</var></code><a class="copiable-link" href="#index-mfp-trap-mode"> ¶</a></span> +</dt> <dd> +<p>This option controls what floating-point related traps are enabled. Other Alpha compilers call this option <samp class="option">-fptm <var class="var">trap-mode</var></samp>. The trap mode can be set to one of four values: </p> <dl class="table"> <dt>‘<samp class="samp">n</samp>’</dt> <dd> +<p>This is the default (normal) setting. The only traps that are enabled are the ones that cannot be disabled in software (e.g., division by zero trap). </p> </dd> <dt>‘<samp class="samp">u</samp>’</dt> <dd> +<p>In addition to the traps enabled by ‘<samp class="samp">n</samp>’, underflow traps are enabled as well. </p> </dd> <dt>‘<samp class="samp">su</samp>’</dt> <dd> +<p>Like ‘<samp class="samp">u</samp>’, but the instructions are marked to be safe for software completion (see Alpha architecture manual for details). </p> </dd> <dt>‘<samp class="samp">sui</samp>’</dt> <dd><p>Like ‘<samp class="samp">su</samp>’, but inexact traps are enabled as well. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mfp-rounding-mode=<var class="var">rounding-mode</var></code><a class="copiable-link" href="#index-mfp-rounding-mode"> ¶</a></span> +</dt> <dd> +<p>Selects the IEEE rounding mode. Other Alpha compilers call this option <samp class="option">-fprm <var class="var">rounding-mode</var></samp>. The <var class="var">rounding-mode</var> can be one of: </p> <dl class="table"> <dt>‘<samp class="samp">n</samp>’</dt> <dd> +<p>Normal IEEE rounding mode. Floating-point numbers are rounded towards the nearest machine number or towards the even machine number in case of a tie. </p> </dd> <dt>‘<samp class="samp">m</samp>’</dt> <dd> +<p>Round towards minus infinity. </p> </dd> <dt>‘<samp class="samp">c</samp>’</dt> <dd> +<p>Chopped rounding mode. Floating-point numbers are rounded towards zero. </p> </dd> <dt>‘<samp class="samp">d</samp>’</dt> <dd><p>Dynamic rounding mode. A field in the floating-point control register (<var class="var">fpcr</var>, see Alpha architecture reference manual) controls the rounding mode in effect. The C library initializes this register for rounding towards plus infinity. Thus, unless your program modifies the <var class="var">fpcr</var>, ‘<samp class="samp">d</samp>’ corresponds to round towards plus infinity. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mtrap-precision=<var class="var">trap-precision</var></code><a class="copiable-link" href="#index-mtrap-precision"> ¶</a></span> +</dt> <dd> +<p>In the Alpha architecture, floating-point traps are imprecise. This means without software assistance it is impossible to recover from a floating trap and program execution normally needs to be terminated. GCC can generate code that can assist operating system trap handlers in determining the exact location that caused a floating-point trap. Depending on the requirements of an application, different levels of precisions can be selected: </p> <dl class="table"> <dt>‘<samp class="samp">p</samp>’</dt> <dd> +<p>Program precision. This option is the default and means a trap handler can only identify which program caused a floating-point exception. </p> </dd> <dt>‘<samp class="samp">f</samp>’</dt> <dd> +<p>Function precision. The trap handler can determine the function that caused a floating-point exception. </p> </dd> <dt>‘<samp class="samp">i</samp>’</dt> <dd><p>Instruction precision. The trap handler can determine the exact instruction that caused a floating-point exception. </p></dd> </dl> <p>Other Alpha compilers provide the equivalent options called <samp class="option">-scope_safe</samp> and <samp class="option">-resumption_safe</samp>. </p> </dd> <dt> +<span><code class="code">-mieee-conformant</code><a class="copiable-link" href="#index-mieee-conformant"> ¶</a></span> +</dt> <dd> +<p>This option marks the generated code as IEEE conformant. You must not use this option unless you also specify <samp class="option">-mtrap-precision=i</samp> and either <samp class="option">-mfp-trap-mode=su</samp> or <samp class="option">-mfp-trap-mode=sui</samp>. Its only effect is to emit the line ‘<samp class="samp">.eflag 48</samp>’ in the function prologue of the generated assembly file. </p> </dd> <dt> +<span><code class="code">-mbuild-constants</code><a class="copiable-link" href="#index-mbuild-constants"> ¶</a></span> +</dt> <dd> +<p>Normally GCC examines a 32- or 64-bit integer constant to see if it can construct it from smaller constants in two or three instructions. If it cannot, it outputs the constant as a literal and generates code to load it from the data segment at run time. </p> <p>Use this option to require GCC to construct <em class="emph">all</em> integer constants using code, even if it takes more instructions (the maximum is six). </p> <p>You typically use this option to build a shared library dynamic loader. Itself a shared library, it must relocate itself in memory before it can find the variables and constants in its own data segment. </p> </dd> <dt> + <span><code class="code">-mbwx</code><a class="copiable-link" href="#index-mbwx"> ¶</a></span> +</dt> <dt><code class="code">-mno-bwx</code></dt> <dt><code class="code">-mcix</code></dt> <dt><code class="code">-mno-cix</code></dt> <dt><code class="code">-mfix</code></dt> <dt><code class="code">-mno-fix</code></dt> <dt><code class="code">-mmax</code></dt> <dt><code class="code">-mno-max</code></dt> <dd> +<p>Indicate whether GCC should generate code to use the optional BWX, CIX, FIX and MAX instruction sets. The default is to use the instruction sets supported by the CPU type specified via <samp class="option">-mcpu=</samp> option or that of the CPU on which GCC was built if none is specified. </p> </dd> <dt> + <span><code class="code">-mfloat-vax</code><a class="copiable-link" href="#index-mfloat-vax"> ¶</a></span> +</dt> <dt><code class="code">-mfloat-ieee</code></dt> <dd> +<p>Generate code that uses (does not use) VAX F and G floating-point arithmetic instead of IEEE single and double precision. </p> </dd> <dt> + <span><code class="code">-mexplicit-relocs</code><a class="copiable-link" href="#index-mexplicit-relocs"> ¶</a></span> +</dt> <dt><code class="code">-mno-explicit-relocs</code></dt> <dd> +<p>Older Alpha assemblers provided no way to generate symbol relocations except via assembler macros. Use of these macros does not allow optimal instruction scheduling. GNU binutils as of version 2.12 supports a new syntax that allows the compiler to explicitly mark which relocations should apply to which instructions. This option is mostly useful for debugging, as GCC detects the capabilities of the assembler when it is built and sets the default accordingly. </p> </dd> <dt> + <span><code class="code">-msmall-data</code><a class="copiable-link" href="#index-msmall-data"> ¶</a></span> +</dt> <dt><code class="code">-mlarge-data</code></dt> <dd> +<p>When <samp class="option">-mexplicit-relocs</samp> is in effect, static data is accessed via <em class="dfn">gp-relative</em> relocations. When <samp class="option">-msmall-data</samp> is used, objects 8 bytes long or smaller are placed in a <em class="dfn">small data area</em> (the <code class="code">.sdata</code> and <code class="code">.sbss</code> sections) and are accessed via 16-bit relocations off of the <code class="code">$gp</code> register. This limits the size of the small data area to 64KB, but allows the variables to be directly accessed via a single instruction. </p> <p>The default is <samp class="option">-mlarge-data</samp>. With this option the data area is limited to just below 2GB. Programs that require more than 2GB of data must use <code class="code">malloc</code> or <code class="code">mmap</code> to allocate the data in the heap instead of in the program’s data segment. </p> <p>When generating code for shared libraries, <samp class="option">-fpic</samp> implies <samp class="option">-msmall-data</samp> and <samp class="option">-fPIC</samp> implies <samp class="option">-mlarge-data</samp>. </p> </dd> <dt> + <span><code class="code">-msmall-text</code><a class="copiable-link" href="#index-msmall-text"> ¶</a></span> +</dt> <dt><code class="code">-mlarge-text</code></dt> <dd> +<p>When <samp class="option">-msmall-text</samp> is used, the compiler assumes that the code of the entire program (or shared library) fits in 4MB, and is thus reachable with a branch instruction. When <samp class="option">-msmall-data</samp> is used, the compiler can assume that all local symbols share the same <code class="code">$gp</code> value, and thus reduce the number of instructions required for a function call from 4 to 1. </p> <p>The default is <samp class="option">-mlarge-text</samp>. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu_type</var></code><a class="copiable-link" href="#index-mcpu-4"> ¶</a></span> +</dt> <dd> +<p>Set the instruction set and instruction scheduling parameters for machine type <var class="var">cpu_type</var>. You can specify either the ‘<samp class="samp">EV</samp>’ style name or the corresponding chip number. GCC supports scheduling parameters for the EV4, EV5 and EV6 family of processors and chooses the default values for the instruction set from the processor you specify. If you do not specify a processor type, GCC defaults to the processor on which the compiler was built. </p> <p>Supported values for <var class="var">cpu_type</var> are </p> <dl class="table"> <dt>‘<samp class="samp">ev4</samp>’</dt> <dt>‘<samp class="samp">ev45</samp>’</dt> <dt>‘<samp class="samp">21064</samp>’</dt> <dd> +<p>Schedules as an EV4 and has no instruction set extensions. </p> </dd> <dt>‘<samp class="samp">ev5</samp>’</dt> <dt>‘<samp class="samp">21164</samp>’</dt> <dd> +<p>Schedules as an EV5 and has no instruction set extensions. </p> </dd> <dt>‘<samp class="samp">ev56</samp>’</dt> <dt>‘<samp class="samp">21164a</samp>’</dt> <dd> +<p>Schedules as an EV5 and supports the BWX extension. </p> </dd> <dt>‘<samp class="samp">pca56</samp>’</dt> <dt>‘<samp class="samp">21164pc</samp>’</dt> <dt>‘<samp class="samp">21164PC</samp>’</dt> <dd> +<p>Schedules as an EV5 and supports the BWX and MAX extensions. </p> </dd> <dt>‘<samp class="samp">ev6</samp>’</dt> <dt>‘<samp class="samp">21264</samp>’</dt> <dd> +<p>Schedules as an EV6 and supports the BWX, FIX, and MAX extensions. </p> </dd> <dt>‘<samp class="samp">ev67</samp>’</dt> <dt>‘<samp class="samp">21264a</samp>’</dt> <dd><p>Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions. </p></dd> </dl> <p>Native toolchains also support the value ‘<samp class="samp">native</samp>’, which selects the best architecture option for the host processor. <samp class="option">-mcpu=native</samp> has no effect if GCC does not recognize the processor. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu_type</var></code><a class="copiable-link" href="#index-mtune-6"> ¶</a></span> +</dt> <dd> +<p>Set only the instruction scheduling parameters for machine type <var class="var">cpu_type</var>. The instruction set is not changed. </p> <p>Native toolchains also support the value ‘<samp class="samp">native</samp>’, which selects the best architecture option for the host processor. <samp class="option">-mtune=native</samp> has no effect if GCC does not recognize the processor. </p> </dd> <dt> +<span><code class="code">-mmemory-latency=<var class="var">time</var></code><a class="copiable-link" href="#index-mmemory-latency"> ¶</a></span> +</dt> <dd> +<p>Sets the latency the scheduler should assume for typical memory references as seen by the application. This number is highly dependent on the memory access patterns used by the application and the size of the external cache on the machine. </p> <p>Valid options for <var class="var">time</var> are </p> <dl class="table"> <dt>‘<samp class="samp"><var class="var">number</var></samp>’</dt> <dd> +<p>A decimal number representing clock cycles. </p> </dd> <dt>‘<samp class="samp">L1</samp>’</dt> <dt>‘<samp class="samp">L2</samp>’</dt> <dt>‘<samp class="samp">L3</samp>’</dt> <dt>‘<samp class="samp">main</samp>’</dt> <dd> +<p>The compiler contains estimates of the number of clock cycles for “typical” EV4 & EV5 hardware for the Level 1, 2 & 3 caches (also called Dcache, Scache, and Bcache), as well as to main memory. Note that L3 is only valid for EV5. </p> </dd> </dl> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="ebpf-options">eBPF Options</a>, Previous: <a href="darwin-options">Darwin Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/DEC-Alpha-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/DEC-Alpha-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/decimal-float.html b/devdocs/gcc~13/decimal-float.html new file mode 100644 index 00000000..e6d3a25c --- /dev/null +++ b/devdocs/gcc~13/decimal-float.html @@ -0,0 +1,8 @@ +<div class="section-level-extent" id="Decimal-Float"> <div class="nav-panel"> <p> Next: <a href="hex-floats" accesskey="n" rel="next">Hex Floats</a>, Previous: <a href="half-precision" accesskey="p" rel="prev">Half-Precision Floating Point</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Decimal-Floating-Types"><span>6.14 Decimal Floating Types<a class="copiable-link" href="#Decimal-Floating-Types"> ¶</a></span></h1> <p>As an extension, GNU C supports decimal floating types as defined in the N1312 draft of ISO/IEC WDTR24732. Support for decimal floating types in GCC will evolve as the draft technical report changes. Calling conventions for any target might also change. Not all targets support decimal floating types. </p> <p>The decimal floating types are <code class="code">_Decimal32</code>, <code class="code">_Decimal64</code>, and <code class="code">_Decimal128</code>. They use a radix of ten, unlike the floating types <code class="code">float</code>, <code class="code">double</code>, and <code class="code">long double</code> whose radix is not specified by the C standard but is usually two. </p> <p>Support for decimal floating types includes the arithmetic operators add, subtract, multiply, divide; unary arithmetic operators; relational operators; equality operators; and conversions to and from integer and other floating types. Use a suffix ‘<samp class="samp">df</samp>’ or ‘<samp class="samp">DF</samp>’ in a literal constant of type <code class="code">_Decimal32</code>, ‘<samp class="samp">dd</samp>’ or ‘<samp class="samp">DD</samp>’ for <code class="code">_Decimal64</code>, and ‘<samp class="samp">dl</samp>’ or ‘<samp class="samp">DL</samp>’ for <code class="code">_Decimal128</code>. </p> <p>GCC support of decimal float as specified by the draft technical report is incomplete: </p> <ul class="itemize mark-bullet"> <li>When the value of a decimal floating type cannot be represented in the integer type to which it is being converted, the result is undefined rather than the result value specified by the draft technical report. </li> +<li>GCC does not provide the C library functionality associated with <samp class="file">math.h</samp>, <samp class="file">fenv.h</samp>, <samp class="file">stdio.h</samp>, <samp class="file">stdlib.h</samp>, and <samp class="file">wchar.h</samp>, which must come from a separate C library implementation. Because of this the GNU C compiler does not define macro <code class="code">__STDC_DEC_FP__</code> to indicate that the implementation conforms to the technical report. </li> +</ul> <p>Types <code class="code">_Decimal32</code>, <code class="code">_Decimal64</code>, and <code class="code">_Decimal128</code> are supported by the DWARF debug information format. </p> </div> <div class="nav-panel"> <p> Next: <a href="hex-floats">Hex Floats</a>, Previous: <a href="half-precision">Half-Precision Floating Point</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Decimal-Float.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Decimal-Float.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/declarators-implementation.html b/devdocs/gcc~13/declarators-implementation.html new file mode 100644 index 00000000..17bf740c --- /dev/null +++ b/devdocs/gcc~13/declarators-implementation.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Declarators-implementation"> <div class="nav-panel"> <p> Next: <a href="statements-implementation" accesskey="n" rel="next">Statements</a>, Previous: <a href="qualifiers-implementation" accesskey="p" rel="prev">Qualifiers</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Declarators"><span>4.11 Declarators<a class="copiable-link" href="#Declarators"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>The maximum number of declarators that may modify an arithmetic, structure or union type (C90 6.5.4). <p>GCC is only limited by available memory. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Declarators-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Declarators-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/deprecated-features.html b/devdocs/gcc~13/deprecated-features.html new file mode 100644 index 00000000..4a40e920 --- /dev/null +++ b/devdocs/gcc~13/deprecated-features.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Deprecated-Features"> <div class="nav-panel"> <p> Next: <a href="backwards-compatibility" accesskey="n" rel="next">Backwards Compatibility</a>, Previous: <a href="c_002b_002b-concepts" accesskey="p" rel="prev">C++ Concepts</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Deprecated-Features-1"><span>7.11 Deprecated Features<a class="copiable-link" href="#Deprecated-Features-1"> ¶</a></span></h1> <p>In the past, the GNU C++ compiler was extended to experiment with new features, at a time when the C++ language was still evolving. Now that the C++ standard is complete, some of those features are superseded by superior alternatives. Using the old features might cause a warning in some cases that the feature will be dropped in the future. In other cases, the feature might be gone already. </p> <p>G++ allows a virtual function returning ‘<samp class="samp">void *</samp>’ to be overridden by one returning a different pointer type. This extension to the covariant return type rules is now deprecated and will be removed from a future version. </p> <p>The use of default arguments in function pointers, function typedefs and other places where they are not permitted by the standard is deprecated and will be removed from a future version of G++. </p> <p>G++ allows floating-point literals to appear in integral constant expressions, e.g. ‘<samp class="samp"> enum E { e = int(2.2 * 3.7) } </samp>’ This extension is deprecated and will be removed from a future version. </p> <p>G++ allows static data members of const floating-point type to be declared with an initializer in a class definition. The standard only allows initializers for static members of const integral types and const enumeration types so this extension has been deprecated and will be removed from a future version. </p> <p>G++ allows attributes to follow a parenthesized direct initializer, e.g. ‘<samp class="samp"> int f (0) __attribute__ ((something)); </samp>’ This extension has been ignored since G++ 3.3 and is deprecated. </p> <p>G++ allows anonymous structs and unions to have members that are not public non-static data members (i.e. fields). These extensions are deprecated. </p> </div> <div class="nav-panel"> <p> Next: <a href="backwards-compatibility">Backwards Compatibility</a>, Previous: <a href="c_002b_002b-concepts">C++ Concepts</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Deprecated-Features.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Deprecated-Features.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/designated-inits.html b/devdocs/gcc~13/designated-inits.html new file mode 100644 index 00000000..dcb5f8ff --- /dev/null +++ b/devdocs/gcc~13/designated-inits.html @@ -0,0 +1,22 @@ +<div class="section-level-extent" id="Designated-Inits"> <div class="nav-panel"> <p> Next: <a href="case-ranges" accesskey="n" rel="next">Case Ranges</a>, Previous: <a href="compound-literals" accesskey="p" rel="prev">Compound Literals</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Designated-Initializers"><span>6.29 Designated Initializers<a class="copiable-link" href="#Designated-Initializers"> ¶</a></span></h1> <p>Standard C90 requires the elements of an initializer to appear in a fixed order, the same as the order of the elements in the array or structure being initialized. </p> <p>In ISO C99 you can give the elements in any order, specifying the array indices or structure field names they apply to, and GNU C allows this as an extension in C90 mode as well. This extension is not implemented in GNU C++. </p> <p>To specify an array index, write ‘<samp class="samp">[<var class="var">index</var>] =</samp>’ before the element value. For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int a[6] = { [4] = 29, [2] = 15 };</pre> +</div> <p>is equivalent to </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int a[6] = { 0, 0, 15, 0, 29, 0 };</pre> +</div> <p>The index values must be constant expressions, even if the array being initialized is automatic. </p> <p>An alternative syntax for this that has been obsolete since GCC 2.5 but GCC still accepts is to write ‘<samp class="samp">[<var class="var">index</var>]</samp>’ before the element value, with no ‘<samp class="samp">=</samp>’. </p> <p>To initialize a range of elements to the same value, write ‘<samp class="samp">[<var class="var">first</var> ... <var class="var">last</var>] = <var class="var">value</var></samp>’. This is a GNU extension. For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };</pre> +</div> <p>If the value in it has side effects, the side effects happen only once, not for each initialized field by the range initializer. </p> <p>Note that the length of the array is the highest value specified plus one. </p> <p>In a structure initializer, specify the name of a field to initialize with ‘<samp class="samp">.<var class="var">fieldname</var> =</samp>’ before the element value. For example, given the following structure, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct point { int x, y; };</pre> +</div> <p>the following initialization </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct point p = { .y = yvalue, .x = xvalue };</pre> +</div> <p>is equivalent to </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct point p = { xvalue, yvalue };</pre> +</div> <p>Another syntax that has the same meaning, obsolete since GCC 2.5, is ‘<samp class="samp"><var class="var">fieldname</var>:</samp>’, as shown here: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct point p = { y: yvalue, x: xvalue };</pre> +</div> <p>Omitted fields are implicitly initialized the same as for objects that have static storage duration. </p> <p>The ‘<samp class="samp">[<var class="var">index</var>]</samp>’ or ‘<samp class="samp">.<var class="var">fieldname</var></samp>’ is known as a <em class="dfn">designator</em>. You can also use a designator (or the obsolete colon syntax) when initializing a union, to specify which element of the union should be used. For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">union foo { int i; double d; }; + +union foo f = { .d = 4 };</pre> +</div> <p>converts 4 to a <code class="code">double</code> to store it in the union using the second element. By contrast, casting 4 to type <code class="code">union foo</code> stores it into the union as the integer <code class="code">i</code>, since it is an integer. See <a class="xref" href="cast-to-union">Cast to a Union Type</a>. </p> <p>You can combine this technique of naming elements with ordinary C initialization of successive elements. Each initializer element that does not have a designator applies to the next consecutive element of the array or structure. For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int a[6] = { [1] = v1, v2, [4] = v4 };</pre> +</div> <p>is equivalent to </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int a[6] = { 0, v1, v2, 0, v4, 0 };</pre> +</div> <p>Labeling the elements of an array initializer is especially useful when the indices are characters or belong to an <code class="code">enum</code> type. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int whitespace[256] + = { [' '] = 1, ['\t'] = 1, ['\h'] = 1, + ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 };</pre> +</div> <p>You can also write a series of ‘<samp class="samp">.<var class="var">fieldname</var></samp>’ and ‘<samp class="samp">[<var class="var">index</var>]</samp>’ designators before an ‘<samp class="samp">=</samp>’ to specify a nested subobject to initialize; the list is taken relative to the subobject corresponding to the closest surrounding brace pair. For example, with the ‘<samp class="samp">struct point</samp>’ declaration above: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct point ptarray[10] = { [2].y = yv2, [2].x = xv2, [0].x = xv0 };</pre> +</div> <p>If the same field is initialized multiple times, or overlapping fields of a union are initialized, the value from the last initialization is used. When a field of a union is itself a structure, the entire structure from the last field initialized is used. If any previous initializer has side effect, it is unspecified whether the side effect happens or not. Currently, GCC discards the side-effecting initializer expressions and issues a warning. </p> </div> <div class="nav-panel"> <p> Next: <a href="case-ranges">Case Ranges</a>, Previous: <a href="compound-literals">Compound Literals</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Designated-Inits.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Designated-Inits.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/developer-options.html b/devdocs/gcc~13/developer-options.html new file mode 100644 index 00000000..c36d6331 --- /dev/null +++ b/devdocs/gcc~13/developer-options.html @@ -0,0 +1,403 @@ +<div class="section-level-extent" id="Developer-Options"> <div class="nav-panel"> <p> Next: <a href="submodel-options" accesskey="n" rel="next">Machine-Dependent Options</a>, Previous: <a href="code-gen-options" accesskey="p" rel="prev">Options for Code Generation Conventions</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="GCC-Developer-Options"><span>3.18 GCC Developer Options<a class="copiable-link" href="#GCC-Developer-Options"> ¶</a></span></h1> <p>This section describes command-line options that are primarily of interest to GCC developers, including options to support compiler testing and investigation of compiler bugs and compile-time performance problems. This includes options that produce debug dumps at various points in the compilation; that print statistics such as memory use and execution time; and that print information about GCC’s configuration, such as where it searches for libraries. You should rarely need to use any of these options for ordinary compilation and linking tasks. </p> <p>Many developer options that cause GCC to dump output to a file take an optional ‘<samp class="samp">=<var class="var">filename</var></samp>’ suffix. You can specify ‘<samp class="samp">stdout</samp>’ or ‘<samp class="samp">-</samp>’ to dump to standard output, and ‘<samp class="samp">stderr</samp>’ for standard error. </p> <p>If ‘<samp class="samp">=<var class="var">filename</var></samp>’ is omitted, a default dump file name is constructed by concatenating the base dump file name, a pass number, phase letter, and pass name. The base dump file name is the name of output file produced by the compiler if explicitly specified and not an executable; otherwise it is the source file name. The pass number is determined by the order passes are registered with the compiler’s pass manager. This is generally the same as the order of execution, but passes registered by plugins, target-specific passes, or passes that are otherwise registered late are numbered higher than the pass named ‘<samp class="samp">final</samp>’, even if they are executed earlier. The phase letter is one of ‘<samp class="samp">i</samp>’ (inter-procedural analysis), ‘<samp class="samp">l</samp>’ (language-specific), ‘<samp class="samp">r</samp>’ (RTL), or ‘<samp class="samp">t</samp>’ (tree). The files are created in the directory of the output file. </p> <dl class="table"> <dt> +<span><code class="code">-fcallgraph-info</code><a class="copiable-link" href="#index-fcallgraph-info"> ¶</a></span> +</dt> <dt><code class="code">-fcallgraph-info=<var class="var">MARKERS</var></code></dt> <dd> +<p>Makes the compiler output callgraph information for the program, on a per-object-file basis. The information is generated in the common VCG format. It can be decorated with additional, per-node and/or per-edge information, if a list of comma-separated markers is additionally specified. When the <code class="code">su</code> marker is specified, the callgraph is decorated with stack usage information; it is equivalent to <samp class="option">-fstack-usage</samp>. When the <code class="code">da</code> marker is specified, the callgraph is decorated with information about dynamically allocated objects. </p> <p>When compiling with <samp class="option">-flto</samp>, no callgraph information is output along with the object file. At LTO link time, <samp class="option">-fcallgraph-info</samp> may generate multiple callgraph information files next to intermediate LTO output files. </p> </dd> <dt> + <span><code class="code">-d<var class="var">letters</var></code><a class="copiable-link" href="#index-d-1"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-<var class="var">pass</var></code></dt> <dt><code class="code">-fdump-rtl-<var class="var">pass</var>=<var class="var">filename</var></code></dt> <dd> +<p>Says to make debugging dumps during compilation at times specified by <var class="var">letters</var>. This is used for debugging the RTL-based passes of the compiler. </p> <p>Some <samp class="option">-d<var class="var">letters</var></samp> switches have different meaning when <samp class="option">-E</samp> is used for preprocessing. See <a class="xref" href="preprocessor-options">Options Controlling the Preprocessor</a>, for information about preprocessor-specific dump options. </p> <p>Debug dumps can be enabled with a <samp class="option">-fdump-rtl</samp> switch or some <samp class="option">-d</samp> option <var class="var">letters</var>. Here are the possible letters for use in <var class="var">pass</var> and <var class="var">letters</var>, and their meanings: </p> <dl class="table"> <dt> +<span><code class="code">-fdump-rtl-alignments</code><a class="copiable-link" href="#index-fdump-rtl-alignments"> ¶</a></span> +</dt> <dd> +<p>Dump after branch alignments have been computed. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-asmcons</code><a class="copiable-link" href="#index-fdump-rtl-asmcons"> ¶</a></span> +</dt> <dd> +<p>Dump after fixing rtl statements that have unsatisfied in/out constraints. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-auto_inc_dec</code><a class="copiable-link" href="#index-fdump-rtl-auto_005finc_005fdec"> ¶</a></span> +</dt> <dd> +<p>Dump after auto-inc-dec discovery. This pass is only run on architectures that have auto inc or auto dec instructions. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-barriers</code><a class="copiable-link" href="#index-fdump-rtl-barriers"> ¶</a></span> +</dt> <dd> +<p>Dump after cleaning up the barrier instructions. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-bbpart</code><a class="copiable-link" href="#index-fdump-rtl-bbpart"> ¶</a></span> +</dt> <dd> +<p>Dump after partitioning hot and cold basic blocks. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-bbro</code><a class="copiable-link" href="#index-fdump-rtl-bbro"> ¶</a></span> +</dt> <dd> +<p>Dump after block reordering. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-btl1</code><a class="copiable-link" href="#index-fdump-rtl-btl2"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-btl2</code></dt> <dd> +<p><samp class="option">-fdump-rtl-btl1</samp> and <samp class="option">-fdump-rtl-btl2</samp> enable dumping after the two branch target load optimization passes. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-bypass</code><a class="copiable-link" href="#index-fdump-rtl-bypass"> ¶</a></span> +</dt> <dd> +<p>Dump after jump bypassing and control flow optimizations. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-combine</code><a class="copiable-link" href="#index-fdump-rtl-combine"> ¶</a></span> +</dt> <dd> +<p>Dump after the RTL instruction combination pass. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-compgotos</code><a class="copiable-link" href="#index-fdump-rtl-compgotos"> ¶</a></span> +</dt> <dd> +<p>Dump after duplicating the computed gotos. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-ce1</code><a class="copiable-link" href="#index-fdump-rtl-ce1"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-ce2</code></dt> <dt><code class="code">-fdump-rtl-ce3</code></dt> <dd> +<p><samp class="option">-fdump-rtl-ce1</samp>, <samp class="option">-fdump-rtl-ce2</samp>, and <samp class="option">-fdump-rtl-ce3</samp> enable dumping after the three if conversion passes. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-cprop_hardreg</code><a class="copiable-link" href="#index-fdump-rtl-cprop_005fhardreg"> ¶</a></span> +</dt> <dd> +<p>Dump after hard register copy propagation. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-csa</code><a class="copiable-link" href="#index-fdump-rtl-csa"> ¶</a></span> +</dt> <dd> +<p>Dump after combining stack adjustments. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-cse1</code><a class="copiable-link" href="#index-fdump-rtl-cse1"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-cse2</code></dt> <dd> +<p><samp class="option">-fdump-rtl-cse1</samp> and <samp class="option">-fdump-rtl-cse2</samp> enable dumping after the two common subexpression elimination passes. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-dce</code><a class="copiable-link" href="#index-fdump-rtl-dce"> ¶</a></span> +</dt> <dd> +<p>Dump after the standalone dead code elimination passes. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-dbr</code><a class="copiable-link" href="#index-fdump-rtl-dbr"> ¶</a></span> +</dt> <dd> +<p>Dump after delayed branch scheduling. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-dce1</code><a class="copiable-link" href="#index-fdump-rtl-dce1"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-dce2</code></dt> <dd> +<p><samp class="option">-fdump-rtl-dce1</samp> and <samp class="option">-fdump-rtl-dce2</samp> enable dumping after the two dead store elimination passes. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-eh</code><a class="copiable-link" href="#index-fdump-rtl-eh"> ¶</a></span> +</dt> <dd> +<p>Dump after finalization of EH handling code. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-eh_ranges</code><a class="copiable-link" href="#index-fdump-rtl-eh_005franges"> ¶</a></span> +</dt> <dd> +<p>Dump after conversion of EH handling range regions. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-expand</code><a class="copiable-link" href="#index-fdump-rtl-expand"> ¶</a></span> +</dt> <dd> +<p>Dump after RTL generation. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-fwprop1</code><a class="copiable-link" href="#index-fdump-rtl-fwprop1"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-fwprop2</code></dt> <dd> +<p><samp class="option">-fdump-rtl-fwprop1</samp> and <samp class="option">-fdump-rtl-fwprop2</samp> enable dumping after the two forward propagation passes. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-gcse1</code><a class="copiable-link" href="#index-fdump-rtl-gcse1"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-gcse2</code></dt> <dd> +<p><samp class="option">-fdump-rtl-gcse1</samp> and <samp class="option">-fdump-rtl-gcse2</samp> enable dumping after global common subexpression elimination. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-init-regs</code><a class="copiable-link" href="#index-fdump-rtl-init-regs"> ¶</a></span> +</dt> <dd> +<p>Dump after the initialization of the registers. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-initvals</code><a class="copiable-link" href="#index-fdump-rtl-initvals"> ¶</a></span> +</dt> <dd> +<p>Dump after the computation of the initial value sets. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-into_cfglayout</code><a class="copiable-link" href="#index-fdump-rtl-into_005fcfglayout"> ¶</a></span> +</dt> <dd> +<p>Dump after converting to cfglayout mode. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-ira</code><a class="copiable-link" href="#index-fdump-rtl-ira"> ¶</a></span> +</dt> <dd> +<p>Dump after iterated register allocation. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-jump</code><a class="copiable-link" href="#index-fdump-rtl-jump"> ¶</a></span> +</dt> <dd> +<p>Dump after the second jump optimization. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-loop2</code><a class="copiable-link" href="#index-fdump-rtl-loop2"> ¶</a></span> +</dt> <dd> +<p><samp class="option">-fdump-rtl-loop2</samp> enables dumping after the rtl loop optimization passes. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-mach</code><a class="copiable-link" href="#index-fdump-rtl-mach"> ¶</a></span> +</dt> <dd> +<p>Dump after performing the machine dependent reorganization pass, if that pass exists. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-mode_sw</code><a class="copiable-link" href="#index-fdump-rtl-mode_005fsw"> ¶</a></span> +</dt> <dd> +<p>Dump after removing redundant mode switches. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-rnreg</code><a class="copiable-link" href="#index-fdump-rtl-rnreg"> ¶</a></span> +</dt> <dd> +<p>Dump after register renumbering. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-outof_cfglayout</code><a class="copiable-link" href="#index-fdump-rtl-outof_005fcfglayout"> ¶</a></span> +</dt> <dd> +<p>Dump after converting from cfglayout mode. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-peephole2</code><a class="copiable-link" href="#index-fdump-rtl-peephole2"> ¶</a></span> +</dt> <dd> +<p>Dump after the peephole pass. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-postreload</code><a class="copiable-link" href="#index-fdump-rtl-postreload"> ¶</a></span> +</dt> <dd> +<p>Dump after post-reload optimizations. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-pro_and_epilogue</code><a class="copiable-link" href="#index-fdump-rtl-pro_005fand_005fepilogue"> ¶</a></span> +</dt> <dd> +<p>Dump after generating the function prologues and epilogues. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-sched1</code><a class="copiable-link" href="#index-fdump-rtl-sched1"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-sched2</code></dt> <dd> +<p><samp class="option">-fdump-rtl-sched1</samp> and <samp class="option">-fdump-rtl-sched2</samp> enable dumping after the basic block scheduling passes. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-ree</code><a class="copiable-link" href="#index-fdump-rtl-ree"> ¶</a></span> +</dt> <dd> +<p>Dump after sign/zero extension elimination. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-seqabstr</code><a class="copiable-link" href="#index-fdump-rtl-seqabstr"> ¶</a></span> +</dt> <dd> +<p>Dump after common sequence discovery. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-shorten</code><a class="copiable-link" href="#index-fdump-rtl-shorten"> ¶</a></span> +</dt> <dd> +<p>Dump after shortening branches. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-sibling</code><a class="copiable-link" href="#index-fdump-rtl-sibling"> ¶</a></span> +</dt> <dd> +<p>Dump after sibling call optimizations. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-split1</code><a class="copiable-link" href="#index-fdump-rtl-split1"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-split2</code></dt> <dt><code class="code">-fdump-rtl-split3</code></dt> <dt><code class="code">-fdump-rtl-split4</code></dt> <dt><code class="code">-fdump-rtl-split5</code></dt> <dd> +<p>These options enable dumping after five rounds of instruction splitting. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-sms</code><a class="copiable-link" href="#index-fdump-rtl-sms"> ¶</a></span> +</dt> <dd> +<p>Dump after modulo scheduling. This pass is only run on some architectures. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-stack</code><a class="copiable-link" href="#index-fdump-rtl-stack"> ¶</a></span> +</dt> <dd> +<p>Dump after conversion from GCC’s “flat register file” registers to the x87’s stack-like registers. This pass is only run on x86 variants. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-subreg1</code><a class="copiable-link" href="#index-fdump-rtl-subreg1"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-subreg2</code></dt> <dd> +<p><samp class="option">-fdump-rtl-subreg1</samp> and <samp class="option">-fdump-rtl-subreg2</samp> enable dumping after the two subreg expansion passes. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-unshare</code><a class="copiable-link" href="#index-fdump-rtl-unshare"> ¶</a></span> +</dt> <dd> +<p>Dump after all rtl has been unshared. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-vartrack</code><a class="copiable-link" href="#index-fdump-rtl-vartrack"> ¶</a></span> +</dt> <dd> +<p>Dump after variable tracking. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-vregs</code><a class="copiable-link" href="#index-fdump-rtl-vregs"> ¶</a></span> +</dt> <dd> +<p>Dump after converting virtual registers to hard registers. </p> </dd> <dt> +<span><code class="code">-fdump-rtl-web</code><a class="copiable-link" href="#index-fdump-rtl-web"> ¶</a></span> +</dt> <dd> +<p>Dump after live range splitting. </p> </dd> <dt> + <span><code class="code">-fdump-rtl-regclass</code><a class="copiable-link" href="#index-fdump-rtl-regclass"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-subregs_of_mode_init</code></dt> <dt><code class="code">-fdump-rtl-subregs_of_mode_finish</code></dt> <dt><code class="code">-fdump-rtl-dfinit</code></dt> <dt><code class="code">-fdump-rtl-dfinish</code></dt> <dd> +<p>These dumps are defined but always produce empty files. </p> </dd> <dt> + <span><code class="code">-da</code><a class="copiable-link" href="#index-da"> ¶</a></span> +</dt> <dt><code class="code">-fdump-rtl-all</code></dt> <dd> +<p>Produce all the dumps listed above. </p> </dd> <dt> +<span><code class="code">-dA</code><a class="copiable-link" href="#index-dA"> ¶</a></span> +</dt> <dd> +<p>Annotate the assembler output with miscellaneous debugging information. </p> </dd> <dt> +<span><code class="code">-dD</code><a class="copiable-link" href="#index-dD-1"> ¶</a></span> +</dt> <dd> +<p>Dump all macro definitions, at the end of preprocessing, in addition to normal output. </p> </dd> <dt> +<span><code class="code">-dH</code><a class="copiable-link" href="#index-dH"> ¶</a></span> +</dt> <dd> +<p>Produce a core dump whenever an error occurs. </p> </dd> <dt> +<span><code class="code">-dp</code><a class="copiable-link" href="#index-dp"> ¶</a></span> +</dt> <dd> +<p>Annotate the assembler output with a comment indicating which pattern and alternative is used. The length and cost of each instruction are also printed. </p> </dd> <dt> +<span><code class="code">-dP</code><a class="copiable-link" href="#index-dP"> ¶</a></span> +</dt> <dd> +<p>Dump the RTL in the assembler output as a comment before each instruction. Also turns on <samp class="option">-dp</samp> annotation. </p> </dd> <dt> +<span><code class="code">-dx</code><a class="copiable-link" href="#index-dx"> ¶</a></span> +</dt> <dd><p>Just generate RTL for a function instead of compiling it. Usually used with <samp class="option">-fdump-rtl-expand</samp>. </p></dd> </dl> </dd> <dt> +<span><code class="code">-fdump-debug</code><a class="copiable-link" href="#index-fdump-debug"> ¶</a></span> +</dt> <dd> +<p>Dump debugging information generated during the debug generation phase. </p> </dd> <dt> +<span><code class="code">-fdump-earlydebug</code><a class="copiable-link" href="#index-fdump-earlydebug"> ¶</a></span> +</dt> <dd> +<p>Dump debugging information generated during the early debug generation phase. </p> </dd> <dt> +<span><code class="code">-fdump-noaddr</code><a class="copiable-link" href="#index-fdump-noaddr"> ¶</a></span> +</dt> <dd> +<p>When doing debugging dumps, suppress address output. This makes it more feasible to use diff on debugging dumps for compiler invocations with different compiler binaries and/or different text / bss / data / heap / stack / dso start locations. </p> </dd> <dt> +<span><code class="code">-freport-bug</code><a class="copiable-link" href="#index-freport-bug"> ¶</a></span> +</dt> <dd> +<p>Collect and dump debug information into a temporary file if an internal compiler error (ICE) occurs. </p> </dd> <dt> +<span><code class="code">-fdump-unnumbered</code><a class="copiable-link" href="#index-fdump-unnumbered"> ¶</a></span> +</dt> <dd> +<p>When doing debugging dumps, suppress instruction numbers and address output. This makes it more feasible to use diff on debugging dumps for compiler invocations with different options, in particular with and without <samp class="option">-g</samp>. </p> </dd> <dt> +<span><code class="code">-fdump-unnumbered-links</code><a class="copiable-link" href="#index-fdump-unnumbered-links"> ¶</a></span> +</dt> <dd> +<p>When doing debugging dumps (see <samp class="option">-d</samp> option above), suppress instruction numbers for the links to the previous and next instructions in a sequence. </p> </dd> <dt> +<span><code class="code">-fdump-ipa-<var class="var">switch</var></code><a class="copiable-link" href="#index-fdump-ipa"> ¶</a></span> +</dt> <dt><code class="code">-fdump-ipa-<var class="var">switch</var>-<var class="var">options</var></code></dt> <dd> +<p>Control the dumping at various stages of inter-procedural analysis language tree to a file. The file name is generated by appending a switch specific suffix to the source file name, and the file is created in the same directory as the output file. The following dumps are possible: </p> <dl class="table"> <dt>‘<samp class="samp">all</samp>’</dt> <dd> +<p>Enables all inter-procedural analysis dumps. </p> </dd> <dt>‘<samp class="samp">cgraph</samp>’</dt> <dd> +<p>Dumps information about call-graph optimization, unused function removal, and inlining decisions. </p> </dd> <dt>‘<samp class="samp">inline</samp>’</dt> <dd> +<p>Dump after function inlining. </p> </dd> </dl> <p>Additionally, the options <samp class="option">-optimized</samp>, <samp class="option">-missed</samp>, <samp class="option">-note</samp>, and <samp class="option">-all</samp> can be provided, with the same meaning as for <samp class="option">-fopt-info</samp>, defaulting to <samp class="option">-optimized</samp>. </p> <p>For example, <samp class="option">-fdump-ipa-inline-optimized-missed</samp> will emit information on callsites that were inlined, along with callsites that were not inlined. </p> <p>By default, the dump will contain messages about successful optimizations (equivalent to <samp class="option">-optimized</samp>) together with low-level details about the analysis. </p> </dd> <dt> +<span><code class="code">-fdump-lang</code><a class="copiable-link" href="#index-fdump-lang"> ¶</a></span> +</dt> <dd> +<p>Dump language-specific information. The file name is made by appending <samp class="file">.lang</samp> to the source file name. </p> </dd> <dt> + <span><code class="code">-fdump-lang-all</code><a class="copiable-link" href="#index-fdump-lang-all"> ¶</a></span> +</dt> <dt><code class="code">-fdump-lang-<var class="var">switch</var></code></dt> <dt><code class="code">-fdump-lang-<var class="var">switch</var>-<var class="var">options</var></code></dt> <dt><code class="code">-fdump-lang-<var class="var">switch</var>-<var class="var">options</var>=<var class="var">filename</var></code></dt> <dd> +<p>Control the dumping of language-specific information. The <var class="var">options</var> and <var class="var">filename</var> portions behave as described in the <samp class="option">-fdump-tree</samp> option. The following <var class="var">switch</var> values are accepted: </p> <dl class="table"> <dt>‘<samp class="samp">all</samp>’</dt> <dd> <p>Enable all language-specific dumps. </p> </dd> <dt>‘<samp class="samp">class</samp>’</dt> <dd> +<p>Dump class hierarchy information. Virtual table information is emitted unless ’<samp class="option">slim</samp>’ is specified. This option is applicable to C++ only. </p> </dd> <dt>‘<samp class="samp">module</samp>’</dt> <dd> +<p>Dump module information. Options <samp class="option">lineno</samp> (locations), <samp class="option">graph</samp> (reachability), <samp class="option">blocks</samp> (clusters), <samp class="option">uid</samp> (serialization), <samp class="option">alias</samp> (mergeable), <samp class="option">asmname</samp> (Elrond), <samp class="option">eh</samp> (mapper) & <samp class="option">vops</samp> (macros) may provide additional information. This option is applicable to C++ only. </p> </dd> <dt>‘<samp class="samp">raw</samp>’</dt> <dd> +<p>Dump the raw internal tree data. This option is applicable to C++ only. </p> </dd> </dl> </dd> <dt> +<span><code class="code">-fdump-passes</code><a class="copiable-link" href="#index-fdump-passes"> ¶</a></span> +</dt> <dd> +<p>Print on <samp class="file">stderr</samp> the list of optimization passes that are turned on and off by the current command-line options. </p> </dd> <dt> +<span><code class="code">-fdump-statistics-<var class="var">option</var></code><a class="copiable-link" href="#index-fdump-statistics"> ¶</a></span> +</dt> <dd> +<p>Enable and control dumping of pass statistics in a separate file. The file name is generated by appending a suffix ending in ‘<samp class="samp">.statistics</samp>’ to the source file name, and the file is created in the same directory as the output file. If the ‘<samp class="samp">-<var class="var">option</var></samp>’ form is used, ‘<samp class="samp">-stats</samp>’ causes counters to be summed over the whole compilation unit while ‘<samp class="samp">-details</samp>’ dumps every event as the passes generate them. The default with no option is to sum counters for each function compiled. </p> </dd> <dt> + <span><code class="code">-fdump-tree-all</code><a class="copiable-link" href="#index-fdump-tree-all"> ¶</a></span> +</dt> <dt><code class="code">-fdump-tree-<var class="var">switch</var></code></dt> <dt><code class="code">-fdump-tree-<var class="var">switch</var>-<var class="var">options</var></code></dt> <dt><code class="code">-fdump-tree-<var class="var">switch</var>-<var class="var">options</var>=<var class="var">filename</var></code></dt> <dd> +<p>Control the dumping at various stages of processing the intermediate language tree to a file. If the ‘<samp class="samp">-<var class="var">options</var></samp>’ form is used, <var class="var">options</var> is a list of ‘<samp class="samp">-</samp>’ separated options which control the details of the dump. Not all options are applicable to all dumps; those that are not meaningful are ignored. The following options are available </p> <dl class="table"> <dt>‘<samp class="samp">address</samp>’</dt> <dd><p>Print the address of each node. Usually this is not meaningful as it changes according to the environment and source file. Its primary use is for tying up a dump file with a debug environment. </p></dd> <dt>‘<samp class="samp">asmname</samp>’</dt> <dd><p>If <code class="code">DECL_ASSEMBLER_NAME</code> has been set for a given decl, use that in the dump instead of <code class="code">DECL_NAME</code>. Its primary use is ease of use working backward from mangled names in the assembly file. </p></dd> <dt>‘<samp class="samp">slim</samp>’</dt> <dd> +<p>When dumping front-end intermediate representations, inhibit dumping of members of a scope or body of a function merely because that scope has been reached. Only dump such items when they are directly reachable by some other path. </p> <p>When dumping pretty-printed trees, this option inhibits dumping the bodies of control structures. </p> <p>When dumping RTL, print the RTL in slim (condensed) form instead of the default LISP-like representation. </p> +</dd> <dt>‘<samp class="samp">raw</samp>’</dt> <dd><p>Print a raw representation of the tree. By default, trees are pretty-printed into a C-like representation. </p></dd> <dt>‘<samp class="samp">details</samp>’</dt> <dd><p>Enable more detailed dumps (not honored by every dump option). Also include information from the optimization passes. </p></dd> <dt>‘<samp class="samp">stats</samp>’</dt> <dd><p>Enable dumping various statistics about the pass (not honored by every dump option). </p></dd> <dt>‘<samp class="samp">blocks</samp>’</dt> <dd><p>Enable showing basic block boundaries (disabled in raw dumps). </p></dd> <dt>‘<samp class="samp">graph</samp>’</dt> <dd> +<p>For each of the other indicated dump files (<samp class="option">-fdump-rtl-<var class="var">pass</var></samp>), dump a representation of the control flow graph suitable for viewing with GraphViz to <samp class="file"><var class="var">file</var>.<var class="var">passid</var>.<var class="var">pass</var>.dot</samp>. Each function in the file is pretty-printed as a subgraph, so that GraphViz can render them all in a single plot. </p> <p>This option currently only works for RTL dumps, and the RTL is always dumped in slim form. </p> +</dd> <dt>‘<samp class="samp">vops</samp>’</dt> <dd><p>Enable showing virtual operands for every statement. </p></dd> <dt>‘<samp class="samp">lineno</samp>’</dt> <dd><p>Enable showing line numbers for statements. </p></dd> <dt>‘<samp class="samp">uid</samp>’</dt> <dd><p>Enable showing the unique ID (<code class="code">DECL_UID</code>) for each variable. </p></dd> <dt>‘<samp class="samp">verbose</samp>’</dt> <dd><p>Enable showing the tree dump for each statement. </p></dd> <dt>‘<samp class="samp">eh</samp>’</dt> <dd><p>Enable showing the EH region number holding each statement. </p></dd> <dt>‘<samp class="samp">scev</samp>’</dt> <dd><p>Enable showing scalar evolution analysis details. </p></dd> <dt>‘<samp class="samp">optimized</samp>’</dt> <dd><p>Enable showing optimization information (only available in certain passes). </p></dd> <dt>‘<samp class="samp">missed</samp>’</dt> <dd><p>Enable showing missed optimization information (only available in certain passes). </p></dd> <dt>‘<samp class="samp">note</samp>’</dt> <dd><p>Enable other detailed optimization information (only available in certain passes). </p></dd> <dt>‘<samp class="samp">all</samp>’</dt> <dd><p>Turn on all options, except <samp class="option">raw</samp>, <samp class="option">slim</samp>, <samp class="option">verbose</samp> and <samp class="option">lineno</samp>. </p></dd> <dt>‘<samp class="samp">optall</samp>’</dt> <dd><p>Turn on all optimization options, i.e., <samp class="option">optimized</samp>, <samp class="option">missed</samp>, and <samp class="option">note</samp>. </p></dd> </dl> <p>To determine what tree dumps are available or find the dump for a pass of interest follow the steps below. </p> <ol class="enumerate"> <li> Invoke GCC with <samp class="option">-fdump-passes</samp> and in the <samp class="file">stderr</samp> output look for a code that corresponds to the pass you are interested in. For example, the codes <code class="code">tree-evrp</code>, <code class="code">tree-vrp1</code>, and <code class="code">tree-vrp2</code> correspond to the three Value Range Propagation passes. The number at the end distinguishes distinct invocations of the same pass. </li> +<li> To enable the creation of the dump file, append the pass code to the <samp class="option">-fdump-</samp> option prefix and invoke GCC with it. For example, to enable the dump from the Early Value Range Propagation pass, invoke GCC with the <samp class="option">-fdump-tree-evrp</samp> option. Optionally, you may specify the name of the dump file. If you don’t specify one, GCC creates as described below. </li> +<li> Find the pass dump in a file whose name is composed of three components separated by a period: the name of the source file GCC was invoked to compile, a numeric suffix indicating the pass number followed by the letter ‘<samp class="samp">t</samp>’ for tree passes (and the letter ‘<samp class="samp">r</samp>’ for RTL passes), and finally the pass code. For example, the Early VRP pass dump might be in a file named <samp class="file">myfile.c.038t.evrp</samp> in the current working directory. Note that the numeric codes are not stable and may change from one version of GCC to another. </li> +</ol> </dd> <dt> +<span><code class="code">-fopt-info</code><a class="copiable-link" href="#index-fopt-info"> ¶</a></span> +</dt> <dt><code class="code">-fopt-info-<var class="var">options</var></code></dt> <dt><code class="code">-fopt-info-<var class="var">options</var>=<var class="var">filename</var></code></dt> <dd> +<p>Controls optimization dumps from various optimization passes. If the ‘<samp class="samp">-<var class="var">options</var></samp>’ form is used, <var class="var">options</var> is a list of ‘<samp class="samp">-</samp>’ separated option keywords to select the dump details and optimizations. </p> <p>The <var class="var">options</var> can be divided into three groups: </p> +<ol class="enumerate"> <li> options describing what kinds of messages should be emitted, </li> +<li> options describing the verbosity of the dump, and </li> +<li> options describing which optimizations should be included. </li> +</ol> <p>The options from each group can be freely mixed as they are non-overlapping. However, in case of any conflicts, the later options override the earlier options on the command line. </p> <p>The following options control which kinds of messages should be emitted: </p> <dl class="table"> <dt>‘<samp class="samp">optimized</samp>’</dt> <dd><p>Print information when an optimization is successfully applied. It is up to a pass to decide which information is relevant. For example, the vectorizer passes print the source location of loops which are successfully vectorized. </p></dd> <dt>‘<samp class="samp">missed</samp>’</dt> <dd><p>Print information about missed optimizations. Individual passes control which information to include in the output. </p></dd> <dt>‘<samp class="samp">note</samp>’</dt> <dd><p>Print verbose information about optimizations, such as certain transformations, more detailed messages about decisions etc. </p></dd> <dt>‘<samp class="samp">all</samp>’</dt> <dd><p>Print detailed optimization information. This includes ‘<samp class="samp">optimized</samp>’, ‘<samp class="samp">missed</samp>’, and ‘<samp class="samp">note</samp>’. </p></dd> </dl> <p>The following option controls the dump verbosity: </p> <dl class="table"> <dt>‘<samp class="samp">internals</samp>’</dt> <dd><p>By default, only “high-level” messages are emitted. This option enables additional, more detailed, messages, which are likely to only be of interest to GCC developers. </p></dd> </dl> <p>One or more of the following option keywords can be used to describe a group of optimizations: </p> <dl class="table"> <dt>‘<samp class="samp">ipa</samp>’</dt> <dd><p>Enable dumps from all interprocedural optimizations. </p></dd> <dt>‘<samp class="samp">loop</samp>’</dt> <dd><p>Enable dumps from all loop optimizations. </p></dd> <dt>‘<samp class="samp">inline</samp>’</dt> <dd><p>Enable dumps from all inlining optimizations. </p></dd> <dt>‘<samp class="samp">omp</samp>’</dt> <dd><p>Enable dumps from all OMP (Offloading and Multi Processing) optimizations. </p></dd> <dt>‘<samp class="samp">vec</samp>’</dt> <dd><p>Enable dumps from all vectorization optimizations. </p></dd> <dt>‘<samp class="samp">optall</samp>’</dt> <dd><p>Enable dumps from all optimizations. This is a superset of the optimization groups listed above. </p></dd> </dl> <p>If <var class="var">options</var> is omitted, it defaults to ‘<samp class="samp">optimized-optall</samp>’, which means to dump messages about successful optimizations from all the passes, omitting messages that are treated as “internals”. </p> <p>If the <var class="var">filename</var> is provided, then the dumps from all the applicable optimizations are concatenated into the <var class="var">filename</var>. Otherwise the dump is output onto <samp class="file">stderr</samp>. Though multiple <samp class="option">-fopt-info</samp> options are accepted, only one of them can include a <var class="var">filename</var>. If other filenames are provided then all but the first such option are ignored. </p> <p>Note that the output <var class="var">filename</var> is overwritten in case of multiple translation units. If a combined output from multiple translation units is desired, <samp class="file">stderr</samp> should be used instead. </p> <p>In the following example, the optimization info is output to <samp class="file">stderr</samp>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -O3 -fopt-info</pre> +</div> <p>This example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -O3 -fopt-info-missed=missed.all</pre> +</div> <p>outputs missed optimization report from all the passes into <samp class="file">missed.all</samp>, and this one: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -O2 -ftree-vectorize -fopt-info-vec-missed</pre> +</div> <p>prints information about missed optimization opportunities from vectorization passes on <samp class="file">stderr</samp>. Note that <samp class="option">-fopt-info-vec-missed</samp> is equivalent to <samp class="option">-fopt-info-missed-vec</samp>. The order of the optimization group names and message types listed after <samp class="option">-fopt-info</samp> does not matter. </p> <p>As another example, </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -O3 -fopt-info-inline-optimized-missed=inline.txt</pre> +</div> <p>outputs information about missed optimizations as well as optimized locations from all the inlining passes into <samp class="file">inline.txt</samp>. </p> <p>Finally, consider: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt</pre> +</div> <p>Here the two output filenames <samp class="file">vec.miss</samp> and <samp class="file">loop.opt</samp> are in conflict since only one output file is allowed. In this case, only the first option takes effect and the subsequent options are ignored. Thus only <samp class="file">vec.miss</samp> is produced which contains dumps from the vectorizer about missed opportunities. </p> </dd> <dt> +<span><code class="code">-fsave-optimization-record</code><a class="copiable-link" href="#index-fsave-optimization-record"> ¶</a></span> +</dt> <dd> +<p>Write a SRCFILE.opt-record.json.gz file detailing what optimizations were performed, for those optimizations that support <samp class="option">-fopt-info</samp>. </p> <p>This option is experimental and the format of the data within the compressed JSON file is subject to change. </p> <p>It is roughly equivalent to a machine-readable version of <samp class="option">-fopt-info-all</samp>, as a collection of messages with source file, line number and column number, with the following additional data for each message: </p> <ul class="itemize mark-bullet"> <li>the execution count of the code being optimized, along with metadata about whether this was from actual profile data, or just an estimate, allowing consumers to prioritize messages by code hotness, </li> +<li>the function name of the code being optimized, where applicable, </li> +<li>the “inlining chain” for the code being optimized, so that when a function is inlined into several different places (which might themselves be inlined), the reader can distinguish between the copies, </li> +<li>objects identifying those parts of the message that refer to expressions, statements or symbol-table nodes, which of these categories they are, and, when available, their source code location, </li> +<li>the GCC pass that emitted the message, and </li> +<li>the location in GCC’s own code from which the message was emitted </li> +</ul> <p>Additionally, some messages are logically nested within other messages, reflecting implementation details of the optimization passes. </p> </dd> <dt> +<span><code class="code">-fsched-verbose=<var class="var">n</var></code><a class="copiable-link" href="#index-fsched-verbose"> ¶</a></span> +</dt> <dd> +<p>On targets that use instruction scheduling, this option controls the amount of debugging output the scheduler prints to the dump files. </p> <p>For <var class="var">n</var> greater than zero, <samp class="option">-fsched-verbose</samp> outputs the same information as <samp class="option">-fdump-rtl-sched1</samp> and <samp class="option">-fdump-rtl-sched2</samp>. For <var class="var">n</var> greater than one, it also output basic block probabilities, detailed ready list information and unit/insn info. For <var class="var">n</var> greater than two, it includes RTL at abort point, control-flow and regions info. And for <var class="var">n</var> over four, <samp class="option">-fsched-verbose</samp> also includes dependence info. </p> </dd> <dt> + <span><code class="code">-fenable-<var class="var">kind</var>-<var class="var">pass</var></code><a class="copiable-link" href="#index-fdisable-"> ¶</a></span> +</dt> <dt><code class="code">-fdisable-<var class="var">kind</var>-<var class="var">pass</var>=<var class="var">range-list</var></code></dt> <dd> <p>This is a set of options that are used to explicitly disable/enable optimization passes. These options are intended for use for debugging GCC. Compiler users should use regular options for enabling/disabling passes instead. </p> <dl class="table"> <dt><code class="code">-fdisable-ipa-<var class="var">pass</var></code></dt> <dd> +<p>Disable IPA pass <var class="var">pass</var>. <var class="var">pass</var> is the pass name. If the same pass is statically invoked in the compiler multiple times, the pass name should be appended with a sequential number starting from 1. </p> </dd> <dt><code class="code">-fdisable-rtl-<var class="var">pass</var></code></dt> <dt><code class="code">-fdisable-rtl-<var class="var">pass</var>=<var class="var">range-list</var></code></dt> <dd> +<p>Disable RTL pass <var class="var">pass</var>. <var class="var">pass</var> is the pass name. If the same pass is statically invoked in the compiler multiple times, the pass name should be appended with a sequential number starting from 1. <var class="var">range-list</var> is a comma-separated list of function ranges or assembler names. Each range is a number pair separated by a colon. The range is inclusive in both ends. If the range is trivial, the number pair can be simplified as a single number. If the function’s call graph node’s <var class="var">uid</var> falls within one of the specified ranges, the <var class="var">pass</var> is disabled for that function. The <var class="var">uid</var> is shown in the function header of a dump file, and the pass names can be dumped by using option <samp class="option">-fdump-passes</samp>. </p> </dd> <dt><code class="code">-fdisable-tree-<var class="var">pass</var></code></dt> <dt><code class="code">-fdisable-tree-<var class="var">pass</var>=<var class="var">range-list</var></code></dt> <dd> +<p>Disable tree pass <var class="var">pass</var>. See <samp class="option">-fdisable-rtl</samp> for the description of option arguments. </p> </dd> <dt><code class="code">-fenable-ipa-<var class="var">pass</var></code></dt> <dd> +<p>Enable IPA pass <var class="var">pass</var>. <var class="var">pass</var> is the pass name. If the same pass is statically invoked in the compiler multiple times, the pass name should be appended with a sequential number starting from 1. </p> </dd> <dt><code class="code">-fenable-rtl-<var class="var">pass</var></code></dt> <dt><code class="code">-fenable-rtl-<var class="var">pass</var>=<var class="var">range-list</var></code></dt> <dd> +<p>Enable RTL pass <var class="var">pass</var>. See <samp class="option">-fdisable-rtl</samp> for option argument description and examples. </p> </dd> <dt><code class="code">-fenable-tree-<var class="var">pass</var></code></dt> <dt><code class="code">-fenable-tree-<var class="var">pass</var>=<var class="var">range-list</var></code></dt> <dd> +<p>Enable tree pass <var class="var">pass</var>. See <samp class="option">-fdisable-rtl</samp> for the description of option arguments. </p> </dd> </dl> <p>Here are some examples showing uses of these options. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp"># disable ccp1 for all functions + -fdisable-tree-ccp1 +# disable complete unroll for function whose cgraph node uid is 1 + -fenable-tree-cunroll=1 +# disable gcse2 for functions at the following ranges [1,1], +# [300,400], and [400,1000] +# disable gcse2 for functions foo and foo2 + -fdisable-rtl-gcse2=foo,foo2 +# disable early inlining + -fdisable-tree-einline +# disable ipa inlining + -fdisable-ipa-inline +# enable tree full unroll + -fenable-tree-unroll</pre> +</div> </dd> <dt> + <span><code class="code">-fchecking</code><a class="copiable-link" href="#index-fchecking"> ¶</a></span> +</dt> <dt><code class="code">-fchecking=<var class="var">n</var></code></dt> <dd> +<p>Enable internal consistency checking. The default depends on the compiler configuration. <samp class="option">-fchecking=2</samp> enables further internal consistency checking that might affect code generation. </p> </dd> <dt> +<span><code class="code">-frandom-seed=<var class="var">string</var></code><a class="copiable-link" href="#index-frandom-seed"> ¶</a></span> +</dt> <dd> +<p>This option provides a seed that GCC uses in place of random numbers in generating certain symbol names that have to be different in every compiled file. It is also used to place unique stamps in coverage data files and the object files that produce them. You can use the <samp class="option">-frandom-seed</samp> option to produce reproducibly identical object files. </p> <p>The <var class="var">string</var> can either be a number (decimal, octal or hex) or an arbitrary string (in which case it’s converted to a number by computing CRC32). </p> <p>The <var class="var">string</var> should be different for every file you compile. </p> </dd> <dt> +<span><code class="code">-save-temps</code><a class="copiable-link" href="#index-save-temps"> ¶</a></span> +</dt> <dd> +<p>Store the usual “temporary” intermediate files permanently; name them as auxiliary output files, as specified described under <samp class="option">-dumpbase</samp> and <samp class="option">-dumpdir</samp>. </p> <p>When used in combination with the <samp class="option">-x</samp> command-line option, <samp class="option">-save-temps</samp> is sensible enough to avoid overwriting an input source file with the same extension as an intermediate file. The corresponding intermediate file may be obtained by renaming the source file before using <samp class="option">-save-temps</samp>. </p> </dd> <dt> +<span><code class="code">-save-temps=cwd</code><a class="copiable-link" href="#index-save-temps_003dcwd"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-save-temps -dumpdir ./</samp>. </p> </dd> <dt> +<span><code class="code">-save-temps=obj</code><a class="copiable-link" href="#index-save-temps_003dobj"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-save-temps -dumpdir <samp class="file">outdir/</samp></samp>, where <samp class="file">outdir/</samp> is the directory of the output file specified after the <samp class="option">-o</samp> option, including any directory separators. If the <samp class="option">-o</samp> option is not used, the <samp class="option">-save-temps=obj</samp> switch behaves like <samp class="option">-save-temps=cwd</samp>. </p> </dd> <dt> +<span><code class="code">-time<span class="r">[</span>=<var class="var">file</var><span class="r">]</span></code><a class="copiable-link" href="#index-time"> ¶</a></span> +</dt> <dd> +<p>Report the CPU time taken by each subprocess in the compilation sequence. For C source files, this is the compiler proper and assembler (plus the linker if linking is done). </p> <p>Without the specification of an output file, the output looks like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp"># cc1 0.12 0.01 +# as 0.00 0.01</pre> +</div> <p>The first number on each line is the “user time”, that is time spent executing the program itself. The second number is “system time”, time spent executing operating system routines on behalf of the program. Both numbers are in seconds. </p> <p>With the specification of an output file, the output is appended to the named file, and it looks like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">0.12 0.01 cc1 <var class="var">options</var> +0.00 0.01 as <var class="var">options</var></pre> +</div> <p>The “user time” and the “system time” are moved before the program name, and the options passed to the program are displayed, so that one can later tell what file was being compiled, and with which options. </p> </dd> <dt> +<span><code class="code">-fdump-final-insns<span class="r">[</span>=<var class="var">file</var><span class="r">]</span></code><a class="copiable-link" href="#index-fdump-final-insns"> ¶</a></span> +</dt> <dd> +<p>Dump the final internal representation (RTL) to <var class="var">file</var>. If the optional argument is omitted (or if <var class="var">file</var> is <code class="code">.</code>), the name of the dump file is determined by appending <code class="code">.gkd</code> to the dump base name, see <samp class="option">-dumpbase</samp>. </p> </dd> <dt> + <span><code class="code">-fcompare-debug<span class="r">[</span>=<var class="var">opts</var><span class="r">]</span></code><a class="copiable-link" href="#index-fcompare-debug"> ¶</a></span> +</dt> <dd> +<p>If no error occurs during compilation, run the compiler a second time, adding <var class="var">opts</var> and <samp class="option">-fcompare-debug-second</samp> to the arguments passed to the second compilation. Dump the final internal representation in both compilations, and print an error if they differ. </p> <p>If the equal sign is omitted, the default <samp class="option">-gtoggle</samp> is used. </p> <p>The environment variable <code class="env">GCC_COMPARE_DEBUG</code>, if defined, non-empty and nonzero, implicitly enables <samp class="option">-fcompare-debug</samp>. If <code class="env">GCC_COMPARE_DEBUG</code> is defined to a string starting with a dash, then it is used for <var class="var">opts</var>, otherwise the default <samp class="option">-gtoggle</samp> is used. </p> <p><samp class="option">-fcompare-debug=</samp>, with the equal sign but without <var class="var">opts</var>, is equivalent to <samp class="option">-fno-compare-debug</samp>, which disables the dumping of the final representation and the second compilation, preventing even <code class="env">GCC_COMPARE_DEBUG</code> from taking effect. </p> <p>To verify full coverage during <samp class="option">-fcompare-debug</samp> testing, set <code class="env">GCC_COMPARE_DEBUG</code> to say <samp class="option">-fcompare-debug-not-overridden</samp>, which GCC rejects as an invalid option in any actual compilation (rather than preprocessing, assembly or linking). To get just a warning, setting <code class="env">GCC_COMPARE_DEBUG</code> to ‘<samp class="samp">-w%n-fcompare-debug not overridden</samp>’ will do. </p> </dd> <dt> +<span><code class="code">-fcompare-debug-second</code><a class="copiable-link" href="#index-fcompare-debug-second"> ¶</a></span> +</dt> <dd> +<p>This option is implicitly passed to the compiler for the second compilation requested by <samp class="option">-fcompare-debug</samp>, along with options to silence warnings, and omitting other options that would cause the compiler to produce output to files or to standard output as a side effect. Dump files and preserved temporary files are renamed so as to contain the <code class="code">.gk</code> additional extension during the second compilation, to avoid overwriting those generated by the first. </p> <p>When this option is passed to the compiler driver, it causes the <em class="emph">first</em> compilation to be skipped, which makes it useful for little other than debugging the compiler proper. </p> </dd> <dt> +<span><code class="code">-gtoggle</code><a class="copiable-link" href="#index-gtoggle"> ¶</a></span> +</dt> <dd> +<p>Turn off generation of debug info, if leaving out this option generates it, or turn it on at level 2 otherwise. The position of this argument in the command line does not matter; it takes effect after all other options are processed, and it does so only once, no matter how many times it is given. This is mainly intended to be used with <samp class="option">-fcompare-debug</samp>. </p> </dd> <dt> + <span><code class="code">-fvar-tracking-assignments-toggle</code><a class="copiable-link" href="#index-fvar-tracking-assignments-toggle"> ¶</a></span> +</dt> <dd> +<p>Toggle <samp class="option">-fvar-tracking-assignments</samp>, in the same way that <samp class="option">-gtoggle</samp> toggles <samp class="option">-g</samp>. </p> </dd> <dt> +<span><code class="code">-Q</code><a class="copiable-link" href="#index-Q"> ¶</a></span> +</dt> <dd> +<p>Makes the compiler print out each function name as it is compiled, and print some statistics about each pass when it finishes. </p> </dd> <dt> +<span><code class="code">-ftime-report</code><a class="copiable-link" href="#index-ftime-report"> ¶</a></span> +</dt> <dd> +<p>Makes the compiler print some statistics about the time consumed by each pass when it finishes. </p> </dd> <dt> +<span><code class="code">-ftime-report-details</code><a class="copiable-link" href="#index-ftime-report-details"> ¶</a></span> +</dt> <dd> +<p>Record the time consumed by infrastructure parts separately for each pass. </p> </dd> <dt> +<span><code class="code">-fira-verbose=<var class="var">n</var></code><a class="copiable-link" href="#index-fira-verbose"> ¶</a></span> +</dt> <dd> +<p>Control the verbosity of the dump file for the integrated register allocator. The default value is 5. If the value <var class="var">n</var> is greater or equal to 10, the dump output is sent to stderr using the same format as <var class="var">n</var> minus 10. </p> </dd> <dt> +<span><code class="code">-flto-report</code><a class="copiable-link" href="#index-flto-report"> ¶</a></span> +</dt> <dd> +<p>Prints a report with internal details on the workings of the link-time optimizer. The contents of this report vary from version to version. It is meant to be useful to GCC developers when processing object files in LTO mode (via <samp class="option">-flto</samp>). </p> <p>Disabled by default. </p> </dd> <dt> +<span><code class="code">-flto-report-wpa</code><a class="copiable-link" href="#index-flto-report-wpa"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-flto-report</samp>, but only print for the WPA phase of link-time optimization. </p> </dd> <dt> +<span><code class="code">-fmem-report</code><a class="copiable-link" href="#index-fmem-report"> ¶</a></span> +</dt> <dd> +<p>Makes the compiler print some statistics about permanent memory allocation when it finishes. </p> </dd> <dt> +<span><code class="code">-fmem-report-wpa</code><a class="copiable-link" href="#index-fmem-report-wpa"> ¶</a></span> +</dt> <dd> +<p>Makes the compiler print some statistics about permanent memory allocation for the WPA phase only. </p> </dd> <dt> + <span><code class="code">-fpre-ipa-mem-report</code><a class="copiable-link" href="#index-fpre-ipa-mem-report"> ¶</a></span> +</dt> <dt><code class="code">-fpost-ipa-mem-report</code></dt> <dd> +<p>Makes the compiler print some statistics about permanent memory allocation before or after interprocedural optimization. </p> </dd> <dt> +<span><code class="code">-fmultiflags</code><a class="copiable-link" href="#index-fmultiflags"> ¶</a></span> +</dt> <dd> +<p>This option enables multilib-aware <code class="code">TFLAGS</code> to be used to build target libraries with options different from those the compiler is configured to use by default, through the use of specs (See <a class="xref" href="spec-files">Specifying Subprocesses and the Switches to Pass to Them</a>) set up by compiler internals, by the target, or by builders at configure time. </p> <p>Like <code class="code">TFLAGS</code>, this allows the target libraries to be built for portable baseline environments, while the compiler defaults to more demanding ones. That’s useful because users can easily override the defaults the compiler is configured to use to build their own programs, if the defaults are not ideal for their target environment, whereas rebuilding the runtime libraries is usually not as easy or desirable. </p> <p>Unlike <code class="code">TFLAGS</code>, the use of specs enables different flags to be selected for different multilibs. The way to accomplish that is to build with ‘<samp class="samp">make TFLAGS=-fmultiflags</samp>’, after configuring ‘<samp class="samp">--with-specs=%{fmultiflags:...}</samp>’. </p> <p>This option is discarded by the driver once it’s done processing driver self spec. </p> <p>It is also useful to check that <code class="code">TFLAGS</code> are being used to build all target libraries, by configuring a non-bootstrap compiler ‘<samp class="samp">--with-specs='%{!fmultiflags:%emissing TFLAGS}'</samp>’ and building the compiler and target libraries. </p> </dd> <dt> +<span><code class="code">-fprofile-report</code><a class="copiable-link" href="#index-fprofile-report"> ¶</a></span> +</dt> <dd> +<p>Makes the compiler print some statistics about consistency of the (estimated) profile and effect of individual passes. </p> </dd> <dt> +<span><code class="code">-fstack-usage</code><a class="copiable-link" href="#index-fstack-usage"> ¶</a></span> +</dt> <dd> +<p>Makes the compiler output stack usage information for the program, on a per-function basis. The filename for the dump is made by appending <samp class="file">.su</samp> to the <var class="var">auxname</var>. <var class="var">auxname</var> is generated from the name of the output file, if explicitly specified and it is not an executable, otherwise it is the basename of the source file. An entry is made up of three fields: </p> <ul class="itemize mark-bullet"> <li>The name of the function. </li> +<li>A number of bytes. </li> +<li>One or more qualifiers: <code class="code">static</code>, <code class="code">dynamic</code>, <code class="code">bounded</code>. </li> +</ul> <p>The qualifier <code class="code">static</code> means that the function manipulates the stack statically: a fixed number of bytes are allocated for the frame on function entry and released on function exit; no stack adjustments are otherwise made in the function. The second field is this fixed number of bytes. </p> <p>The qualifier <code class="code">dynamic</code> means that the function manipulates the stack dynamically: in addition to the static allocation described above, stack adjustments are made in the body of the function, for example to push/pop arguments around function calls. If the qualifier <code class="code">bounded</code> is also present, the amount of these adjustments is bounded at compile time and the second field is an upper bound of the total amount of stack used by the function. If it is not present, the amount of these adjustments is not bounded at compile time and the second field only represents the bounded part. </p> </dd> <dt> +<span><code class="code">-fstats</code><a class="copiable-link" href="#index-fstats"> ¶</a></span> +</dt> <dd> +<p>Emit statistics about front-end processing at the end of the compilation. This option is supported only by the C++ front end, and the information is generally only useful to the G++ development team. </p> </dd> <dt> +<span><code class="code">-fdbg-cnt-list</code><a class="copiable-link" href="#index-fdbg-cnt-list"> ¶</a></span> +</dt> <dd> +<p>Print the name and the counter upper bound for all debug counters. </p> </dd> <dt> +<span><code class="code">-fdbg-cnt=<var class="var">counter-value-list</var></code><a class="copiable-link" href="#index-fdbg-cnt"> ¶</a></span> +</dt> <dd> +<p>Set the internal debug counter lower and upper bound. <var class="var">counter-value-list</var> is a comma-separated list of <var class="var">name</var>:<var class="var">lower_bound1</var>-<var class="var">upper_bound1</var> [:<var class="var">lower_bound2</var>-<var class="var">upper_bound2</var>...] tuples which sets the name of the counter and list of closed intervals. The <var class="var">lower_bound</var> is optional and is zero initialized if not set. For example, with <samp class="option">-fdbg-cnt=dce:2-4:10-11,tail_call:10</samp>, <code class="code">dbg_cnt(dce)</code> returns true only for second, third, fourth, tenth and eleventh invocation. For <code class="code">dbg_cnt(tail_call)</code> true is returned for first 10 invocations. </p> </dd> <dt> +<span><code class="code">-print-file-name=<var class="var">library</var></code><a class="copiable-link" href="#index-print-file-name"> ¶</a></span> +</dt> <dd> +<p>Print the full absolute name of the library file <var class="var">library</var> that would be used when linking—and don’t do anything else. With this option, GCC does not compile or link anything; it just prints the file name. </p> </dd> <dt> +<span><code class="code">-print-multi-directory</code><a class="copiable-link" href="#index-print-multi-directory"> ¶</a></span> +</dt> <dd> +<p>Print the directory name corresponding to the multilib selected by any other switches present in the command line. This directory is supposed to exist in <code class="env">GCC_EXEC_PREFIX</code>. </p> </dd> <dt> +<span><code class="code">-print-multi-lib</code><a class="copiable-link" href="#index-print-multi-lib"> ¶</a></span> +</dt> <dd> +<p>Print the mapping from multilib directory names to compiler switches that enable them. The directory name is separated from the switches by ‘<samp class="samp">;</samp>’, and each switch starts with an ‘<samp class="samp">@</samp>’ instead of the ‘<samp class="samp">-</samp>’, without spaces between multiple switches. This is supposed to ease shell processing. </p> </dd> <dt> +<span><code class="code">-print-multi-os-directory</code><a class="copiable-link" href="#index-print-multi-os-directory"> ¶</a></span> +</dt> <dd> +<p>Print the path to OS libraries for the selected multilib, relative to some <samp class="file">lib</samp> subdirectory. If OS libraries are present in the <samp class="file">lib</samp> subdirectory and no multilibs are used, this is usually just <samp class="file">.</samp>, if OS libraries are present in <samp class="file">lib<var class="var">suffix</var></samp> sibling directories this prints e.g. <samp class="file">../lib64</samp>, <samp class="file">../lib</samp> or <samp class="file">../lib32</samp>, or if OS libraries are present in <samp class="file">lib/<var class="var">subdir</var></samp> subdirectories it prints e.g. <samp class="file">amd64</samp>, <samp class="file">sparcv9</samp> or <samp class="file">ev6</samp>. </p> </dd> <dt> +<span><code class="code">-print-multiarch</code><a class="copiable-link" href="#index-print-multiarch"> ¶</a></span> +</dt> <dd> +<p>Print the path to OS libraries for the selected multiarch, relative to some <samp class="file">lib</samp> subdirectory. </p> </dd> <dt> +<span><code class="code">-print-prog-name=<var class="var">program</var></code><a class="copiable-link" href="#index-print-prog-name"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-print-file-name</samp>, but searches for a program such as <code class="command">cpp</code>. </p> </dd> <dt> +<span><code class="code">-print-libgcc-file-name</code><a class="copiable-link" href="#index-print-libgcc-file-name"> ¶</a></span> +</dt> <dd> +<p>Same as <samp class="option">-print-file-name=libgcc.a</samp>. </p> <p>This is useful when you use <samp class="option">-nostdlib</samp> or <samp class="option">-nodefaultlibs</samp> but you do want to link with <samp class="file">libgcc.a</samp>. You can do: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -nostdlib <var class="var">files</var>… `gcc -print-libgcc-file-name`</pre> +</div> </dd> <dt> +<span><code class="code">-print-search-dirs</code><a class="copiable-link" href="#index-print-search-dirs"> ¶</a></span> +</dt> <dd> +<p>Print the name of the configured installation directory and a list of program and library directories <code class="command">gcc</code> searches—and don’t do anything else. </p> <p>This is useful when <code class="command">gcc</code> prints the error message ‘<samp class="samp">installation problem, cannot exec cpp0: No such file or directory</samp>’. To resolve this you either need to put <samp class="file">cpp0</samp> and the other compiler components where <code class="command">gcc</code> expects to find them, or you can set the environment variable <code class="env">GCC_EXEC_PREFIX</code> to the directory where you installed them. Don’t forget the trailing ‘<samp class="samp">/</samp>’. See <a class="xref" href="environment-variables">Environment Variables Affecting GCC</a>. </p> </dd> <dt> +<span><code class="code">-print-sysroot</code><a class="copiable-link" href="#index-print-sysroot"> ¶</a></span> +</dt> <dd> +<p>Print the target sysroot directory that is used during compilation. This is the target sysroot specified either at configure time or using the <samp class="option">--sysroot</samp> option, possibly with an extra suffix that depends on compilation options. If no target sysroot is specified, the option prints nothing. </p> </dd> <dt> +<span><code class="code">-print-sysroot-headers-suffix</code><a class="copiable-link" href="#index-print-sysroot-headers-suffix"> ¶</a></span> +</dt> <dd> +<p>Print the suffix added to the target sysroot when searching for headers, or give an error if the compiler is not configured with such a suffix—and don’t do anything else. </p> </dd> <dt> +<span><code class="code">-dumpmachine</code><a class="copiable-link" href="#index-dumpmachine"> ¶</a></span> +</dt> <dd> +<p>Print the compiler’s target machine (for example, ‘<samp class="samp">i686-pc-linux-gnu</samp>’)—and don’t do anything else. </p> </dd> <dt> +<span><code class="code">-dumpversion</code><a class="copiable-link" href="#index-dumpversion"> ¶</a></span> +</dt> <dd> +<p>Print the compiler version (for example, <code class="code">3.0</code>, <code class="code">6.3.0</code> or <code class="code">7</code>)—and don’t do anything else. This is the compiler version used in filesystem paths and specs. Depending on how the compiler has been configured it can be just a single number (major version), two numbers separated by a dot (major and minor version) or three numbers separated by dots (major, minor and patchlevel version). </p> </dd> <dt> +<span><code class="code">-dumpfullversion</code><a class="copiable-link" href="#index-dumpfullversion"> ¶</a></span> +</dt> <dd> +<p>Print the full compiler version—and don’t do anything else. The output is always three numbers separated by dots, major, minor and patchlevel version. </p> </dd> <dt> +<span><code class="code">-dumpspecs</code><a class="copiable-link" href="#index-dumpspecs"> ¶</a></span> +</dt> <dd><p>Print the compiler’s built-in specs—and don’t do anything else. (This is used when GCC itself is being built.) See <a class="xref" href="spec-files">Specifying Subprocesses and the Switches to Pass to Them</a>. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="submodel-options">Machine-Dependent Options</a>, Previous: <a href="code-gen-options">Options for Code Generation Conventions</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Developer-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Developer-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/diagnostic-message-formatting-options.html b/devdocs/gcc~13/diagnostic-message-formatting-options.html new file mode 100644 index 00000000..aad486eb --- /dev/null +++ b/devdocs/gcc~13/diagnostic-message-formatting-options.html @@ -0,0 +1,398 @@ +<div class="section-level-extent" id="Diagnostic-Message-Formatting-Options"> <div class="nav-panel"> <p> Next: <a href="warning-options" accesskey="n" rel="next">Options to Request or Suppress Warnings</a>, Previous: <a href="objective-c-and-objective-c_002b_002b-dialect-options" accesskey="p" rel="prev">Options Controlling Objective-C and Objective-C++ Dialects</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-to-Control-Diagnostic-Messages-Formatting"><span>3.7 Options to Control Diagnostic Messages Formatting<a class="copiable-link" href="#Options-to-Control-Diagnostic-Messages-Formatting"> ¶</a></span></h1> <p>Traditionally, diagnostic messages have been formatted irrespective of the output device’s aspect (e.g. its width, …). You can use the options described below to control the formatting algorithm for diagnostic messages, e.g. how many characters per line, how often source location information should be reported. Note that some language front ends may not honor these options. </p> <dl class="table"> <dt> +<span><code class="code">-fmessage-length=<var class="var">n</var></code><a class="copiable-link" href="#index-fmessage-length"> ¶</a></span> +</dt> <dd> +<p>Try to format error messages so that they fit on lines of about <var class="var">n</var> characters. If <var class="var">n</var> is zero, then no line-wrapping is done; each error message appears on a single line. This is the default for all front ends. </p> <p>Note - this option also affects the display of the ‘<samp class="samp">#error</samp>’ and ‘<samp class="samp">#warning</samp>’ pre-processor directives, and the ‘<samp class="samp">deprecated</samp>’ function/type/variable attribute. It does not however affect the ‘<samp class="samp">pragma GCC warning</samp>’ and ‘<samp class="samp">pragma GCC error</samp>’ pragmas. </p> </dd> <dt><code class="code">-fdiagnostics-plain-output</code></dt> <dd> +<p>This option requests that diagnostic output look as plain as possible, which may be useful when running <code class="command">dejagnu</code> or other utilities that need to parse diagnostics output and prefer that it remain more stable over time. <samp class="option">-fdiagnostics-plain-output</samp> is currently equivalent to the following options: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fno-diagnostics-show-caret +-fno-diagnostics-show-line-numbers +-fdiagnostics-color=never +-fdiagnostics-urls=never +-fdiagnostics-path-format=separate-events</pre> +</div> <p>In the future, if GCC changes the default appearance of its diagnostics, the corresponding option to disable the new behavior will be added to this list. </p> </dd> <dt> +<span><code class="code">-fdiagnostics-show-location=once</code><a class="copiable-link" href="#index-fdiagnostics-show-location"> ¶</a></span> +</dt> <dd> +<p>Only meaningful in line-wrapping mode. Instructs the diagnostic messages reporter to emit source location information <em class="emph">once</em>; that is, in case the message is too long to fit on a single physical line and has to be wrapped, the source location won’t be emitted (as prefix) again, over and over, in subsequent continuation lines. This is the default behavior. </p> </dd> <dt><code class="code">-fdiagnostics-show-location=every-line</code></dt> <dd> +<p>Only meaningful in line-wrapping mode. Instructs the diagnostic messages reporter to emit the same source location information (as prefix) for physical lines that result from the process of breaking a message which is too long to fit on a single line. </p> </dd> <dt> + <span><code class="code">-fdiagnostics-color[=<var class="var">WHEN</var>]</code><a class="copiable-link" href="#index-fdiagnostics-color"> ¶</a></span> +</dt> <dt><code class="code">-fno-diagnostics-color</code></dt> <dd> +<p>Use color in diagnostics. <var class="var">WHEN</var> is ‘<samp class="samp">never</samp>’, ‘<samp class="samp">always</samp>’, or ‘<samp class="samp">auto</samp>’. The default depends on how the compiler has been configured, it can be any of the above <var class="var">WHEN</var> options or also ‘<samp class="samp">never</samp>’ if <code class="env">GCC_COLORS</code> environment variable isn’t present in the environment, and ‘<samp class="samp">auto</samp>’ otherwise. ‘<samp class="samp">auto</samp>’ makes GCC use color only when the standard error is a terminal, and when not executing in an emacs shell. The forms <samp class="option">-fdiagnostics-color</samp> and <samp class="option">-fno-diagnostics-color</samp> are aliases for <samp class="option">-fdiagnostics-color=always</samp> and <samp class="option">-fdiagnostics-color=never</samp>, respectively. </p> <p>The colors are defined by the environment variable <code class="env">GCC_COLORS</code>. Its value is a colon-separated list of capabilities and Select Graphic Rendition (SGR) substrings. SGR commands are interpreted by the terminal or terminal emulator. (See the section in the documentation of your text terminal for permitted values and their meanings as character attributes.) These substring values are integers in decimal representation and can be concatenated with semicolons. Common values to concatenate include ‘<samp class="samp">1</samp>’ for bold, ‘<samp class="samp">4</samp>’ for underline, ‘<samp class="samp">5</samp>’ for blink, ‘<samp class="samp">7</samp>’ for inverse, ‘<samp class="samp">39</samp>’ for default foreground color, ‘<samp class="samp">30</samp>’ to ‘<samp class="samp">37</samp>’ for foreground colors, ‘<samp class="samp">90</samp>’ to ‘<samp class="samp">97</samp>’ for 16-color mode foreground colors, ‘<samp class="samp">38;5;0</samp>’ to ‘<samp class="samp">38;5;255</samp>’ for 88-color and 256-color modes foreground colors, ‘<samp class="samp">49</samp>’ for default background color, ‘<samp class="samp">40</samp>’ to ‘<samp class="samp">47</samp>’ for background colors, ‘<samp class="samp">100</samp>’ to ‘<samp class="samp">107</samp>’ for 16-color mode background colors, and ‘<samp class="samp">48;5;0</samp>’ to ‘<samp class="samp">48;5;255</samp>’ for 88-color and 256-color modes background colors. </p> <p>The default <code class="env">GCC_COLORS</code> is </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\ +quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\ +diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\ +type-diff=01;32:fnname=01;32:targs=35</pre> +</div> <p>where ‘<samp class="samp">01;31</samp>’ is bold red, ‘<samp class="samp">01;35</samp>’ is bold magenta, ‘<samp class="samp">01;36</samp>’ is bold cyan, ‘<samp class="samp">32</samp>’ is green, ‘<samp class="samp">34</samp>’ is blue, ‘<samp class="samp">01</samp>’ is bold, and ‘<samp class="samp">31</samp>’ is red. Setting <code class="env">GCC_COLORS</code> to the empty string disables colors. Supported capabilities are as follows. </p> <dl class="table"> <dt> +<span><code class="code">error=</code><a class="copiable-link" href="#index-error-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for error: markers. </p> </dd> <dt> +<span><code class="code">warning=</code><a class="copiable-link" href="#index-warning-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for warning: markers. </p> </dd> <dt> +<span><code class="code">note=</code><a class="copiable-link" href="#index-note-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for note: markers. </p> </dd> <dt> +<span><code class="code">path=</code><a class="copiable-link" href="#index-path-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for colorizing paths of control-flow events as printed via <samp class="option">-fdiagnostics-path-format=</samp>, such as the identifiers of individual events and lines indicating interprocedural calls and returns. </p> </dd> <dt> +<span><code class="code">range1=</code><a class="copiable-link" href="#index-range1-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for first additional range. </p> </dd> <dt> +<span><code class="code">range2=</code><a class="copiable-link" href="#index-range2-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for second additional range. </p> </dd> <dt> +<span><code class="code">locus=</code><a class="copiable-link" href="#index-locus-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for location information, ‘<samp class="samp">file:line</samp>’ or ‘<samp class="samp">file:line:column</samp>’ etc. </p> </dd> <dt> +<span><code class="code">quote=</code><a class="copiable-link" href="#index-quote-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for information printed within quotes. </p> </dd> <dt> +<span><code class="code">fnname=</code><a class="copiable-link" href="#index-fnname-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for names of C++ functions. </p> </dd> <dt> +<span><code class="code">targs=</code><a class="copiable-link" href="#index-targs-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for C++ function template parameter bindings. </p> </dd> <dt> +<span><code class="code">fixit-insert=</code><a class="copiable-link" href="#index-fixit-insert-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for fix-it hints suggesting text to be inserted or replaced. </p> </dd> <dt> +<span><code class="code">fixit-delete=</code><a class="copiable-link" href="#index-fixit-delete-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for fix-it hints suggesting text to be deleted. </p> </dd> <dt> +<span><code class="code">diff-filename=</code><a class="copiable-link" href="#index-diff-filename-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for filename headers within generated patches. </p> </dd> <dt> +<span><code class="code">diff-hunk=</code><a class="copiable-link" href="#index-diff-hunk-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for the starts of hunks within generated patches. </p> </dd> <dt> +<span><code class="code">diff-delete=</code><a class="copiable-link" href="#index-diff-delete-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for deleted lines within generated patches. </p> </dd> <dt> +<span><code class="code">diff-insert=</code><a class="copiable-link" href="#index-diff-insert-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd> +<p>SGR substring for inserted lines within generated patches. </p> </dd> <dt> +<span><code class="code">type-diff=</code><a class="copiable-link" href="#index-type-diff-GCC_005fCOLORS-capability"> ¶</a></span> +</dt> <dd><p>SGR substring for highlighting mismatching types within template arguments in the C++ frontend. </p></dd> </dl> </dd> <dt> + <span><code class="code">-fdiagnostics-urls[=<var class="var">WHEN</var>]</code><a class="copiable-link" href="#index-fdiagnostics-urls"> ¶</a></span> +</dt> <dd> +<p>Use escape sequences to embed URLs in diagnostics. For example, when <samp class="option">-fdiagnostics-show-option</samp> emits text showing the command-line option controlling a diagnostic, embed a URL for documentation of that option. </p> <p><var class="var">WHEN</var> is ‘<samp class="samp">never</samp>’, ‘<samp class="samp">always</samp>’, or ‘<samp class="samp">auto</samp>’. ‘<samp class="samp">auto</samp>’ makes GCC use URL escape sequences only when the standard error is a terminal, and when not executing in an emacs shell or any graphical terminal which is known to be incompatible with this feature, see below. </p> <p>The default depends on how the compiler has been configured. It can be any of the above <var class="var">WHEN</var> options. </p> <p>GCC can also be configured (via the <samp class="option">--with-diagnostics-urls=auto-if-env</samp> configure-time option) so that the default is affected by environment variables. Under such a configuration, GCC defaults to using ‘<samp class="samp">auto</samp>’ if either <code class="env">GCC_URLS</code> or <code class="env">TERM_URLS</code> environment variables are present and non-empty in the environment of the compiler, or ‘<samp class="samp">never</samp>’ if neither are. </p> <p>However, even with <samp class="option">-fdiagnostics-urls=always</samp> the behavior is dependent on those environment variables: If <code class="env">GCC_URLS</code> is set to empty or ‘<samp class="samp">no</samp>’, do not embed URLs in diagnostics. If set to ‘<samp class="samp">st</samp>’, URLs use ST escape sequences. If set to ‘<samp class="samp">bel</samp>’, the default, URLs use BEL escape sequences. Any other non-empty value enables the feature. If <code class="env">GCC_URLS</code> is not set, use <code class="env">TERM_URLS</code> as a fallback. Note: ST is an ANSI escape sequence, string terminator ‘<samp class="samp">ESC \</samp>’, BEL is an ASCII character, CTRL-G that usually sounds like a beep. </p> <p>At this time GCC tries to detect also a few terminals that are known to not implement the URL feature, and have bugs or at least had bugs in some versions that are still in use, where the URL escapes are likely to misbehave, i.e. print garbage on the screen. That list is currently xfce4-terminal, certain known to be buggy gnome-terminal versions, the linux console, and mingw. This check can be skipped with the <samp class="option">-fdiagnostics-urls=always</samp>. </p> </dd> <dt> + <span><code class="code">-fno-diagnostics-show-option</code><a class="copiable-link" href="#index-fno-diagnostics-show-option"> ¶</a></span> +</dt> <dd> +<p>By default, each diagnostic emitted includes text indicating the command-line option that directly controls the diagnostic (if such an option is known to the diagnostic machinery). Specifying the <samp class="option">-fno-diagnostics-show-option</samp> flag suppresses that behavior. </p> </dd> <dt> + <span><code class="code">-fno-diagnostics-show-caret</code><a class="copiable-link" href="#index-fno-diagnostics-show-caret"> ¶</a></span> +</dt> <dd> +<p>By default, each diagnostic emitted includes the original source line and a caret ‘<samp class="samp">^</samp>’ indicating the column. This option suppresses this information. The source line is truncated to <var class="var">n</var> characters, if the <samp class="option">-fmessage-length=n</samp> option is given. When the output is done to the terminal, the width is limited to the width given by the <code class="env">COLUMNS</code> environment variable or, if not set, to the terminal width. </p> </dd> <dt> + <span><code class="code">-fno-diagnostics-show-labels</code><a class="copiable-link" href="#index-fno-diagnostics-show-labels"> ¶</a></span> +</dt> <dd> +<p>By default, when printing source code (via <samp class="option">-fdiagnostics-show-caret</samp>), diagnostics can label ranges of source code with pertinent information, such as the types of expressions: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">printf ("foo %s bar", long_i + long_j); + ~^ ~~~~~~~~~~~~~~~ + | | + char * long int</pre> +</div> <p>This option suppresses the printing of these labels (in the example above, the vertical bars and the “char *” and “long int” text). </p> </dd> <dt> + <span><code class="code">-fno-diagnostics-show-cwe</code><a class="copiable-link" href="#index-fno-diagnostics-show-cwe"> ¶</a></span> +</dt> <dd> +<p>Diagnostic messages can optionally have an associated <a class="uref" href="https://cwe.mitre.org/index.html">CWE</a> identifier. GCC itself only provides such metadata for some of the <samp class="option">-fanalyzer</samp> diagnostics. GCC plugins may also provide diagnostics with such metadata. By default, if this information is present, it will be printed with the diagnostic. This option suppresses the printing of this metadata. </p> </dd> <dt> + <span><code class="code">-fno-diagnostics-show-rules</code><a class="copiable-link" href="#index-fno-diagnostics-show-rules"> ¶</a></span> +</dt> <dd> +<p>Diagnostic messages can optionally have rules associated with them, such as from a coding standard, or a specification. GCC itself does not do this for any of its diagnostics, but plugins may do so. By default, if this information is present, it will be printed with the diagnostic. This option suppresses the printing of this metadata. </p> </dd> <dt> + <span><code class="code">-fno-diagnostics-show-line-numbers</code><a class="copiable-link" href="#index-fno-diagnostics-show-line-numbers"> ¶</a></span> +</dt> <dd> +<p>By default, when printing source code (via <samp class="option">-fdiagnostics-show-caret</samp>), a left margin is printed, showing line numbers. This option suppresses this left margin. </p> </dd> <dt> +<span><code class="code">-fdiagnostics-minimum-margin-width=<var class="var">width</var></code><a class="copiable-link" href="#index-fdiagnostics-minimum-margin-width"> ¶</a></span> +</dt> <dd> +<p>This option controls the minimum width of the left margin printed by <samp class="option">-fdiagnostics-show-line-numbers</samp>. It defaults to 6. </p> </dd> <dt> +<span><code class="code">-fdiagnostics-parseable-fixits</code><a class="copiable-link" href="#index-fdiagnostics-parseable-fixits"> ¶</a></span> +</dt> <dd> +<p>Emit fix-it hints in a machine-parseable format, suitable for consumption by IDEs. For each fix-it, a line will be printed after the relevant diagnostic, starting with the string “fix-it:”. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"</pre> +</div> <p>The location is expressed as a half-open range, expressed as a count of bytes, starting at byte 1 for the initial column. In the above example, bytes 3 through 20 of line 45 of “test.c” are to be replaced with the given string: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">00000000011111111112222222222 +12345678901234567890123456789 + gtk_widget_showall (dlg); + ^^^^^^^^^^^^^^^^^^ + gtk_widget_show_all</pre> +</div> <p>The filename and replacement string escape backslash as “\\", tab as “\t”, newline as “\n”, double quotes as “\"”, non-printable characters as octal (e.g. vertical tab as “\013”). </p> <p>An empty replacement string indicates that the given range is to be removed. An empty range (e.g. “45:3-45:3”) indicates that the string is to be inserted at the given position. </p> </dd> <dt> +<span><code class="code">-fdiagnostics-generate-patch</code><a class="copiable-link" href="#index-fdiagnostics-generate-patch"> ¶</a></span> +</dt> <dd> +<p>Print fix-it hints to stderr in unified diff format, after any diagnostics are printed. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">--- test.c ++++ test.c +@ -42,5 +42,5 @ + + void show_cb(GtkDialog *dlg) + { +- gtk_widget_showall(dlg); ++ gtk_widget_show_all(dlg); + }</pre> +</div> <p>The diff may or may not be colorized, following the same rules as for diagnostics (see <samp class="option">-fdiagnostics-color</samp>). </p> </dd> <dt> +<span><code class="code">-fdiagnostics-show-template-tree</code><a class="copiable-link" href="#index-fdiagnostics-show-template-tree"> ¶</a></span> +</dt> <dd> <p>In the C++ frontend, when printing diagnostics showing mismatching template types, such as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">could not convert 'std::map<int, std::vector<double> >()' + from 'map<[...],vector<double>>' to 'map<[...],vector<float>></pre> +</div> <p>the <samp class="option">-fdiagnostics-show-template-tree</samp> flag enables printing a tree-like structure showing the common and differing parts of the types, such as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">map< + [...], + vector< + [double != float]>></pre> +</div> <p>The parts that differ are highlighted with color (“double” and “float” in this case). </p> </dd> <dt> + <span><code class="code">-fno-elide-type</code><a class="copiable-link" href="#index-fno-elide-type"> ¶</a></span> +</dt> <dd> +<p>By default when the C++ frontend prints diagnostics showing mismatching template types, common parts of the types are printed as “[...]” to simplify the error message. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">could not convert 'std::map<int, std::vector<double> >()' + from 'map<[...],vector<double>>' to 'map<[...],vector<float>></pre> +</div> <p>Specifying the <samp class="option">-fno-elide-type</samp> flag suppresses that behavior. This flag also affects the output of the <samp class="option">-fdiagnostics-show-template-tree</samp> flag. </p> </dd> <dt> +<span><code class="code">-fdiagnostics-path-format=<var class="var">KIND</var></code><a class="copiable-link" href="#index-fdiagnostics-path-format"> ¶</a></span> +</dt> <dd> +<p>Specify how to print paths of control-flow events for diagnostics that have such a path associated with them. </p> <p><var class="var">KIND</var> is ‘<samp class="samp">none</samp>’, ‘<samp class="samp">separate-events</samp>’, or ‘<samp class="samp">inline-events</samp>’, the default. </p> <p>‘<samp class="samp">none</samp>’ means to not print diagnostic paths. </p> <p>‘<samp class="samp">separate-events</samp>’ means to print a separate “note” diagnostic for each event within the diagnostic. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter +test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL +test.c:27:3: note: (2) when 'i < count' +test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1</pre> +</div> <p>‘<samp class="samp">inline-events</samp>’ means to print the events “inline” within the source code. This view attempts to consolidate the events into runs of sufficiently-close events, printing them as labelled ranges within the source. </p> <p>For example, the same events as above might be printed as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">'test': events 1-3 + | + | 25 | list = PyList_New(0); + | | ^~~~~~~~~~~~~ + | | | + | | (1) when 'PyList_New' fails, returning NULL + | 26 | + | 27 | for (i = 0; i < count; i++) { + | | ~~~ + | | | + | | (2) when 'i < count' + | 28 | item = PyLong_FromLong(random()); + | 29 | PyList_Append(list, item); + | | ~~~~~~~~~~~~~~~~~~~~~~~~~ + | | | + | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1 + |</pre> +</div> <p>Interprocedural control flow is shown by grouping the events by stack frame, and using indentation to show how stack frames are nested, pushed, and popped. </p> <p>For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">'test': events 1-2 + | + | 133 | { + | | ^ + | | | + | | (1) entering 'test' + | 134 | boxed_int *obj = make_boxed_int (i); + | | ~~~~~~~~~~~~~~~~~~ + | | | + | | (2) calling 'make_boxed_int' + | + +--> 'make_boxed_int': events 3-4 + | + | 120 | { + | | ^ + | | | + | | (3) entering 'make_boxed_int' + | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int)); + | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | | | + | | (4) calling 'wrapped_malloc' + | + +--> 'wrapped_malloc': events 5-6 + | + | 7 | { + | | ^ + | | | + | | (5) entering 'wrapped_malloc' + | 8 | return malloc (size); + | | ~~~~~~~~~~~~~ + | | | + | | (6) calling 'malloc' + | + <-------------+ + | + 'test': event 7 + | + | 138 | free_boxed_int (obj); + | | ^~~~~~~~~~~~~~~~~~~~ + | | | + | | (7) calling 'free_boxed_int' + | +(etc)</pre> +</div> </dd> <dt> +<span><code class="code">-fdiagnostics-show-path-depths</code><a class="copiable-link" href="#index-fdiagnostics-show-path-depths"> ¶</a></span> +</dt> <dd> +<p>This option provides additional information when printing control-flow paths associated with a diagnostic. </p> <p>If this is option is provided then the stack depth will be printed for each run of events within <samp class="option">-fdiagnostics-path-format=inline-events</samp>. If provided with <samp class="option">-fdiagnostics-path-format=separate-events</samp>, then the stack depth and function declaration will be appended when printing each event. </p> <p>This is intended for use by GCC developers and plugin developers when debugging diagnostics that report interprocedural control flow. </p> </dd> <dt> + <span><code class="code">-fno-show-column</code><a class="copiable-link" href="#index-fno-show-column"> ¶</a></span> +</dt> <dd> +<p>Do not print column numbers in diagnostics. This may be necessary if diagnostics are being scanned by a program that does not understand the column numbers, such as <code class="command">dejagnu</code>. </p> </dd> <dt> +<span><code class="code">-fdiagnostics-column-unit=<var class="var">UNIT</var></code><a class="copiable-link" href="#index-fdiagnostics-column-unit"> ¶</a></span> +</dt> <dd> +<p>Select the units for the column number. This affects traditional diagnostics (in the absence of <samp class="option">-fno-show-column</samp>), as well as JSON format diagnostics if requested. </p> <p>The default <var class="var">UNIT</var>, ‘<samp class="samp">display</samp>’, considers the number of display columns occupied by each character. This may be larger than the number of bytes required to encode the character, in the case of tab characters, or it may be smaller, in the case of multibyte characters. For example, the character “GREEK SMALL LETTER PI (U+03C0)” occupies one display column, and its UTF-8 encoding requires two bytes; the character “SLIGHTLY SMILING FACE (U+1F642)” occupies two display columns, and its UTF-8 encoding requires four bytes. </p> <p>Setting <var class="var">UNIT</var> to ‘<samp class="samp">byte</samp>’ changes the column number to the raw byte count in all cases, as was traditionally output by GCC prior to version 11.1.0. </p> </dd> <dt> +<span><code class="code">-fdiagnostics-column-origin=<var class="var">ORIGIN</var></code><a class="copiable-link" href="#index-fdiagnostics-column-origin"> ¶</a></span> +</dt> <dd> +<p>Select the origin for column numbers, i.e. the column number assigned to the first column. The default value of 1 corresponds to traditional GCC behavior and to the GNU style guide. Some utilities may perform better with an origin of 0; any non-negative value may be specified. </p> </dd> <dt> +<span><code class="code">-fdiagnostics-escape-format=<var class="var">FORMAT</var></code><a class="copiable-link" href="#index-fdiagnostics-escape-format"> ¶</a></span> +</dt> <dd> +<p>When GCC prints pertinent source lines for a diagnostic it normally attempts to print the source bytes directly. However, some diagnostics relate to encoding issues in the source file, such as malformed UTF-8, or issues with Unicode normalization. These diagnostics are flagged so that GCC will escape bytes that are not printable ASCII when printing their pertinent source lines. </p> <p>This option controls how such bytes should be escaped. </p> <p>The default <var class="var">FORMAT</var>, ‘<samp class="samp">unicode</samp>’ displays Unicode characters that are not printable ASCII in the form ‘<samp class="samp"><U+XXXX></samp>’, and bytes that do not correspond to a Unicode character validly-encoded in UTF-8-encoded will be displayed as hexadecimal in the form ‘<samp class="samp"><XX></samp>’. </p> <p>For example, a source line containing the string ‘<samp class="samp">before</samp>’ followed by the Unicode character U+03C0 (“GREEK SMALL LETTER PI”, with UTF-8 encoding 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by the string ‘<samp class="samp">after</samp>’ will be printed for such a diagnostic as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">before<U+03C0><BF>after</pre> +</div> <p>Setting <var class="var">FORMAT</var> to ‘<samp class="samp">bytes</samp>’ will display all non-printable-ASCII bytes in the form ‘<samp class="samp"><XX></samp>’, thus showing the underlying encoding of non-ASCII Unicode characters. For the example above, the following will be printed: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">before<CF><80><BF>after</pre> +</div> </dd> <dt> +<span><code class="code">-fdiagnostics-format=<var class="var">FORMAT</var></code><a class="copiable-link" href="#index-fdiagnostics-format"> ¶</a></span> +</dt> <dd> +<p>Select a different format for printing diagnostics. <var class="var">FORMAT</var> is ‘<samp class="samp">text</samp>’, ‘<samp class="samp">sarif-stderr</samp>’, ‘<samp class="samp">sarif-file</samp>’, ‘<samp class="samp">json</samp>’, ‘<samp class="samp">json-stderr</samp>’, or ‘<samp class="samp">json-file</samp>’. </p> <p>The default is ‘<samp class="samp">text</samp>’. </p> <p>The ‘<samp class="samp">sarif-stderr</samp>’ and ‘<samp class="samp">sarif-file</samp>’ formats both emit diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file named <samp class="file"><var class="var">source</var>.sarif</samp>, respectively. </p> <p>The ‘<samp class="samp">json</samp>’ format is a synonym for ‘<samp class="samp">json-stderr</samp>’. The ‘<samp class="samp">json-stderr</samp>’ and ‘<samp class="samp">json-file</samp>’ formats are identical, apart from where the JSON is emitted to - with the former, the JSON is emitted to stderr, whereas with ‘<samp class="samp">json-file</samp>’ it is written to <samp class="file"><var class="var">source</var>.gcc.json</samp>. </p> <p>The emitted JSON consists of a top-level JSON array containing JSON objects representing the diagnostics. The JSON is emitted as one line, without formatting; the examples below have been formatted for clarity. </p> <p>Diagnostics can have child diagnostics. For example, this error and note: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">misleading-indentation.c:15:3: warning: this 'if' clause does not + guard... [-Wmisleading-indentation] + 15 | if (flag) + | ^~ +misleading-indentation.c:17:5: note: ...this statement, but the latter + is misleadingly indented as if it were guarded by the 'if' + 17 | y = 2; + | ^</pre> +</div> <p>might be printed in JSON form (after formatting) like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">[ + { + "kind": "warning", + "locations": [ + { + "caret": { + "display-column": 3, + "byte-column": 3, + "column": 3, + "file": "misleading-indentation.c", + "line": 15 + }, + "finish": { + "display-column": 4, + "byte-column": 4, + "column": 4, + "file": "misleading-indentation.c", + "line": 15 + } + } + ], + "message": "this \u2018if\u2019 clause does not guard...", + "option": "-Wmisleading-indentation", + "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation", + "children": [ + { + "kind": "note", + "locations": [ + { + "caret": { + "display-column": 5, + "byte-column": 5, + "column": 5, + "file": "misleading-indentation.c", + "line": 17 + } + } + ], + "escape-source": false, + "message": "...this statement, but the latter is …" + } + ] + "escape-source": false, + "column-origin": 1, + } +]</pre> +</div> <p>where the <code class="code">note</code> is a child of the <code class="code">warning</code>. </p> <p>A diagnostic has a <code class="code">kind</code>. If this is <code class="code">warning</code>, then there is an <code class="code">option</code> key describing the command-line option controlling the warning. </p> <p>A diagnostic can contain zero or more locations. Each location has an optional <code class="code">label</code> string and up to three positions within it: a <code class="code">caret</code> position and optional <code class="code">start</code> and <code class="code">finish</code> positions. A position is described by a <code class="code">file</code> name, a <code class="code">line</code> number, and three numbers indicating a column position: </p> +<ul class="itemize mark-bullet"> <li> +<code class="code">display-column</code> counts display columns, accounting for tabs and multibyte characters. </li> +<li> +<code class="code">byte-column</code> counts raw bytes. </li> +<li> +<code class="code">column</code> is equal to one of the previous two, as dictated by the <samp class="option">-fdiagnostics-column-unit</samp> option. </li> +</ul> <p>All three columns are relative to the origin specified by <samp class="option">-fdiagnostics-column-origin</samp>, which is typically equal to 1 but may be set, for instance, to 0 for compatibility with other utilities that number columns from 0. The column origin is recorded in the JSON output in the <code class="code">column-origin</code> tag. In the remaining examples below, the extra column number outputs have been omitted for brevity. </p> <p>For example, this error: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka + 'struct s'} and 'T' {aka 'struct t'}) + 64 | return callee_4a () + callee_4b (); + | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ + | | | + | | T {aka struct t} + | S {aka struct s}</pre> +</div> <p>has three locations. Its primary location is at the “+” token at column 23. It has two secondary locations, describing the left and right-hand sides of the expression, which have labels. It might be printed in JSON form as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + "children": [], + "kind": "error", + "locations": [ + { + "caret": { + "column": 23, "file": "bad-binary-ops.c", "line": 64 + } + }, + { + "caret": { + "column": 10, "file": "bad-binary-ops.c", "line": 64 + }, + "finish": { + "column": 21, "file": "bad-binary-ops.c", "line": 64 + }, + "label": "S {aka struct s}" + }, + { + "caret": { + "column": 25, "file": "bad-binary-ops.c", "line": 64 + }, + "finish": { + "column": 36, "file": "bad-binary-ops.c", "line": 64 + }, + "label": "T {aka struct t}" + } + ], + "escape-source": false, + "message": "invalid operands to binary + …" +}</pre> +</div> <p>If a diagnostic contains fix-it hints, it has a <code class="code">fixits</code> array, consisting of half-open intervals, similar to the output of <samp class="option">-fdiagnostics-parseable-fixits</samp>. For example, this diagnostic with a replacement fix-it hint: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">demo.c:8:15: error: 'struct s' has no member named 'colour'; did you + mean 'color'? + 8 | return ptr->colour; + | ^~~~~~ + | color</pre> +</div> <p>might be printed in JSON form as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + "children": [], + "fixits": [ + { + "next": { + "column": 21, + "file": "demo.c", + "line": 8 + }, + "start": { + "column": 15, + "file": "demo.c", + "line": 8 + }, + "string": "color" + } + ], + "kind": "error", + "locations": [ + { + "caret": { + "column": 15, + "file": "demo.c", + "line": 8 + }, + "finish": { + "column": 20, + "file": "demo.c", + "line": 8 + } + } + ], + "escape-source": false, + "message": "\u2018struct s\u2019 has no member named …" +}</pre> +</div> <p>where the fix-it hint suggests replacing the text from <code class="code">start</code> up to but not including <code class="code">next</code> with <code class="code">string</code>’s value. Deletions are expressed via an empty value for <code class="code">string</code>, insertions by having <code class="code">start</code> equal <code class="code">next</code>. </p> <p>If the diagnostic has a path of control-flow events associated with it, it has a <code class="code">path</code> array of objects representing the events. Each event object has a <code class="code">description</code> string, a <code class="code">location</code> object, along with a <code class="code">function</code> string and a <code class="code">depth</code> number for representing interprocedural paths. The <code class="code">function</code> represents the current function at that event, and the <code class="code">depth</code> represents the stack depth relative to some baseline: the higher, the more frames are within the stack. </p> <p>For example, the intraprocedural example shown for <samp class="option">-fdiagnostics-path-format=</samp> might have this JSON for its path: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">"path": [ + { + "depth": 0, + "description": "when 'PyList_New' fails, returning NULL", + "function": "test", + "location": { + "column": 10, + "file": "test.c", + "line": 25 + } + }, + { + "depth": 0, + "description": "when 'i < count'", + "function": "test", + "location": { + "column": 3, + "file": "test.c", + "line": 27 + } + }, + { + "depth": 0, + "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1", + "function": "test", + "location": { + "column": 5, + "file": "test.c", + "line": 29 + } + } +]</pre> +</div> <p>Diagnostics have a boolean attribute <code class="code">escape-source</code>, hinting whether non-ASCII bytes should be escaped when printing the pertinent lines of source code (<code class="code">true</code> for diagnostics involving source encoding issues). </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="warning-options">Options to Request or Suppress Warnings</a>, Previous: <a href="objective-c-and-objective-c_002b_002b-dialect-options">Options Controlling Objective-C and Objective-C++ Dialects</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Diagnostic-Message-Formatting-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Diagnostic-Message-Formatting-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/diagnostic-pragmas.html b/devdocs/gcc~13/diagnostic-pragmas.html new file mode 100644 index 00000000..c5403c4b --- /dev/null +++ b/devdocs/gcc~13/diagnostic-pragmas.html @@ -0,0 +1,44 @@ +<div class="subsection-level-extent" id="Diagnostic-Pragmas"> <div class="nav-panel"> <p> Next: <a href="visibility-pragmas" accesskey="n" rel="next">Visibility Pragmas</a>, Previous: <a href="weak-pragmas" accesskey="p" rel="prev">Weak Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Diagnostic-Pragmas-1"><span>6.62.12 Diagnostic Pragmas<a class="copiable-link" href="#Diagnostic-Pragmas-1"> ¶</a></span></h1> <p>GCC allows the user to selectively enable or disable certain types of diagnostics, and change the kind of the diagnostic. For example, a project’s policy might require that all sources compile with <samp class="option">-Werror</samp> but certain files might have exceptions allowing specific types of warnings. Or, a project might selectively enable diagnostics and treat them as errors depending on which preprocessor macros are defined. </p> <dl class="table"> <dt> +<span><code class="code">#pragma GCC diagnostic <var class="var">kind</var> <var class="var">option</var></code><a class="copiable-link" href="#index-pragma_002c-diagnostic"> ¶</a></span> +</dt> <dd> <p>Modifies the disposition of a diagnostic. Note that not all diagnostics are modifiable; at the moment only warnings (normally controlled by ‘<samp class="samp">-W…</samp>’) can be controlled, and not all of them. Use <samp class="option">-fdiagnostics-show-option</samp> to determine which diagnostics are controllable and which option controls them. </p> <p><var class="var">kind</var> is ‘<samp class="samp">error</samp>’ to treat this diagnostic as an error, ‘<samp class="samp">warning</samp>’ to treat it like a warning (even if <samp class="option">-Werror</samp> is in effect), or ‘<samp class="samp">ignored</samp>’ if the diagnostic is to be ignored. <var class="var">option</var> is a double quoted string that matches the command-line option. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#pragma GCC diagnostic warning "-Wformat" +#pragma GCC diagnostic error "-Wformat" +#pragma GCC diagnostic ignored "-Wformat"</pre> +</div> <p>Note that these pragmas override any command-line options. GCC keeps track of the location of each pragma, and issues diagnostics according to the state as of that point in the source file. Thus, pragmas occurring after a line do not affect diagnostics caused by that line. </p> </dd> <dt><code class="code">#pragma GCC diagnostic push</code></dt> <dt><code class="code">#pragma GCC diagnostic pop</code></dt> <dd> <p>Causes GCC to remember the state of the diagnostics as of each <code class="code">push</code>, and restore to that point at each <code class="code">pop</code>. If a <code class="code">pop</code> has no matching <code class="code">push</code>, the command-line options are restored. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#pragma GCC diagnostic error "-Wuninitialized" + foo(a); /* error is given for this one */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuninitialized" + foo(b); /* no diagnostic for this one */ +#pragma GCC diagnostic pop + foo(c); /* error is given for this one */ +#pragma GCC diagnostic pop + foo(d); /* depends on command-line options */</pre> +</div> </dd> <dt><code class="code">#pragma GCC diagnostic ignored_attributes</code></dt> <dd> <p>Similarly to <samp class="option">-Wno-attributes=</samp>, this pragma allows users to suppress warnings about unknown scoped attributes (in C++11 and C2X). For example, <code class="code">#pragma GCC diagnostic ignored_attributes "vendor::attr"</code> disables warning about the following declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">[[vendor::attr]] void f();</pre> +</div> <p>whereas <code class="code">#pragma GCC diagnostic ignored_attributes "vendor::"</code> prevents warning about both of these declarations: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">[[vendor::safe]] void f(); +[[vendor::unsafe]] void f2();</pre> +</div> </dd> </dl> <p>GCC also offers a simple mechanism for printing messages during compilation. </p> <dl class="table"> <dt> +<span><code class="code">#pragma message <var class="var">string</var></code><a class="copiable-link" href="#index-pragma_002c-diagnostic-1"> ¶</a></span> +</dt> <dd> <p>Prints <var class="var">string</var> as a compiler message on compilation. The message is informational only, and is neither a compilation warning nor an error. Newlines can be included in the string by using the ‘<samp class="samp">\n</samp>’ escape sequence. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#pragma message "Compiling " __FILE__ "..."</pre> +</div> <p><var class="var">string</var> may be parenthesized, and is printed with location information. For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define DO_PRAGMA(x) _Pragma (#x) +#define TODO(x) DO_PRAGMA(message ("TODO - " #x)) + +TODO(Remember to fix this)</pre> +</div> <p>prints ‘<samp class="samp">/tmp/file.c:4: note: #pragma message: TODO - Remember to fix this</samp>’. </p> </dd> <dt> +<span><code class="code">#pragma GCC error <var class="var">message</var></code><a class="copiable-link" href="#index-pragma_002c-diagnostic-2"> ¶</a></span> +</dt> <dd> +<p>Generates an error message. This pragma <em class="emph">is</em> considered to indicate an error in the compilation, and it will be treated as such. </p> <p>Newlines can be included in the string by using the ‘<samp class="samp">\n</samp>’ escape sequence. They will be displayed as newlines even if the <samp class="option">-fmessage-length</samp> option is set to zero. </p> <p>The error is only generated if the pragma is present in the code after pre-processing has been completed. It does not matter however if the code containing the pragma is unreachable: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#if 0 +#pragma GCC error "this error is not seen" +#endif +void foo (void) +{ + return; +#pragma GCC error "this error is seen" +}</pre> +</div> </dd> <dt> +<span><code class="code">#pragma GCC warning <var class="var">message</var></code><a class="copiable-link" href="#index-pragma_002c-diagnostic-3"> ¶</a></span> +</dt> <dd> +<p>This is just like ‘<samp class="samp">pragma GCC error</samp>’ except that a warning message is issued instead of an error message. Unless <samp class="option">-Werror</samp> is in effect, in which case this pragma will generate an error as well. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="visibility-pragmas">Visibility Pragmas</a>, Previous: <a href="weak-pragmas">Weak Pragmas</a>, Up: <a href="pragmas">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Diagnostic-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Diagnostic-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/directly-mapped-integer-functions.html b/devdocs/gcc~13/directly-mapped-integer-functions.html new file mode 100644 index 00000000..b8dca7da --- /dev/null +++ b/devdocs/gcc~13/directly-mapped-integer-functions.html @@ -0,0 +1,51 @@ +<div class="subsubsection-level-extent" id="Directly-mapped-Integer-Functions"> <div class="nav-panel"> <p> Next: <a href="directly-mapped-media-functions" accesskey="n" rel="next">Directly-Mapped Media Functions</a>, Previous: <a href="argument-types" accesskey="p" rel="prev">Argument Types</a>, Up: <a href="fr-v-built-in-functions" accesskey="u" rel="up">FR-V Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Directly-Mapped-Integer-Functions"><span>6.60.13.2 Directly-Mapped Integer Functions<a class="copiable-link" href="#Directly-Mapped-Integer-Functions"> ¶</a></span></h1> <p>The functions listed below map directly to FR-V I-type instructions. </p> <table class="multitable"> <thead><tr> +<th width="45%">Function prototype</th> +<th width="32%">Example usage</th> +<th width="23%">Assembly output</th> +</tr></thead> <tbody> +<tr> +<td width="45%"><code class="code">sw1 __ADDSS (sw1, sw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __ADDSS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">ADDSS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __SCAN (sw1, sw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __SCAN (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">SCAN <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __SCUTSS (sw1)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __SCUTSS (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">SCUTSS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __SLASS (sw1, sw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __SLASS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">SLASS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __SMASS (sw1, sw1)</code></td> +<td width="32%"><code class="code">__SMASS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">SMASS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __SMSSS (sw1, sw1)</code></td> +<td width="32%"><code class="code">__SMSSS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">SMSSS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __SMU (sw1, sw1)</code></td> +<td width="32%"><code class="code">__SMU (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">SMU <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw2 __SMUL (sw1, sw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __SMUL (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">SMUL <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __SUBSS (sw1, sw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __SUBSS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">SUBSS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __UMUL (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __UMUL (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">UMUL <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> </tbody> </table> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Directly-mapped-Integer-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Directly-mapped-Integer-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/directly-mapped-media-functions.html b/devdocs/gcc~13/directly-mapped-media-functions.html new file mode 100644 index 00000000..4be2f54c --- /dev/null +++ b/devdocs/gcc~13/directly-mapped-media-functions.html @@ -0,0 +1,363 @@ +<div class="subsubsection-level-extent" id="Directly-mapped-Media-Functions"> <div class="nav-panel"> <p> Next: <a href="raw-read_002fwrite-functions" accesskey="n" rel="next">Raw Read/Write Functions</a>, Previous: <a href="directly-mapped-integer-functions" accesskey="p" rel="prev">Directly-Mapped Integer Functions</a>, Up: <a href="fr-v-built-in-functions" accesskey="u" rel="up">FR-V Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Directly-Mapped-Media-Functions"><span>6.60.13.3 Directly-Mapped Media Functions<a class="copiable-link" href="#Directly-Mapped-Media-Functions"> ¶</a></span></h1> <p>The functions listed below map directly to FR-V M-type instructions. </p> <table class="multitable"> <thead><tr> +<th width="45%">Function prototype</th> +<th width="32%">Example usage</th> +<th width="23%">Assembly output</th> +</tr></thead> <tbody> +<tr> +<td width="45%"><code class="code">uw1 __MABSHS (sw1)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MABSHS (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MABSHS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MADDACCS (acc, acc)</code></td> +<td width="32%"><code class="code">__MADDACCS (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MADDACCS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __MADDHSS (sw1, sw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MADDHSS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MADDHSS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MADDHUS (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MADDHUS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MADDHUS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MAND (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MAND (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MAND <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MASACCS (acc, acc)</code></td> +<td width="32%"><code class="code">__MASACCS (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MASACCS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MAVEH (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MAVEH (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MAVEH <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __MBTOH (uw1)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MBTOH (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MBTOH <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MBTOHE (uw1 *, uw1)</code></td> +<td width="32%"><code class="code">__MBTOHE (&<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MBTOHE <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MCLRACC (acc)</code></td> +<td width="32%"><code class="code">__MCLRACC (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MCLRACC <var class="var">a</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MCLRACCA (void)</code></td> +<td width="32%"><code class="code">__MCLRACCA ()</code></td> +<td width="23%"><code class="code">MCLRACCA</code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __Mcop1 (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __Mcop1 (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">Mcop1 <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __Mcop2 (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __Mcop2 (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">Mcop2 <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MCPLHI (uw2, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MCPLHI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MCPLHI <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MCPLI (uw2, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MCPLI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MCPLI <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MCPXIS (acc, sw1, sw1)</code></td> +<td width="32%"><code class="code">__MCPXIS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MCPXIS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MCPXIU (acc, uw1, uw1)</code></td> +<td width="32%"><code class="code">__MCPXIU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MCPXIU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MCPXRS (acc, sw1, sw1)</code></td> +<td width="32%"><code class="code">__MCPXRS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MCPXRS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MCPXRU (acc, uw1, uw1)</code></td> +<td width="32%"><code class="code">__MCPXRU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MCPXRU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MCUT (acc, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MCUT (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MCUT <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MCUTSS (acc, sw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MCUTSS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MCUTSS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MDADDACCS (acc, acc)</code></td> +<td width="32%"><code class="code">__MDADDACCS (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MDADDACCS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MDASACCS (acc, acc)</code></td> +<td width="32%"><code class="code">__MDASACCS (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MDASACCS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __MDCUTSSI (acc, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MDCUTSSI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MDCUTSSI <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __MDPACKH (uw2, uw2)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MDPACKH (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MDPACKH <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __MDROTLI (uw2, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MDROTLI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MDROTLI <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MDSUBACCS (acc, acc)</code></td> +<td width="32%"><code class="code">__MDSUBACCS (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MDSUBACCS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MDUNPACKH (uw1 *, uw2)</code></td> +<td width="32%"><code class="code">__MDUNPACKH (&<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MDUNPACKH <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __MEXPDHD (uw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MEXPDHD (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MEXPDHD <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MEXPDHW (uw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MEXPDHW (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MEXPDHW <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MHDSETH (uw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MHDSETH (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MHDSETH <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __MHDSETS (const)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MHDSETS (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MHDSETS #<var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MHSETHIH (uw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MHSETHIH (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MHSETHIH #<var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __MHSETHIS (sw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MHSETHIS (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MHSETHIS #<var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MHSETLOH (uw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MHSETLOH (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MHSETLOH #<var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __MHSETLOS (sw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MHSETLOS (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MHSETLOS #<var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MHTOB (uw2)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MHTOB (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MHTOB <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MMACHS (acc, sw1, sw1)</code></td> +<td width="32%"><code class="code">__MMACHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MMACHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MMACHU (acc, uw1, uw1)</code></td> +<td width="32%"><code class="code">__MMACHU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MMACHU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MMRDHS (acc, sw1, sw1)</code></td> +<td width="32%"><code class="code">__MMRDHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MMRDHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MMRDHU (acc, uw1, uw1)</code></td> +<td width="32%"><code class="code">__MMRDHU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MMRDHU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MMULHS (acc, sw1, sw1)</code></td> +<td width="32%"><code class="code">__MMULHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MMULHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MMULHU (acc, uw1, uw1)</code></td> +<td width="32%"><code class="code">__MMULHU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MMULHU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MMULXHS (acc, sw1, sw1)</code></td> +<td width="32%"><code class="code">__MMULXHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MMULXHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MMULXHU (acc, uw1, uw1)</code></td> +<td width="32%"><code class="code">__MMULXHU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MMULXHU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MNOT (uw1)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MNOT (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MNOT <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MOR (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MOR (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MOR <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MPACKH (uh, uh)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MPACKH (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MPACKH <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw2 __MQADDHSS (sw2, sw2)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MQADDHSS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQADDHSS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __MQADDHUS (uw2, uw2)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MQADDHUS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQADDHUS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQCPXIS (acc, sw2, sw2)</code></td> +<td width="32%"><code class="code">__MQCPXIS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQCPXIS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQCPXIU (acc, uw2, uw2)</code></td> +<td width="32%"><code class="code">__MQCPXIU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQCPXIU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQCPXRS (acc, sw2, sw2)</code></td> +<td width="32%"><code class="code">__MQCPXRS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQCPXRS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQCPXRU (acc, uw2, uw2)</code></td> +<td width="32%"><code class="code">__MQCPXRU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQCPXRU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw2 __MQLCLRHS (sw2, sw2)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MQLCLRHS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQLCLRHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw2 __MQLMTHS (sw2, sw2)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MQLMTHS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQLMTHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQMACHS (acc, sw2, sw2)</code></td> +<td width="32%"><code class="code">__MQMACHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQMACHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQMACHU (acc, uw2, uw2)</code></td> +<td width="32%"><code class="code">__MQMACHU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQMACHU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQMACXHS (acc, sw2, sw2)</code></td> +<td width="32%"><code class="code">__MQMACXHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQMACXHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQMULHS (acc, sw2, sw2)</code></td> +<td width="32%"><code class="code">__MQMULHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQMULHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQMULHU (acc, uw2, uw2)</code></td> +<td width="32%"><code class="code">__MQMULHU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQMULHU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQMULXHS (acc, sw2, sw2)</code></td> +<td width="32%"><code class="code">__MQMULXHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQMULXHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQMULXHU (acc, uw2, uw2)</code></td> +<td width="32%"><code class="code">__MQMULXHU (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQMULXHU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw2 __MQSATHS (sw2, sw2)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MQSATHS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQSATHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __MQSLLHI (uw2, int)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MQSLLHI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQSLLHI <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw2 __MQSRAHI (sw2, int)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MQSRAHI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQSRAHI <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw2 __MQSUBHSS (sw2, sw2)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MQSUBHSS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQSUBHSS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __MQSUBHUS (uw2, uw2)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MQSUBHUS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQSUBHUS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQXMACHS (acc, sw2, sw2)</code></td> +<td width="32%"><code class="code">__MQXMACHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQXMACHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MQXMACXHS (acc, sw2, sw2)</code></td> +<td width="32%"><code class="code">__MQXMACXHS (<var class="var">c</var>, <var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MQXMACXHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MRDACC (acc)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MRDACC (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MRDACC <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MRDACCG (acc)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MRDACCG (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MRDACCG <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MROTLI (uw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MROTLI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MROTLI <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MROTRI (uw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MROTRI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MROTRI <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __MSATHS (sw1, sw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MSATHS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MSATHS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MSATHU (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MSATHU (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MSATHU <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MSLLHI (uw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MSLLHI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MSLLHI <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __MSRAHI (sw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MSRAHI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MSRAHI <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MSRLHI (uw1, const)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MSRLHI (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MSRLHI <var class="var">a</var>,#<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MSUBACCS (acc, acc)</code></td> +<td width="32%"><code class="code">__MSUBACCS (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MSUBACCS <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">sw1 __MSUBHSS (sw1, sw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MSUBHSS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MSUBHSS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MSUBHUS (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MSUBHUS (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MSUBHUS <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MTRAP (void)</code></td> +<td width="32%"><code class="code">__MTRAP ()</code></td> +<td width="23%"><code class="code">MTRAP</code></td> +</tr> <tr> +<td width="45%"><code class="code">uw2 __MUNPACKH (uw1)</code></td> +<td width="32%"><code class="code"><var class="var">b</var> = __MUNPACKH (<var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MUNPACKH <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MWCUT (uw2, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MWCUT (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MWCUT <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MWTACC (acc, uw1)</code></td> +<td width="32%"><code class="code">__MWTACC (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MWTACC <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">void __MWTACCG (acc, uw1)</code></td> +<td width="32%"><code class="code">__MWTACCG (<var class="var">b</var>, <var class="var">a</var>)</code></td> +<td width="23%"><code class="code">MWTACCG <var class="var">a</var>,<var class="var">b</var></code></td> +</tr> <tr> +<td width="45%"><code class="code">uw1 __MXOR (uw1, uw1)</code></td> +<td width="32%"><code class="code"><var class="var">c</var> = __MXOR (<var class="var">a</var>, <var class="var">b</var>)</code></td> +<td width="23%"><code class="code">MXOR <var class="var">a</var>,<var class="var">b</var>,<var class="var">c</var></code></td> +</tr> </tbody> </table> </div> <div class="nav-panel"> <p> Next: <a href="raw-read_002fwrite-functions">Raw Read/Write Functions</a>, Previous: <a href="directly-mapped-integer-functions">Directly-Mapped Integer Functions</a>, Up: <a href="fr-v-built-in-functions">FR-V Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Directly-mapped-Media-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Directly-mapped-Media-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/directory-options.html b/devdocs/gcc~13/directory-options.html new file mode 100644 index 00000000..17f892e4 --- /dev/null +++ b/devdocs/gcc~13/directory-options.html @@ -0,0 +1,54 @@ +<div class="section-level-extent" id="Directory-Options"> <div class="nav-panel"> <p> Next: <a href="code-gen-options" accesskey="n" rel="next">Options for Code Generation Conventions</a>, Previous: <a href="link-options" accesskey="p" rel="prev">Options for Linking</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-for-Directory-Search"><span>3.16 Options for Directory Search<a class="copiable-link" href="#Options-for-Directory-Search"> ¶</a></span></h1> <p>These options specify directories to search for header files, for libraries and for parts of the compiler: </p> <dl class="table"> <dt> + <span><code class="code">-I <var class="var">dir</var></code><a class="copiable-link" href="#index-I"> ¶</a></span> +</dt> <dt><code class="code">-iquote <var class="var">dir</var></code></dt> <dt><code class="code">-isystem <var class="var">dir</var></code></dt> <dt><code class="code">-idirafter <var class="var">dir</var></code></dt> <dd> +<p>Add the directory <var class="var">dir</var> to the list of directories to be searched for header files during preprocessing. If <var class="var">dir</var> begins with ‘<samp class="samp">=</samp>’ or <code class="code">$SYSROOT</code>, then the ‘<samp class="samp">=</samp>’ or <code class="code">$SYSROOT</code> is replaced by the sysroot prefix; see <samp class="option">--sysroot</samp> and <samp class="option">-isysroot</samp>. </p> <p>Directories specified with <samp class="option">-iquote</samp> apply only to the quote form of the directive, <code class="code">#include "<var class="var">file</var>"</code>. Directories specified with <samp class="option">-I</samp>, <samp class="option">-isystem</samp>, or <samp class="option">-idirafter</samp> apply to lookup for both the <code class="code">#include "<var class="var">file</var>"</code> and <code class="code">#include <<var class="var">file</var>></code> directives. </p> <p>You can specify any number or combination of these options on the command line to search for header files in several directories. The lookup order is as follows: </p> <ol class="enumerate"> <li> For the quote form of the include directive, the directory of the current file is searched first. </li> +<li> For the quote form of the include directive, the directories specified by <samp class="option">-iquote</samp> options are searched in left-to-right order, as they appear on the command line. </li> +<li> Directories specified with <samp class="option">-I</samp> options are scanned in left-to-right order. </li> +<li> Directories specified with <samp class="option">-isystem</samp> options are scanned in left-to-right order. </li> +<li> Standard system directories are scanned. </li> +<li> Directories specified with <samp class="option">-idirafter</samp> options are scanned in left-to-right order. </li> +</ol> <p>You can use <samp class="option">-I</samp> to override a system header file, substituting your own version, since these directories are searched before the standard system header file directories. However, you should not use this option to add directories that contain vendor-supplied system header files; use <samp class="option">-isystem</samp> for that. </p> <p>The <samp class="option">-isystem</samp> and <samp class="option">-idirafter</samp> options also mark the directory as a system directory, so that it gets the same special treatment that is applied to the standard system directories. </p> <p>If a standard system include directory, or a directory specified with <samp class="option">-isystem</samp>, is also specified with <samp class="option">-I</samp>, the <samp class="option">-I</samp> option is ignored. The directory is still searched but as a system directory at its normal position in the system include chain. This is to ensure that GCC’s procedure to fix buggy system headers and the ordering for the <code class="code">#include_next</code> directive are not inadvertently changed. If you really need to change the search order for system directories, use the <samp class="option">-nostdinc</samp> and/or <samp class="option">-isystem</samp> options. </p> </dd> <dt> +<span><code class="code">-I-</code><a class="copiable-link" href="#index-I-"> ¶</a></span> +</dt> <dd> +<p>Split the include path. This option has been deprecated. Please use <samp class="option">-iquote</samp> instead for <samp class="option">-I</samp> directories before the <samp class="option">-I-</samp> and remove the <samp class="option">-I-</samp> option. </p> <p>Any directories specified with <samp class="option">-I</samp> options before <samp class="option">-I-</samp> are searched only for headers requested with <code class="code">#include "<var class="var">file</var>"</code>; they are not searched for <code class="code">#include <<var class="var">file</var>></code>. If additional directories are specified with <samp class="option">-I</samp> options after the <samp class="option">-I-</samp>, those directories are searched for all ‘<samp class="samp">#include</samp>’ directives. </p> <p>In addition, <samp class="option">-I-</samp> inhibits the use of the directory of the current file directory as the first search directory for <code class="code">#include "<var class="var">file</var>"</code>. There is no way to override this effect of <samp class="option">-I-</samp>. </p> </dd> <dt> +<span><code class="code">-iprefix <var class="var">prefix</var></code><a class="copiable-link" href="#index-iprefix"> ¶</a></span> +</dt> <dd> +<p>Specify <var class="var">prefix</var> as the prefix for subsequent <samp class="option">-iwithprefix</samp> options. If the prefix represents a directory, you should include the final ‘<samp class="samp">/</samp>’. </p> </dd> <dt> + <span><code class="code">-iwithprefix <var class="var">dir</var></code><a class="copiable-link" href="#index-iwithprefix"> ¶</a></span> +</dt> <dt><code class="code">-iwithprefixbefore <var class="var">dir</var></code></dt> <dd> +<p>Append <var class="var">dir</var> to the prefix specified previously with <samp class="option">-iprefix</samp>, and add the resulting directory to the include search path. <samp class="option">-iwithprefixbefore</samp> puts it in the same place <samp class="option">-I</samp> would; <samp class="option">-iwithprefix</samp> puts it where <samp class="option">-idirafter</samp> would. </p> </dd> <dt> +<span><code class="code">-isysroot <var class="var">dir</var></code><a class="copiable-link" href="#index-isysroot"> ¶</a></span> +</dt> <dd> +<p>This option is like the <samp class="option">--sysroot</samp> option, but applies only to header files (except for Darwin targets, where it applies to both header files and libraries). See the <samp class="option">--sysroot</samp> option for more information. </p> </dd> <dt> +<span><code class="code">-imultilib <var class="var">dir</var></code><a class="copiable-link" href="#index-imultilib"> ¶</a></span> +</dt> <dd> +<p>Use <var class="var">dir</var> as a subdirectory of the directory containing target-specific C++ headers. </p> </dd> <dt> +<span><code class="code">-nostdinc</code><a class="copiable-link" href="#index-nostdinc"> ¶</a></span> +</dt> <dd> +<p>Do not search the standard system directories for header files. Only the directories explicitly specified with <samp class="option">-I</samp>, <samp class="option">-iquote</samp>, <samp class="option">-isystem</samp>, and/or <samp class="option">-idirafter</samp> options (and the directory of the current file, if appropriate) are searched. </p> </dd> <dt> +<span><code class="code">-nostdinc++</code><a class="copiable-link" href="#index-nostdinc_002b_002b-1"> ¶</a></span> +</dt> <dd> +<p>Do not search for header files in the C++-specific standard directories, but do still search the other standard directories. (This option is used when building the C++ library.) </p> </dd> <dt> +<span><code class="code">-iplugindir=<var class="var">dir</var></code><a class="copiable-link" href="#index-iplugindir_003d"> ¶</a></span> +</dt> <dd> +<p>Set the directory to search for plugins that are passed by <samp class="option">-fplugin=<var class="var">name</var></samp> instead of <samp class="option">-fplugin=<var class="var">path</var>/<var class="var">name</var>.so</samp>. This option is not meant to be used by the user, but only passed by the driver. </p> </dd> <dt> +<span><code class="code">-L<var class="var">dir</var></code><a class="copiable-link" href="#index-L"> ¶</a></span> +</dt> <dd> +<p>Add directory <var class="var">dir</var> to the list of directories to be searched for <samp class="option">-l</samp>. </p> </dd> <dt> +<span><code class="code">-B<var class="var">prefix</var></code><a class="copiable-link" href="#index-B"> ¶</a></span> +</dt> <dd> +<p>This option specifies where to find the executables, libraries, include files, and data files of the compiler itself. </p> <p>The compiler driver program runs one or more of the subprograms <code class="command">cpp</code>, <code class="command">cc1</code>, <code class="command">as</code> and <code class="command">ld</code>. It tries <var class="var">prefix</var> as a prefix for each program it tries to run, both with and without ‘<samp class="samp"><var class="var">machine</var>/<var class="var">version</var>/</samp>’ for the corresponding target machine and compiler version. </p> <p>For each subprogram to be run, the compiler driver first tries the <samp class="option">-B</samp> prefix, if any. If that name is not found, or if <samp class="option">-B</samp> is not specified, the driver tries two standard prefixes, <samp class="file">/usr/lib/gcc/</samp> and <samp class="file">/usr/local/lib/gcc/</samp>. If neither of those results in a file name that is found, the unmodified program name is searched for using the directories specified in your <code class="env">PATH</code> environment variable. </p> <p>The compiler checks to see if the path provided by <samp class="option">-B</samp> refers to a directory, and if necessary it adds a directory separator character at the end of the path. </p> <p><samp class="option">-B</samp> prefixes that effectively specify directory names also apply to libraries in the linker, because the compiler translates these options into <samp class="option">-L</samp> options for the linker. They also apply to include files in the preprocessor, because the compiler translates these options into <samp class="option">-isystem</samp> options for the preprocessor. In this case, the compiler appends ‘<samp class="samp">include</samp>’ to the prefix. </p> <p>The runtime support file <samp class="file">libgcc.a</samp> can also be searched for using the <samp class="option">-B</samp> prefix, if needed. If it is not found there, the two standard prefixes above are tried, and that is all. The file is left out of the link if it is not found by those means. </p> <p>Another way to specify a prefix much like the <samp class="option">-B</samp> prefix is to use the environment variable <code class="env">GCC_EXEC_PREFIX</code>. See <a class="xref" href="environment-variables">Environment Variables Affecting GCC</a>. </p> <p>As a special kludge, if the path provided by <samp class="option">-B</samp> is <samp class="file">[dir/]stage<var class="var">N</var>/</samp>, where <var class="var">N</var> is a number in the range 0 to 9, then it is replaced by <samp class="file">[dir/]include</samp>. This is to help with boot-strapping the compiler. </p> </dd> <dt> +<span><code class="code">-no-canonical-prefixes</code><a class="copiable-link" href="#index-no-canonical-prefixes"> ¶</a></span> +</dt> <dd> +<p>Do not expand any symbolic links, resolve references to ‘<samp class="samp">/../</samp>’ or ‘<samp class="samp">/./</samp>’, or make the path absolute when generating a relative prefix. </p> </dd> <dt> +<span><code class="code">--sysroot=<var class="var">dir</var></code><a class="copiable-link" href="#index-sysroot"> ¶</a></span> +</dt> <dd> +<p>Use <var class="var">dir</var> as the logical root directory for headers and libraries. For example, if the compiler normally searches for headers in <samp class="file">/usr/include</samp> and libraries in <samp class="file">/usr/lib</samp>, it instead searches <samp class="file"><var class="var">dir</var>/usr/include</samp> and <samp class="file"><var class="var">dir</var>/usr/lib</samp>. </p> <p>If you use both this option and the <samp class="option">-isysroot</samp> option, then the <samp class="option">--sysroot</samp> option applies to libraries, but the <samp class="option">-isysroot</samp> option applies to header files. </p> <p>The GNU linker (beginning with version 2.16) has the necessary support for this option. If your linker does not support this option, the header file aspect of <samp class="option">--sysroot</samp> still works, but the library aspect does not. </p> </dd> <dt> +<span><code class="code">--no-sysroot-suffix</code><a class="copiable-link" href="#index-no-sysroot-suffix"> ¶</a></span> +</dt> <dd> +<p>For some targets, a suffix is added to the root directory specified with <samp class="option">--sysroot</samp>, depending on the other options used, so that headers may for example be found in <samp class="file"><var class="var">dir</var>/<var class="var">suffix</var>/usr/include</samp> instead of <samp class="file"><var class="var">dir</var>/usr/include</samp>. This option disables the addition of such a suffix. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="code-gen-options">Options for Code Generation Conventions</a>, Previous: <a href="link-options">Options for Linking</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Directory-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Directory-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/disappointments.html b/devdocs/gcc~13/disappointments.html new file mode 100644 index 00000000..1a6f1edf --- /dev/null +++ b/devdocs/gcc~13/disappointments.html @@ -0,0 +1,22 @@ +<div class="section-level-extent" id="Disappointments"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-misunderstandings" accesskey="n" rel="next">Common Misunderstandings with GNU C++</a>, Previous: <a href="standard-libraries" accesskey="p" rel="prev">Standard Libraries</a>, Up: <a href="trouble" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Disappointments-and-Misunderstandings"><span>14.6 Disappointments and Misunderstandings<a class="copiable-link" href="#Disappointments-and-Misunderstandings"> ¶</a></span></h1> <p>These problems are perhaps regrettable, but we don’t know any practical way around them. </p> <ul class="itemize mark-bullet"> <li>Certain local variables aren’t recognized by debuggers when you compile with optimization. <p>This occurs because sometimes GCC optimizes the variable out of existence. There is no way to tell the debugger how to compute the value such a variable “would have had”, and it is not clear that would be desirable anyway. So GCC simply does not mention the eliminated variable when it writes debugging information. </p> <p>You have to expect a certain amount of disagreement between the executable and your source code, when you use optimization. </p> </li> +<li> + Users often think it is a bug when GCC reports an error for code like this: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int foo (struct mumble *); + +struct mumble { … }; + +int foo (struct mumble *x) +{ … }</pre> +</div> <p>This code really is erroneous, because the scope of <code class="code">struct +mumble</code> in the prototype is limited to the argument list containing it. It does not refer to the <code class="code">struct mumble</code> defined with file scope immediately below—they are two unrelated types with similar names in different scopes. </p> <p>But in the definition of <code class="code">foo</code>, the file-scope type is used because that is available to be inherited. Thus, the definition and the prototype do not match, and you get an error. </p> <p>This behavior may seem silly, but it’s what the ISO standard specifies. It is easy enough for you to make your code work by moving the definition of <code class="code">struct mumble</code> above the prototype. It’s not worth being incompatible with ISO C just to avoid an error for the example shown above. </p> </li> +<li>Accesses to bit-fields even in volatile objects works by accessing larger objects, such as a byte or a word. You cannot rely on what size of object is accessed in order to read or write the bit-field; it may even vary for a given bit-field according to the precise usage. <p>If you care about controlling the amount of memory that is accessed, use volatile but do not use bit-fields. </p> </li> +<li>GCC comes with shell scripts to fix certain known problems in system header files. They install corrected copies of various header files in a special directory where only GCC will normally look for them. The scripts adapt to various systems by searching all the system header files for the problem cases that we know about. <p>If new system header files are installed, nothing automatically arranges to update the corrected header files. They can be updated using the <code class="command">mkheaders</code> script installed in <samp class="file"><var class="var">libexecdir</var>/gcc/<var class="var">target</var>/<var class="var">version</var>/install-tools/</samp>. </p> </li> +<li> + On 68000 and x86 systems, for instance, you can get paradoxical results if you test the precise values of floating point numbers. For example, you can find that a floating point value which is not a NaN is not equal to itself. This results from the fact that the floating point registers hold a few more bits of precision than fit in a <code class="code">double</code> in memory. Compiled code moves values between memory and floating point registers at its convenience, and moving them into memory truncates them. <p>You can partially avoid this problem by using the <samp class="option">-ffloat-store</samp> option (see <a class="pxref" href="optimize-options">Options That Control Optimization</a>). </p> </li> +<li>On AIX and other platforms without weak symbol support, templates need to be instantiated explicitly and symbols for static members of templates will not be generated. </li> +<li>On AIX, GCC scans object files and library archives for static constructors and destructors when linking an application before the linker prunes unreferenced symbols. This is necessary to prevent the AIX linker from mistakenly assuming that static constructor or destructor are unused and removing them before the scanning can occur. All static constructors and destructors found will be referenced even though the modules in which they occur may not be used by the program. This may lead to both increased executable size and unexpected symbol references. </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-misunderstandings">Common Misunderstandings with GNU C++</a>, Previous: <a href="standard-libraries">Standard Libraries</a>, Up: <a href="trouble">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Disappointments.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Disappointments.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/dollar-signs.html b/devdocs/gcc~13/dollar-signs.html new file mode 100644 index 00000000..7141d150 --- /dev/null +++ b/devdocs/gcc~13/dollar-signs.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Dollar-Signs"> <div class="nav-panel"> <p> Next: <a href="character-escapes" accesskey="n" rel="next">The Character <kbd class="key">ESC</kbd> in Constants</a>, Previous: <a href="c_002b_002b-comments" accesskey="p" rel="prev">C++ Style Comments</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Dollar-Signs-in-Identifier-Names"><span>6.42 Dollar Signs in Identifier Names<a class="copiable-link" href="#Dollar-Signs-in-Identifier-Names"> ¶</a></span></h1> <p>In GNU C, you may normally use dollar signs in identifier names. This is because many traditional C implementations allow such identifiers. However, dollar signs in identifiers are not supported on a few target machines, typically because the target assembler does not allow them. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Dollar-Signs.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Dollar-Signs.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/dynamically-registering-methods.html b/devdocs/gcc~13/dynamically-registering-methods.html new file mode 100644 index 00000000..573de3eb --- /dev/null +++ b/devdocs/gcc~13/dynamically-registering-methods.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="Dynamically-registering-methods"> <div class="nav-panel"> <p> Next: <a href="forwarding-hook" accesskey="n" rel="next">Forwarding Hook</a>, Up: <a href="messaging-with-the-gnu-objective-c-runtime" accesskey="u" rel="up">Messaging with the GNU Objective-C Runtime</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Dynamically-Registering-Methods"><span>8.10.1 Dynamically Registering Methods<a class="copiable-link" href="#Dynamically-Registering-Methods"> ¶</a></span></h1> <p>If <code class="code">objc_msg_lookup()</code> does not find a suitable method implementation, because the receiver does not implement the required method, it tries to see if the class can dynamically register the method. </p> <p>To do so, the runtime checks if the class of the receiver implements the method </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">+ (BOOL) resolveInstanceMethod: (SEL)selector;</pre> +</div> <p>in the case of an instance method, or </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">+ (BOOL) resolveClassMethod: (SEL)selector;</pre> +</div> <p>in the case of a class method. If the class implements it, the runtime invokes it, passing as argument the selector of the original method, and if it returns <code class="code">YES</code>, the runtime tries the lookup again, which could now succeed if a matching method was added dynamically by <code class="code">+resolveInstanceMethod:</code> or <code class="code">+resolveClassMethod:</code>. </p> <p>This allows classes to dynamically register methods (by adding them to the class using <code class="code">class_addMethod</code>) when they are first called. To do so, a class should implement <code class="code">+resolveInstanceMethod:</code> (or, depending on the case, <code class="code">+resolveClassMethod:</code>) and have it recognize the selectors of methods that can be registered dynamically at runtime, register them, and return <code class="code">YES</code>. It should return <code class="code">NO</code> for methods that it does not dynamically registered at runtime. </p> <p>If <code class="code">+resolveInstanceMethod:</code> (or <code class="code">+resolveClassMethod:</code>) is not implemented or returns <code class="code">NO</code>, the runtime then tries the forwarding hook. </p> <p>Support for <code class="code">+resolveInstanceMethod:</code> and <code class="code">resolveClassMethod:</code> was added to the GNU Objective-C runtime in GCC version 4.6. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Dynamically-registering-methods.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Dynamically-registering-methods.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/ebpf-options.html b/devdocs/gcc~13/ebpf-options.html new file mode 100644 index 00000000..45d0fa1a --- /dev/null +++ b/devdocs/gcc~13/ebpf-options.html @@ -0,0 +1,43 @@ +<div class="subsection-level-extent" id="eBPF-Options"> <div class="nav-panel"> <p> Next: <a href="fr30-options" accesskey="n" rel="next">FR30 Options</a>, Previous: <a href="dec-alpha-options" accesskey="p" rel="prev">DEC Alpha Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="eBPF-Options-1"><span>3.19.13 eBPF Options<a class="copiable-link" href="#eBPF-Options-1"> ¶</a></span></h1> <dl class="table"> <dt><code class="code">-mframe-limit=<var class="var">bytes</var></code></dt> <dd> +<p>This specifies the hard limit for frame sizes, in bytes. Currently, the value that can be specified should be less than or equal to ‘<samp class="samp">32767</samp>’. Defaults to whatever limit is imposed by the version of the Linux kernel targeted. </p> </dd> <dt> +<span><code class="code">-mkernel=<var class="var">version</var></code><a class="copiable-link" href="#index-mkernel-1"> ¶</a></span> +</dt> <dd> +<p>This specifies the minimum version of the kernel that will run the compiled program. GCC uses this version to determine which instructions to use, what kernel helpers to allow, etc. Currently, <var class="var">version</var> can be one of ‘<samp class="samp">4.0</samp>’, ‘<samp class="samp">4.1</samp>’, ‘<samp class="samp">4.2</samp>’, ‘<samp class="samp">4.3</samp>’, ‘<samp class="samp">4.4</samp>’, ‘<samp class="samp">4.5</samp>’, ‘<samp class="samp">4.6</samp>’, ‘<samp class="samp">4.7</samp>’, ‘<samp class="samp">4.8</samp>’, ‘<samp class="samp">4.9</samp>’, ‘<samp class="samp">4.10</samp>’, ‘<samp class="samp">4.11</samp>’, ‘<samp class="samp">4.12</samp>’, ‘<samp class="samp">4.13</samp>’, ‘<samp class="samp">4.14</samp>’, ‘<samp class="samp">4.15</samp>’, ‘<samp class="samp">4.16</samp>’, ‘<samp class="samp">4.17</samp>’, ‘<samp class="samp">4.18</samp>’, ‘<samp class="samp">4.19</samp>’, ‘<samp class="samp">4.20</samp>’, ‘<samp class="samp">5.0</samp>’, ‘<samp class="samp">5.1</samp>’, ‘<samp class="samp">5.2</samp>’, ‘<samp class="samp">latest</samp>’ and ‘<samp class="samp">native</samp>’. </p> </dd> <dt> +<span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian-5"> ¶</a></span> +</dt> <dd> +<p>Generate code for a big-endian target. </p> </dd> <dt> +<span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian-5"> ¶</a></span> +</dt> <dd> +<p>Generate code for a little-endian target. This is the default. </p> </dd> <dt> +<span><code class="code">-mjmpext</code><a class="copiable-link" href="#index-mjmpext"> ¶</a></span> +</dt> <dd> +<p>Enable generation of extra conditional-branch instructions. Enabled for CPU v2 and above. </p> </dd> <dt> +<span><code class="code">-mjmp32</code><a class="copiable-link" href="#index-mjmp32"> ¶</a></span> +</dt> <dd> +<p>Enable 32-bit jump instructions. Enabled for CPU v3 and above. </p> </dd> <dt> +<span><code class="code">-malu32</code><a class="copiable-link" href="#index-malu32"> ¶</a></span> +</dt> <dd> +<p>Enable 32-bit ALU instructions. Enabled for CPU v3 and above. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">version</var></code><a class="copiable-link" href="#index-mcpu-5"> ¶</a></span> +</dt> <dd> +<p>This specifies which version of the eBPF ISA to target. Newer versions may not be supported by all kernels. The default is ‘<samp class="samp">v3</samp>’. </p> <p>Supported values for <var class="var">version</var> are: </p> <dl class="table"> <dt>‘<samp class="samp">v1</samp>’</dt> <dd> +<p>The first stable eBPF ISA with no special features or extensions. </p> </dd> <dt>‘<samp class="samp">v2</samp>’</dt> <dd> +<p>Supports the jump extensions, as in <samp class="option">-mjmpext</samp>. </p> </dd> <dt>‘<samp class="samp">v3</samp>’</dt> <dd> +<p>All features of v2, plus: </p> +<ul class="itemize mark-minus"> <li>32-bit jump operations, as in <samp class="option">-mjmp32</samp> </li> +<li>32-bit ALU operations, as in <samp class="option">-malu32</samp> </li> +</ul> </dd> </dl> </dd> <dt> +<span><code class="code">-mco-re</code><a class="copiable-link" href="#index-mco-re"> ¶</a></span> +</dt> <dd> +<p>Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and is implied by <samp class="option">-gbtf</samp>. </p> </dd> <dt> +<span><code class="code">-mno-co-re</code><a class="copiable-link" href="#index-mno-co-re"> ¶</a></span> +</dt> <dd> +<p>Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE support is enabled by default when generating BTF debug information for the BPF target. </p> </dd> <dt><code class="code">-mxbpf</code></dt> <dd> +<p>Generate code for an expanded version of BPF, which relaxes some of the restrictions imposed by the BPF architecture: </p> +<ul class="itemize mark-minus"> <li>Save and restore callee-saved registers at function entry and exit, respectively. </li> +</ul> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="fr30-options">FR30 Options</a>, Previous: <a href="dec-alpha-options">DEC Alpha Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/eBPF-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/eBPF-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/empty-structures.html b/devdocs/gcc~13/empty-structures.html new file mode 100644 index 00000000..2f702560 --- /dev/null +++ b/devdocs/gcc~13/empty-structures.html @@ -0,0 +1,8 @@ +<div class="section-level-extent" id="Empty-Structures"> <div class="nav-panel"> <p> Next: <a href="variable-length" accesskey="n" rel="next">Arrays of Variable Length</a>, Previous: <a href="zero-length" accesskey="p" rel="prev">Arrays of Length Zero</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Structures-with-No-Members"><span>6.19 Structures with No Members<a class="copiable-link" href="#Structures-with-No-Members"> ¶</a></span></h1> <p>GCC permits a C structure to have no members: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct empty { +};</pre> +</div> <p>The structure has size zero. In C++, empty structures are part of the language. G++ treats empty structures as if they had a single member of type <code class="code">char</code>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Empty-Structures.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Empty-Structures.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/enumerator-attributes.html b/devdocs/gcc~13/enumerator-attributes.html new file mode 100644 index 00000000..647c8f8d --- /dev/null +++ b/devdocs/gcc~13/enumerator-attributes.html @@ -0,0 +1,22 @@ +<div class="section-level-extent" id="Enumerator-Attributes"> <div class="nav-panel"> <p> Next: <a href="statement-attributes" accesskey="n" rel="next">Statement Attributes</a>, Previous: <a href="label-attributes" accesskey="p" rel="prev">Label Attributes</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Enumerator-Attributes-1"><span>6.37 Enumerator Attributes<a class="copiable-link" href="#Enumerator-Attributes-1"> ¶</a></span></h1> <p>GCC allows attributes to be set on enumerators. See <a class="xref" href="attribute-syntax">Attribute Syntax</a>, for details of the exact syntax for using attributes. Other attributes are available for functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>), variables (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>), labels (see <a class="pxref" href="label-attributes">Label Attributes</a>), statements (see <a class="pxref" href="statement-attributes">Statement Attributes</a>), and for types (see <a class="pxref" href="type-attributes">Specifying Attributes of Types</a>). </p> <p>This example uses the <code class="code">deprecated</code> enumerator attribute to indicate the <code class="code">oldval</code> enumerator is deprecated: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">enum E { + oldval __attribute__((deprecated)), + newval +}; + +int +fn (void) +{ + return oldval; +}</pre> +</div> <dl class="table"> <dt> +<span><code class="code">deprecated</code><a class="copiable-link" href="#index-deprecated-enumerator-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">deprecated</code> attribute results in a warning if the enumerator is used anywhere in the source file. This is useful when identifying enumerators that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated enumerator, to enable users to easily find further information about why the enumerator is deprecated, or what they should do instead. Note that the warnings only occurs for uses. </p> </dd> <dt> +<span><code class="code">unavailable</code><a class="copiable-link" href="#index-unavailable-enumerator-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">unavailable</code> attribute results in an error if the enumerator is used anywhere in the source file. In other respects it behaves in the same manner as the <code class="code">deprecated</code> attribute. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Enumerator-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Enumerator-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/environment-implementation.html b/devdocs/gcc~13/environment-implementation.html new file mode 100644 index 00000000..315ec67b --- /dev/null +++ b/devdocs/gcc~13/environment-implementation.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Environment-implementation"> <div class="nav-panel"> <p> Next: <a href="identifiers-implementation" accesskey="n" rel="next">Identifiers</a>, Previous: <a href="translation-implementation" accesskey="p" rel="prev">Translation</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Environment"><span>4.2 Environment<a class="copiable-link" href="#Environment"> ¶</a></span></h1> <p>The behavior of most of these points are dependent on the implementation of the C library, and are not defined by GCC itself. </p> <ul class="itemize mark-bullet"> <li>The mapping between physical source file multibyte characters and the source character set in translation phase 1 (C90, C99 and C11 5.1.1.2). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Environment-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Environment-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/environment-variables.html b/devdocs/gcc~13/environment-variables.html new file mode 100644 index 00000000..b23a76b4 --- /dev/null +++ b/devdocs/gcc~13/environment-variables.html @@ -0,0 +1,49 @@ +<div class="section-level-extent" id="Environment-Variables"> <div class="nav-panel"> <p> Next: <a href="precompiled-headers" accesskey="n" rel="next">Using Precompiled Headers</a>, Previous: <a href="spec-files" accesskey="p" rel="prev">Specifying Subprocesses and the Switches to Pass to Them</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Environment-Variables-Affecting-GCC"><span>3.21 Environment Variables Affecting GCC<a class="copiable-link" href="#Environment-Variables-Affecting-GCC"> ¶</a></span></h1> <p>This section describes several environment variables that affect how GCC operates. Some of them work by specifying directories or prefixes to use when searching for various kinds of files. Some are used to specify other aspects of the compilation environment. </p> <p>Note that you can also specify places to search using options such as <samp class="option">-B</samp>, <samp class="option">-I</samp> and <samp class="option">-L</samp> (see <a class="pxref" href="directory-options">Options for Directory Search</a>). These take precedence over places specified using environment variables, which in turn take precedence over those specified by the configuration of GCC. See <a data-manual="gccint" href="https://gcc.gnu.org/onlinedocs/gccint/Driver.html#Driver">Controlling the Compilation Driver <samp class="file">gcc</samp></a> in GNU Compiler Collection (GCC) Internals. </p> <dl class="table"> <dt> + <span><code class="env">LANG</code><a class="copiable-link" href="#index-LANG"> ¶</a></span> +</dt> <dt><code class="env">LC_CTYPE</code></dt> <dt><code class="env">LC_MESSAGES</code></dt> <dt><code class="env">LC_ALL</code></dt> <dd> +<p>These environment variables control the way that GCC uses localization information which allows GCC to work with different national conventions. GCC inspects the locale categories <code class="env">LC_CTYPE</code> and <code class="env">LC_MESSAGES</code> if it has been configured to do so. These locale categories can be set to any value supported by your installation. A typical value is ‘<samp class="samp">en_GB.UTF-8</samp>’ for English in the United Kingdom encoded in UTF-8. </p> <p>The <code class="env">LC_CTYPE</code> environment variable specifies character classification. GCC uses it to determine the character boundaries in a string; this is needed for some multibyte encodings that contain quote and escape characters that are otherwise interpreted as a string end or escape. </p> <p>The <code class="env">LC_MESSAGES</code> environment variable specifies the language to use in diagnostic messages. </p> <p>If the <code class="env">LC_ALL</code> environment variable is set, it overrides the value of <code class="env">LC_CTYPE</code> and <code class="env">LC_MESSAGES</code>; otherwise, <code class="env">LC_CTYPE</code> and <code class="env">LC_MESSAGES</code> default to the value of the <code class="env">LANG</code> environment variable. If none of these variables are set, GCC defaults to traditional C English behavior. </p> </dd> <dt> +<span><code class="env">TMPDIR</code><a class="copiable-link" href="#index-TMPDIR"> ¶</a></span> +</dt> <dd> +<p>If <code class="env">TMPDIR</code> is set, it specifies the directory to use for temporary files. GCC uses temporary files to hold the output of one stage of compilation which is to be used as input to the next stage: for example, the output of the preprocessor, which is the input to the compiler proper. </p> </dd> <dt> +<span><code class="env">GCC_COMPARE_DEBUG</code><a class="copiable-link" href="#index-GCC_005fCOMPARE_005fDEBUG"> ¶</a></span> +</dt> <dd> +<p>Setting <code class="env">GCC_COMPARE_DEBUG</code> is nearly equivalent to passing <samp class="option">-fcompare-debug</samp> to the compiler driver. See the documentation of this option for more details. </p> </dd> <dt> +<span><code class="env">GCC_EXEC_PREFIX</code><a class="copiable-link" href="#index-GCC_005fEXEC_005fPREFIX"> ¶</a></span> +</dt> <dd> +<p>If <code class="env">GCC_EXEC_PREFIX</code> is set, it specifies a prefix to use in the names of the subprograms executed by the compiler. No slash is added when this prefix is combined with the name of a subprogram, but you can specify a prefix that ends with a slash if you wish. </p> <p>If <code class="env">GCC_EXEC_PREFIX</code> is not set, GCC attempts to figure out an appropriate prefix to use based on the pathname it is invoked with. </p> <p>If GCC cannot find the subprogram using the specified prefix, it tries looking in the usual places for the subprogram. </p> <p>The default value of <code class="env">GCC_EXEC_PREFIX</code> is <samp class="file"><var class="var">prefix</var>/lib/gcc/</samp> where <var class="var">prefix</var> is the prefix to the installed compiler. In many cases <var class="var">prefix</var> is the value of <code class="code">prefix</code> when you ran the <samp class="file">configure</samp> script. </p> <p>Other prefixes specified with <samp class="option">-B</samp> take precedence over this prefix. </p> <p>This prefix is also used for finding files such as <samp class="file">crt0.o</samp> that are used for linking. </p> <p>In addition, the prefix is used in an unusual way in finding the directories to search for header files. For each of the standard directories whose name normally begins with ‘<samp class="samp">/usr/local/lib/gcc</samp>’ (more precisely, with the value of <code class="env">GCC_INCLUDE_DIR</code>), GCC tries replacing that beginning with the specified prefix to produce an alternate directory name. Thus, with <samp class="option">-Bfoo/</samp>, GCC searches <samp class="file">foo/bar</samp> just before it searches the standard directory <samp class="file">/usr/local/lib/bar</samp>. If a standard directory begins with the configured <var class="var">prefix</var> then the value of <var class="var">prefix</var> is replaced by <code class="env">GCC_EXEC_PREFIX</code> when looking for header files. </p> </dd> <dt> +<span><code class="env">COMPILER_PATH</code><a class="copiable-link" href="#index-COMPILER_005fPATH"> ¶</a></span> +</dt> <dd> +<p>The value of <code class="env">COMPILER_PATH</code> is a colon-separated list of directories, much like <code class="env">PATH</code>. GCC tries the directories thus specified when searching for subprograms, if it cannot find the subprograms using <code class="env">GCC_EXEC_PREFIX</code>. </p> </dd> <dt> +<span><code class="env">LIBRARY_PATH</code><a class="copiable-link" href="#index-LIBRARY_005fPATH"> ¶</a></span> +</dt> <dd> +<p>The value of <code class="env">LIBRARY_PATH</code> is a colon-separated list of directories, much like <code class="env">PATH</code>. When configured as a native compiler, GCC tries the directories thus specified when searching for special linker files, if it cannot find them using <code class="env">GCC_EXEC_PREFIX</code>. Linking using GCC also uses these directories when searching for ordinary libraries for the <samp class="option">-l</samp> option (but directories specified with <samp class="option">-L</samp> come first). </p> </dd> <dt> + <span><code class="env">LANG</code><a class="copiable-link" href="#index-LANG-1"> ¶</a></span> +</dt> <dd> +<p>This variable is used to pass locale information to the compiler. One way in which this information is used is to determine the character set to be used when character literals, string literals and comments are parsed in C and C++. When the compiler is configured to allow multibyte characters, the following values for <code class="env">LANG</code> are recognized: </p> <dl class="table"> <dt>‘<samp class="samp">C-JIS</samp>’</dt> <dd><p>Recognize JIS characters. </p></dd> <dt>‘<samp class="samp">C-SJIS</samp>’</dt> <dd><p>Recognize SJIS characters. </p></dd> <dt>‘<samp class="samp">C-EUCJP</samp>’</dt> <dd><p>Recognize EUCJP characters. </p></dd> </dl> <p>If <code class="env">LANG</code> is not defined, or if it has some other value, then the compiler uses <code class="code">mblen</code> and <code class="code">mbtowc</code> as defined by the default locale to recognize and translate multibyte characters. </p> </dd> <dt> +<span><code class="env">GCC_EXTRA_DIAGNOSTIC_OUTPUT</code><a class="copiable-link" href="#index-GCC_005fEXTRA_005fDIAGNOSTIC_005fOUTPUT"> ¶</a></span> +</dt> <dd> +<p>If <code class="env">GCC_EXTRA_DIAGNOSTIC_OUTPUT</code> is set to one of the following values, then additional text will be emitted to stderr when fix-it hints are emitted. <samp class="option">-fdiagnostics-parseable-fixits</samp> and <samp class="option">-fno-diagnostics-parseable-fixits</samp> take precedence over this environment variable. </p> <dl class="table"> <dt>‘<samp class="samp">fixits-v1</samp>’</dt> <dd> +<p>Emit parseable fix-it hints, equivalent to <samp class="option">-fdiagnostics-parseable-fixits</samp>. In particular, columns are expressed as a count of bytes, starting at byte 1 for the initial column. </p> </dd> <dt>‘<samp class="samp">fixits-v2</samp>’</dt> <dd><p>As <code class="code">fixits-v1</code>, but columns are expressed as display columns, as per <samp class="option">-fdiagnostics-column-unit=display</samp>. </p></dd> </dl> </dd> </dl> <p>Some additional environment variables affect the behavior of the preprocessor. </p> <dl class="vtable"> <dt> +<span><code class="env">CPATH</code><a class="copiable-link" href="#index-CPATH"> ¶</a></span> +</dt> <dt> +<span><code class="env">C_INCLUDE_PATH</code><a class="copiable-link" href="#index-C_005fINCLUDE_005fPATH"> ¶</a></span> +</dt> <dt> +<span><code class="env">CPLUS_INCLUDE_PATH</code><a class="copiable-link" href="#index-CPLUS_005fINCLUDE_005fPATH"> ¶</a></span> +</dt> <dt> +<span><code class="env">OBJC_INCLUDE_PATH</code><a class="copiable-link" href="#index-OBJC_005fINCLUDE_005fPATH"> ¶</a></span> +</dt> <dd> +<p>Each variable’s value is a list of directories separated by a special character, much like <code class="env">PATH</code>, in which to look for header files. The special character, <code class="code">PATH_SEPARATOR</code>, is target-dependent and determined at GCC build time. For Microsoft Windows-based targets it is a semicolon, and for almost all other targets it is a colon. </p> <p><code class="env">CPATH</code> specifies a list of directories to be searched as if specified with <samp class="option">-I</samp>, but after any paths given with <samp class="option">-I</samp> options on the command line. This environment variable is used regardless of which language is being preprocessed. </p> <p>The remaining environment variables apply only when preprocessing the particular language indicated. Each specifies a list of directories to be searched as if specified with <samp class="option">-isystem</samp>, but after any paths given with <samp class="option">-isystem</samp> options on the command line. </p> <p>In all these variables, an empty element instructs the compiler to search its current working directory. Empty elements can appear at the beginning or end of a path. For instance, if the value of <code class="env">CPATH</code> is <code class="code">:/special/include</code>, that has the same effect as ‘<samp class="samp">-I. -I/special/include</samp>’. </p> </dd> <dt> + <span><code class="env">DEPENDENCIES_OUTPUT</code><a class="copiable-link" href="#index-DEPENDENCIES_005fOUTPUT"> ¶</a></span> +</dt> <dd> +<p>If this variable is set, its value specifies how to output dependencies for Make based on the non-system header files processed by the compiler. System header files are ignored in the dependency output. </p> <p>The value of <code class="env">DEPENDENCIES_OUTPUT</code> can be just a file name, in which case the Make rules are written to that file, guessing the target name from the source file name. Or the value can have the form ‘<samp class="samp"><var class="var">file</var> <var class="var">target</var></samp>’, in which case the rules are written to file <var class="var">file</var> using <var class="var">target</var> as the target name. </p> <p>In other words, this environment variable is equivalent to combining the options <samp class="option">-MM</samp> and <samp class="option">-MF</samp> (see <a class="pxref" href="preprocessor-options">Options Controlling the Preprocessor</a>), with an optional <samp class="option">-MT</samp> switch too. </p> </dd> <dt> + <span><code class="env">SUNPRO_DEPENDENCIES</code><a class="copiable-link" href="#index-SUNPRO_005fDEPENDENCIES"> ¶</a></span> +</dt> <dd> +<p>This variable is the same as <code class="env">DEPENDENCIES_OUTPUT</code> (see above), except that system header files are not ignored, so it implies <samp class="option">-M</samp> rather than <samp class="option">-MM</samp>. However, the dependence on the main input file is omitted. See <a class="xref" href="preprocessor-options">Options Controlling the Preprocessor</a>. </p> </dd> <dt> +<span><code class="env">SOURCE_DATE_EPOCH</code><a class="copiable-link" href="#index-SOURCE_005fDATE_005fEPOCH"> ¶</a></span> +</dt> <dd> +<p>If this variable is set, its value specifies a UNIX timestamp to be used in replacement of the current date and time in the <code class="code">__DATE__</code> and <code class="code">__TIME__</code> macros, so that the embedded timestamps become reproducible. </p> <p>The value of <code class="env">SOURCE_DATE_EPOCH</code> must be a UNIX timestamp, defined as the number of seconds (excluding leap seconds) since 01 Jan 1970 00:00:00 represented in ASCII; identical to the output of <code class="code">date +%s</code> on GNU/Linux and other systems that support the <code class="code">%s</code> extension in the <code class="code">date</code> command. </p> <p>The value should be a known timestamp such as the last modification time of the source or package and it should be set by the build process. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="precompiled-headers">Using Precompiled Headers</a>, Previous: <a href="spec-files">Specifying Subprocesses and the Switches to Pass to Them</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Environment-Variables.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Environment-Variables.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/epiphany-function-attributes.html b/devdocs/gcc~13/epiphany-function-attributes.html new file mode 100644 index 00000000..4aa02633 --- /dev/null +++ b/devdocs/gcc~13/epiphany-function-attributes.html @@ -0,0 +1,28 @@ +<div class="subsection-level-extent" id="Epiphany-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="h8_002f300-function-attributes" accesskey="n" rel="next">H8/300 Function Attributes</a>, Previous: <a href="c-sky-function-attributes" accesskey="p" rel="prev">C-SKY Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Epiphany-Function-Attributes-1"><span>6.33.10 Epiphany Function Attributes<a class="copiable-link" href="#Epiphany-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the Epiphany back end: </p> <dl class="table"> <dt> +<span><code class="code">disinterrupt</code><a class="copiable-link" href="#index-disinterrupt-function-attribute_002c-Epiphany"> ¶</a></span> +</dt> <dd> +<p>This attribute causes the compiler to emit instructions to disable interrupts for the duration of the given function. </p> </dd> <dt> +<span><code class="code">forwarder_section</code><a class="copiable-link" href="#index-forwarder_005fsection-function-attribute_002c-Epiphany"> ¶</a></span> +</dt> <dd> +<p>This attribute modifies the behavior of an interrupt handler. The interrupt handler may be in external memory which cannot be reached by a branch instruction, so generate a local memory trampoline to transfer control. The single parameter identifies the section where the trampoline is placed. </p> </dd> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-Epiphany"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. It may also generate a special section with code to initialize the interrupt vector table. </p> <p>On Epiphany targets one or more optional parameters can be added like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __attribute__ ((interrupt ("dma0, dma1"))) universal_dma_handler ();</pre> +</div> <p>Permissible values for these parameters are: <code class="code">reset</code>, <code class="code">software_exception</code>, <code class="code">page_miss</code>, <code class="code">timer0</code>, <code class="code">timer1</code>, <code class="code">message</code>, <code class="code">dma0</code>, <code class="code">dma1</code>, <code class="code">wand</code> and <code class="code">swi</code>. Multiple parameters indicate that multiple entries in the interrupt vector table should be initialized for this function, i.e. for each parameter <var class="var">name</var>, a jump to the function is emitted in the section ivt_entry_<var class="var">name</var>. The parameter(s) may be omitted entirely, in which case no interrupt vector table entry is provided. </p> <p>Note that interrupts are enabled inside the function unless the <code class="code">disinterrupt</code> attribute is also specified. </p> <p>The following examples are all valid uses of these attributes on Epiphany targets: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __attribute__ ((interrupt)) universal_handler (); +void __attribute__ ((interrupt ("dma1"))) dma1_handler (); +void __attribute__ ((interrupt ("dma0, dma1"))) + universal_dma_handler (); +void __attribute__ ((interrupt ("timer0"), disinterrupt)) + fast_timer_handler (); +void __attribute__ ((interrupt ("dma0, dma1"), + forwarder_section ("tramp"))) + external_dma_handler ();</pre> +</div> </dd> <dt> + <span><code class="code">long_call</code><a class="copiable-link" href="#index-long_005fcall-function-attribute_002c-Epiphany"> ¶</a></span> +</dt> <dt><code class="code">short_call</code></dt> <dd><p>These attributes specify how a particular function is called. These attributes override the <samp class="option">-mlong-calls</samp> (see <a class="pxref" href="adapteva-epiphany-options">Adapteva Epiphany Options</a>) command-line switch and <code class="code">#pragma long_calls</code> settings. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="h8_002f300-function-attributes">H8/300 Function Attributes</a>, Previous: <a href="c-sky-function-attributes">C-SKY Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Epiphany-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Epiphany-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/escaped-newlines.html b/devdocs/gcc~13/escaped-newlines.html new file mode 100644 index 00000000..46b30d76 --- /dev/null +++ b/devdocs/gcc~13/escaped-newlines.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Escaped-Newlines"> <div class="nav-panel"> <p> Next: <a href="subscripting" accesskey="n" rel="next">Non-Lvalue Arrays May Have Subscripts</a>, Previous: <a href="variadic-macros" accesskey="p" rel="prev">Macros with a Variable Number of Arguments.</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Slightly-Looser-Rules-for-Escaped-Newlines"><span>6.22 Slightly Looser Rules for Escaped Newlines<a class="copiable-link" href="#Slightly-Looser-Rules-for-Escaped-Newlines"> ¶</a></span></h1> <p>The preprocessor treatment of escaped newlines is more relaxed than that specified by the C90 standard, which requires the newline to immediately follow a backslash. GCC’s implementation allows whitespace in the form of spaces, horizontal and vertical tabs, and form feeds between the backslash and the subsequent newline. The preprocessor issues a warning, but treats it as a valid escaped newline and combines the two lines to form a single logical line. This works within comments and tokens, as well as between tokens. Comments are <em class="emph">not</em> treated as whitespace for the purposes of this relaxation, since they have not yet been replaced with spaces. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Escaped-Newlines.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Escaped-Newlines.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/exception-handling.html b/devdocs/gcc~13/exception-handling.html new file mode 100644 index 00000000..11d1391f --- /dev/null +++ b/devdocs/gcc~13/exception-handling.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Exception-handling"> <div class="nav-panel"> <p> Previous: <a href="conditionally-supported-behavior" accesskey="p" rel="prev">Conditionally-Supported Behavior</a>, Up: <a href="c_002b_002b-implementation" accesskey="u" rel="up">C++ Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Exception-Handling"><span>5.2 Exception Handling<a class="copiable-link" href="#Exception-Handling"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>In the situation where no matching handler is found, it is implementation-defined whether or not the stack is unwound before std::terminate() is called (C++98 15.5.1). <p>The stack is not unwound before std::terminate is called. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Exception-handling.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Exception-handling.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/exceptions.html b/devdocs/gcc~13/exceptions.html new file mode 100644 index 00000000..f95c5b07 --- /dev/null +++ b/devdocs/gcc~13/exceptions.html @@ -0,0 +1,33 @@ +<div class="section-level-extent" id="Exceptions"> <div class="nav-panel"> <p> Next: <a href="synchronization" accesskey="n" rel="next">Synchronization</a>, Previous: <a href="compatibility_005falias" accesskey="p" rel="prev"><code class="code">compatibility_alias</code></a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Exceptions-1"><span>8.7 Exceptions<a class="copiable-link" href="#Exceptions-1"> ¶</a></span></h1> <p>GNU Objective-C provides exception support built into the language, as in the following example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">@try { + … + @throw expr; + … +} +@catch (AnObjCClass *exc) { + … + @throw expr; + … + @throw; + … +} +@catch (AnotherClass *exc) { + … +} +@catch (id allOthers) { + … +} +@finally { + … + @throw expr; + … +}</pre> +</div> <p>The <code class="code">@throw</code> statement may appear anywhere in an Objective-C or Objective-C++ program; when used inside of a <code class="code">@catch</code> block, the <code class="code">@throw</code> may appear without an argument (as shown above), in which case the object caught by the <code class="code">@catch</code> will be rethrown. </p> <p>Note that only (pointers to) Objective-C objects may be thrown and caught using this scheme. When an object is thrown, it will be caught by the nearest <code class="code">@catch</code> clause capable of handling objects of that type, analogously to how <code class="code">catch</code> blocks work in C++ and Java. A <code class="code">@catch(id …)</code> clause (as shown above) may also be provided to catch any and all Objective-C exceptions not caught by previous <code class="code">@catch</code> clauses (if any). </p> <p>The <code class="code">@finally</code> clause, if present, will be executed upon exit from the immediately preceding <code class="code">@try … @catch</code> section. This will happen regardless of whether any exceptions are thrown, caught or rethrown inside the <code class="code">@try … @catch</code> section, analogously to the behavior of the <code class="code">finally</code> clause in Java. </p> <p>There are several caveats to using the new exception mechanism: </p> <ul class="itemize mark-bullet"> <li>The <samp class="option">-fobjc-exceptions</samp> command line option must be used when compiling Objective-C files that use exceptions. </li> +<li>With the GNU runtime, exceptions are always implemented as “native” exceptions and it is recommended that the <samp class="option">-fexceptions</samp> and <samp class="option">-shared-libgcc</samp> options are used when linking. </li> +<li>With the NeXT runtime, although currently designed to be binary compatible with <code class="code">NS_HANDLER</code>-style idioms provided by the <code class="code">NSException</code> class, the new exceptions can only be used on Mac OS X 10.3 (Panther) and later systems, due to additional functionality needed in the NeXT Objective-C runtime. </li> +<li>As mentioned above, the new exceptions do not support handling types other than Objective-C objects. Furthermore, when used from Objective-C++, the Objective-C exception model does not interoperate with C++ exceptions at this time. This means you cannot <code class="code">@throw</code> an exception from Objective-C and <code class="code">catch</code> it in C++, or vice versa (i.e., <code class="code">throw … @catch</code>). </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="synchronization">Synchronization</a>, Previous: <a href="compatibility_005falias"><code class="code">compatibility_alias</code></a>, Up: <a href="objective-c">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Exceptions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Exceptions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/executing-code-before-main.html b/devdocs/gcc~13/executing-code-before-main.html new file mode 100644 index 00000000..e247b7ca --- /dev/null +++ b/devdocs/gcc~13/executing-code-before-main.html @@ -0,0 +1,32 @@ +<div class="section-level-extent" id="Executing-code-before-main"> <div class="nav-panel"> <p> Next: <a href="type-encoding" accesskey="n" rel="next">Type Encoding</a>, Previous: <a href="gnu-objective-c-runtime-api" accesskey="p" rel="prev">GNU Objective-C Runtime API</a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="g_t_002bload_003a-Executing-Code-before-main"><span>8.2 +load: Executing Code before main<a class="copiable-link" href="#g_t_002bload_003a-Executing-Code-before-main"> ¶</a></span></h1> <p>This section is specific for the GNU Objective-C runtime. If you are using a different runtime, you can skip it. </p> <p>The GNU Objective-C runtime provides a way that allows you to execute code before the execution of the program enters the <code class="code">main</code> function. The code is executed on a per-class and a per-category basis, through a special class method <code class="code">+load</code>. </p> <p>This facility is very useful if you want to initialize global variables which can be accessed by the program directly, without sending a message to the class first. The usual way to initialize global variables, in the <code class="code">+initialize</code> method, might not be useful because <code class="code">+initialize</code> is only called when the first message is sent to a class object, which in some cases could be too late. </p> <p>Suppose for example you have a <code class="code">FileStream</code> class that declares <code class="code">Stdin</code>, <code class="code">Stdout</code> and <code class="code">Stderr</code> as global variables, like below: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">FileStream *Stdin = nil; +FileStream *Stdout = nil; +FileStream *Stderr = nil; + +@implementation FileStream + ++ (void)initialize +{ + Stdin = [[FileStream new] initWithFd:0]; + Stdout = [[FileStream new] initWithFd:1]; + Stderr = [[FileStream new] initWithFd:2]; +} + +/* <span class="r">Other methods here</span> */ +@end</pre> +</div> <p>In this example, the initialization of <code class="code">Stdin</code>, <code class="code">Stdout</code> and <code class="code">Stderr</code> in <code class="code">+initialize</code> occurs too late. The programmer can send a message to one of these objects before the variables are actually initialized, thus sending messages to the <code class="code">nil</code> object. The <code class="code">+initialize</code> method which actually initializes the global variables is not invoked until the first message is sent to the class object. The solution would require these variables to be initialized just before entering <code class="code">main</code>. </p> <p>The correct solution of the above problem is to use the <code class="code">+load</code> method instead of <code class="code">+initialize</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">@implementation FileStream + ++ (void)load +{ + Stdin = [[FileStream new] initWithFd:0]; + Stdout = [[FileStream new] initWithFd:1]; + Stderr = [[FileStream new] initWithFd:2]; +} + +/* <span class="r">Other methods here</span> */ +@end</pre> +</div> <p>The <code class="code">+load</code> is a method that is not overridden by categories. If a class and a category of it both implement <code class="code">+load</code>, both methods are invoked. This allows some additional initializations to be performed in a category. </p> <p>This mechanism is not intended to be a replacement for <code class="code">+initialize</code>. You should be aware of its limitations when you decide to use it instead of <code class="code">+initialize</code>. </p> <ul class="mini-toc"> <li><a href="what-you-can-and-what-you-cannot-do-in-_002bload" accesskey="1">What You Can and Cannot Do in <code class="code">+load</code></a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="type-encoding">Type Encoding</a>, Previous: <a href="gnu-objective-c-runtime-api">GNU Objective-C Runtime API</a>, Up: <a href="objective-c">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Executing-code-before-main.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Executing-code-before-main.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/explicit-register-variables.html b/devdocs/gcc~13/explicit-register-variables.html new file mode 100644 index 00000000..2c485cd2 --- /dev/null +++ b/devdocs/gcc~13/explicit-register-variables.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="Explicit-Register-Variables"> <div class="nav-panel"> <p> Next: <a href="size-of-an-asm" accesskey="n" rel="next">Size of an <code class="code">asm</code></a>, Previous: <a href="asm-labels" accesskey="p" rel="prev">Controlling Names Used in Assembler Code</a>, Up: <a href="using-assembly-language-with-c" accesskey="u" rel="up">How to Use Inline Assembly Language in C Code</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Variables-in-Specified-Registers"><span>6.47.5 Variables in Specified Registers<a class="copiable-link" href="#Variables-in-Specified-Registers"> ¶</a></span></h1> <p>GNU C allows you to associate specific hardware registers with C variables. In almost all cases, allowing the compiler to assign registers produces the best code. However under certain unusual circumstances, more precise control over the variable storage is required. </p> <p>Both global and local variables can be associated with a register. The consequences of performing this association are very different between the two, as explained in the sections below. </p> <ul class="mini-toc"> <li><a href="global-register-variables" accesskey="1">Defining Global Register Variables</a></li> <li><a href="local-register-variables" accesskey="2">Specifying Registers for Local Variables</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Explicit-Register-Variables.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Explicit-Register-Variables.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/extended-asm.html b/devdocs/gcc~13/extended-asm.html new file mode 100644 index 00000000..8ab5458e --- /dev/null +++ b/devdocs/gcc~13/extended-asm.html @@ -0,0 +1,610 @@ +<div class="subsection-level-extent" id="Extended-Asm"> <div class="nav-panel"> <p> Next: <a href="constraints" accesskey="n" rel="next">Constraints for <code class="code">asm</code> Operands</a>, Previous: <a href="basic-asm" accesskey="p" rel="prev">Basic Asm — Assembler Instructions Without Operands</a>, Up: <a href="using-assembly-language-with-c" accesskey="u" rel="up">How to Use Inline Assembly Language in C Code</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Extended-Asm---Assembler-Instructions-with-C-Expression-Operands"><span>6.47.2 Extended Asm - Assembler Instructions with C Expression Operands<a class="copiable-link" href="#Extended-Asm---Assembler-Instructions-with-C-Expression-Operands"> ¶</a></span></h1> <p>With extended <code class="code">asm</code> you can read and write C variables from assembler and perform jumps from assembler code to C labels. Extended <code class="code">asm</code> syntax uses colons (‘<samp class="samp">:</samp>’) to delimit the operand parameters after the assembler template: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">asm <var class="var">asm-qualifiers</var> ( <var class="var">AssemblerTemplate</var> + : <var class="var">OutputOperands</var> + <span class="r">[</span> : <var class="var">InputOperands</var> + <span class="r">[</span> : <var class="var">Clobbers</var> <span class="r">]</span> <span class="r">]</span>) + +asm <var class="var">asm-qualifiers</var> ( <var class="var">AssemblerTemplate</var> + : <var class="var">OutputOperands</var> + : <var class="var">InputOperands</var> + : <var class="var">Clobbers</var> + : <var class="var">GotoLabels</var>)</pre> +</div> <p>where in the last form, <var class="var">asm-qualifiers</var> contains <code class="code">goto</code> (and in the first form, not). </p> <p>The <code class="code">asm</code> keyword is a GNU extension. When writing code that can be compiled with <samp class="option">-ansi</samp> and the various <samp class="option">-std</samp> options, use <code class="code">__asm__</code> instead of <code class="code">asm</code> (see <a class="pxref" href="alternate-keywords">Alternate Keywords</a>). </p> <h1 class="subsubheading" id="Qualifiers-2"><span>Qualifiers<a class="copiable-link" href="#Qualifiers-2"> ¶</a></span></h1> <dl class="table"> <dt><code class="code">volatile</code></dt> <dd> +<p>The typical use of extended <code class="code">asm</code> statements is to manipulate input values to produce output values. However, your <code class="code">asm</code> statements may also produce side effects. If so, you may need to use the <code class="code">volatile</code> qualifier to disable certain optimizations. See <a class="xref" href="#Volatile">Volatile</a>. </p> </dd> <dt><code class="code">inline</code></dt> <dd> +<p>If you use the <code class="code">inline</code> qualifier, then for inlining purposes the size of the <code class="code">asm</code> statement is taken as the smallest size possible (see <a class="pxref" href="size-of-an-asm">Size of an <code class="code">asm</code></a>). </p> </dd> <dt><code class="code">goto</code></dt> <dd><p>This qualifier informs the compiler that the <code class="code">asm</code> statement may perform a jump to one of the labels listed in the <var class="var">GotoLabels</var>. See <a class="xref" href="#GotoLabels">GotoLabels</a>. </p></dd> </dl> <h1 class="subsubheading" id="Parameters-1"><span>Parameters<a class="copiable-link" href="#Parameters-1"> ¶</a></span></h1> <dl class="table"> <dt><var class="var">AssemblerTemplate</var></dt> <dd> +<p>This is a literal string that is the template for the assembler code. It is a combination of fixed text and tokens that refer to the input, output, and goto parameters. See <a class="xref" href="#AssemblerTemplate">AssemblerTemplate</a>. </p> </dd> <dt><var class="var">OutputOperands</var></dt> <dd> +<p>A comma-separated list of the C variables modified by the instructions in the <var class="var">AssemblerTemplate</var>. An empty list is permitted. See <a class="xref" href="#OutputOperands">OutputOperands</a>. </p> </dd> <dt><var class="var">InputOperands</var></dt> <dd> +<p>A comma-separated list of C expressions read by the instructions in the <var class="var">AssemblerTemplate</var>. An empty list is permitted. See <a class="xref" href="#InputOperands">InputOperands</a>. </p> </dd> <dt><var class="var">Clobbers</var></dt> <dd> +<p>A comma-separated list of registers or other values changed by the <var class="var">AssemblerTemplate</var>, beyond those listed as outputs. An empty list is permitted. See <a class="xref" href="#Clobbers-and-Scratch-Registers">Clobbers and Scratch Registers</a>. </p> </dd> <dt><var class="var">GotoLabels</var></dt> <dd> +<p>When you are using the <code class="code">goto</code> form of <code class="code">asm</code>, this section contains the list of all C labels to which the code in the <var class="var">AssemblerTemplate</var> may jump. See <a class="xref" href="#GotoLabels">GotoLabels</a>. </p> <p><code class="code">asm</code> statements may not perform jumps into other <code class="code">asm</code> statements, only to the listed <var class="var">GotoLabels</var>. GCC’s optimizers do not know about other jumps; therefore they cannot take account of them when deciding how to optimize. </p> +</dd> </dl> <p>The total number of input + output + goto operands is limited to 30. </p> <h1 class="subsubheading" id="Remarks-1"><span>Remarks<a class="copiable-link" href="#Remarks-1"> ¶</a></span></h1> <p>The <code class="code">asm</code> statement allows you to include assembly instructions directly within C code. This may help you to maximize performance in time-sensitive code or to access assembly instructions that are not readily available to C programs. </p> <p>Note that extended <code class="code">asm</code> statements must be inside a function. Only basic <code class="code">asm</code> may be outside functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). Functions declared with the <code class="code">naked</code> attribute also require basic <code class="code">asm</code> (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> <p>While the uses of <code class="code">asm</code> are many and varied, it may help to think of an <code class="code">asm</code> statement as a series of low-level instructions that convert input parameters to output parameters. So a simple (if not particularly useful) example for i386 using <code class="code">asm</code> might look like this: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">int src = 1; +int dst; + +asm ("mov %1, %0\n\t" + "add $1, %0" + : "=r" (dst) + : "r" (src)); + +printf("%d\n", dst);</pre> +</div> <p>This code copies <code class="code">src</code> to <code class="code">dst</code> and add 1 to <code class="code">dst</code>. </p> <ul class="mini-toc"> <li><a href="#Volatile-1" accesskey="1">Volatile</a></li> <li><a href="#Assembler-Template" accesskey="2">Assembler Template</a></li> <li><a href="#Output-Operands" accesskey="3">Output Operands</a></li> <li><a href="#Flag-Output-Operands" accesskey="4">Flag Output Operands</a></li> <li><a href="#Input-Operands" accesskey="5">Input Operands</a></li> <li><a href="#Clobbers-and-Scratch-Registers-1" accesskey="6">Clobbers and Scratch Registers</a></li> <li><a href="#Goto-Labels" accesskey="7">Goto Labels</a></li> <li><a href="#Generic-Operand-Modifiers" accesskey="8">Generic Operand Modifiers</a></li> <li><a href="#x86-Operand-Modifiers" accesskey="9">x86 Operand Modifiers</a></li> <li><a href="#x86-Floating-Point-asm-Operands">x86 Floating-Point <code class="code">asm</code> Operands</a></li> <li><a href="#MSP430-Operand-Modifiers">MSP430 Operand Modifiers</a></li> <li><a href="#LoongArch-Operand-Modifiers">LoongArch Operand Modifiers</a></li> </ul> <div class="subsubsection-level-extent" id="Volatile-1"> <h1 class="subsubsection"><span>6.47.2.1 Volatile<a class="copiable-link" href="#Volatile-1"> ¶</a></span></h1> <p>GCC’s optimizers sometimes discard <code class="code">asm</code> statements if they determine there is no need for the output variables. Also, the optimizers may move code out of loops if they believe that the code will always return the same result (i.e. none of its input values change between calls). Using the <code class="code">volatile</code> qualifier disables these optimizations. <code class="code">asm</code> statements that have no output operands and <code class="code">asm goto</code> statements, are implicitly volatile. </p> <p>This i386 code demonstrates a case that does not use (or require) the <code class="code">volatile</code> qualifier. If it is performing assertion checking, this code uses <code class="code">asm</code> to perform the validation. Otherwise, <code class="code">dwRes</code> is unreferenced by any code. As a result, the optimizers can discard the <code class="code">asm</code> statement, which in turn removes the need for the entire <code class="code">DoCheck</code> routine. By omitting the <code class="code">volatile</code> qualifier when it isn’t needed you allow the optimizers to produce the most efficient code possible. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">void DoCheck(uint32_t dwSomeValue) +{ + uint32_t dwRes; + + // Assumes dwSomeValue is not zero. + asm ("bsfl %1,%0" + : "=r" (dwRes) + : "r" (dwSomeValue) + : "cc"); + + assert(dwRes > 3); +}</pre> +</div> <p>The next example shows a case where the optimizers can recognize that the input (<code class="code">dwSomeValue</code>) never changes during the execution of the function and can therefore move the <code class="code">asm</code> outside the loop to produce more efficient code. Again, using the <code class="code">volatile</code> qualifier disables this type of optimization. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">void do_print(uint32_t dwSomeValue) +{ + uint32_t dwRes; + + for (uint32_t x=0; x < 5; x++) + { + // Assumes dwSomeValue is not zero. + asm ("bsfl %1,%0" + : "=r" (dwRes) + : "r" (dwSomeValue) + : "cc"); + + printf("%u: %u %u\n", x, dwSomeValue, dwRes); + } +}</pre> +</div> <p>The following example demonstrates a case where you need to use the <code class="code">volatile</code> qualifier. It uses the x86 <code class="code">rdtsc</code> instruction, which reads the computer’s time-stamp counter. Without the <code class="code">volatile</code> qualifier, the optimizers might assume that the <code class="code">asm</code> block will always return the same value and therefore optimize away the second call. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">uint64_t msr; + +asm volatile ( "rdtsc\n\t" // Returns the time in EDX:EAX. + "shl $32, %%rdx\n\t" // Shift the upper bits left. + "or %%rdx, %0" // 'Or' in the lower bits. + : "=a" (msr) + : + : "rdx"); + +printf("msr: %llx\n", msr); + +// Do other work... + +// Reprint the timestamp +asm volatile ( "rdtsc\n\t" // Returns the time in EDX:EAX. + "shl $32, %%rdx\n\t" // Shift the upper bits left. + "or %%rdx, %0" // 'Or' in the lower bits. + : "=a" (msr) + : + : "rdx"); + +printf("msr: %llx\n", msr);</pre> +</div> <p>GCC’s optimizers do not treat this code like the non-volatile code in the earlier examples. They do not move it out of loops or omit it on the assumption that the result from a previous call is still valid. </p> <p>Note that the compiler can move even <code class="code">volatile asm</code> instructions relative to other code, including across jump instructions. For example, on many targets there is a system register that controls the rounding mode of floating-point operations. Setting it with a <code class="code">volatile asm</code> statement, as in the following PowerPC example, does not work reliably. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">asm volatile("mtfsf 255, %0" : : "f" (fpenv)); +sum = x + y;</pre> +</div> <p>The compiler may move the addition back before the <code class="code">volatile asm</code> statement. To make it work as expected, add an artificial dependency to the <code class="code">asm</code> by referencing a variable in the subsequent code, for example: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">asm volatile ("mtfsf 255,%1" : "=X" (sum) : "f" (fpenv)); +sum = x + y;</pre> +</div> <p>Under certain circumstances, GCC may duplicate (or remove duplicates of) your assembly code when optimizing. This can lead to unexpected duplicate symbol errors during compilation if your <code class="code">asm</code> code defines symbols or labels. Using ‘<samp class="samp">%=</samp>’ (see <a class="pxref" href="#AssemblerTemplate">AssemblerTemplate</a>) may help resolve this problem. </p> +</div> <div class="subsubsection-level-extent" id="Assembler-Template"> <h1 class="subsubsection"><span>6.47.2.2 Assembler Template<a class="copiable-link" href="#Assembler-Template"> ¶</a></span></h1> <p>An assembler template is a literal string containing assembler instructions. The compiler replaces tokens in the template that refer to inputs, outputs, and goto labels, and then outputs the resulting string to the assembler. The string can contain any instructions recognized by the assembler, including directives. GCC does not parse the assembler instructions themselves and does not know what they mean or even whether they are valid assembler input. However, it does count the statements (see <a class="pxref" href="size-of-an-asm">Size of an <code class="code">asm</code></a>). </p> <p>You may place multiple assembler instructions together in a single <code class="code">asm</code> string, separated by the characters normally used in assembly code for the system. A combination that works in most places is a newline to break the line, plus a tab character to move to the instruction field (written as ‘<samp class="samp">\n\t</samp>’). Some assemblers allow semicolons as a line separator. However, note that some assembler dialects use semicolons to start a comment. </p> <p>Do not expect a sequence of <code class="code">asm</code> statements to remain perfectly consecutive after compilation, even when you are using the <code class="code">volatile</code> qualifier. If certain instructions need to remain consecutive in the output, put them in a single multi-instruction <code class="code">asm</code> statement. </p> <p>Accessing data from C programs without using input/output operands (such as by using global symbols directly from the assembler template) may not work as expected. Similarly, calling functions directly from an assembler template requires a detailed understanding of the target assembler and ABI. </p> <p>Since GCC does not parse the assembler template, it has no visibility of any symbols it references. This may result in GCC discarding those symbols as unreferenced unless they are also listed as input, output, or goto operands. </p> <h1 class="subsubheading" id="Special-format-strings"><span>Special format strings<a class="copiable-link" href="#Special-format-strings"> ¶</a></span></h1> <p>In addition to the tokens described by the input, output, and goto operands, these tokens have special meanings in the assembler template: </p> <dl class="table"> <dt>‘<samp class="samp">%%</samp>’</dt> <dd> +<p>Outputs a single ‘<samp class="samp">%</samp>’ into the assembler code. </p> </dd> <dt>‘<samp class="samp">%=</samp>’</dt> <dd> +<p>Outputs a number that is unique to each instance of the <code class="code">asm</code> statement in the entire compilation. This option is useful when creating local labels and referring to them multiple times in a single template that generates multiple assembler instructions. </p> </dd> <dt>‘<samp class="samp">%{</samp>’</dt> <dt>‘<samp class="samp">%|</samp>’</dt> <dt>‘<samp class="samp">%}</samp>’</dt> <dd><p>Outputs ‘<samp class="samp">{</samp>’, ‘<samp class="samp">|</samp>’, and ‘<samp class="samp">}</samp>’ characters (respectively) into the assembler code. When unescaped, these characters have special meaning to indicate multiple assembler dialects, as described below. </p></dd> </dl> <h1 class="subsubheading" id="Multiple-assembler-dialects-in-asm-templates"><span>Multiple assembler dialects in asm templates<a class="copiable-link" href="#Multiple-assembler-dialects-in-asm-templates"> ¶</a></span></h1> <p>On targets such as x86, GCC supports multiple assembler dialects. The <samp class="option">-masm</samp> option controls which dialect GCC uses as its default for inline assembler. The target-specific documentation for the <samp class="option">-masm</samp> option contains the list of supported dialects, as well as the default dialect if the option is not specified. This information may be important to understand, since assembler code that works correctly when compiled using one dialect will likely fail if compiled using another. See <a class="xref" href="x86-options">x86 Options</a>. </p> <p>If your code needs to support multiple assembler dialects (for example, if you are writing public headers that need to support a variety of compilation options), use constructs of this form: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">{ dialect0 | dialect1 | dialect2... }</pre> +</div> <p>This construct outputs <code class="code">dialect0</code> when using dialect #0 to compile the code, <code class="code">dialect1</code> for dialect #1, etc. If there are fewer alternatives within the braces than the number of dialects the compiler supports, the construct outputs nothing. </p> <p>For example, if an x86 compiler supports two dialects (‘<samp class="samp">att</samp>’, ‘<samp class="samp">intel</samp>’), an assembler template such as this: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">"bt{l %[Offset],%[Base] | %[Base],%[Offset]}; jc %l2"</pre> +</div> <p>is equivalent to one of </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">"btl %[Offset],%[Base] ; jc %l2" <span class="r">/* att dialect */</span> +"bt %[Base],%[Offset]; jc %l2" <span class="r">/* intel dialect */</span></pre> +</div> <p>Using that same compiler, this code: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">"xchg{l}\t{%%}ebx, %1"</pre> +</div> <p>corresponds to either </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">"xchgl\t%%ebx, %1" <span class="r">/* att dialect */</span> +"xchg\tebx, %1" <span class="r">/* intel dialect */</span></pre> +</div> <p>There is no support for nesting dialect alternatives. </p> +</div> <div class="subsubsection-level-extent" id="Output-Operands"> <h1 class="subsubsection"><span>6.47.2.3 Output Operands<a class="copiable-link" href="#Output-Operands"> ¶</a></span></h1> <p>An <code class="code">asm</code> statement has zero or more output operands indicating the names of C variables modified by the assembler code. </p> <p>In this i386 example, <code class="code">old</code> (referred to in the template string as <code class="code">%0</code>) and <code class="code">*Base</code> (as <code class="code">%1</code>) are outputs and <code class="code">Offset</code> (<code class="code">%2</code>) is an input: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">bool old; + +__asm__ ("btsl %2,%1\n\t" // Turn on zero-based bit #Offset in Base. + "sbb %0,%0" // Use the CF to calculate old. + : "=r" (old), "+rm" (*Base) + : "Ir" (Offset) + : "cc"); + +return old;</pre> +</div> <p>Operands are separated by commas. Each operand has this format: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp"><span class="r">[</span> [<var class="var">asmSymbolicName</var>] <span class="r">]</span> <var class="var">constraint</var> (<var class="var">cvariablename</var>)</pre> +</div> <dl class="table"> <dt><var class="var">asmSymbolicName</var></dt> <dd> +<p>Specifies a symbolic name for the operand. Reference the name in the assembler template by enclosing it in square brackets (i.e. ‘<samp class="samp">%[Value]</samp>’). The scope of the name is the <code class="code">asm</code> statement that contains the definition. Any valid C variable name is acceptable, including names already defined in the surrounding code. No two operands within the same <code class="code">asm</code> statement can use the same symbolic name. </p> <p>When not using an <var class="var">asmSymbolicName</var>, use the (zero-based) position of the operand in the list of operands in the assembler template. For example if there are three output operands, use ‘<samp class="samp">%0</samp>’ in the template to refer to the first, ‘<samp class="samp">%1</samp>’ for the second, and ‘<samp class="samp">%2</samp>’ for the third. </p> </dd> <dt><var class="var">constraint</var></dt> <dd> +<p>A string constant specifying constraints on the placement of the operand; See <a class="xref" href="constraints">Constraints for <code class="code">asm</code> Operands</a>, for details. </p> <p>Output constraints must begin with either ‘<samp class="samp">=</samp>’ (a variable overwriting an existing value) or ‘<samp class="samp">+</samp>’ (when reading and writing). When using ‘<samp class="samp">=</samp>’, do not assume the location contains the existing value on entry to the <code class="code">asm</code>, except when the operand is tied to an input; see <a class="pxref" href="#InputOperands">Input Operands</a>. </p> <p>After the prefix, there must be one or more additional constraints (see <a class="pxref" href="constraints">Constraints for <code class="code">asm</code> Operands</a>) that describe where the value resides. Common constraints include ‘<samp class="samp">r</samp>’ for register and ‘<samp class="samp">m</samp>’ for memory. When you list more than one possible location (for example, <code class="code">"=rm"</code>), the compiler chooses the most efficient one based on the current context. If you list as many alternates as the <code class="code">asm</code> statement allows, you permit the optimizers to produce the best possible code. If you must use a specific register, but your Machine Constraints do not provide sufficient control to select the specific register you want, local register variables may provide a solution (see <a class="pxref" href="local-register-variables">Specifying Registers for Local Variables</a>). </p> </dd> <dt><var class="var">cvariablename</var></dt> <dd> +<p>Specifies a C lvalue expression to hold the output, typically a variable name. The enclosing parentheses are a required part of the syntax. </p> </dd> </dl> <p>When the compiler selects the registers to use to represent the output operands, it does not use any of the clobbered registers (see <a class="pxref" href="#Clobbers-and-Scratch-Registers">Clobbers and Scratch Registers</a>). </p> <p>Output operand expressions must be lvalues. The compiler cannot check whether the operands have data types that are reasonable for the instruction being executed. For output expressions that are not directly addressable (for example a bit-field), the constraint must allow a register. In that case, GCC uses the register as the output of the <code class="code">asm</code>, and then stores that register into the output. </p> <p>Operands using the ‘<samp class="samp">+</samp>’ constraint modifier count as two operands (that is, both as input and output) towards the total maximum of 30 operands per <code class="code">asm</code> statement. </p> <p>Use the ‘<samp class="samp">&</samp>’ constraint modifier (see <a class="pxref" href="modifiers">Constraint Modifier Characters</a>) on all output operands that must not overlap an input. Otherwise, GCC may allocate the output operand in the same register as an unrelated input operand, on the assumption that the assembler code consumes its inputs before producing outputs. This assumption may be false if the assembler code actually consists of more than one instruction. </p> <p>The same problem can occur if one output parameter (<var class="var">a</var>) allows a register constraint and another output parameter (<var class="var">b</var>) allows a memory constraint. The code generated by GCC to access the memory address in <var class="var">b</var> can contain registers which <em class="emph">might</em> be shared by <var class="var">a</var>, and GCC considers those registers to be inputs to the asm. As above, GCC assumes that such input registers are consumed before any outputs are written. This assumption may result in incorrect behavior if the <code class="code">asm</code> statement writes to <var class="var">a</var> before using <var class="var">b</var>. Combining the ‘<samp class="samp">&</samp>’ modifier with the register constraint on <var class="var">a</var> ensures that modifying <var class="var">a</var> does not affect the address referenced by <var class="var">b</var>. Otherwise, the location of <var class="var">b</var> is undefined if <var class="var">a</var> is modified before using <var class="var">b</var>. </p> <p><code class="code">asm</code> supports operand modifiers on operands (for example ‘<samp class="samp">%k2</samp>’ instead of simply ‘<samp class="samp">%2</samp>’). <a class="ref" href="#GenericOperandmodifiers">Generic Operand modifiers</a> lists the modifiers that are available on all targets. Other modifiers are hardware dependent. For example, the list of supported modifiers for x86 is found at <a class="ref" href="#x86Operandmodifiers">x86 Operand modifiers</a>. </p> <p>If the C code that follows the <code class="code">asm</code> makes no use of any of the output operands, use <code class="code">volatile</code> for the <code class="code">asm</code> statement to prevent the optimizers from discarding the <code class="code">asm</code> statement as unneeded (see <a class="ref" href="#Volatile">Volatile</a>). </p> <p>This code makes no use of the optional <var class="var">asmSymbolicName</var>. Therefore it references the first output operand as <code class="code">%0</code> (were there a second, it would be <code class="code">%1</code>, etc). The number of the first input operand is one greater than that of the last output operand. In this i386 example, that makes <code class="code">Mask</code> referenced as <code class="code">%1</code>: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">uint32_t Mask = 1234; +uint32_t Index; + + asm ("bsfl %1, %0" + : "=r" (Index) + : "r" (Mask) + : "cc");</pre> +</div> <p>That code overwrites the variable <code class="code">Index</code> (‘<samp class="samp">=</samp>’), placing the value in a register (‘<samp class="samp">r</samp>’). Using the generic ‘<samp class="samp">r</samp>’ constraint instead of a constraint for a specific register allows the compiler to pick the register to use, which can result in more efficient code. This may not be possible if an assembler instruction requires a specific register. </p> <p>The following i386 example uses the <var class="var">asmSymbolicName</var> syntax. It produces the same result as the code above, but some may consider it more readable or more maintainable since reordering index numbers is not necessary when adding or removing operands. The names <code class="code">aIndex</code> and <code class="code">aMask</code> are only used in this example to emphasize which names get used where. It is acceptable to reuse the names <code class="code">Index</code> and <code class="code">Mask</code>. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">uint32_t Mask = 1234; +uint32_t Index; + + asm ("bsfl %[aMask], %[aIndex]" + : [aIndex] "=r" (Index) + : [aMask] "r" (Mask) + : "cc");</pre> +</div> <p>Here are some more examples of output operands. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">uint32_t c = 1; +uint32_t d; +uint32_t *e = &c; + +asm ("mov %[e], %[d]" + : [d] "=rm" (d) + : [e] "rm" (*e));</pre> +</div> <p>Here, <code class="code">d</code> may either be in a register or in memory. Since the compiler might already have the current value of the <code class="code">uint32_t</code> location pointed to by <code class="code">e</code> in a register, you can enable it to choose the best location for <code class="code">d</code> by specifying both constraints. </p> +</div> <div class="subsubsection-level-extent" id="Flag-Output-Operands"> <h1 class="subsubsection"><span>6.47.2.4 Flag Output Operands<a class="copiable-link" href="#Flag-Output-Operands"> ¶</a></span></h1> <p>Some targets have a special register that holds the “flags” for the result of an operation or comparison. Normally, the contents of that register are either unmodifed by the asm, or the <code class="code">asm</code> statement is considered to clobber the contents. </p> <p>On some targets, a special form of output operand exists by which conditions in the flags register may be outputs of the asm. The set of conditions supported are target specific, but the general rule is that the output variable must be a scalar integer, and the value is boolean. When supported, the target defines the preprocessor symbol <code class="code">__GCC_ASM_FLAG_OUTPUTS__</code>. </p> <p>Because of the special nature of the flag output operands, the constraint may not include alternatives. </p> <p>Most often, the target has only one flags register, and thus is an implied operand of many instructions. In this case, the operand should not be referenced within the assembler template via <code class="code">%0</code> etc, as there’s no corresponding text in the assembly language. </p> <dl class="table"> <dt>ARM</dt> <dt>AArch64</dt> <dd> +<p>The flag output constraints for the ARM family are of the form ‘<samp class="samp">=@cc<var class="var">cond</var></samp>’ where <var class="var">cond</var> is one of the standard conditions defined in the ARM ARM for <code class="code">ConditionHolds</code>. </p> <dl class="table"> <dt><code class="code">eq</code></dt> <dd><p>Z flag set, or equal </p></dd> <dt><code class="code">ne</code></dt> <dd><p>Z flag clear or not equal </p></dd> <dt><code class="code">cs</code></dt> <dt><code class="code">hs</code></dt> <dd><p>C flag set or unsigned greater than equal </p></dd> <dt><code class="code">cc</code></dt> <dt><code class="code">lo</code></dt> <dd><p>C flag clear or unsigned less than </p></dd> <dt><code class="code">mi</code></dt> <dd><p>N flag set or “minus” </p></dd> <dt><code class="code">pl</code></dt> <dd><p>N flag clear or “plus” </p></dd> <dt><code class="code">vs</code></dt> <dd><p>V flag set or signed overflow </p></dd> <dt><code class="code">vc</code></dt> <dd><p>V flag clear </p></dd> <dt><code class="code">hi</code></dt> <dd><p>unsigned greater than </p></dd> <dt><code class="code">ls</code></dt> <dd><p>unsigned less than equal </p></dd> <dt><code class="code">ge</code></dt> <dd><p>signed greater than equal </p></dd> <dt><code class="code">lt</code></dt> <dd><p>signed less than </p></dd> <dt><code class="code">gt</code></dt> <dd><p>signed greater than </p></dd> <dt><code class="code">le</code></dt> <dd><p>signed less than equal </p></dd> </dl> <p>The flag output constraints are not supported in thumb1 mode. </p> </dd> <dt>x86 family</dt> <dd> +<p>The flag output constraints for the x86 family are of the form ‘<samp class="samp">=@cc<var class="var">cond</var></samp>’ where <var class="var">cond</var> is one of the standard conditions defined in the ISA manual for <code class="code">j<var class="var">cc</var></code> or <code class="code">set<var class="var">cc</var></code>. </p> <dl class="table"> <dt><code class="code">a</code></dt> <dd><p>“above” or unsigned greater than </p></dd> <dt><code class="code">ae</code></dt> <dd><p>“above or equal” or unsigned greater than or equal </p></dd> <dt><code class="code">b</code></dt> <dd><p>“below” or unsigned less than </p></dd> <dt><code class="code">be</code></dt> <dd><p>“below or equal” or unsigned less than or equal </p></dd> <dt><code class="code">c</code></dt> <dd><p>carry flag set </p></dd> <dt><code class="code">e</code></dt> <dt><code class="code">z</code></dt> <dd><p>“equal” or zero flag set </p></dd> <dt><code class="code">g</code></dt> <dd><p>signed greater than </p></dd> <dt><code class="code">ge</code></dt> <dd><p>signed greater than or equal </p></dd> <dt><code class="code">l</code></dt> <dd><p>signed less than </p></dd> <dt><code class="code">le</code></dt> <dd><p>signed less than or equal </p></dd> <dt><code class="code">o</code></dt> <dd><p>overflow flag set </p></dd> <dt><code class="code">p</code></dt> <dd><p>parity flag set </p></dd> <dt><code class="code">s</code></dt> <dd><p>sign flag set </p></dd> <dt><code class="code">na</code></dt> <dt><code class="code">nae</code></dt> <dt><code class="code">nb</code></dt> <dt><code class="code">nbe</code></dt> <dt><code class="code">nc</code></dt> <dt><code class="code">ne</code></dt> <dt><code class="code">ng</code></dt> <dt><code class="code">nge</code></dt> <dt><code class="code">nl</code></dt> <dt><code class="code">nle</code></dt> <dt><code class="code">no</code></dt> <dt><code class="code">np</code></dt> <dt><code class="code">ns</code></dt> <dt><code class="code">nz</code></dt> <dd><p>“not” <var class="var">flag</var>, or inverted versions of those above </p></dd> </dl> </dd> </dl> +</div> <div class="subsubsection-level-extent" id="Input-Operands"> <h1 class="subsubsection"><span>6.47.2.5 Input Operands<a class="copiable-link" href="#Input-Operands"> ¶</a></span></h1> <p>Input operands make values from C variables and expressions available to the assembly code. </p> <p>Operands are separated by commas. Each operand has this format: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp"><span class="r">[</span> [<var class="var">asmSymbolicName</var>] <span class="r">]</span> <var class="var">constraint</var> (<var class="var">cexpression</var>)</pre> +</div> <dl class="table"> <dt><var class="var">asmSymbolicName</var></dt> <dd> +<p>Specifies a symbolic name for the operand. Reference the name in the assembler template by enclosing it in square brackets (i.e. ‘<samp class="samp">%[Value]</samp>’). The scope of the name is the <code class="code">asm</code> statement that contains the definition. Any valid C variable name is acceptable, including names already defined in the surrounding code. No two operands within the same <code class="code">asm</code> statement can use the same symbolic name. </p> <p>When not using an <var class="var">asmSymbolicName</var>, use the (zero-based) position of the operand in the list of operands in the assembler template. For example if there are two output operands and three inputs, use ‘<samp class="samp">%2</samp>’ in the template to refer to the first input operand, ‘<samp class="samp">%3</samp>’ for the second, and ‘<samp class="samp">%4</samp>’ for the third. </p> </dd> <dt><var class="var">constraint</var></dt> <dd> +<p>A string constant specifying constraints on the placement of the operand; See <a class="xref" href="constraints">Constraints for <code class="code">asm</code> Operands</a>, for details. </p> <p>Input constraint strings may not begin with either ‘<samp class="samp">=</samp>’ or ‘<samp class="samp">+</samp>’. When you list more than one possible location (for example, ‘<samp class="samp">"irm"</samp>’), the compiler chooses the most efficient one based on the current context. If you must use a specific register, but your Machine Constraints do not provide sufficient control to select the specific register you want, local register variables may provide a solution (see <a class="pxref" href="local-register-variables">Specifying Registers for Local Variables</a>). </p> <p>Input constraints can also be digits (for example, <code class="code">"0"</code>). This indicates that the specified input must be in the same place as the output constraint at the (zero-based) index in the output constraint list. When using <var class="var">asmSymbolicName</var> syntax for the output operands, you may use these names (enclosed in brackets ‘<samp class="samp">[]</samp>’) instead of digits. </p> </dd> <dt><var class="var">cexpression</var></dt> <dd> +<p>This is the C variable or expression being passed to the <code class="code">asm</code> statement as input. The enclosing parentheses are a required part of the syntax. </p> </dd> </dl> <p>When the compiler selects the registers to use to represent the input operands, it does not use any of the clobbered registers (see <a class="pxref" href="#Clobbers-and-Scratch-Registers">Clobbers and Scratch Registers</a>). </p> <p>If there are no output operands but there are input operands, place two consecutive colons where the output operands would go: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">__asm__ ("some instructions" + : /* No outputs. */ + : "r" (Offset / 8));</pre> +</div> <p><strong class="strong">Warning:</strong> Do <em class="emph">not</em> modify the contents of input-only operands (except for inputs tied to outputs). The compiler assumes that on exit from the <code class="code">asm</code> statement these operands contain the same values as they had before executing the statement. It is <em class="emph">not</em> possible to use clobbers to inform the compiler that the values in these inputs are changing. One common work-around is to tie the changing input variable to an output variable that never gets used. Note, however, that if the code that follows the <code class="code">asm</code> statement makes no use of any of the output operands, the GCC optimizers may discard the <code class="code">asm</code> statement as unneeded (see <a class="ref" href="#Volatile">Volatile</a>). </p> <p><code class="code">asm</code> supports operand modifiers on operands (for example ‘<samp class="samp">%k2</samp>’ instead of simply ‘<samp class="samp">%2</samp>’). <a class="ref" href="#GenericOperandmodifiers">Generic Operand modifiers</a> lists the modifiers that are available on all targets. Other modifiers are hardware dependent. For example, the list of supported modifiers for x86 is found at <a class="ref" href="#x86Operandmodifiers">x86 Operand modifiers</a>. </p> <p>In this example using the fictitious <code class="code">combine</code> instruction, the constraint <code class="code">"0"</code> for input operand 1 says that it must occupy the same location as output operand 0. Only input operands may use numbers in constraints, and they must each refer to an output operand. Only a number (or the symbolic assembler name) in the constraint can guarantee that one operand is in the same place as another. The mere fact that <code class="code">foo</code> is the value of both operands is not enough to guarantee that they are in the same place in the generated assembler code. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">asm ("combine %2, %0" + : "=r" (foo) + : "0" (foo), "g" (bar));</pre> +</div> <p>Here is an example using symbolic names. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">asm ("cmoveq %1, %2, %[result]" + : [result] "=r"(result) + : "r" (test), "r" (new), "[result]" (old));</pre> +</div> +</div> <div class="subsubsection-level-extent" id="Clobbers-and-Scratch-Registers-1"> <h1 class="subsubsection"><span>6.47.2.6 Clobbers and Scratch Registers<a class="copiable-link" href="#Clobbers-and-Scratch-Registers-1"> ¶</a></span></h1> <p>While the compiler is aware of changes to entries listed in the output operands, the inline <code class="code">asm</code> code may modify more than just the outputs. For example, calculations may require additional registers, or the processor may overwrite a register as a side effect of a particular assembler instruction. In order to inform the compiler of these changes, list them in the clobber list. Clobber list items are either register names or the special clobbers (listed below). Each clobber list item is a string constant enclosed in double quotes and separated by commas. </p> <p>Clobber descriptions may not in any way overlap with an input or output operand. For example, you may not have an operand describing a register class with one member when listing that register in the clobber list. Variables declared to live in specific registers (see <a class="pxref" href="explicit-register-variables">Variables in Specified Registers</a>) and used as <code class="code">asm</code> input or output operands must have no part mentioned in the clobber description. In particular, there is no way to specify that input operands get modified without also specifying them as output operands. </p> <p>When the compiler selects which registers to use to represent input and output operands, it does not use any of the clobbered registers. As a result, clobbered registers are available for any use in the assembler code. </p> <p>Another restriction is that the clobber list should not contain the stack pointer register. This is because the compiler requires the value of the stack pointer to be the same after an <code class="code">asm</code> statement as it was on entry to the statement. However, previous versions of GCC did not enforce this rule and allowed the stack pointer to appear in the list, with unclear semantics. This behavior is deprecated and listing the stack pointer may become an error in future versions of GCC. </p> <p>Here is a realistic example for the VAX showing the use of clobbered registers: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">asm volatile ("movc3 %0, %1, %2" + : /* No outputs. */ + : "g" (from), "g" (to), "g" (count) + : "r0", "r1", "r2", "r3", "r4", "r5", "memory");</pre> +</div> <p>Also, there are two special clobber arguments: </p> <dl class="table"> <dt><code class="code">"cc"</code></dt> <dd> +<p>The <code class="code">"cc"</code> clobber indicates that the assembler code modifies the flags register. On some machines, GCC represents the condition codes as a specific hardware register; <code class="code">"cc"</code> serves to name this register. On other machines, condition code handling is different, and specifying <code class="code">"cc"</code> has no effect. But it is valid no matter what the target. </p> </dd> <dt><code class="code">"memory"</code></dt> <dd> +<p>The <code class="code">"memory"</code> clobber tells the compiler that the assembly code performs memory reads or writes to items other than those listed in the input and output operands (for example, accessing the memory pointed to by one of the input parameters). To ensure memory contains correct values, GCC may need to flush specific register values to memory before executing the <code class="code">asm</code>. Further, the compiler does not assume that any values read from memory before an <code class="code">asm</code> remain unchanged after that <code class="code">asm</code>; it reloads them as needed. Using the <code class="code">"memory"</code> clobber effectively forms a read/write memory barrier for the compiler. </p> <p>Note that this clobber does not prevent the <em class="emph">processor</em> from doing speculative reads past the <code class="code">asm</code> statement. To prevent that, you need processor-specific fence instructions. </p> </dd> </dl> <p>Flushing registers to memory has performance implications and may be an issue for time-sensitive code. You can provide better information to GCC to avoid this, as shown in the following examples. At a minimum, aliasing rules allow GCC to know what memory <em class="emph">doesn’t</em> need to be flushed. </p> <p>Here is a fictitious sum of squares instruction, that takes two pointers to floating point values in memory and produces a floating point register output. Notice that <code class="code">x</code>, and <code class="code">y</code> both appear twice in the <code class="code">asm</code> parameters, once to specify memory accessed, and once to specify a base register used by the <code class="code">asm</code>. You won’t normally be wasting a register by doing this as GCC can use the same register for both purposes. However, it would be foolish to use both <code class="code">%1</code> and <code class="code">%3</code> for <code class="code">x</code> in this <code class="code">asm</code> and expect them to be the same. In fact, <code class="code">%3</code> may well not be a register. It might be a symbolic memory reference to the object pointed to by <code class="code">x</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("sumsq %0, %1, %2" + : "+f" (result) + : "r" (x), "r" (y), "m" (*x), "m" (*y));</pre> +</div> <p>Here is a fictitious <code class="code">*z++ = *x++ * *y++</code> instruction. Notice that the <code class="code">x</code>, <code class="code">y</code> and <code class="code">z</code> pointer registers must be specified as input/output because the <code class="code">asm</code> modifies them. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("vecmul %0, %1, %2" + : "+r" (z), "+r" (x), "+r" (y), "=m" (*z) + : "m" (*x), "m" (*y));</pre> +</div> <p>An x86 example where the string memory argument is of unknown length. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm("repne scasb" + : "=c" (count), "+D" (p) + : "m" (*(const char (*)[]) p), "0" (-1), "a" (0));</pre> +</div> <p>If you know the above will only be reading a ten byte array then you could instead use a memory input like: <code class="code">"m" (*(const char (*)[10]) p)</code>. </p> <p>Here is an example of a PowerPC vector scale implemented in assembly, complete with vector and condition code clobbers, and some initialized offset registers that are unchanged by the <code class="code">asm</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void +dscal (size_t n, double *x, double alpha) +{ + asm ("/* lots of asm here */" + : "+m" (*(double (*)[n]) x), "+&r" (n), "+b" (x) + : "d" (alpha), "b" (32), "b" (48), "b" (64), + "b" (80), "b" (96), "b" (112) + : "cr0", + "vs32","vs33","vs34","vs35","vs36","vs37","vs38","vs39", + "vs40","vs41","vs42","vs43","vs44","vs45","vs46","vs47"); +}</pre> +</div> <p>Rather than allocating fixed registers via clobbers to provide scratch registers for an <code class="code">asm</code> statement, an alternative is to define a variable and make it an early-clobber output as with <code class="code">a2</code> and <code class="code">a3</code> in the example below. This gives the compiler register allocator more freedom. You can also define a variable and make it an output tied to an input as with <code class="code">a0</code> and <code class="code">a1</code>, tied respectively to <code class="code">ap</code> and <code class="code">lda</code>. Of course, with tied outputs your <code class="code">asm</code> can’t use the input value after modifying the output register since they are one and the same register. What’s more, if you omit the early-clobber on the output, it is possible that GCC might allocate the same register to another of the inputs if GCC could prove they had the same value on entry to the <code class="code">asm</code>. This is why <code class="code">a1</code> has an early-clobber. Its tied input, <code class="code">lda</code> might conceivably be known to have the value 16 and without an early-clobber share the same register as <code class="code">%11</code>. On the other hand, <code class="code">ap</code> can’t be the same as any of the other inputs, so an early-clobber on <code class="code">a0</code> is not needed. It is also not desirable in this case. An early-clobber on <code class="code">a0</code> would cause GCC to allocate a separate register for the <code class="code">"m" (*(const double (*)[]) ap)</code> input. Note that tying an input to an output is the way to set up an initialized temporary register modified by an <code class="code">asm</code> statement. An input not tied to an output is assumed by GCC to be unchanged, for example <code class="code">"b" (16)</code> below sets up <code class="code">%11</code> to 16, and GCC might use that register in following code if the value 16 happened to be needed. You can even use a normal <code class="code">asm</code> output for a scratch if all inputs that might share the same register are consumed before the scratch is used. The VSX registers clobbered by the <code class="code">asm</code> statement could have used this technique except for GCC’s limit on the number of <code class="code">asm</code> parameters. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static void +dgemv_kernel_4x4 (long n, const double *ap, long lda, + const double *x, double *y, double alpha) +{ + double *a0; + double *a1; + double *a2; + double *a3; + + __asm__ + ( + /* lots of asm here */ + "#n=%1 ap=%8=%12 lda=%13 x=%7=%10 y=%0=%2 alpha=%9 o16=%11\n" + "#a0=%3 a1=%4 a2=%5 a3=%6" + : + "+m" (*(double (*)[n]) y), + "+&r" (n), // 1 + "+b" (y), // 2 + "=b" (a0), // 3 + "=&b" (a1), // 4 + "=&b" (a2), // 5 + "=&b" (a3) // 6 + : + "m" (*(const double (*)[n]) x), + "m" (*(const double (*)[]) ap), + "d" (alpha), // 9 + "r" (x), // 10 + "b" (16), // 11 + "3" (ap), // 12 + "4" (lda) // 13 + : + "cr0", + "vs32","vs33","vs34","vs35","vs36","vs37", + "vs40","vs41","vs42","vs43","vs44","vs45","vs46","vs47" + ); +}</pre> +</div> +</div> <div class="subsubsection-level-extent" id="Goto-Labels"> <h1 class="subsubsection"><span>6.47.2.7 Goto Labels<a class="copiable-link" href="#Goto-Labels"> ¶</a></span></h1> <p><code class="code">asm goto</code> allows assembly code to jump to one or more C labels. The <var class="var">GotoLabels</var> section in an <code class="code">asm goto</code> statement contains a comma-separated list of all C labels to which the assembler code may jump. GCC assumes that <code class="code">asm</code> execution falls through to the next statement (if this is not the case, consider using the <code class="code">__builtin_unreachable</code> intrinsic after the <code class="code">asm</code> statement). Optimization of <code class="code">asm goto</code> may be improved by using the <code class="code">hot</code> and <code class="code">cold</code> label attributes (see <a class="pxref" href="label-attributes">Label Attributes</a>). </p> <p>If the assembler code does modify anything, use the <code class="code">"memory"</code> clobber to force the optimizers to flush all register values to memory and reload them if necessary after the <code class="code">asm</code> statement. </p> <p>Also note that an <code class="code">asm goto</code> statement is always implicitly considered volatile. </p> <p>Be careful when you set output operands inside <code class="code">asm goto</code> only on some possible control flow paths. If you don’t set up the output on given path and never use it on this path, it is okay. Otherwise, you should use ‘<samp class="samp">+</samp>’ constraint modifier meaning that the operand is input and output one. With this modifier you will have the correct values on all possible paths from the <code class="code">asm goto</code>. </p> <p>To reference a label in the assembler template, prefix it with ‘<samp class="samp">%l</samp>’ (lowercase ‘<samp class="samp">L</samp>’) followed by its (zero-based) position in <var class="var">GotoLabels</var> plus the number of input and output operands. Output operand with constraint modifier ‘<samp class="samp">+</samp>’ is counted as two operands because it is considered as one output and one input operand. For example, if the <code class="code">asm</code> has three inputs, one output operand with constraint modifier ‘<samp class="samp">+</samp>’ and one output operand with constraint modifier ‘<samp class="samp">=</samp>’ and references two labels, refer to the first label as ‘<samp class="samp">%l6</samp>’ and the second as ‘<samp class="samp">%l7</samp>’). </p> <p>Alternately, you can reference labels using the actual C label name enclosed in brackets. For example, to reference a label named <code class="code">carry</code>, you can use ‘<samp class="samp">%l[carry]</samp>’. The label must still be listed in the <var class="var">GotoLabels</var> section when using this approach. It is better to use the named references for labels as in this case you can avoid counting input and output operands and special treatment of output operands with constraint modifier ‘<samp class="samp">+</samp>’. </p> <p>Here is an example of <code class="code">asm goto</code> for i386: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">asm goto ( + "btl %1, %0\n\t" + "jc %l2" + : /* No outputs. */ + : "r" (p1), "r" (p2) + : "cc" + : carry); + +return 0; + +carry: +return 1;</pre> +</div> <p>The following example shows an <code class="code">asm goto</code> that uses a memory clobber. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">int frob(int x) +{ + int y; + asm goto ("frob %%r5, %1; jc %l[error]; mov (%2), %%r5" + : /* No outputs. */ + : "r"(x), "r"(&y) + : "r5", "memory" + : error); + return y; +error: + return -1; +}</pre> +</div> <p>The following example shows an <code class="code">asm goto</code> that uses an output. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">int foo(int count) +{ + asm goto ("dec %0; jb %l[stop]" + : "+r" (count) + : + : + : stop); + return count; +stop: + return 0; +}</pre> +</div> <p>The following artificial example shows an <code class="code">asm goto</code> that sets up an output only on one path inside the <code class="code">asm goto</code>. Usage of constraint modifier <code class="code">=</code> instead of <code class="code">+</code> would be wrong as <code class="code">factor</code> is used on all paths from the <code class="code">asm goto</code>. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">int foo(int inp) +{ + int factor = 0; + asm goto ("cmp %1, 10; jb %l[lab]; mov 2, %0" + : "+r" (factor) + : "r" (inp) + : + : lab); +lab: + return inp * factor; /* return 2 * inp or 0 if inp < 10 */ +}</pre> +</div> +</div> <div class="subsubsection-level-extent" id="Generic-Operand-Modifiers"> <h1 class="subsubsection"><span>6.47.2.8 Generic Operand Modifiers<a class="copiable-link" href="#Generic-Operand-Modifiers"> ¶</a></span></h1> <p>The following table shows the modifiers supported by all targets and their effects: </p> <table class="multitable"> <thead><tr> +<th width="15%">Modifier</th> +<th width="70%">Description</th> +<th width="15%">Example</th> +</tr></thead> <tbody> +<tr> +<td width="15%"><code class="code">c</code></td> +<td width="70%">Require a constant operand and print the constant expression with no punctuation.</td> +<td width="15%"><code class="code">%c0</code></td> +</tr> <tr> +<td width="15%"><code class="code">n</code></td> +<td width="70%">Like ‘<samp class="samp">%c</samp>’ except that the value of the constant is negated before printing.</td> +<td width="15%"><code class="code">%n0</code></td> +</tr> <tr> +<td width="15%"><code class="code">a</code></td> +<td width="70%">Substitute a memory reference, with the actual operand treated as the address. This may be useful when outputting a “load address” instruction, because often the assembler syntax for such an instruction requires you to write the operand as if it were a memory reference.</td> +<td width="15%"><code class="code">%a0</code></td> +</tr> <tr> +<td width="15%"><code class="code">l</code></td> +<td width="70%">Print the label name with no punctuation.</td> +<td width="15%"><code class="code">%l0</code></td> +</tr> </tbody> </table> +</div> <div class="subsubsection-level-extent" id="x86-Operand-Modifiers"> <h1 class="subsubsection"><span>6.47.2.9 x86 Operand Modifiers<a class="copiable-link" href="#x86-Operand-Modifiers"> ¶</a></span></h1> <p>References to input, output, and goto operands in the assembler template of extended <code class="code">asm</code> statements can use modifiers to affect the way the operands are formatted in the code output to the assembler. For example, the following code uses the ‘<samp class="samp">h</samp>’ and ‘<samp class="samp">b</samp>’ modifiers for x86: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">uint16_t num; +asm volatile ("xchg %h0, %b0" : "+a" (num) );</pre> +</div> <p>These modifiers generate this assembler code: </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">xchg %ah, %al</pre> +</div> <p>The rest of this discussion uses the following code for illustrative purposes. </p> <div class="example"> <pre class="example-preformatted" data-language="cpp">int main() +{ + int iInt = 1; + +top: + + asm volatile goto ("some assembler instructions here" + : /* No outputs. */ + : "q" (iInt), "X" (sizeof(unsigned char) + 1), "i" (42) + : /* No clobbers. */ + : top); +}</pre> +</div> <p>With no modifiers, this is what the output from the operands would be for the ‘<samp class="samp">att</samp>’ and ‘<samp class="samp">intel</samp>’ dialects of assembler: </p> <table class="multitable"> <thead><tr> +<th>Operand</th> +<th>‘<samp class="samp">att</samp>’</th> +<th>‘<samp class="samp">intel</samp>’</th> +</tr></thead> <tbody> +<tr> +<td><code class="code">%0</code></td> +<td><code class="code">%eax</code></td> +<td><code class="code">eax</code></td> +</tr> <tr> +<td><code class="code">%1</code></td> +<td><code class="code">$2</code></td> +<td><code class="code">2</code></td> +</tr> <tr> +<td><code class="code">%3</code></td> +<td><code class="code">$.L3</code></td> +<td><code class="code">OFFSET FLAT:.L3</code></td> +</tr> <tr> +<td><code class="code">%4</code></td> +<td><code class="code">$8</code></td> +<td><code class="code">8</code></td> +</tr> <tr> +<td><code class="code">%5</code></td> +<td><code class="code">%xmm0</code></td> +<td><code class="code">xmm0</code></td> +</tr> <tr> +<td><code class="code">%7</code></td> +<td><code class="code">$0</code></td> +<td><code class="code">0</code></td> +</tr> </tbody> </table> <p>The table below shows the list of supported modifiers and their effects. </p> <table class="multitable"> <thead><tr> +<th>Modifier</th> +<th>Description</th> +<th>Operand</th> +<th>‘<samp class="samp">att</samp>’</th> +<th>‘<samp class="samp">intel</samp>’</th> +</tr></thead> <tbody> +<tr> +<td><code class="code">A</code></td> +<td>Print an absolute memory reference.</td> +<td><code class="code">%A0</code></td> +<td><code class="code">*%rax</code></td> +<td><code class="code">rax</code></td> +</tr> <tr> +<td><code class="code">b</code></td> +<td>Print the QImode name of the register.</td> +<td><code class="code">%b0</code></td> +<td><code class="code">%al</code></td> +<td><code class="code">al</code></td> +</tr> <tr> +<td><code class="code">B</code></td> +<td>print the opcode suffix of b.</td> +<td><code class="code">%B0</code></td> +<td><code class="code">b</code></td> +<td></td> +</tr> <tr> +<td><code class="code">c</code></td> +<td>Require a constant operand and print the constant expression with no punctuation.</td> +<td><code class="code">%c1</code></td> +<td><code class="code">2</code></td> +<td><code class="code">2</code></td> +</tr> <tr> +<td><code class="code">d</code></td> +<td>print duplicated register operand for AVX instruction.</td> +<td><code class="code">%d5</code></td> +<td><code class="code">%xmm0, %xmm0</code></td> +<td><code class="code">xmm0, xmm0</code></td> +</tr> <tr> +<td><code class="code">E</code></td> +<td>Print the address in Double Integer (DImode) mode (8 bytes) when the target is 64-bit. Otherwise mode is unspecified (VOIDmode).</td> +<td><code class="code">%E1</code></td> +<td><code class="code">%(rax)</code></td> +<td><code class="code">[rax]</code></td> +</tr> <tr> +<td><code class="code">g</code></td> +<td>Print the V16SFmode name of the register.</td> +<td><code class="code">%g0</code></td> +<td><code class="code">%zmm0</code></td> +<td><code class="code">zmm0</code></td> +</tr> <tr> +<td><code class="code">h</code></td> +<td>Print the QImode name for a “high” register.</td> +<td><code class="code">%h0</code></td> +<td><code class="code">%ah</code></td> +<td><code class="code">ah</code></td> +</tr> <tr> +<td><code class="code">H</code></td> +<td>Add 8 bytes to an offsettable memory reference. Useful when accessing the high 8 bytes of SSE values. For a memref in (%rax), it generates</td> +<td><code class="code">%H0</code></td> +<td><code class="code">8(%rax)</code></td> +<td><code class="code">8[rax]</code></td> +</tr> <tr> +<td><code class="code">k</code></td> +<td>Print the SImode name of the register.</td> +<td><code class="code">%k0</code></td> +<td><code class="code">%eax</code></td> +<td><code class="code">eax</code></td> +</tr> <tr> +<td><code class="code">l</code></td> +<td>Print the label name with no punctuation.</td> +<td><code class="code">%l3</code></td> +<td><code class="code">.L3</code></td> +<td><code class="code">.L3</code></td> +</tr> <tr> +<td><code class="code">L</code></td> +<td>print the opcode suffix of l.</td> +<td><code class="code">%L0</code></td> +<td><code class="code">l</code></td> +<td></td> +</tr> <tr> +<td><code class="code">N</code></td> +<td>print maskz.</td> +<td><code class="code">%N7</code></td> +<td><code class="code">{z}</code></td> +<td><code class="code">{z}</code></td> +</tr> <tr> +<td><code class="code">p</code></td> +<td>Print raw symbol name (without syntax-specific prefixes).</td> +<td><code class="code">%p2</code></td> +<td><code class="code">42</code></td> +<td><code class="code">42</code></td> +</tr> <tr> +<td><code class="code">P</code></td> +<td>If used for a function, print the PLT suffix and generate PIC code. For example, emit <code class="code">foo@PLT</code> instead of ’foo’ for the function foo(). If used for a constant, drop all syntax-specific prefixes and issue the bare constant. See <code class="code">p</code> above.</td> +</tr> <tr> +<td><code class="code">q</code></td> +<td>Print the DImode name of the register.</td> +<td><code class="code">%q0</code></td> +<td><code class="code">%rax</code></td> +<td><code class="code">rax</code></td> +</tr> <tr> +<td><code class="code">Q</code></td> +<td>print the opcode suffix of q.</td> +<td><code class="code">%Q0</code></td> +<td><code class="code">q</code></td> +<td></td> +</tr> <tr> +<td><code class="code">R</code></td> +<td>print embedded rounding and sae.</td> +<td><code class="code">%R4</code></td> +<td><code class="code">{rn-sae}, </code></td> +<td><code class="code">, {rn-sae}</code></td> +</tr> <tr> +<td><code class="code">r</code></td> +<td>print only sae.</td> +<td><code class="code">%r4</code></td> +<td><code class="code">{sae}, </code></td> +<td><code class="code">, {sae}</code></td> +</tr> <tr> +<td><code class="code">s</code></td> +<td>print a shift double count, followed by the assemblers argument delimiterprint the opcode suffix of s.</td> +<td><code class="code">%s1</code></td> +<td><code class="code">$2, </code></td> +<td><code class="code">2, </code></td> +</tr> <tr> +<td><code class="code">S</code></td> +<td>print the opcode suffix of s.</td> +<td><code class="code">%S0</code></td> +<td><code class="code">s</code></td> +<td></td> +</tr> <tr> +<td><code class="code">t</code></td> +<td>print the V8SFmode name of the register.</td> +<td><code class="code">%t5</code></td> +<td><code class="code">%ymm0</code></td> +<td><code class="code">ymm0</code></td> +</tr> <tr> +<td><code class="code">T</code></td> +<td>print the opcode suffix of t.</td> +<td><code class="code">%T0</code></td> +<td><code class="code">t</code></td> +<td></td> +</tr> <tr> +<td><code class="code">V</code></td> +<td>print naked full integer register name without %.</td> +<td><code class="code">%V0</code></td> +<td><code class="code">eax</code></td> +<td><code class="code">eax</code></td> +</tr> <tr> +<td><code class="code">w</code></td> +<td>Print the HImode name of the register.</td> +<td><code class="code">%w0</code></td> +<td><code class="code">%ax</code></td> +<td><code class="code">ax</code></td> +</tr> <tr> +<td><code class="code">W</code></td> +<td>print the opcode suffix of w.</td> +<td><code class="code">%W0</code></td> +<td><code class="code">w</code></td> +<td></td> +</tr> <tr> +<td><code class="code">x</code></td> +<td>print the V4SFmode name of the register.</td> +<td><code class="code">%x5</code></td> +<td><code class="code">%xmm0</code></td> +<td><code class="code">xmm0</code></td> +</tr> <tr> +<td><code class="code">y</code></td> +<td>print "st(0)" instead of "st" as a register.</td> +<td><code class="code">%y6</code></td> +<td><code class="code">%st(0)</code></td> +<td><code class="code">st(0)</code></td> +</tr> <tr> +<td><code class="code">z</code></td> +<td>Print the opcode suffix for the size of the current integer operand (one of <code class="code">b</code>/<code class="code">w</code>/<code class="code">l</code>/<code class="code">q</code>).</td> +<td><code class="code">%z0</code></td> +<td><code class="code">l</code></td> +<td></td> +</tr> <tr> +<td><code class="code">Z</code></td> +<td>Like <code class="code">z</code>, with special suffixes for x87 instructions.</td> +</tr> </tbody> </table> +</div> <div class="subsubsection-level-extent" id="x86-Floating-Point-asm-Operands"> <h1 class="subsubsection"><span>6.47.2.10 x86 Floating-Point asm Operands<a class="copiable-link" href="#x86-Floating-Point-asm-Operands"> ¶</a></span></h1> <p>On x86 targets, there are several rules on the usage of stack-like registers in the operands of an <code class="code">asm</code>. These rules apply only to the operands that are stack-like registers: </p> <ol class="enumerate"> <li> Given a set of input registers that die in an <code class="code">asm</code>, it is necessary to know which are implicitly popped by the <code class="code">asm</code>, and which must be explicitly popped by GCC. <p>An input register that is implicitly popped by the <code class="code">asm</code> must be explicitly clobbered, unless it is constrained to match an output operand. </p> </li> +<li> For any input register that is implicitly popped by an <code class="code">asm</code>, it is necessary to know how to adjust the stack to compensate for the pop. If any non-popped input is closer to the top of the reg-stack than the implicitly popped register, it would not be possible to know what the stack looked like—it’s not clear how the rest of the stack “slides up”. <p>All implicitly popped input registers must be closer to the top of the reg-stack than any input that is not implicitly popped. </p> <p>It is possible that if an input dies in an <code class="code">asm</code>, the compiler might use the input register for an output reload. Consider this example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("foo" : "=t" (a) : "f" (b));</pre> +</div> <p>This code says that input <code class="code">b</code> is not popped by the <code class="code">asm</code>, and that the <code class="code">asm</code> pushes a result onto the reg-stack, i.e., the stack is one deeper after the <code class="code">asm</code> than it was before. But, it is possible that reload may think that it can use the same register for both the input and the output. </p> <p>To prevent this from happening, if any input operand uses the ‘<samp class="samp">f</samp>’ constraint, all output register constraints must use the ‘<samp class="samp">&</samp>’ early-clobber modifier. </p> <p>The example above is correctly written as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("foo" : "=&t" (a) : "f" (b));</pre> +</div> </li> +<li> Some operands need to be in particular places on the stack. All output operands fall in this category—GCC has no other way to know which registers the outputs appear in unless you indicate this in the constraints. <p>Output operands must specifically indicate which register an output appears in after an <code class="code">asm</code>. ‘<samp class="samp">=f</samp>’ is not allowed: the operand constraints must select a class with a single register. </p> </li> +<li> Output operands may not be “inserted” between existing stack registers. Since no 387 opcode uses a read/write operand, all output operands are dead before the <code class="code">asm</code>, and are pushed by the <code class="code">asm</code>. It makes no sense to push anywhere but the top of the reg-stack. <p>Output operands must start at the top of the reg-stack: output operands may not “skip” a register. </p> </li> +<li> Some <code class="code">asm</code> statements may need extra stack space for internal calculations. This can be guaranteed by clobbering stack registers unrelated to the inputs and outputs. </li> +</ol> <p>This <code class="code">asm</code> takes one input, which is internally popped, and produces two outputs. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("fsincos" : "=t" (cos), "=u" (sin) : "0" (inp));</pre> +</div> <p>This <code class="code">asm</code> takes two inputs, which are popped by the <code class="code">fyl2xp1</code> opcode, and replaces them with one output. The <code class="code">st(1)</code> clobber is necessary for the compiler to know that <code class="code">fyl2xp1</code> pops both inputs. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("fyl2xp1" : "=t" (result) : "0" (x), "u" (y) : "st(1)");</pre> +</div> +</div> <div class="subsubsection-level-extent" id="MSP430-Operand-Modifiers"> <h1 class="subsubsection"><span>6.47.2.11 MSP430 Operand Modifiers<a class="copiable-link" href="#MSP430-Operand-Modifiers"> ¶</a></span></h1> <p>The list below describes the supported modifiers and their effects for MSP430. </p> <table class="multitable"> <thead><tr> +<th width="10%">Modifier</th> +<th width="90%">Description</th> +</tr></thead> <tbody> +<tr> +<td width="10%"><code class="code">A</code></td> +<td width="90%">Select low 16-bits of the constant/register/memory operand.</td> +</tr> <tr> +<td width="10%"><code class="code">B</code></td> +<td width="90%">Select high 16-bits of the constant/register/memory operand.</td> +</tr> <tr> +<td width="10%"><code class="code">C</code></td> +<td width="90%">Select bits 32-47 of the constant/register/memory operand.</td> +</tr> <tr> +<td width="10%"><code class="code">D</code></td> +<td width="90%">Select bits 48-63 of the constant/register/memory operand.</td> +</tr> <tr> +<td width="10%"><code class="code">H</code></td> +<td width="90%">Equivalent to <code class="code">B</code> (for backwards compatibility).</td> +</tr> <tr> +<td width="10%"><code class="code">I</code></td> +<td width="90%">Print the inverse (logical <code class="code">NOT</code>) of the constant value.</td> +</tr> <tr> +<td width="10%"><code class="code">J</code></td> +<td width="90%">Print an integer without a <code class="code">#</code> prefix.</td> +</tr> <tr> +<td width="10%"><code class="code">L</code></td> +<td width="90%">Equivalent to <code class="code">A</code> (for backwards compatibility).</td> +</tr> <tr> +<td width="10%"><code class="code">O</code></td> +<td width="90%">Offset of the current frame from the top of the stack.</td> +</tr> <tr> +<td width="10%"><code class="code">Q</code></td> +<td width="90%">Use the <code class="code">A</code> instruction postfix.</td> +</tr> <tr> +<td width="10%"><code class="code">R</code></td> +<td width="90%">Inverse of condition code, for unsigned comparisons.</td> +</tr> <tr> +<td width="10%"><code class="code">W</code></td> +<td width="90%">Subtract 16 from the constant value.</td> +</tr> <tr> +<td width="10%"><code class="code">X</code></td> +<td width="90%">Use the <code class="code">X</code> instruction postfix.</td> +</tr> <tr> +<td width="10%"><code class="code">Y</code></td> +<td width="90%">Subtract 4 from the constant value.</td> +</tr> <tr> +<td width="10%"><code class="code">Z</code></td> +<td width="90%">Subtract 1 from the constant value.</td> +</tr> <tr> +<td width="10%"><code class="code">b</code></td> +<td width="90%">Append <code class="code">.B</code>, <code class="code">.W</code> or <code class="code">.A</code> to the instruction, depending on the mode.</td> +</tr> <tr> +<td width="10%"><code class="code">d</code></td> +<td width="90%">Offset 1 byte of a memory reference or constant value.</td> +</tr> <tr> +<td width="10%"><code class="code">e</code></td> +<td width="90%">Offset 3 bytes of a memory reference or constant value.</td> +</tr> <tr> +<td width="10%"><code class="code">f</code></td> +<td width="90%">Offset 5 bytes of a memory reference or constant value.</td> +</tr> <tr> +<td width="10%"><code class="code">g</code></td> +<td width="90%">Offset 7 bytes of a memory reference or constant value.</td> +</tr> <tr> +<td width="10%"><code class="code">p</code></td> +<td width="90%">Print the value of 2, raised to the power of the given constant. Used to select the specified bit position.</td> +</tr> <tr> +<td width="10%"><code class="code">r</code></td> +<td width="90%">Inverse of condition code, for signed comparisons.</td> +</tr> <tr> +<td width="10%"><code class="code">x</code></td> +<td width="90%">Equivialent to <code class="code">X</code>, but only for pointers.</td> +</tr> </tbody> </table> +</div> <div class="subsubsection-level-extent" id="LoongArch-Operand-Modifiers"> <h1 class="subsubsection"><span>6.47.2.12 LoongArch Operand Modifiers<a class="copiable-link" href="#LoongArch-Operand-Modifiers"> ¶</a></span></h1> <p>The list below describes the supported modifiers and their effects for LoongArch. </p> <table class="multitable"> <thead><tr> +<th width="10%">Modifier</th> +<th width="90%">Description</th> +</tr></thead> <tbody> +<tr> +<td width="10%"><code class="code">d</code></td> +<td width="90%">Same as <code class="code">c</code>.</td> +</tr> <tr> +<td width="10%"><code class="code">i</code></td> +<td width="90%">Print the character ”<code class="code">i</code>” if the operand is not a register.</td> +</tr> <tr> +<td width="10%"><code class="code">m</code></td> +<td width="90%">Same as <code class="code">c</code>, but the printed value is <code class="code">operand - 1</code>.</td> +</tr> <tr> +<td width="10%"><code class="code">X</code></td> +<td width="90%">Print a constant integer operand in hexadecimal.</td> +</tr> <tr> +<td width="10%"><code class="code">z</code></td> +<td width="90%">Print the operand in its unmodified form, followed by a comma.</td> +</tr> </tbody> </table> </div> </div> <div class="nav-panel"> <p> Next: <a href="constraints">Constraints for <code class="code">asm</code> Operands</a>, Previous: <a href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>, Up: <a href="using-assembly-language-with-c">How to Use Inline Assembly Language in C Code</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Extended-Asm.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Extended-Asm.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/fast-enumeration-details.html b/devdocs/gcc~13/fast-enumeration-details.html new file mode 100644 index 00000000..9fc92612 --- /dev/null +++ b/devdocs/gcc~13/fast-enumeration-details.html @@ -0,0 +1,21 @@ +<div class="subsection-level-extent" id="Fast-enumeration-details"> <div class="nav-panel"> <p> Next: <a href="fast-enumeration-protocol" accesskey="n" rel="next">Fast Enumeration Protocol</a>, Previous: <a href="c99-like-fast-enumeration-syntax" accesskey="p" rel="prev">C99-Like Fast Enumeration Syntax</a>, Up: <a href="fast-enumeration" accesskey="u" rel="up">Fast Enumeration</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Fast-Enumeration-Details"><span>8.9.3 Fast Enumeration Details<a class="copiable-link" href="#Fast-Enumeration-Details"> ¶</a></span></h1> <p>Here is a more technical description with the gory details. Consider the code </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">for (<var class="var">object expression</var> in <var class="var">collection expression</var>) +{ + <var class="var">statements</var> +}</pre> +</div> <p>here is what happens when you run it: </p> <ul class="itemize mark-bullet"> <li> +<code class="code"><var class="var">collection expression</var></code> is evaluated exactly once and the result is used as the collection object to iterate over. This means it is safe to write code such as <code class="code">for (object in [NSDictionary +keyEnumerator]) …</code>. </li> +<li>the iteration is implemented by the compiler by repeatedly getting batches of objects from the collection object using the fast enumeration protocol (see below), then iterating over all objects in the batch. This is faster than a normal enumeration where objects are retrieved one by one (hence the name “fast enumeration”). </li> +<li>if there are no objects in the collection, then <code class="code"><var class="var">object expression</var></code> is set to <code class="code">nil</code> and the loop immediately terminates. </li> +<li>if there are objects in the collection, then for each object in the collection (in the order they are returned) <code class="code"><var class="var">object expression</var></code> is set to the object, then <code class="code"><var class="var">statements</var></code> are executed. </li> +<li> +<code class="code"><var class="var">statements</var></code> can contain <code class="code">break</code> and <code class="code">continue</code> commands, which will abort the iteration or skip to the next loop iteration as expected. </li> +<li>when the iteration ends because there are no more objects to iterate over, <code class="code"><var class="var">object expression</var></code> is set to <code class="code">nil</code>. This allows you to determine whether the iteration finished because a <code class="code">break</code> command was used (in which case <code class="code"><var class="var">object expression</var></code> will remain set to the last object that was iterated over) or because it iterated over all the objects (in which case <code class="code"><var class="var">object expression</var></code> will be set to <code class="code">nil</code>). </li> +<li> +<code class="code"><var class="var">statements</var></code> must not make any changes to the collection object; if they do, it is a hard error and the fast enumeration terminates by invoking <code class="code">objc_enumerationMutation</code>, a runtime function that normally aborts the program but which can be customized by Foundation libraries via <code class="code">objc_set_mutation_handler</code> to do something different, such as raising an exception. </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="fast-enumeration-protocol">Fast Enumeration Protocol</a>, Previous: <a href="c99-like-fast-enumeration-syntax">C99-Like Fast Enumeration Syntax</a>, Up: <a href="fast-enumeration">Fast Enumeration</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fast-enumeration-details.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fast-enumeration-details.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/fast-enumeration-protocol.html b/devdocs/gcc~13/fast-enumeration-protocol.html new file mode 100644 index 00000000..f3ed769a --- /dev/null +++ b/devdocs/gcc~13/fast-enumeration-protocol.html @@ -0,0 +1,16 @@ +<div class="subsection-level-extent" id="Fast-enumeration-protocol"> <div class="nav-panel"> <p> Previous: <a href="fast-enumeration-details" accesskey="p" rel="prev">Fast Enumeration Details</a>, Up: <a href="fast-enumeration" accesskey="u" rel="up">Fast Enumeration</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Fast-Enumeration-Protocol"><span>8.9.4 Fast Enumeration Protocol<a class="copiable-link" href="#Fast-Enumeration-Protocol"> ¶</a></span></h1> <p>If you want your own collection object to be usable with fast enumeration, you need to have it implement the method </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">- (unsigned long) countByEnumeratingWithState: (NSFastEnumerationState *)state + objects: (id *)objects + count: (unsigned long)len;</pre> +</div> <p>where <code class="code">NSFastEnumerationState</code> must be defined in your code as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef struct +{ + unsigned long state; + id *itemsPtr; + unsigned long *mutationsPtr; + unsigned long extra[5]; +} NSFastEnumerationState;</pre> +</div> <p>If no <code class="code">NSFastEnumerationState</code> is defined in your code, the compiler will automatically replace <code class="code">NSFastEnumerationState *</code> with <code class="code">struct __objcFastEnumerationState *</code>, where that type is silently defined by the compiler in an identical way. This can be confusing and we recommend that you define <code class="code">NSFastEnumerationState</code> (as shown above) instead. </p> <p>The method is called repeatedly during a fast enumeration to retrieve batches of objects. Each invocation of the method should retrieve the next batch of objects. </p> <p>The return value of the method is the number of objects in the current batch; this should not exceed <code class="code">len</code>, which is the maximum size of a batch as requested by the caller. The batch itself is returned in the <code class="code">itemsPtr</code> field of the <code class="code">NSFastEnumerationState</code> struct. </p> <p>To help with returning the objects, the <code class="code">objects</code> array is a C array preallocated by the caller (on the stack) of size <code class="code">len</code>. In many cases you can put the objects you want to return in that <code class="code">objects</code> array, then do <code class="code">itemsPtr = objects</code>. But you don’t have to; if your collection already has the objects to return in some form of C array, it could return them from there instead. </p> <p>The <code class="code">state</code> and <code class="code">extra</code> fields of the <code class="code">NSFastEnumerationState</code> structure allows your collection object to keep track of the state of the enumeration. In a simple array implementation, <code class="code">state</code> may keep track of the index of the last object that was returned, and <code class="code">extra</code> may be unused. </p> <p>The <code class="code">mutationsPtr</code> field of the <code class="code">NSFastEnumerationState</code> is used to keep track of mutations. It should point to a number; before working on each object, the fast enumeration loop will check that this number has not changed. If it has, a mutation has happened and the fast enumeration will abort. So, <code class="code">mutationsPtr</code> could be set to point to some sort of version number of your collection, which is increased by one every time there is a change (for example when an object is added or removed). Or, if you are content with less strict mutation checks, it could point to the number of objects in your collection or some other value that can be checked to perform an approximate check that the collection has not been mutated. </p> <p>Finally, note how we declared the <code class="code">len</code> argument and the return value to be of type <code class="code">unsigned long</code>. They could also be declared to be of type <code class="code">unsigned int</code> and everything would still work. </p> </div> <div class="nav-panel"> <p> Previous: <a href="fast-enumeration-details">Fast Enumeration Details</a>, Up: <a href="fast-enumeration">Fast Enumeration</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fast-enumeration-protocol.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fast-enumeration-protocol.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/fast-enumeration.html b/devdocs/gcc~13/fast-enumeration.html new file mode 100644 index 00000000..41fb3bc8 --- /dev/null +++ b/devdocs/gcc~13/fast-enumeration.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Fast-enumeration"> <div class="nav-panel"> <p> Next: <a href="messaging-with-the-gnu-objective-c-runtime" accesskey="n" rel="next">Messaging with the GNU Objective-C Runtime</a>, Previous: <a href="synchronization" accesskey="p" rel="prev">Synchronization</a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Fast-Enumeration"><span>8.9 Fast Enumeration<a class="copiable-link" href="#Fast-Enumeration"> ¶</a></span></h1> <ul class="mini-toc"> <li><a href="using-fast-enumeration" accesskey="1">Using Fast Enumeration</a></li> <li><a href="c99-like-fast-enumeration-syntax" accesskey="2">C99-Like Fast Enumeration Syntax</a></li> <li><a href="fast-enumeration-details" accesskey="3">Fast Enumeration Details</a></li> <li><a href="fast-enumeration-protocol" accesskey="4">Fast Enumeration Protocol</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fast-enumeration.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fast-enumeration.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/fixed-headers.html b/devdocs/gcc~13/fixed-headers.html new file mode 100644 index 00000000..618bfdf2 --- /dev/null +++ b/devdocs/gcc~13/fixed-headers.html @@ -0,0 +1,9 @@ +<div class="section-level-extent" id="Fixed-Headers"> <div class="nav-panel"> <p> Next: <a href="standard-libraries" accesskey="n" rel="next">Standard Libraries</a>, Previous: <a href="incompatibilities" accesskey="p" rel="prev">Incompatibilities of GCC</a>, Up: <a href="trouble" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Fixed-Header-Files"><span>14.4 Fixed Header Files<a class="copiable-link" href="#Fixed-Header-Files"> ¶</a></span></h1> <p>GCC needs to install corrected versions of some system header files. This is because most target systems have some header files that won’t work with GCC unless they are changed. Some have bugs, some are incompatible with ISO C, and some depend on special features of other compilers. </p> <p>Installing GCC automatically creates and installs the fixed header files, by running a program called <code class="code">fixincludes</code>. Normally, you don’t need to pay attention to this. But there are cases where it doesn’t do the right thing automatically. </p> <ul class="itemize mark-bullet"> <li>If you update the system’s header files, such as by installing a new system version, the fixed header files of GCC are not automatically updated. They can be updated using the <code class="command">mkheaders</code> script installed in <samp class="file"><var class="var">libexecdir</var>/gcc/<var class="var">target</var>/<var class="var">version</var>/install-tools/</samp>. </li> +<li>On some systems, header file directories contain machine-specific symbolic links in certain places. This makes it possible to share most of the header files among hosts running the same version of the system on different machine models. <p>The programs that fix the header files do not understand this special way of using symbolic links; therefore, the directory of fixed header files is good only for the machine model used to build it. </p> <p>It is possible to make separate sets of fixed header files for the different machine models, and arrange a structure of symbolic links so as to use the proper set, but you’ll have to do this by hand. </p> +</li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fixed-Headers.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fixed-Headers.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/fixed-point.html b/devdocs/gcc~13/fixed-point.html new file mode 100644 index 00000000..705f9150 --- /dev/null +++ b/devdocs/gcc~13/fixed-point.html @@ -0,0 +1,33 @@ +<div class="section-level-extent" id="Fixed-Point"> <div class="nav-panel"> <p> Next: <a href="named-address-spaces" accesskey="n" rel="next">Named Address Spaces</a>, Previous: <a href="hex-floats" accesskey="p" rel="prev">Hex Floats</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Fixed-Point-Types"><span>6.16 Fixed-Point Types<a class="copiable-link" href="#Fixed-Point-Types"> ¶</a></span></h1> <p>As an extension, GNU C supports fixed-point types as defined in the N1169 draft of ISO/IEC DTR 18037. Support for fixed-point types in GCC will evolve as the draft technical report changes. Calling conventions for any target might also change. Not all targets support fixed-point types. </p> <p>The fixed-point types are <code class="code">short _Fract</code>, <code class="code">_Fract</code>, <code class="code">long _Fract</code>, <code class="code">long long _Fract</code>, <code class="code">unsigned short _Fract</code>, <code class="code">unsigned _Fract</code>, <code class="code">unsigned long _Fract</code>, <code class="code">unsigned long long _Fract</code>, <code class="code">_Sat short _Fract</code>, <code class="code">_Sat _Fract</code>, <code class="code">_Sat long _Fract</code>, <code class="code">_Sat long long _Fract</code>, <code class="code">_Sat unsigned short _Fract</code>, <code class="code">_Sat unsigned _Fract</code>, <code class="code">_Sat unsigned long _Fract</code>, <code class="code">_Sat unsigned long long _Fract</code>, <code class="code">short _Accum</code>, <code class="code">_Accum</code>, <code class="code">long _Accum</code>, <code class="code">long long _Accum</code>, <code class="code">unsigned short _Accum</code>, <code class="code">unsigned _Accum</code>, <code class="code">unsigned long _Accum</code>, <code class="code">unsigned long long _Accum</code>, <code class="code">_Sat short _Accum</code>, <code class="code">_Sat _Accum</code>, <code class="code">_Sat long _Accum</code>, <code class="code">_Sat long long _Accum</code>, <code class="code">_Sat unsigned short _Accum</code>, <code class="code">_Sat unsigned _Accum</code>, <code class="code">_Sat unsigned long _Accum</code>, <code class="code">_Sat unsigned long long _Accum</code>. </p> <p>Fixed-point data values contain fractional and optional integral parts. The format of fixed-point data varies and depends on the target machine. </p> <p>Support for fixed-point types includes: </p> +<ul class="itemize mark-bullet"> <li>prefix and postfix increment and decrement operators (<code class="code">++</code>, <code class="code">--</code>) </li> +<li>unary arithmetic operators (<code class="code">+</code>, <code class="code">-</code>, <code class="code">!</code>) </li> +<li>binary arithmetic operators (<code class="code">+</code>, <code class="code">-</code>, <code class="code">*</code>, <code class="code">/</code>) </li> +<li>binary shift operators (<code class="code"><<</code>, <code class="code">>></code>) </li> +<li>relational operators (<code class="code"><</code>, <code class="code"><=</code>, <code class="code">>=</code>, <code class="code">></code>) </li> +<li>equality operators (<code class="code">==</code>, <code class="code">!=</code>) </li> +<li>assignment operators (<code class="code">+=</code>, <code class="code">-=</code>, <code class="code">*=</code>, <code class="code">/=</code>, <code class="code"><<=</code>, <code class="code">>>=</code>) </li> +<li>conversions to and from integer, floating-point, or fixed-point types </li> +</ul> <p>Use a suffix in a fixed-point literal constant: </p> +<ul class="itemize mark-bullet"> <li>‘<samp class="samp">hr</samp>’ or ‘<samp class="samp">HR</samp>’ for <code class="code">short _Fract</code> and <code class="code">_Sat short _Fract</code> </li> +<li>‘<samp class="samp">r</samp>’ or ‘<samp class="samp">R</samp>’ for <code class="code">_Fract</code> and <code class="code">_Sat _Fract</code> </li> +<li>‘<samp class="samp">lr</samp>’ or ‘<samp class="samp">LR</samp>’ for <code class="code">long _Fract</code> and <code class="code">_Sat long _Fract</code> </li> +<li>‘<samp class="samp">llr</samp>’ or ‘<samp class="samp">LLR</samp>’ for <code class="code">long long _Fract</code> and <code class="code">_Sat long long _Fract</code> </li> +<li>‘<samp class="samp">uhr</samp>’ or ‘<samp class="samp">UHR</samp>’ for <code class="code">unsigned short _Fract</code> and <code class="code">_Sat unsigned short _Fract</code> </li> +<li>‘<samp class="samp">ur</samp>’ or ‘<samp class="samp">UR</samp>’ for <code class="code">unsigned _Fract</code> and <code class="code">_Sat unsigned _Fract</code> </li> +<li>‘<samp class="samp">ulr</samp>’ or ‘<samp class="samp">ULR</samp>’ for <code class="code">unsigned long _Fract</code> and <code class="code">_Sat unsigned long _Fract</code> </li> +<li>‘<samp class="samp">ullr</samp>’ or ‘<samp class="samp">ULLR</samp>’ for <code class="code">unsigned long long _Fract</code> and <code class="code">_Sat unsigned long long _Fract</code> </li> +<li>‘<samp class="samp">hk</samp>’ or ‘<samp class="samp">HK</samp>’ for <code class="code">short _Accum</code> and <code class="code">_Sat short _Accum</code> </li> +<li>‘<samp class="samp">k</samp>’ or ‘<samp class="samp">K</samp>’ for <code class="code">_Accum</code> and <code class="code">_Sat _Accum</code> </li> +<li>‘<samp class="samp">lk</samp>’ or ‘<samp class="samp">LK</samp>’ for <code class="code">long _Accum</code> and <code class="code">_Sat long _Accum</code> </li> +<li>‘<samp class="samp">llk</samp>’ or ‘<samp class="samp">LLK</samp>’ for <code class="code">long long _Accum</code> and <code class="code">_Sat long long _Accum</code> </li> +<li>‘<samp class="samp">uhk</samp>’ or ‘<samp class="samp">UHK</samp>’ for <code class="code">unsigned short _Accum</code> and <code class="code">_Sat unsigned short _Accum</code> </li> +<li>‘<samp class="samp">uk</samp>’ or ‘<samp class="samp">UK</samp>’ for <code class="code">unsigned _Accum</code> and <code class="code">_Sat unsigned _Accum</code> </li> +<li>‘<samp class="samp">ulk</samp>’ or ‘<samp class="samp">ULK</samp>’ for <code class="code">unsigned long _Accum</code> and <code class="code">_Sat unsigned long _Accum</code> </li> +<li>‘<samp class="samp">ullk</samp>’ or ‘<samp class="samp">ULLK</samp>’ for <code class="code">unsigned long long _Accum</code> and <code class="code">_Sat unsigned long long _Accum</code> </li> +</ul> <p>GCC support of fixed-point types as specified by the draft technical report is incomplete: </p> <ul class="itemize mark-bullet"> <li>Pragmas to control overflow and rounding behaviors are not implemented. </li> +</ul> <p>Fixed-point types are supported by the DWARF debug information format. </p> </div> <div class="nav-panel"> <p> Next: <a href="named-address-spaces">Named Address Spaces</a>, Previous: <a href="hex-floats">Hex Floats</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fixed-Point.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Fixed-Point.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/floating-point-implementation.html b/devdocs/gcc~13/floating-point-implementation.html new file mode 100644 index 00000000..db14eb19 --- /dev/null +++ b/devdocs/gcc~13/floating-point-implementation.html @@ -0,0 +1,18 @@ +<div class="section-level-extent" id="Floating-point-implementation"> <div class="nav-panel"> <p> Next: <a href="arrays-and-pointers-implementation" accesskey="n" rel="next">Arrays and Pointers</a>, Previous: <a href="integers-implementation" accesskey="p" rel="prev">Integers</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Floating-Point"><span>4.6 Floating Point<a class="copiable-link" href="#Floating-Point"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>The accuracy of the floating-point operations and of the library functions in <code class="code"><math.h></code> and <code class="code"><complex.h></code> that return floating-point results (C90, C99 and C11 5.2.4.2.2). <p>The accuracy is unknown. </p> </li> +<li>The rounding behaviors characterized by non-standard values of <code class="code">FLT_ROUNDS</code> (C90, C99 and C11 5.2.4.2.2). <p>GCC does not use such values. </p> </li> +<li>The evaluation methods characterized by non-standard negative values of <code class="code">FLT_EVAL_METHOD</code> (C99 and C11 5.2.4.2.2). <p>GCC does not use such values. </p> </li> +<li>The direction of rounding when an integer is converted to a floating-point number that cannot exactly represent the original value (C90 6.2.1.3, C99 and C11 6.3.1.4). <p>C99 Annex F is followed. </p> </li> +<li>The direction of rounding when a floating-point number is converted to a narrower floating-point number (C90 6.2.1.4, C99 and C11 6.3.1.5). <p>C99 Annex F is followed. </p> </li> +<li>How the nearest representable value or the larger or smaller representable value immediately adjacent to the nearest representable value is chosen for certain floating constants (C90 6.1.3.1, C99 and C11 6.4.4.2). <p>C99 Annex F is followed. </p> </li> +<li>Whether and how floating expressions are contracted when not disallowed by the <code class="code">FP_CONTRACT</code> pragma (C99 and C11 6.5). <p>Expressions are currently only contracted if <samp class="option">-ffp-contract=fast</samp>, <samp class="option">-funsafe-math-optimizations</samp> or <samp class="option">-ffast-math</samp> are used. This is subject to change. </p> </li> +<li>The default state for the <code class="code">FENV_ACCESS</code> pragma (C99 and C11 7.6.1). <p>This pragma is not implemented, but the default is to “off” unless <samp class="option">-frounding-math</samp> is used and <samp class="option">-fno-trapping-math</samp> is not in which case it is “on”. </p> </li> +<li>Additional floating-point exceptions, rounding modes, environments, and classifications, and their macro names (C99 and C11 7.6, C99 and C11 7.12). <p>This is dependent on the implementation of the C library, and is not defined by GCC itself. </p> </li> +<li>The default state for the <code class="code">FP_CONTRACT</code> pragma (C99 and C11 7.12.2). <p>This pragma is not implemented. Expressions are currently only contracted if <samp class="option">-ffp-contract=fast</samp>, <samp class="option">-funsafe-math-optimizations</samp> or <samp class="option">-ffast-math</samp> are used. This is subject to change. </p> </li> +<li>Whether the “inexact” floating-point exception can be raised when the rounded result actually does equal the mathematical result in an IEC 60559 conformant implementation (C99 F.9). <p>This is dependent on the implementation of the C library, and is not defined by GCC itself. </p> </li> +<li>Whether the “underflow” (and “inexact”) floating-point exception can be raised when a result is tiny but not inexact in an IEC 60559 conformant implementation (C99 F.9). <p>This is dependent on the implementation of the C library, and is not defined by GCC itself. </p> </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="arrays-and-pointers-implementation">Arrays and Pointers</a>, Previous: <a href="integers-implementation">Integers</a>, Up: <a href="c-implementation">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Floating-point-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Floating-point-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/floating-types.html b/devdocs/gcc~13/floating-types.html new file mode 100644 index 00000000..dd1614af --- /dev/null +++ b/devdocs/gcc~13/floating-types.html @@ -0,0 +1,18 @@ +<div class="section-level-extent" id="Floating-Types"> <div class="nav-panel"> <p> Next: <a href="half-precision" accesskey="n" rel="next">Half-Precision Floating Point</a>, Previous: <a href="complex" accesskey="p" rel="prev">Complex Numbers</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Additional-Floating-Types"><span>6.12 Additional Floating Types<a class="copiable-link" href="#Additional-Floating-Types"> ¶</a></span></h1> <p>ISO/IEC TS 18661-3:2015 defines C support for additional floating types <code class="code">_Float<var class="var">n</var></code> and <code class="code">_Float<var class="var">n</var>x</code>, and GCC supports these type names; the set of types supported depends on the target architecture. These types are not supported when compiling C++. Constants with these types use suffixes <code class="code">f<var class="var">n</var></code> or <code class="code">F<var class="var">n</var></code> and <code class="code">f<var class="var">n</var>x</code> or <code class="code">F<var class="var">n</var>x</code>. These type names can be used together with <code class="code">_Complex</code> to declare complex types. </p> <p>As an extension, GNU C and GNU C++ support additional floating types, which are not supported by all targets. </p> +<ul class="itemize mark-bullet"> <li> +<code class="code">__float128</code> is available on i386, x86_64, IA-64, and hppa HP-UX, as well as on PowerPC GNU/Linux targets that enable the vector scalar (VSX) instruction set. <code class="code">__float128</code> supports the 128-bit floating type. On i386, x86_64, PowerPC, and IA-64 other than HP-UX, <code class="code">__float128</code> is an alias for <code class="code">_Float128</code>. On hppa and IA-64 HP-UX, <code class="code">__float128</code> is an alias for <code class="code">long +double</code>. </li> +<li> +<code class="code">__float80</code> is available on the i386, x86_64, and IA-64 targets, and supports the 80-bit (<code class="code">XFmode</code>) floating type. It is an alias for the type name <code class="code">_Float64x</code> on these targets. </li> +<li> +<code class="code">__ibm128</code> is available on PowerPC targets, and provides access to the IBM extended double format which is the current format used for <code class="code">long double</code>. When <code class="code">long double</code> transitions to <code class="code">__float128</code> on PowerPC in the future, <code class="code">__ibm128</code> will remain for use in conversions between the two types. </li> +</ul> <p>Support for these additional types includes the arithmetic operators: add, subtract, multiply, divide; unary arithmetic operators; relational operators; equality operators; and conversions to and from integer and other floating types. Use a suffix ‘<samp class="samp">w</samp>’ or ‘<samp class="samp">W</samp>’ in a literal constant of type <code class="code">__float80</code> or type <code class="code">__ibm128</code>. Use a suffix ‘<samp class="samp">q</samp>’ or ‘<samp class="samp">Q</samp>’ for <code class="code">__float128</code>. </p> <p>In order to use <code class="code">_Float128</code>, <code class="code">__float128</code>, and <code class="code">__ibm128</code> on PowerPC Linux systems, you must use the <samp class="option">-mfloat128</samp> option. It is expected in future versions of GCC that <code class="code">_Float128</code> and <code class="code">__float128</code> will be enabled automatically. </p> <p>The <code class="code">_Float128</code> type is supported on all systems where <code class="code">__float128</code> is supported or where <code class="code">long double</code> has the IEEE binary128 format. The <code class="code">_Float64x</code> type is supported on all systems where <code class="code">__float128</code> is supported. The <code class="code">_Float32</code> type is supported on all systems supporting IEEE binary32; the <code class="code">_Float64</code> and <code class="code">_Float32x</code> types are supported on all systems supporting IEEE binary64. The <code class="code">_Float16</code> type is supported on AArch64 systems by default, on ARM systems when the IEEE format for 16-bit floating-point types is selected with <samp class="option">-mfp16-format=ieee</samp> and, for both C and C++, on x86 systems with SSE2 enabled. GCC does not currently support <code class="code">_Float128x</code> on any systems. </p> <p>On the i386, x86_64, IA-64, and HP-UX targets, you can declare complex types using the corresponding internal complex type, <code class="code">XCmode</code> for <code class="code">__float80</code> type and <code class="code">TCmode</code> for <code class="code">__float128</code> type: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef _Complex float __attribute__((mode(TC))) _Complex128; +typedef _Complex float __attribute__((mode(XC))) _Complex80;</pre> +</div> <p>On the PowerPC Linux VSX targets, you can declare complex types using the corresponding internal complex type, <code class="code">KCmode</code> for <code class="code">__float128</code> type and <code class="code">ICmode</code> for <code class="code">__ibm128</code> type: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef _Complex float __attribute__((mode(KC))) _Complex_float128; +typedef _Complex float __attribute__((mode(IC))) _Complex_ibm128;</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="half-precision">Half-Precision Floating Point</a>, Previous: <a href="complex">Complex Numbers</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Floating-Types.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Floating-Types.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/forwarding-hook.html b/devdocs/gcc~13/forwarding-hook.html new file mode 100644 index 00000000..8adcc309 --- /dev/null +++ b/devdocs/gcc~13/forwarding-hook.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="Forwarding-hook"> <div class="nav-panel"> <p> Previous: <a href="dynamically-registering-methods" accesskey="p" rel="prev">Dynamically Registering Methods</a>, Up: <a href="messaging-with-the-gnu-objective-c-runtime" accesskey="u" rel="up">Messaging with the GNU Objective-C Runtime</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Forwarding-Hook"><span>8.10.2 Forwarding Hook<a class="copiable-link" href="#Forwarding-Hook"> ¶</a></span></h1> <p>The GNU Objective-C runtime provides a hook, called <code class="code">__objc_msg_forward2</code>, which is called by <code class="code">objc_msg_lookup()</code> when it cannot find a method implementation in the runtime tables and after calling <code class="code">+resolveInstanceMethod:</code> and <code class="code">+resolveClassMethod:</code> has been attempted and did not succeed in dynamically registering the method. </p> <p>To configure the hook, you set the global variable <code class="code">__objc_msg_forward2</code> to a function with the same argument and return types of <code class="code">objc_msg_lookup()</code>. When <code class="code">objc_msg_lookup()</code> cannot find a method implementation, it invokes the hook function you provided to get a method implementation to return. So, in practice <code class="code">__objc_msg_forward2</code> allows you to extend <code class="code">objc_msg_lookup()</code> by adding some custom code that is called to do a further lookup when no standard method implementation can be found using the normal lookup. </p> <p>This hook is generally reserved for “Foundation” libraries such as GNUstep Base, which use it to implement their high-level method forwarding API, typically based around the <code class="code">forwardInvocation:</code> method. So, unless you are implementing your own “Foundation” library, you should not set this hook. </p> <p>In a typical forwarding implementation, the <code class="code">__objc_msg_forward2</code> hook function determines the argument and return type of the method that is being looked up, and then creates a function that takes these arguments and has that return type, and returns it to the caller. Creating this function is non-trivial and is typically performed using a dedicated library such as <code class="code">libffi</code>. </p> <p>The forwarding method implementation thus created is returned by <code class="code">objc_msg_lookup()</code> and is executed as if it was a normal method implementation. When the forwarding method implementation is called, it is usually expected to pack all arguments into some sort of object (typically, an <code class="code">NSInvocation</code> in a “Foundation” library), and hand it over to the programmer (<code class="code">forwardInvocation:</code>) who is then allowed to manipulate the method invocation using a high-level API provided by the “Foundation” library. For example, the programmer may want to examine the method invocation arguments and name and potentially change them before forwarding the method invocation to one or more local objects (<code class="code">performInvocation:</code>) or even to remote objects (by using Distributed Objects or some other mechanism). When all this completes, the return value is passed back and must be returned correctly to the original caller. </p> <p>Note that the GNU Objective-C runtime currently provides no support for method forwarding or method invocations other than the <code class="code">__objc_msg_forward2</code> hook. </p> <p>If the forwarding hook does not exist or returns <code class="code">NULL</code>, the runtime currently attempts forwarding using an older, deprecated API, and if that fails, it aborts the program. In future versions of the GNU Objective-C runtime, the runtime will immediately abort. </p> </div> <div class="nav-panel"> <p> Previous: <a href="dynamically-registering-methods">Dynamically Registering Methods</a>, Up: <a href="messaging-with-the-gnu-objective-c-runtime">Messaging with the GNU Objective-C Runtime</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Forwarding-hook.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Forwarding-hook.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/fr-v-built-in-functions.html b/devdocs/gcc~13/fr-v-built-in-functions.html new file mode 100644 index 00000000..39ac02d4 --- /dev/null +++ b/devdocs/gcc~13/fr-v-built-in-functions.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="FR-V-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="loongarch-base-built-in-functions" accesskey="n" rel="next">LoongArch Base Built-in Functions</a>, Previous: <a href="bpf-built-in-functions" accesskey="p" rel="prev">BPF Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="FR-V-Built-in-Functions-1"><span>6.60.13 FR-V Built-in Functions<a class="copiable-link" href="#FR-V-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC provides many FR-V-specific built-in functions. In general, these functions are intended to be compatible with those described by FR-V Family, Softune C/C++ Compiler Manual (V6), Fujitsu Semiconductor. The two exceptions are <code class="code">__MDUNPACKH</code> and <code class="code">__MBTOHE</code>, the GCC forms of which pass 128-bit values by pointer rather than by value. </p> <p>Most of the functions are named after specific FR-V instructions. Such functions are said to be “directly mapped” and are summarized here in tabular form. </p> <ul class="mini-toc"> <li><a href="argument-types" accesskey="1">Argument Types</a></li> <li><a href="directly-mapped-integer-functions" accesskey="2">Directly-Mapped Integer Functions</a></li> <li><a href="directly-mapped-media-functions" accesskey="3">Directly-Mapped Media Functions</a></li> <li><a href="raw-read_002fwrite-functions" accesskey="4">Raw Read/Write Functions</a></li> <li><a href="other-built-in-functions" accesskey="5">Other Built-in Functions</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/FR-V-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/FR-V-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/fr30-options.html b/devdocs/gcc~13/fr30-options.html new file mode 100644 index 00000000..23ed38f6 --- /dev/null +++ b/devdocs/gcc~13/fr30-options.html @@ -0,0 +1,12 @@ +<div class="subsection-level-extent" id="FR30-Options"> <div class="nav-panel"> <p> Next: <a href="ft32-options" accesskey="n" rel="next">FT32 Options</a>, Previous: <a href="ebpf-options" accesskey="p" rel="prev">eBPF Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="FR30-Options-1"><span>3.19.14 FR30 Options<a class="copiable-link" href="#FR30-Options-1"> ¶</a></span></h1> <p>These options are defined specifically for the FR30 port. </p> <dl class="table"> <dt> +<span><code class="code">-msmall-model</code><a class="copiable-link" href="#index-msmall-model"> ¶</a></span> +</dt> <dd> +<p>Use the small address space model. This can produce smaller code, but it does assume that all symbolic values and addresses fit into a 20-bit range. </p> </dd> <dt> +<span><code class="code">-mno-lsim</code><a class="copiable-link" href="#index-mno-lsim"> ¶</a></span> +</dt> <dd> +<p>Assume that runtime support has been provided and so there is no need to include the simulator library (<samp class="file">libsim.a</samp>) on the linker command line. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/FR30-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/FR30-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/freestanding-environments.html b/devdocs/gcc~13/freestanding-environments.html new file mode 100644 index 00000000..9d423f27 --- /dev/null +++ b/devdocs/gcc~13/freestanding-environments.html @@ -0,0 +1,214 @@ +<div class="section-level-extent" id="Freestanding-Environments"> <div class="nav-panel"> <p> Previous: <a href="cross-profiling" accesskey="p" rel="prev">Data File Relocation to Support Cross-Profiling</a>, Up: <a href="gcov" accesskey="u" rel="up"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Profiling-and-Test-Coverage-in-Freestanding-Environments"><span>10.6 Profiling and Test Coverage in Freestanding Environments<a class="copiable-link" href="#Profiling-and-Test-Coverage-in-Freestanding-Environments"> ¶</a></span></h1> <p>In case your application runs in a hosted environment such as GNU/Linux, then this section is likely not relevant to you. This section is intended for application developers targeting freestanding environments (for example embedded systems) with limited resources. In particular, systems or test cases which do not support constructors/destructors or the C library file I/O. In this section, the <em class="dfn">target system</em> runs your application instrumented for profiling or test coverage. You develop and analyze your application on the <em class="dfn">host system</em>. We now provide an overview how profiling and test coverage can be obtained in this scenario followed by a tutorial which can be exercised on the host system. Finally, some system initialization caveats are listed. </p> <ul class="mini-toc"> <li><a href="#Overview" accesskey="1">Overview</a></li> <li><a href="#Tutorial" accesskey="2">Tutorial</a></li> <li><a href="#System-Initialization-Caveats" accesskey="3">System Initialization Caveats</a></li> </ul> <div class="subsection-level-extent" id="Overview"> <h2 class="subsection"><span>10.6.1 Overview<a class="copiable-link" href="#Overview"> ¶</a></span></h2> <p>For an application instrumented for profiling or test coverage, the compiler generates some global data structures which are updated by instrumentation code while the application runs. These data structures are called the <em class="dfn">gcov information</em>. Normally, when the application exits, the gcov information is stored to <samp class="file">.gcda</samp> files. There is one file per translation unit instrumented for profiling or test coverage. The function <code class="code">__gcov_exit()</code>, which stores the gcov information to a file, is called by a global destructor function for each translation unit instrumented for profiling or test coverage. It runs at process exit. In a global constructor function, the <code class="code">__gcov_init()</code> function is called to register the gcov information of a translation unit in a global list. In some situations, this procedure does not work. Firstly, if you want to profile the global constructor or exit processing of an operating system, the compiler generated functions may conflict with the test objectives. Secondly, you may want to test early parts of the system initialization or abnormal program behaviour which do not allow a global constructor or exit processing. Thirdly, you need a filesystem to store the files. </p> <p>The <samp class="option">-fprofile-info-section</samp> GCC option enables you to use profiling and test coverage in freestanding environments. This option disables the use of global constructors and destructors for the gcov information. Instead, a pointer to the gcov information is stored in a special linker input section for each translation unit which is compiled with this option. By default, the section name is <code class="code">.gcov_info</code>. The gcov information is statically initialized. The pointers to the gcov information from all translation units of an executable can be collected by the linker in a contiguous memory block. For the GNU linker, the below linker script output section definition can be used to achieve this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">.gcov_info : +{ + PROVIDE (__gcov_info_start = .); + KEEP (*(.gcov_info)) + PROVIDE (__gcov_info_end = .); +}</pre> +</div> <p>The linker will provide two global symbols, <code class="code">__gcov_info_start</code> and <code class="code">__gcov_info_end</code>, which define the start and end of the array of pointers to gcov information blocks, respectively. The <code class="code">KEEP ()</code> directive is required to prevent a garbage collection of the pointers. They are not directly referenced by anything in the executable. The section may be placed in a read-only memory area. </p> <p>In order to transfer the profiling and test coverage data from the target to the host system, the application has to provide a function to produce a reliable in order byte stream from the target to the host. The byte stream may be compressed and encoded using error detection and correction codes to meet application-specific requirements. The GCC provided <samp class="file">libgcov</samp> target library provides two functions, <code class="code">__gcov_info_to_gcda()</code> and <code class="code">__gcov_filename_to_gcfn()</code>, to generate a byte stream from a gcov information bock. The functions are declared in <code class="code">#include <gcov.h></code>. The byte stream can be deserialized by the <code class="command">merge-stream</code> subcommand of the <code class="command">gcov-tool</code> to create or update <samp class="file">.gcda</samp> files in the host filesystem for the instrumented application. </p> </div> <div class="subsection-level-extent" id="Tutorial"> <h2 class="subsection"><span>10.6.2 Tutorial<a class="copiable-link" href="#Tutorial"> ¶</a></span></h2> <p>This tutorial should be exercised on the host system. We will build a program instrumented for test coverage. The program runs an application and dumps the gcov information to <samp class="file">stderr</samp> encoded as a printable character stream. The application simply decodes such character streams from <samp class="file">stdin</samp> and writes the decoded character stream to <samp class="file">stdout</samp> (warning: this is binary data). The decoded character stream is consumed by the <code class="command">merge-stream</code> subcommand of the <code class="command">gcov-tool</code> to create or update the <samp class="file">.gcda</samp> files. </p> <p>To get started, create an empty directory. Change into the new directory. Then you will create the following three files in this directory </p> <ol class="enumerate"> <li> <samp class="file">app.h</samp> - a header file included by <samp class="file">app.c</samp> and <samp class="file">main.c</samp>, </li> +<li> <samp class="file">app.c</samp> - a source file which contains an example application, and </li> +<li> <samp class="file">main.c</samp> - a source file which contains the program main function and code to dump the gcov information. </li> +</ol> <p>Firstly, create the header file <samp class="file">app.h</samp> with the following content: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static const unsigned char a = 'a'; + +static inline unsigned char * +encode (unsigned char c, unsigned char buf[2]) +{ + buf[0] = c % 16 + a; + buf[1] = (c / 16) % 16 + a; + return buf; +} + +extern void application (void);</pre> +</div> <p>Secondly, create the source file <samp class="file">app.c</samp> with the following content: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include "app.h" + +#include <stdio.h> + +/* The application reads a character stream encoded by encode() from stdin, + decodes it, and writes the decoded characters to stdout. Characters other + than the 16 characters 'a' to 'p' are ignored. */ + +static int can_decode (unsigned char c) +{ + return (unsigned char)(c - a) < 16; +} + +void +application (void) +{ + int first = 1; + int i; + unsigned char c; + + while ((i = fgetc (stdin)) != EOF) + { + unsigned char x = (unsigned char)i; + + if (can_decode (x)) + { + if (first) + c = x - a; + else + fputc (c + 16 * (x - a), stdout); + first = !first; + } + else + first = 1; + } +}</pre> +</div> <p>Thirdly, create the source file <samp class="file">main.c</samp> with the following content: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include "app.h" + +#include <gcov.h> +#include <stdio.h> +#include <stdlib.h> + +/* The start and end symbols are provided by the linker script. We use the + array notation to avoid issues with a potential small-data area. */ + +extern const struct gcov_info *const __gcov_info_start[]; +extern const struct gcov_info *const __gcov_info_end[]; + +/* This function shall produce a reliable in order byte stream to transfer the + gcov information from the target to the host system. */ + +static void +dump (const void *d, unsigned n, void *arg) +{ + (void)arg; + const unsigned char *c = d; + unsigned char buf[2]; + + for (unsigned i = 0; i < n; ++i) + fwrite (encode (c[i], buf), sizeof (buf), 1, stderr); +} + +/* The filename is serialized to a gcfn data stream by the + __gcov_filename_to_gcfn() function. The gcfn data is used by the + "merge-stream" subcommand of the "gcov-tool" to figure out the filename + associated with the gcov information. */ + +static void +filename (const char *f, void *arg) +{ + __gcov_filename_to_gcfn (f, dump, arg); +} + +/* The __gcov_info_to_gcda() function may have to allocate memory under + certain conditions. Simply try it out if it is needed for your application + or not. */ + +static void * +allocate (unsigned length, void *arg) +{ + (void)arg; + return malloc (length); +} + +/* Dump the gcov information of all translation units. */ + +static void +dump_gcov_info (void) +{ + const struct gcov_info *const *info = __gcov_info_start; + const struct gcov_info *const *end = __gcov_info_end; + + /* Obfuscate variable to prevent compiler optimizations. */ + __asm__ ("" : "+r" (info)); + + while (info != end) + { + void *arg = NULL; + __gcov_info_to_gcda (*info, filename, dump, allocate, arg); + fputc ('\n', stderr); + ++info; + } +} + +/* The main() function just runs the application and then dumps the gcov + information to stderr. */ + +int +main (void) +{ + application (); + dump_gcov_info (); + return 0; +}</pre> +</div> <p>If we compile <samp class="file">app.c</samp> with test coverage and no extra profiling options, then a global constructor (<code class="code">_sub_I_00100_0</code> here, it may have a different name in your environment) and destructor (<code class="code">_sub_D_00100_1</code>) is used to register and dump the gcov information, respectively. We also see undefined references to <code class="code">__gcov_init</code> and <code class="code">__gcov_exit</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$ gcc --coverage -c app.c +$ nm app.o +0000000000000000 r a +0000000000000030 T application +0000000000000000 t can_decode + U fgetc + U fputc +0000000000000000 b __gcov0.application +0000000000000038 b __gcov0.can_decode +0000000000000000 d __gcov_.application +00000000000000c0 d __gcov_.can_decode + U __gcov_exit + U __gcov_init + U __gcov_merge_add + U stdin + U stdout +0000000000000161 t _sub_D_00100_1 +0000000000000151 t _sub_I_00100_0</pre> +</div> <p>Compile <samp class="file">app.c</samp> and <samp class="file">main.c</samp> with test coverage and <samp class="option">-fprofile-info-section</samp>. Now, a read-only pointer size object is present in the <code class="code">.gcov_info</code> section and there are no undefined references to <code class="code">__gcov_init</code> and <code class="code">__gcov_exit</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$ gcc --coverage -fprofile-info-section -c main.c +$ gcc --coverage -fprofile-info-section -c app.c +$ objdump -h app.o + +app.o: file format elf64-x86-64 + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 00000151 0000000000000000 0000000000000000 00000040 2**0 + CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE + 1 .data 00000100 0000000000000000 0000000000000000 000001a0 2**5 + CONTENTS, ALLOC, LOAD, RELOC, DATA + 2 .bss 00000040 0000000000000000 0000000000000000 000002a0 2**5 + ALLOC + 3 .rodata 0000003c 0000000000000000 0000000000000000 000002a0 2**3 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 4 .gcov_info 00000008 0000000000000000 0000000000000000 000002e0 2**3 + CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA + 5 .comment 0000004e 0000000000000000 0000000000000000 000002e8 2**0 + CONTENTS, READONLY + 6 .note.GNU-stack 00000000 0000000000000000 0000000000000000 00000336 2**0 + CONTENTS, READONLY + 7 .eh_frame 00000058 0000000000000000 0000000000000000 00000338 2**3 + CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA</pre> +</div> <p>We have to customize the program link procedure so that all the <code class="code">.gcov_info</code> linker input sections are placed in a contiguous memory block with a begin and end symbol. Firstly, get the default linker script using the following commands (we assume a GNU linker): </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$ ld --verbose | sed '1,/^===/d' | sed '/^===/d' > linkcmds</pre> +</div> <p>Secondly, open the file <samp class="file">linkcmds</samp> with a text editor and place the linker output section definition from the overview after the <code class="code">.rodata</code> section definition. Link the program executable using the customized linker script: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$ gcc --coverage main.o app.o -T linkcmds -Wl,-Map,app.map</pre> +</div> <p>In the linker map file <samp class="file">app.map</samp>, we see that the linker placed the read-only pointer size objects of our objects files <samp class="file">main.o</samp> and <samp class="file">app.o</samp> into a contiguous memory block and provided the symbols <code class="code">__gcov_info_start</code> and <code class="code">__gcov_info_end</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$ grep -C 1 "\.gcov_info" app.map + +.gcov_info 0x0000000000403ac0 0x10 + 0x0000000000403ac0 PROVIDE (__gcov_info_start = .) + *(.gcov_info) + .gcov_info 0x0000000000403ac0 0x8 main.o + .gcov_info 0x0000000000403ac8 0x8 app.o + 0x0000000000403ad0 PROVIDE (__gcov_info_end = .)</pre> +</div> <p>Make sure no <samp class="file">.gcda</samp> files are present. Run the program with nothing to decode and dump <samp class="file">stderr</samp> to the file <samp class="file">gcda-0.txt</samp> (first run). Run the program to decode <samp class="file">gcda-0.txt</samp> and send it to the <code class="command">gcov-tool</code> using the <code class="command">merge-stream</code> subcommand to create the <samp class="file">.gcda</samp> files (second run). Run <code class="command">gcov</code> to produce a report for <samp class="file">app.c</samp>. We see that the first run with nothing to decode results in a partially covered application: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$ rm -f app.gcda main.gcda +$ echo "" | ./a.out 2>gcda-0.txt +$ ./a.out <gcda-0.txt 2>gcda-1.txt | gcov-tool merge-stream +$ gcov -bc app.c +File 'app.c' +Lines executed:69.23% of 13 +Branches executed:66.67% of 6 +Taken at least once:50.00% of 6 +Calls executed:66.67% of 3 +Creating 'app.c.gcov' + +Lines executed:69.23% of 13</pre> +</div> <p>Run the program to decode <samp class="file">gcda-1.txt</samp> and send it to the <code class="command">gcov-tool</code> using the <code class="command">merge-stream</code> subcommand to update the <samp class="file">.gcda</samp> files. Run <code class="command">gcov</code> to produce a report for <samp class="file">app.c</samp>. Since the second run decoded the gcov information of the first run, we have now a fully covered application: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$ ./a.out <gcda-1.txt 2>gcda-2.txt | gcov-tool merge-stream +$ gcov -bc app.c +File 'app.c' +Lines executed:100.00% of 13 +Branches executed:100.00% of 6 +Taken at least once:100.00% of 6 +Calls executed:100.00% of 3 +Creating 'app.c.gcov' + +Lines executed:100.00% of 13</pre> +</div> </div> <div class="subsection-level-extent" id="System-Initialization-Caveats"> <h2 class="subsection"><span>10.6.3 System Initialization Caveats<a class="copiable-link" href="#System-Initialization-Caveats"> ¶</a></span></h2> <p>The gcov information of a translation unit consists of several global data structures. For example, the instrumented code may update program flow graph edge counters in a zero-initialized data structure. It is safe to run instrumented code before the zero-initialized data is cleared to zero. The coverage information obtained before the zero-initialized data is cleared to zero is unusable. Dumping the gcov information using <code class="code">__gcov_info_to_gcda()</code> before the zero-initialized data is cleared to zero or the initialized data is loaded, is undefined behaviour. Clearing the zero-initialized data to zero through a function instrumented for profiling or test coverage is undefined behaviour, since it may produce inconsistent program flow graph edge counters for example. </p> </div> </div> <div class="nav-panel"> <p> Previous: <a href="cross-profiling">Data File Relocation to Support Cross-Profiling</a>, Up: <a href="gcov"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Freestanding-Environments.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Freestanding-Environments.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/frv-options.html b/devdocs/gcc~13/frv-options.html new file mode 100644 index 00000000..96c1d5bd --- /dev/null +++ b/devdocs/gcc~13/frv-options.html @@ -0,0 +1,100 @@ +<div class="subsection-level-extent" id="FRV-Options"> <div class="nav-panel"> <p> Next: <a href="gnu_002flinux-options" accesskey="n" rel="next">GNU/Linux Options</a>, Previous: <a href="ft32-options" accesskey="p" rel="prev">FT32 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="FRV-Options-1"><span>3.19.16 FRV Options<a class="copiable-link" href="#FRV-Options-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">-mgpr-32</code><a class="copiable-link" href="#index-mgpr-32"> ¶</a></span> +</dt> <dd> <p>Only use the first 32 general-purpose registers. </p> </dd> <dt> +<span><code class="code">-mgpr-64</code><a class="copiable-link" href="#index-mgpr-64"> ¶</a></span> +</dt> <dd> <p>Use all 64 general-purpose registers. </p> </dd> <dt> +<span><code class="code">-mfpr-32</code><a class="copiable-link" href="#index-mfpr-32"> ¶</a></span> +</dt> <dd> <p>Use only the first 32 floating-point registers. </p> </dd> <dt> +<span><code class="code">-mfpr-64</code><a class="copiable-link" href="#index-mfpr-64"> ¶</a></span> +</dt> <dd> <p>Use all 64 floating-point registers. </p> </dd> <dt> +<span><code class="code">-mhard-float</code><a class="copiable-link" href="#index-mhard-float-1"> ¶</a></span> +</dt> <dd> <p>Use hardware instructions for floating-point operations. </p> </dd> <dt> +<span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-3"> ¶</a></span> +</dt> <dd> <p>Use library routines for floating-point operations. </p> </dd> <dt> +<span><code class="code">-malloc-cc</code><a class="copiable-link" href="#index-malloc-cc"> ¶</a></span> +</dt> <dd> <p>Dynamically allocate condition code registers. </p> </dd> <dt> +<span><code class="code">-mfixed-cc</code><a class="copiable-link" href="#index-mfixed-cc"> ¶</a></span> +</dt> <dd> <p>Do not try to dynamically allocate condition code registers, only use <code class="code">icc0</code> and <code class="code">fcc0</code>. </p> </dd> <dt> +<span><code class="code">-mdword</code><a class="copiable-link" href="#index-mdword"> ¶</a></span> +</dt> <dd> <p>Change ABI to use double word insns. </p> </dd> <dt> + <span><code class="code">-mno-dword</code><a class="copiable-link" href="#index-mno-dword"> ¶</a></span> +</dt> <dd> <p>Do not use double word instructions. </p> </dd> <dt> +<span><code class="code">-mdouble</code><a class="copiable-link" href="#index-mdouble-1"> ¶</a></span> +</dt> <dd> <p>Use floating-point double instructions. </p> </dd> <dt> +<span><code class="code">-mno-double</code><a class="copiable-link" href="#index-mno-double"> ¶</a></span> +</dt> <dd> <p>Do not use floating-point double instructions. </p> </dd> <dt> +<span><code class="code">-mmedia</code><a class="copiable-link" href="#index-mmedia"> ¶</a></span> +</dt> <dd> <p>Use media instructions. </p> </dd> <dt> +<span><code class="code">-mno-media</code><a class="copiable-link" href="#index-mno-media"> ¶</a></span> +</dt> <dd> <p>Do not use media instructions. </p> </dd> <dt> +<span><code class="code">-mmuladd</code><a class="copiable-link" href="#index-mmuladd"> ¶</a></span> +</dt> <dd> <p>Use multiply and add/subtract instructions. </p> </dd> <dt> +<span><code class="code">-mno-muladd</code><a class="copiable-link" href="#index-mno-muladd"> ¶</a></span> +</dt> <dd> <p>Do not use multiply and add/subtract instructions. </p> </dd> <dt> +<span><code class="code">-mfdpic</code><a class="copiable-link" href="#index-mfdpic-1"> ¶</a></span> +</dt> <dd> <p>Select the FDPIC ABI, which uses function descriptors to represent pointers to functions. Without any PIC/PIE-related options, it implies <samp class="option">-fPIE</samp>. With <samp class="option">-fpic</samp> or <samp class="option">-fpie</samp>, it assumes GOT entries and small data are within a 12-bit range from the GOT base address; with <samp class="option">-fPIC</samp> or <samp class="option">-fPIE</samp>, GOT offsets are computed with 32 bits. With a ‘<samp class="samp">bfin-elf</samp>’ target, this option implies <samp class="option">-msim</samp>. </p> </dd> <dt> +<span><code class="code">-minline-plt</code><a class="copiable-link" href="#index-minline-plt-1"> ¶</a></span> +</dt> <dd> <p>Enable inlining of PLT entries in function calls to functions that are not known to bind locally. It has no effect without <samp class="option">-mfdpic</samp>. It’s enabled by default if optimizing for speed and compiling for shared libraries (i.e., <samp class="option">-fPIC</samp> or <samp class="option">-fpic</samp>), or when an optimization option such as <samp class="option">-O3</samp> or above is present in the command line. </p> </dd> <dt> +<span><code class="code">-mTLS</code><a class="copiable-link" href="#index-mTLS"> ¶</a></span> +</dt> <dd> <p>Assume a large TLS segment when generating thread-local code. </p> </dd> <dt> +<span><code class="code">-mtls</code><a class="copiable-link" href="#index-mtls"> ¶</a></span> +</dt> <dd> <p>Do not assume a large TLS segment when generating thread-local code. </p> </dd> <dt> +<span><code class="code">-mgprel-ro</code><a class="copiable-link" href="#index-mgprel-ro"> ¶</a></span> +</dt> <dd> <p>Enable the use of <code class="code">GPREL</code> relocations in the FDPIC ABI for data that is known to be in read-only sections. It’s enabled by default, except for <samp class="option">-fpic</samp> or <samp class="option">-fpie</samp>: even though it may help make the global offset table smaller, it trades 1 instruction for 4. With <samp class="option">-fPIC</samp> or <samp class="option">-fPIE</samp>, it trades 3 instructions for 4, one of which may be shared by multiple symbols, and it avoids the need for a GOT entry for the referenced symbol, so it’s more likely to be a win. If it is not, <samp class="option">-mno-gprel-ro</samp> can be used to disable it. </p> </dd> <dt> +<span><code class="code">-multilib-library-pic</code><a class="copiable-link" href="#index-multilib-library-pic"> ¶</a></span> +</dt> <dd> <p>Link with the (library, not FD) pic libraries. It’s implied by <samp class="option">-mlibrary-pic</samp>, as well as by <samp class="option">-fPIC</samp> and <samp class="option">-fpic</samp> without <samp class="option">-mfdpic</samp>. You should never have to use it explicitly. </p> </dd> <dt> +<span><code class="code">-mlinked-fp</code><a class="copiable-link" href="#index-mlinked-fp"> ¶</a></span> +</dt> <dd> <p>Follow the EABI requirement of always creating a frame pointer whenever a stack frame is allocated. This option is enabled by default and can be disabled with <samp class="option">-mno-linked-fp</samp>. </p> </dd> <dt> +<span><code class="code">-mlong-calls</code><a class="copiable-link" href="#index-mlong-calls-4"> ¶</a></span> +</dt> <dd> <p>Use indirect addressing to call functions outside the current compilation unit. This allows the functions to be placed anywhere within the 32-bit address space. </p> </dd> <dt> +<span><code class="code">-malign-labels</code><a class="copiable-link" href="#index-malign-labels"> ¶</a></span> +</dt> <dd> <p>Try to align labels to an 8-byte boundary by inserting NOPs into the previous packet. This option only has an effect when VLIW packing is enabled. It doesn’t create new packets; it merely adds NOPs to existing ones. </p> </dd> <dt> +<span><code class="code">-mlibrary-pic</code><a class="copiable-link" href="#index-mlibrary-pic"> ¶</a></span> +</dt> <dd> <p>Generate position-independent EABI code. </p> </dd> <dt> +<span><code class="code">-macc-4</code><a class="copiable-link" href="#index-macc-4"> ¶</a></span> +</dt> <dd> <p>Use only the first four media accumulator registers. </p> </dd> <dt> +<span><code class="code">-macc-8</code><a class="copiable-link" href="#index-macc-8"> ¶</a></span> +</dt> <dd> <p>Use all eight media accumulator registers. </p> </dd> <dt> +<span><code class="code">-mpack</code><a class="copiable-link" href="#index-mpack"> ¶</a></span> +</dt> <dd> <p>Pack VLIW instructions. </p> </dd> <dt> +<span><code class="code">-mno-pack</code><a class="copiable-link" href="#index-mno-pack"> ¶</a></span> +</dt> <dd> <p>Do not pack VLIW instructions. </p> </dd> <dt> +<span><code class="code">-mno-eflags</code><a class="copiable-link" href="#index-mno-eflags"> ¶</a></span> +</dt> <dd> <p>Do not mark ABI switches in e_flags. </p> </dd> <dt> +<span><code class="code">-mcond-move</code><a class="copiable-link" href="#index-mcond-move"> ¶</a></span> +</dt> <dd> <p>Enable the use of conditional-move instructions (default). </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mno-cond-move</code><a class="copiable-link" href="#index-mno-cond-move"> ¶</a></span> +</dt> <dd> <p>Disable the use of conditional-move instructions. </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mscc</code><a class="copiable-link" href="#index-mscc"> ¶</a></span> +</dt> <dd> <p>Enable the use of conditional set instructions (default). </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mno-scc</code><a class="copiable-link" href="#index-mno-scc"> ¶</a></span> +</dt> <dd> <p>Disable the use of conditional set instructions. </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mcond-exec</code><a class="copiable-link" href="#index-mcond-exec"> ¶</a></span> +</dt> <dd> <p>Enable the use of conditional execution (default). </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mno-cond-exec</code><a class="copiable-link" href="#index-mno-cond-exec-1"> ¶</a></span> +</dt> <dd> <p>Disable the use of conditional execution. </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mvliw-branch</code><a class="copiable-link" href="#index-mvliw-branch"> ¶</a></span> +</dt> <dd> <p>Run a pass to pack branches into VLIW instructions (default). </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mno-vliw-branch</code><a class="copiable-link" href="#index-mno-vliw-branch"> ¶</a></span> +</dt> <dd> <p>Do not run a pass to pack branches into VLIW instructions. </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mmulti-cond-exec</code><a class="copiable-link" href="#index-mmulti-cond-exec"> ¶</a></span> +</dt> <dd> <p>Enable optimization of <code class="code">&&</code> and <code class="code">||</code> in conditional execution (default). </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mno-multi-cond-exec</code><a class="copiable-link" href="#index-mno-multi-cond-exec"> ¶</a></span> +</dt> <dd> <p>Disable optimization of <code class="code">&&</code> and <code class="code">||</code> in conditional execution. </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mnested-cond-exec</code><a class="copiable-link" href="#index-mnested-cond-exec"> ¶</a></span> +</dt> <dd> <p>Enable nested conditional execution optimizations (default). </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-mno-nested-cond-exec</code><a class="copiable-link" href="#index-mno-nested-cond-exec"> ¶</a></span> +</dt> <dd> <p>Disable nested conditional execution optimizations. </p> <p>This switch is mainly for debugging the compiler and will likely be removed in a future version. </p> </dd> <dt> +<span><code class="code">-moptimize-membar</code><a class="copiable-link" href="#index-moptimize-membar"> ¶</a></span> +</dt> <dd> <p>This switch removes redundant <code class="code">membar</code> instructions from the compiler-generated code. It is enabled by default. </p> </dd> <dt> + <span><code class="code">-mno-optimize-membar</code><a class="copiable-link" href="#index-mno-optimize-membar"> ¶</a></span> +</dt> <dd> <p>This switch disables the automatic removal of redundant <code class="code">membar</code> instructions from the generated code. </p> </dd> <dt> +<span><code class="code">-mtomcat-stats</code><a class="copiable-link" href="#index-mtomcat-stats"> ¶</a></span> +</dt> <dd> <p>Cause gas to print out tomcat statistics. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu</var></code><a class="copiable-link" href="#index-mcpu-6"> ¶</a></span> +</dt> <dd> <p>Select the processor type for which to generate code. Possible values are ‘<samp class="samp">frv</samp>’, ‘<samp class="samp">fr550</samp>’, ‘<samp class="samp">tomcat</samp>’, ‘<samp class="samp">fr500</samp>’, ‘<samp class="samp">fr450</samp>’, ‘<samp class="samp">fr405</samp>’, ‘<samp class="samp">fr400</samp>’, ‘<samp class="samp">fr300</samp>’ and ‘<samp class="samp">simple</samp>’. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="gnu_002flinux-options">GNU/Linux Options</a>, Previous: <a href="ft32-options">FT32 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/FRV-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/FRV-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/ft32-options.html b/devdocs/gcc~13/ft32-options.html new file mode 100644 index 00000000..915f13f8 --- /dev/null +++ b/devdocs/gcc~13/ft32-options.html @@ -0,0 +1,24 @@ +<div class="subsection-level-extent" id="FT32-Options"> <div class="nav-panel"> <p> Next: <a href="frv-options" accesskey="n" rel="next">FRV Options</a>, Previous: <a href="fr30-options" accesskey="p" rel="prev">FR30 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="FT32-Options-1"><span>3.19.15 FT32 Options<a class="copiable-link" href="#FT32-Options-1"> ¶</a></span></h1> <p>These options are defined specifically for the FT32 port. </p> <dl class="table"> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-3"> ¶</a></span> +</dt> <dd> +<p>Specifies that the program will be run on the simulator. This causes an alternate runtime startup and library to be linked. You must not use this option when generating programs that will run on real hardware; you must provide your own runtime library for whatever I/O functions are needed. </p> </dd> <dt> +<span><code class="code">-mlra</code><a class="copiable-link" href="#index-mlra-1"> ¶</a></span> +</dt> <dd> +<p>Enable Local Register Allocation. This is still experimental for FT32, so by default the compiler uses standard reload. </p> </dd> <dt> +<span><code class="code">-mnodiv</code><a class="copiable-link" href="#index-mnodiv"> ¶</a></span> +</dt> <dd> +<p>Do not use div and mod instructions. </p> </dd> <dt> +<span><code class="code">-mft32b</code><a class="copiable-link" href="#index-mft32b"> ¶</a></span> +</dt> <dd> +<p>Enable use of the extended instructions of the FT32B processor. </p> </dd> <dt> +<span><code class="code">-mcompress</code><a class="copiable-link" href="#index-mcompress"> ¶</a></span> +</dt> <dd> +<p>Compress all code using the Ft32B code compression scheme. </p> </dd> <dt> +<span><code class="code">-mnopm</code><a class="copiable-link" href="#index-mnopm"> ¶</a></span> +</dt> <dd> +<p>Do not generate code that reads program memory. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/FT32-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/FT32-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/function-attributes.html b/devdocs/gcc~13/function-attributes.html new file mode 100644 index 00000000..77e91231 --- /dev/null +++ b/devdocs/gcc~13/function-attributes.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="variable-attributes" accesskey="n" rel="next">Specifying Attributes of Variables</a>, Previous: <a href="mixed-labels-and-declarations" accesskey="p" rel="prev">Mixed Declarations, Labels and Code</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Declaring-Attributes-of-Functions"><span>6.33 Declaring Attributes of Functions<a class="copiable-link" href="#Declaring-Attributes-of-Functions"> ¶</a></span></h1> <p>In GNU C and C++, you can use function attributes to specify certain function properties that may help the compiler optimize calls or check code more carefully for correctness. For example, you can use attributes to specify that a function never returns (<code class="code">noreturn</code>), returns a value depending only on the values of its arguments (<code class="code">const</code>), or has <code class="code">printf</code>-style arguments (<code class="code">format</code>). </p> <p>You can also use attributes to control memory placement, code generation options or call/return conventions within the function being annotated. Many of these attributes are target-specific. For example, many targets support attributes for defining interrupt handler functions, which typically must follow special register usage and return conventions. Such attributes are described in the subsection for each target. However, a considerable number of attributes are supported by most, if not all targets. Those are described in the <a class="ref" href="common-function-attributes">Common Function Attributes</a> section. </p> <p>Function attributes are introduced by the <code class="code">__attribute__</code> keyword in the declaration of a function, followed by an attribute specification enclosed in double parentheses. You can specify multiple attributes in a declaration by separating them by commas within the double parentheses or by immediately following one attribute specification with another. See <a class="xref" href="attribute-syntax">Attribute Syntax</a>, for the exact rules on attribute syntax and placement. Compatible attribute specifications on distinct declarations of the same function are merged. An attribute specification that is not compatible with attributes already applied to a declaration of the same function is ignored with a warning. </p> <p>Some function attributes take one or more arguments that refer to the function’s parameters by their positions within the function parameter list. Such attribute arguments are referred to as <em class="dfn">positional arguments</em>. Unless specified otherwise, positional arguments that specify properties of parameters with pointer types can also specify the same properties of the implicit C++ <code class="code">this</code> argument in non-static member functions, and of parameters of reference to a pointer type. For ordinary functions, position one refers to the first parameter on the list. In C++ non-static member functions, position one refers to the implicit <code class="code">this</code> pointer. The same restrictions and effects apply to function attributes used with ordinary functions or C++ member functions. </p> <p>GCC also supports attributes on variable declarations (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>), labels (see <a class="pxref" href="label-attributes">Label Attributes</a>), enumerators (see <a class="pxref" href="enumerator-attributes">Enumerator Attributes</a>), statements (see <a class="pxref" href="statement-attributes">Statement Attributes</a>), types (see <a class="pxref" href="type-attributes">Specifying Attributes of Types</a>), and on field declarations (for <code class="code">tainted_args</code>). </p> <p>There is some overlap between the purposes of attributes and pragmas (see <a class="pxref" href="pragmas">Pragmas Accepted by GCC</a>). It has been found convenient to use <code class="code">__attribute__</code> to achieve a natural attachment of attributes to their corresponding declarations, whereas <code class="code">#pragma</code> is of use for compatibility with other compilers or constructs that do not naturally form part of the grammar. </p> <p>In addition to the attributes documented here, GCC plugins may provide their own attributes. </p> <ul class="mini-toc"> <li><a href="common-function-attributes" accesskey="1">Common Function Attributes</a></li> <li><a href="aarch64-function-attributes" accesskey="2">AArch64 Function Attributes</a></li> <li><a href="amd-gcn-function-attributes" accesskey="3">AMD GCN Function Attributes</a></li> <li><a href="arc-function-attributes" accesskey="4">ARC Function Attributes</a></li> <li><a href="arm-function-attributes" accesskey="5">ARM Function Attributes</a></li> <li><a href="avr-function-attributes" accesskey="6">AVR Function Attributes</a></li> <li><a href="blackfin-function-attributes" accesskey="7">Blackfin Function Attributes</a></li> <li><a href="bpf-function-attributes" accesskey="8">BPF Function Attributes</a></li> <li><a href="c-sky-function-attributes" accesskey="9">C-SKY Function Attributes</a></li> <li><a href="epiphany-function-attributes">Epiphany Function Attributes</a></li> <li><a href="h8_002f300-function-attributes">H8/300 Function Attributes</a></li> <li><a href="ia-64-function-attributes">IA-64 Function Attributes</a></li> <li><a href="m32c-function-attributes">M32C Function Attributes</a></li> <li><a href="m32r_002fd-function-attributes">M32R/D Function Attributes</a></li> <li><a href="m68k-function-attributes">m68k Function Attributes</a></li> <li><a href="mcore-function-attributes">MCORE Function Attributes</a></li> <li><a href="microblaze-function-attributes">MicroBlaze Function Attributes</a></li> <li><a href="microsoft-windows-function-attributes">Microsoft Windows Function Attributes</a></li> <li><a href="mips-function-attributes">MIPS Function Attributes</a></li> <li><a href="msp430-function-attributes">MSP430 Function Attributes</a></li> <li><a href="nds32-function-attributes">NDS32 Function Attributes</a></li> <li><a href="nios-ii-function-attributes">Nios II Function Attributes</a></li> <li><a href="nvidia-ptx-function-attributes">Nvidia PTX Function Attributes</a></li> <li><a href="powerpc-function-attributes">PowerPC Function Attributes</a></li> <li><a href="risc-v-function-attributes">RISC-V Function Attributes</a></li> <li><a href="rl78-function-attributes">RL78 Function Attributes</a></li> <li><a href="rx-function-attributes">RX Function Attributes</a></li> <li><a href="s_002f390-function-attributes">S/390 Function Attributes</a></li> <li><a href="sh-function-attributes">SH Function Attributes</a></li> <li><a href="symbian-os-function-attributes">Symbian OS Function Attributes</a></li> <li><a href="v850-function-attributes">V850 Function Attributes</a></li> <li><a href="visium-function-attributes">Visium Function Attributes</a></li> <li><a href="x86-function-attributes">x86 Function Attributes</a></li> <li><a href="xstormy16-function-attributes">Xstormy16 Function Attributes</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="variable-attributes">Specifying Attributes of Variables</a>, Previous: <a href="mixed-labels-and-declarations">Mixed Declarations, Labels and Code</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/function-multiversioning.html b/devdocs/gcc~13/function-multiversioning.html new file mode 100644 index 00000000..0e221265 --- /dev/null +++ b/devdocs/gcc~13/function-multiversioning.html @@ -0,0 +1,40 @@ +<div class="section-level-extent" id="Function-Multiversioning"> <div class="nav-panel"> <p> Next: <a href="type-traits" accesskey="n" rel="next">Type Traits</a>, Previous: <a href="c_002b_002b-attributes" accesskey="p" rel="prev">C++-Specific Variable, Function, and Type Attributes</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Function-Multiversioning-1"><span>7.8 Function Multiversioning<a class="copiable-link" href="#Function-Multiversioning-1"> ¶</a></span></h1> <p>With the GNU C++ front end, for x86 targets, you may specify multiple versions of a function, where each function is specialized for a specific target feature. At runtime, the appropriate version of the function is automatically executed depending on the characteristics of the execution platform. Here is an example. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((target ("default"))) +int foo () +{ + // The default version of foo. + return 0; +} + +__attribute__ ((target ("sse4.2"))) +int foo () +{ + // foo version for SSE4.2 + return 1; +} + +__attribute__ ((target ("arch=atom"))) +int foo () +{ + // foo version for the Intel ATOM processor + return 2; +} + +__attribute__ ((target ("arch=amdfam10"))) +int foo () +{ + // foo version for the AMD Family 0x10 processors. + return 3; +} + +int main () +{ + int (*p)() = &foo; + assert ((*p) () == foo ()); + return 0; +}</pre> +</div> <p>In the above example, four versions of function foo are created. The first version of foo with the target attribute "default" is the default version. This version gets executed when no other target specific version qualifies for execution on a particular platform. A new version of foo is created by using the same function signature but with a different target string. Function foo is called or a pointer to it is taken just like a regular function. GCC takes care of doing the dispatching to call the right version at runtime. Refer to the <a class="uref" href="https://gcc.gnu.org/wiki/FunctionMultiVersioning">GCC wiki on Function Multiversioning</a> for more details. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Multiversioning.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Multiversioning.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/function-names.html b/devdocs/gcc~13/function-names.html new file mode 100644 index 00000000..56b88107 --- /dev/null +++ b/devdocs/gcc~13/function-names.html @@ -0,0 +1,27 @@ +<div class="section-level-extent" id="Function-Names"> <div class="nav-panel"> <p> Next: <a href="return-address" accesskey="n" rel="next">Getting the Return or Frame Address of a Function</a>, Previous: <a href="incomplete-enums" accesskey="p" rel="prev">Incomplete <code class="code">enum</code> Types</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Function-Names-as-Strings"><span>6.50 Function Names as Strings<a class="copiable-link" href="#Function-Names-as-Strings"> ¶</a></span></h1> <p>GCC provides three magic constants that hold the name of the current function as a string. In C++11 and later modes, all three are treated as constant expressions and can be used in <code class="code">constexpr</code> constexts. The first of these constants is <code class="code">__func__</code>, which is part of the C99 standard: </p> <p>The identifier <code class="code">__func__</code> is implicitly declared by the translator as if, immediately following the opening brace of each function definition, the declaration </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static const char __func__[] = "function-name";</pre> +</div> <p>appeared, where function-name is the name of the lexically-enclosing function. This name is the unadorned name of the function. As an extension, at file (or, in C++, namespace scope), <code class="code">__func__</code> evaluates to the empty string. </p> <p><code class="code">__FUNCTION__</code> is another name for <code class="code">__func__</code>, provided for backward compatibility with old versions of GCC. </p> <p>In C, <code class="code">__PRETTY_FUNCTION__</code> is yet another name for <code class="code">__func__</code>, except that at file scope (or, in C++, namespace scope), it evaluates to the string <code class="code">"top level"</code>. In addition, in C++, <code class="code">__PRETTY_FUNCTION__</code> contains the signature of the function as well as its bare name. For example, this program: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern "C" int printf (const char *, ...); + +class a { + public: + void sub (int i) + { + printf ("__FUNCTION__ = %s\n", __FUNCTION__); + printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__); + } +}; + +int +main (void) +{ + a ax; + ax.sub (0); + return 0; +}</pre> +</div> <p>gives this output: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__FUNCTION__ = sub +__PRETTY_FUNCTION__ = void a::sub(int)</pre> +</div> <p>These identifiers are variables, not preprocessor macros, and may not be used to initialize <code class="code">char</code> arrays or be concatenated with string literals. </p> </div> <div class="nav-panel"> <p> Next: <a href="return-address">Getting the Return or Frame Address of a Function</a>, Previous: <a href="incomplete-enums">Incomplete <code class="code">enum</code> Types</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Names.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Names.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/function-prototypes.html b/devdocs/gcc~13/function-prototypes.html new file mode 100644 index 00000000..04da0a63 --- /dev/null +++ b/devdocs/gcc~13/function-prototypes.html @@ -0,0 +1,30 @@ +<div class="section-level-extent" id="Function-Prototypes"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-comments" accesskey="n" rel="next">C++ Style Comments</a>, Previous: <a href="attribute-syntax" accesskey="p" rel="prev">Attribute Syntax</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Prototypes-and-Old-Style-Function-Definitions"><span>6.40 Prototypes and Old-Style Function Definitions<a class="copiable-link" href="#Prototypes-and-Old-Style-Function-Definitions"> ¶</a></span></h1> <p>GNU C extends ISO C to allow a function prototype to override a later old-style non-prototype definition. Consider the following example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">/* <span class="r">Use prototypes unless the compiler is old-fashioned.</span> */ +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif + +/* <span class="r">Prototype function declaration.</span> */ +int isroot P((uid_t)); + +/* <span class="r">Old-style function definition.</span> */ +int +isroot (x) /* <span class="r">??? lossage here ???</span> */ + uid_t x; +{ + return x == 0; +}</pre> +</div> <p>Suppose the type <code class="code">uid_t</code> happens to be <code class="code">short</code>. ISO C does not allow this example, because subword arguments in old-style non-prototype definitions are promoted. Therefore in this example the function definition’s argument is really an <code class="code">int</code>, which does not match the prototype argument type of <code class="code">short</code>. </p> <p>This restriction of ISO C makes it hard to write code that is portable to traditional C compilers, because the programmer does not know whether the <code class="code">uid_t</code> type is <code class="code">short</code>, <code class="code">int</code>, or <code class="code">long</code>. Therefore, in cases like these GNU C allows a prototype to override a later old-style definition. More precisely, in GNU C, a function prototype argument type overrides the argument type specified by a later old-style definition if the former type is the same as the latter type before promotion. Thus in GNU C the above example is equivalent to the following: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int isroot (uid_t); + +int +isroot (uid_t x) +{ + return x == 0; +}</pre> +</div> <p>GNU C++ does not support old-style function definitions, so this extension is irrelevant. </p> </div> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-comments">C++ Style Comments</a>, Previous: <a href="attribute-syntax">Attribute Syntax</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Prototypes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Prototypes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/function-specific-option-pragmas.html b/devdocs/gcc~13/function-specific-option-pragmas.html new file mode 100644 index 00000000..7cf35405 --- /dev/null +++ b/devdocs/gcc~13/function-specific-option-pragmas.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="Function-Specific-Option-Pragmas"> <div class="nav-panel"> <p> Next: <a href="loop-specific-pragmas" accesskey="n" rel="next">Loop-Specific Pragmas</a>, Previous: <a href="push_002fpop-macro-pragmas" accesskey="p" rel="prev">Push/Pop Macro Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Function-Specific-Option-Pragmas-1"><span>6.62.15 Function Specific Option Pragmas<a class="copiable-link" href="#Function-Specific-Option-Pragmas-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">#pragma GCC target (<var class="var">string</var>, …)</code><a class="copiable-link" href="#index-pragma-GCC-target"> ¶</a></span> +</dt> <dd> <p>This pragma allows you to set target-specific options for functions defined later in the source file. One or more strings can be specified. Each function that is defined after this point is treated as if it had been declared with one <code class="code">target(</code><var class="var">string</var><code class="code">)</code> attribute for each <var class="var">string</var> argument. The parentheses around the strings in the pragma are optional. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>, for more information about the <code class="code">target</code> attribute and the attribute syntax. </p> <p>The <code class="code">#pragma GCC target</code> pragma is presently implemented for x86, ARM, AArch64, PowerPC, S/390, and Nios II targets only. </p> </dd> <dt> +<span><code class="code">#pragma GCC optimize (<var class="var">string</var>, …)</code><a class="copiable-link" href="#index-pragma-GCC-optimize"> ¶</a></span> +</dt> <dd> <p>This pragma allows you to set global optimization options for functions defined later in the source file. One or more strings can be specified. Each function that is defined after this point is treated as if it had been declared with one <code class="code">optimize(</code><var class="var">string</var><code class="code">)</code> attribute for each <var class="var">string</var> argument. The parentheses around the strings in the pragma are optional. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>, for more information about the <code class="code">optimize</code> attribute and the attribute syntax. </p> </dd> <dt> + <span><code class="code">#pragma GCC push_options</code><a class="copiable-link" href="#index-pragma-GCC-push_005foptions"> ¶</a></span> +</dt> <dt><code class="code">#pragma GCC pop_options</code></dt> <dd> <p>These pragmas maintain a stack of the current target and optimization options. It is intended for include files where you temporarily want to switch to using a different ‘<samp class="samp">#pragma GCC target</samp>’ or ‘<samp class="samp">#pragma GCC optimize</samp>’ and then to pop back to the previous options. </p> </dd> <dt> +<span><code class="code">#pragma GCC reset_options</code><a class="copiable-link" href="#index-pragma-GCC-reset_005foptions"> ¶</a></span> +</dt> <dd> <p>This pragma clears the current <code class="code">#pragma GCC target</code> and <code class="code">#pragma GCC optimize</code> to use the default switches as specified on the command line. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="loop-specific-pragmas">Loop-Specific Pragmas</a>, Previous: <a href="push_002fpop-macro-pragmas">Push/Pop Macro Pragmas</a>, Up: <a href="pragmas">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Specific-Option-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Function-Specific-Option-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/g_002b_002b-and-gcc.html b/devdocs/gcc~13/g_002b_002b-and-gcc.html new file mode 100644 index 00000000..d467e0cd --- /dev/null +++ b/devdocs/gcc~13/g_002b_002b-and-gcc.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="G_002b_002b-and-GCC"> <div class="nav-panel"> <p> Next: <a href="standards" accesskey="n" rel="next">Language Standards Supported by GCC</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="Programming-Languages-Supported-by-GCC"><span>1 Programming Languages Supported by GCC<a class="copiable-link" href="#Programming-Languages-Supported-by-GCC"> ¶</a></span></h1> <p>GCC stands for “GNU Compiler Collection”. GCC is an integrated distribution of compilers for several major programming languages. These languages currently include C, C++, Objective-C, Objective-C++, Fortran, Ada, D, and Go. </p> <p>The abbreviation <em class="dfn">GCC</em> has multiple meanings in common use. The current official meaning is “GNU Compiler Collection”, which refers generically to the complete suite of tools. The name historically stood for “GNU C Compiler”, and this usage is still common when the emphasis is on compiling C programs. Finally, the name is also used when speaking of the <em class="dfn">language-independent</em> component of GCC: code shared among the compilers for all supported languages. </p> <p>The language-independent component of GCC includes the majority of the optimizers, as well as the “back ends” that generate machine code for various processors. </p> <p>The part of a compiler that is specific to a particular language is called the “front end”. In addition to the front ends that are integrated components of GCC, there are several other front ends that are maintained separately. These support languages such as Mercury, and COBOL. To use these, they must be built together with GCC proper. </p> <p>Most of the compilers for languages other than C have their own names. The C++ compiler is G++, the Ada compiler is GNAT, and so on. When we talk about compiling one of those languages, we might refer to that compiler by its own name, or as GCC. Either is correct. </p> <p>Historically, compilers for many languages, including C++ and Fortran, have been implemented as “preprocessors” which emit another high level language such as C. None of the compilers included in GCC are implemented this way; they all generate machine code directly. This sort of preprocessor should not be confused with the <em class="dfn">C preprocessor</em>, which is an integral feature of the C, C++, Objective-C and Objective-C++ languages. </p> </div> <div class="nav-panel"> <p> Next: <a href="standards">Language Standards Supported by GCC</a>, Up: <a href="index">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/G_002b_002b-and-GCC.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/G_002b_002b-and-GCC.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/garbage-collection.html b/devdocs/gcc~13/garbage-collection.html new file mode 100644 index 00000000..486a7715 --- /dev/null +++ b/devdocs/gcc~13/garbage-collection.html @@ -0,0 +1,36 @@ +<div class="section-level-extent" id="Garbage-Collection"> <div class="nav-panel"> <p> Next: <a href="constant-string-objects" accesskey="n" rel="next">Constant String Objects</a>, Previous: <a href="type-encoding" accesskey="p" rel="prev">Type Encoding</a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Garbage-Collection-1"><span>8.4 Garbage Collection<a class="copiable-link" href="#Garbage-Collection-1"> ¶</a></span></h1> <p>This section is specific for the GNU Objective-C runtime. If you are using a different runtime, you can skip it. </p> <p>Support for garbage collection with the GNU runtime has been added by using a powerful conservative garbage collector, known as the Boehm-Demers-Weiser conservative garbage collector. </p> <p>To enable the support for it you have to configure the compiler using an additional argument, <samp class="option">--enable-objc-gc</samp>. This will build the boehm-gc library, and build an additional runtime library which has several enhancements to support the garbage collector. The new library has a new name, <samp class="file">libobjc_gc.a</samp> to not conflict with the non-garbage-collected library. </p> <p>When the garbage collector is used, the objects are allocated using the so-called typed memory allocation mechanism available in the Boehm-Demers-Weiser collector. This mode requires precise information on where pointers are located inside objects. This information is computed once per class, immediately after the class has been initialized. </p> <p>There is a new runtime function <code class="code">class_ivar_set_gcinvisible()</code> which can be used to declare a so-called <em class="dfn">weak pointer</em> reference. Such a pointer is basically hidden for the garbage collector; this can be useful in certain situations, especially when you want to keep track of the allocated objects, yet allow them to be collected. This kind of pointers can only be members of objects, you cannot declare a global pointer as a weak reference. Every type which is a pointer type can be declared a weak pointer, including <code class="code">id</code>, <code class="code">Class</code> and <code class="code">SEL</code>. </p> <p>Here is an example of how to use this feature. Suppose you want to implement a class whose instances hold a weak pointer reference; the following class does this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">@interface WeakPointer : Object +{ + const void* weakPointer; +} + +- initWithPointer:(const void*)p; +- (const void*)weakPointer; +@end + + +@implementation WeakPointer + ++ (void)initialize +{ + if (self == objc_lookUpClass ("WeakPointer")) + class_ivar_set_gcinvisible (self, "weakPointer", YES); +} + +- initWithPointer:(const void*)p +{ + weakPointer = p; + return self; +} + +- (const void*)weakPointer +{ + return weakPointer; +} + +@end</pre> +</div> <p>Weak pointers are supported through a new type character specifier represented by the ‘<samp class="samp">!</samp>’ character. The <code class="code">class_ivar_set_gcinvisible()</code> function adds or removes this specifier to the string type description of the instance variable named as argument. </p> </div> <div class="nav-panel"> <p> Next: <a href="constant-string-objects">Constant String Objects</a>, Previous: <a href="type-encoding">Type Encoding</a>, Up: <a href="objective-c">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Garbage-Collection.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Garbage-Collection.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gcov-and-optimization.html b/devdocs/gcc~13/gcov-and-optimization.html new file mode 100644 index 00000000..13c3dcfd --- /dev/null +++ b/devdocs/gcc~13/gcov-and-optimization.html @@ -0,0 +1,14 @@ +<div class="section-level-extent" id="Gcov-and-Optimization"> <div class="nav-panel"> <p> Next: <a href="gcov-data-files" accesskey="n" rel="next">Brief Description of <code class="command">gcov</code> Data Files</a>, Previous: <a href="invoking-gcov" accesskey="p" rel="prev">Invoking <code class="command">gcov</code></a>, Up: <a href="gcov" accesskey="u" rel="up"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Using-gcov-with-GCC-Optimization"><span>10.3 Using gcov with GCC Optimization<a class="copiable-link" href="#Using-gcov-with-GCC-Optimization"> ¶</a></span></h1> <p>If you plan to use <code class="command">gcov</code> to help optimize your code, you must first compile your program with a special GCC option ‘<samp class="samp">--coverage</samp>’. Aside from that, you can use any other GCC options; but if you want to prove that every single line in your program was executed, you should not compile with optimization at the same time. On some machines the optimizer can eliminate some simple code lines by combining them with other lines. For example, code like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (a != b) + c = 1; +else + c = 0;</pre> +</div> <p>can be compiled into one instruction on some machines. In this case, there is no way for <code class="command">gcov</code> to calculate separate execution counts for each line because there isn’t separate code for each line. Hence the <code class="command">gcov</code> output looks like this if you compiled the program with optimization: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">100: 12:if (a != b) +100: 13: c = 1; +100: 14:else +100: 15: c = 0;</pre> +</div> <p>The output shows that this block of code, combined by optimization, executed 100 times. In one sense this result is correct, because there was only one instruction representing all four of these lines. However, the output does not indicate how many times the result was 0 and how many times the result was 1. </p> <p>Inlineable functions can create unexpected line counts. Line counts are shown for the source code of the inlineable function, but what is shown depends on where the function is inlined, or if it is not inlined at all. </p> <p>If the function is not inlined, the compiler must emit an out of line copy of the function, in any object file that needs it. If <samp class="file">fileA.o</samp> and <samp class="file">fileB.o</samp> both contain out of line bodies of a particular inlineable function, they will also both contain coverage counts for that function. When <samp class="file">fileA.o</samp> and <samp class="file">fileB.o</samp> are linked together, the linker will, on many systems, select one of those out of line bodies for all calls to that function, and remove or ignore the other. Unfortunately, it will not remove the coverage counters for the unused function body. Hence when instrumented, all but one use of that function will show zero counts. </p> <p>If the function is inlined in several places, the block structure in each location might not be the same. For instance, a condition might now be calculable at compile time in some instances. Because the coverage of all the uses of the inline function will be shown for the same source lines, the line counts themselves might seem inconsistent. </p> <p>Long-running applications can use the <code class="code">__gcov_reset</code> and <code class="code">__gcov_dump</code> facilities to restrict profile collection to the program region of interest. Calling <code class="code">__gcov_reset(void)</code> will clear all run-time profile counters to zero, and calling <code class="code">__gcov_dump(void)</code> will cause the profile information collected at that point to be dumped to <samp class="file">.gcda</samp> output files. Instrumented applications use a static destructor with priority 99 to invoke the <code class="code">__gcov_dump</code> function. Thus <code class="code">__gcov_dump</code> is executed after all user defined static destructors, as well as handlers registered with <code class="code">atexit</code>. </p> <p>If an executable loads a dynamic shared object via dlopen functionality, <samp class="option">-Wl,--dynamic-list-data</samp> is needed to dump all profile data. </p> <p>Profiling run-time library reports various errors related to profile manipulation and profile saving. Errors are printed into standard error output or ‘<samp class="samp">GCOV_ERROR_FILE</samp>’ file, if environment variable is used. In order to terminate immediately after an errors occurs set ‘<samp class="samp">GCOV_EXIT_AT_ERROR</samp>’ environment variable. That can help users to find profile clashing which leads to a misleading profile. </p> </div> <div class="nav-panel"> <p> Next: <a href="gcov-data-files">Brief Description of <code class="command">gcov</code> Data Files</a>, Previous: <a href="invoking-gcov">Invoking <code class="command">gcov</code></a>, Up: <a href="gcov"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-and-Optimization.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-and-Optimization.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gcov-data-files.html b/devdocs/gcc~13/gcov-data-files.html new file mode 100644 index 00000000..0f6c5665 --- /dev/null +++ b/devdocs/gcc~13/gcov-data-files.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Gcov-Data-Files"> <div class="nav-panel"> <p> Next: <a href="cross-profiling" accesskey="n" rel="next">Data File Relocation to Support Cross-Profiling</a>, Previous: <a href="gcov-and-optimization" accesskey="p" rel="prev">Using <code class="command">gcov</code> with GCC Optimization</a>, Up: <a href="gcov" accesskey="u" rel="up"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Brief-Description-of-gcov-Data-Files"><span>10.4 Brief Description of gcov Data Files<a class="copiable-link" href="#Brief-Description-of-gcov-Data-Files"> ¶</a></span></h1> <p><code class="command">gcov</code> uses two files for profiling. The names of these files are derived from the original <em class="emph">object</em> file by substituting the file suffix with either <samp class="file">.gcno</samp>, or <samp class="file">.gcda</samp>. The files contain coverage and profile data stored in a platform-independent format. The <samp class="file">.gcno</samp> files are placed in the same directory as the object file. By default, the <samp class="file">.gcda</samp> files are also stored in the same directory as the object file, but the GCC <samp class="option">-fprofile-dir</samp> option may be used to store the <samp class="file">.gcda</samp> files in a separate directory. </p> <p>The <samp class="file">.gcno</samp> notes file is generated when the source file is compiled with the GCC <samp class="option">-ftest-coverage</samp> option. It contains information to reconstruct the basic block graphs and assign source line numbers to blocks. </p> <p>The <samp class="file">.gcda</samp> count data file is generated when a program containing object files built with the GCC <samp class="option">-fprofile-arcs</samp> option is executed. A separate <samp class="file">.gcda</samp> file is created for each object file compiled with this option. It contains arc transition counts, value profile counts, and some summary information. </p> <p>It is not recommended to access the coverage files directly. Consumers should use the intermediate format that is provided by <code class="command">gcov</code> tool via <samp class="option">--json-format</samp> option. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-Data-Files.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-Data-Files.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gcov-dump-intro.html b/devdocs/gcc~13/gcov-dump-intro.html new file mode 100644 index 00000000..703f1088 --- /dev/null +++ b/devdocs/gcc~13/gcov-dump-intro.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Gcov-dump-Intro"> <div class="nav-panel"> <p> Next: <a href="invoking-gcov-dump" accesskey="n" rel="next">Invoking <code class="command">gcov-dump</code></a>, Up: <a href="gcov-dump" accesskey="u" rel="up"><code class="command">gcov-dump</code>—an Offline Gcda and Gcno Profile Dump Tool</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Introduction-to-gcov-dump"><span>12.1 Introduction to gcov-dump<a class="copiable-link" href="#Introduction-to-gcov-dump"> ¶</a></span></h1> <p><code class="command">gcov-dump</code> is a tool you can use in conjunction with GCC to dump content of gcda and gcno profile files offline. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-dump-Intro.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-dump-Intro.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gcov-dump.html b/devdocs/gcc~13/gcov-dump.html new file mode 100644 index 00000000..6bfa3f21 --- /dev/null +++ b/devdocs/gcc~13/gcov-dump.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="Gcov-dump"> <div class="nav-panel"> <p> Next: <a href="lto-dump" accesskey="n" rel="next"><code class="command">lto-dump</code>—Tool for dumping LTO object files.</a>, Previous: <a href="gcov-tool" accesskey="p" rel="prev"><code class="command">gcov-tool</code>—an Offline Gcda Profile Processing Tool</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="gcov-dump---an-Offline-Gcda-and-Gcno-Profile-Dump-Tool"><span>12 gcov-dump—an Offline Gcda and Gcno Profile Dump Tool<a class="copiable-link" href="#gcov-dump---an-Offline-Gcda-and-Gcno-Profile-Dump-Tool"> ¶</a></span></h1> <ul class="mini-toc"> <li><a href="gcov-dump-intro" accesskey="1">Introduction to <code class="command">gcov-dump</code></a></li> <li><a href="invoking-gcov-dump" accesskey="2">Invoking <code class="command">gcov-dump</code></a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-dump.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-dump.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gcov-intro.html b/devdocs/gcc~13/gcov-intro.html new file mode 100644 index 00000000..d6d682d7 --- /dev/null +++ b/devdocs/gcc~13/gcov-intro.html @@ -0,0 +1,9 @@ +<div class="section-level-extent" id="Gcov-Intro"> <div class="nav-panel"> <p> Next: <a href="invoking-gcov" accesskey="n" rel="next">Invoking <code class="command">gcov</code></a>, Up: <a href="gcov" accesskey="u" rel="up"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Introduction-to-gcov"><span>10.1 Introduction to gcov<a class="copiable-link" href="#Introduction-to-gcov"> ¶</a></span></h1> <p><code class="command">gcov</code> is a test coverage program. Use it in concert with GCC to analyze your programs to help create more efficient, faster running code and to discover untested parts of your program. You can use <code class="command">gcov</code> as a profiling tool to help discover where your optimization efforts will best affect your code. You can also use <code class="command">gcov</code> along with the other profiling tool, <code class="command">gprof</code>, to assess which parts of your code use the greatest amount of computing time. </p> <p>Profiling tools help you analyze your code’s performance. Using a profiler such as <code class="command">gcov</code> or <code class="command">gprof</code>, you can find out some basic performance statistics, such as: </p> <ul class="itemize mark-bullet"> <li>how often each line of code executes </li> +<li>what lines of code are actually executed </li> +<li>how much computing time each section of code uses </li> +</ul> <p>Once you know these things about how your code works when compiled, you can look at each module to see which modules should be optimized. <code class="command">gcov</code> helps you determine where to work on optimization. </p> <p>Software developers also use coverage testing in concert with testsuites, to make sure software is actually good enough for a release. Testsuites can verify that a program works as expected; a coverage program tests to see how much of the program is exercised by the testsuite. Developers can then determine what kinds of test cases need to be added to the testsuites to create both better testing and a better final product. </p> <p>You should compile your code without optimization if you plan to use <code class="command">gcov</code> because the optimization, by combining some lines of code into one function, may not give you as much information as you need to look for ‘hot spots’ where the code is using a great deal of computer time. Likewise, because <code class="command">gcov</code> accumulates statistics by line (at the lowest resolution), it works best with a programming style that places only one statement on each line. If you use complicated macros that expand to loops or to other control structures, the statistics are less helpful—they only report on the line where the macro call appears. If your complex macros behave like functions, you can replace them with inline functions to solve this problem. </p> <p><code class="command">gcov</code> creates a logfile called <samp class="file"><var class="var">sourcefile</var>.gcov</samp> which indicates how many times each line of a source file <samp class="file"><var class="var">sourcefile</var>.c</samp> has executed. You can use these logfiles along with <code class="command">gprof</code> to aid in fine-tuning the performance of your programs. <code class="command">gprof</code> gives timing information you can use along with the information you get from <code class="command">gcov</code>. </p> <p><code class="command">gcov</code> works only on code compiled with GCC. It is not compatible with any other profiling or test coverage mechanism. </p> </div> <div class="nav-panel"> <p> Next: <a href="invoking-gcov">Invoking <code class="command">gcov</code></a>, Up: <a href="gcov"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-Intro.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-Intro.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gcov-tool-intro.html b/devdocs/gcc~13/gcov-tool-intro.html new file mode 100644 index 00000000..b71bbf3e --- /dev/null +++ b/devdocs/gcc~13/gcov-tool-intro.html @@ -0,0 +1,17 @@ +<div class="section-level-extent" id="Gcov-tool-Intro"> <div class="nav-panel"> <p> Next: <a href="invoking-gcov-tool" accesskey="n" rel="next">Invoking <code class="command">gcov-tool</code></a>, Up: <a href="gcov-tool" accesskey="u" rel="up"><code class="command">gcov-tool</code>—an Offline Gcda Profile Processing Tool</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Introduction-to-gcov-tool"><span>11.1 Introduction to gcov-tool<a class="copiable-link" href="#Introduction-to-gcov-tool"> ¶</a></span></h1> <p><code class="command">gcov-tool</code> is an offline tool to process gcc’s gcda profile files. </p> <p>Current gcov-tool supports the following functionalities: </p> <ul class="itemize mark-bullet"> <li>merge two sets of profiles with weights. </li> +<li>read a stream of profiles with associated filenames and merge it with a set of profiles with weights. </li> +<li>read one set of profile and rewrite profile contents. One can scale or normalize the count values. </li> +</ul> <p>Examples of the use cases for this tool are: </p> +<ul class="itemize mark-bullet"> <li>Collect the profiles for different set of inputs, and use this tool to merge them. One can specify the weight to factor in the relative importance of each input. </li> +<li>Collect profiles from target systems without a filesystem (freestanding environments). Merge the collected profiles with associated profiles present on the host system. One can specify the weight to factor in the relative importance of each input. </li> +<li>Rewrite the profile after removing a subset of the gcda files, while maintaining the consistency of the summary and the histogram. </li> +<li>It can also be used to debug or libgcov code as the tools shares the majority code as the runtime library. </li> +</ul> <p>Note that for the merging operation, this profile generated offline may contain slight different values from the online merged profile. Here are a list of typical differences: </p> <ul class="itemize mark-bullet"> <li>histogram difference: This offline tool recomputes the histogram after merging the counters. The resulting histogram, therefore, is precise. The online merging does not have this capability – the histogram is merged from two histograms and the result is an approximation. </li> +<li>summary checksum difference: Summary checksum uses a CRC32 operation. The value depends on the link list order of gcov-info objects. This order is different in gcov-tool from that in the online merge. It’s expected to have different summary checksums. It does not really matter as the compiler does not use this checksum anywhere. </li> +<li>value profile counter values difference: Some counter values for value profile are runtime dependent, like heap addresses. It’s normal to see some difference in these kind of counters. </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="invoking-gcov-tool">Invoking <code class="command">gcov-tool</code></a>, Up: <a href="gcov-tool"><code class="command">gcov-tool</code>—an Offline Gcda Profile Processing Tool</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-tool-Intro.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-tool-Intro.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gcov-tool.html b/devdocs/gcc~13/gcov-tool.html new file mode 100644 index 00000000..3fa53d68 --- /dev/null +++ b/devdocs/gcc~13/gcov-tool.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="Gcov-tool"> <div class="nav-panel"> <p> Next: <a href="gcov-dump" accesskey="n" rel="next"><code class="command">gcov-dump</code>—an Offline Gcda and Gcno Profile Dump Tool</a>, Previous: <a href="gcov" accesskey="p" rel="prev"><code class="command">gcov</code>—a Test Coverage Program</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="gcov-tool---an-Offline-Gcda-Profile-Processing-Tool"><span>11 gcov-tool—an Offline Gcda Profile Processing Tool<a class="copiable-link" href="#gcov-tool---an-Offline-Gcda-Profile-Processing-Tool"> ¶</a></span></h1> <p><code class="command">gcov-tool</code> is a tool you can use in conjunction with GCC to manipulate or process gcda profile files offline. </p> <ul class="mini-toc"> <li><a href="gcov-tool-intro" accesskey="1">Introduction to <code class="command">gcov-tool</code></a></li> <li><a href="invoking-gcov-tool" accesskey="2">Invoking <code class="command">gcov-tool</code></a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-tool.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov-tool.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gcov.html b/devdocs/gcc~13/gcov.html new file mode 100644 index 00000000..40157730 --- /dev/null +++ b/devdocs/gcc~13/gcov.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="Gcov"> <div class="nav-panel"> <p> Next: <a href="gcov-tool" accesskey="n" rel="next"><code class="command">gcov-tool</code>—an Offline Gcda Profile Processing Tool</a>, Previous: <a href="compatibility" accesskey="p" rel="prev">Binary Compatibility</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="gcov---a-Test-Coverage-Program"><span>10 gcov—a Test Coverage Program<a class="copiable-link" href="#gcov---a-Test-Coverage-Program"> ¶</a></span></h1> <p><code class="command">gcov</code> is a tool you can use in conjunction with GCC to test code coverage in your programs. </p> <ul class="mini-toc"> <li><a href="gcov-intro" accesskey="1">Introduction to <code class="command">gcov</code></a></li> <li><a href="invoking-gcov" accesskey="2">Invoking <code class="command">gcov</code></a></li> <li><a href="gcov-and-optimization" accesskey="3">Using <code class="command">gcov</code> with GCC Optimization</a></li> <li><a href="gcov-data-files" accesskey="4">Brief Description of <code class="command">gcov</code> Data Files</a></li> <li><a href="cross-profiling" accesskey="5">Data File Relocation to Support Cross-Profiling</a></li> <li><a href="freestanding-environments" accesskey="6">Profiling and Test Coverage in Freestanding Environments</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Gcov.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/global-register-variables.html b/devdocs/gcc~13/global-register-variables.html new file mode 100644 index 00000000..6edf9a7e --- /dev/null +++ b/devdocs/gcc~13/global-register-variables.html @@ -0,0 +1,11 @@ +<div class="subsubsection-level-extent" id="Global-Register-Variables"> <div class="nav-panel"> <p> Next: <a href="local-register-variables" accesskey="n" rel="next">Specifying Registers for Local Variables</a>, Up: <a href="explicit-register-variables" accesskey="u" rel="up">Variables in Specified Registers</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Defining-Global-Register-Variables"><span>6.47.5.1 Defining Global Register Variables<a class="copiable-link" href="#Defining-Global-Register-Variables"> ¶</a></span></h1> <p>You can define a global register variable and associate it with a specified register like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">register int *foo asm ("r12");</pre> +</div> <p>Here <code class="code">r12</code> is the name of the register that should be used. Note that this is the same syntax used for defining local register variables, but for a global variable the declaration appears outside a function. The <code class="code">register</code> keyword is required, and cannot be combined with <code class="code">static</code>. The register name must be a valid register name for the target platform. </p> <p>Do not use type qualifiers such as <code class="code">const</code> and <code class="code">volatile</code>, as the outcome may be contrary to expectations. In particular, using the <code class="code">volatile</code> qualifier does not fully prevent the compiler from optimizing accesses to the register. </p> <p>Registers are a scarce resource on most systems and allowing the compiler to manage their usage usually results in the best code. However, under special circumstances it can make sense to reserve some globally. For example this may be useful in programs such as programming language interpreters that have a couple of global variables that are accessed very often. </p> <p>After defining a global register variable, for the current compilation unit: </p> <ul class="itemize mark-bullet"> <li>If the register is a call-saved register, call ABI is affected: the register will not be restored in function epilogue sequences after the variable has been assigned. Therefore, functions cannot safely return to callers that assume standard ABI. </li> +<li>Conversely, if the register is a call-clobbered register, making calls to functions that use standard ABI may lose contents of the variable. Such calls may be created by the compiler even if none are evident in the original program, for example when libgcc functions are used to make up for unavailable instructions. </li> +<li>Accesses to the variable may be optimized as usual and the register remains available for allocation and use in any computations, provided that observable values of the variable are not affected. </li> +<li>If the variable is referenced in inline assembly, the type of access must be provided to the compiler via constraints (see <a class="pxref" href="constraints">Constraints for <code class="code">asm</code> Operands</a>). Accesses from basic asms are not supported. </li> +</ul> <p>Note that these points <em class="emph">only</em> apply to code that is compiled with the definition. The behavior of code that is merely linked in (for example code from libraries) is not affected. </p> <p>If you want to recompile source files that do not actually use your global register variable so they do not use the specified register for any other purpose, you need not actually add the global register declaration to their source code. It suffices to specify the compiler option <samp class="option">-ffixed-<var class="var">reg</var></samp> (see <a class="pxref" href="code-gen-options">Options for Code Generation Conventions</a>) to reserve the register. </p> <h1 class="subsubheading" id="Declaring-the-variable"><span>Declaring the variable<a class="copiable-link" href="#Declaring-the-variable"> ¶</a></span></h1> <p>Global register variables cannot have initial values, because an executable file has no means to supply initial contents for a register. </p> <p>When selecting a register, choose one that is normally saved and restored by function calls on your machine. This ensures that code which is unaware of this reservation (such as library routines) will restore it before returning. </p> <p>On machines with register windows, be sure to choose a global register that is not affected magically by the function call mechanism. </p> <h1 class="subsubheading" id="Using-the-variable"><span>Using the variable<a class="copiable-link" href="#Using-the-variable"> ¶</a></span></h1> <p>When calling routines that are not aware of the reservation, be cautious if those routines call back into code which uses them. As an example, if you call the system library version of <code class="code">qsort</code>, it may clobber your registers during execution, but (if you have selected appropriate registers) it will restore them before returning. However it will <em class="emph">not</em> restore them before calling <code class="code">qsort</code>’s comparison function. As a result, global values will not reliably be available to the comparison function unless the <code class="code">qsort</code> function itself is rebuilt. </p> <p>Similarly, it is not safe to access the global register variables from signal handlers or from more than one thread of control. Unless you recompile them specially for the task at hand, the system library routines may temporarily use the register for other things. Furthermore, since the register is not reserved exclusively for the variable, accessing it from handlers of asynchronous signals may observe unrelated temporary values residing in the register. </p> <p>On most machines, <code class="code">longjmp</code> restores to each global register variable the value it had at the time of the <code class="code">setjmp</code>. On some machines, however, <code class="code">longjmp</code> does not change the value of global register variables. To be portable, the function that called <code class="code">setjmp</code> should make other arrangements to save the values of the global register variables, and to restore them in a <code class="code">longjmp</code>. This way, the same thing happens regardless of what <code class="code">longjmp</code> does. </p> </div> <div class="nav-panel"> <p> Next: <a href="local-register-variables">Specifying Registers for Local Variables</a>, Up: <a href="explicit-register-variables">Variables in Specified Registers</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Global-Register-Variables.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Global-Register-Variables.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gnu-objective-c-runtime-api.html b/devdocs/gcc~13/gnu-objective-c-runtime-api.html new file mode 100644 index 00000000..090deb69 --- /dev/null +++ b/devdocs/gcc~13/gnu-objective-c-runtime-api.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="GNU-Objective-C-runtime-API"> <div class="nav-panel"> <p> Next: <a href="executing-code-before-main" accesskey="n" rel="next"><code class="code">+load</code>: Executing Code before <code class="code">main</code></a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="GNU-Objective-C-Runtime-API"><span>8.1 GNU Objective-C Runtime API<a class="copiable-link" href="#GNU-Objective-C-Runtime-API"> ¶</a></span></h1> <p>This section is specific for the GNU Objective-C runtime. If you are using a different runtime, you can skip it. </p> <p>The GNU Objective-C runtime provides an API that allows you to interact with the Objective-C runtime system, querying the live runtime structures and even manipulating them. This allows you for example to inspect and navigate classes, methods and protocols; to define new classes or new methods, and even to modify existing classes or protocols. </p> <p>If you are using a “Foundation” library such as GNUstep-Base, this library will provide you with a rich set of functionality to do most of the inspection tasks, and you probably will only need direct access to the GNU Objective-C runtime API to define new classes or methods. </p> <ul class="mini-toc"> <li><a href="modern-gnu-objective-c-runtime-api" accesskey="1">Modern GNU Objective-C Runtime API</a></li> <li><a href="traditional-gnu-objective-c-runtime-api" accesskey="2">Traditional GNU Objective-C Runtime API</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/GNU-Objective-C-runtime-API.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/GNU-Objective-C-runtime-API.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/gnu_002flinux-options.html b/devdocs/gcc~13/gnu_002flinux-options.html new file mode 100644 index 00000000..8d3fcb0a --- /dev/null +++ b/devdocs/gcc~13/gnu_002flinux-options.html @@ -0,0 +1,27 @@ +<div class="subsection-level-extent" id="GNU_002fLinux-Options"> <div class="nav-panel"> <p> Next: <a href="h8_002f300-options" accesskey="n" rel="next">H8/300 Options</a>, Previous: <a href="frv-options" accesskey="p" rel="prev">FRV Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="GNU_002fLinux-Options-1"><span>3.19.17 GNU/Linux Options<a class="copiable-link" href="#GNU_002fLinux-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for GNU/Linux targets: </p> <dl class="table"> <dt> +<span><code class="code">-mglibc</code><a class="copiable-link" href="#index-mglibc"> ¶</a></span> +</dt> <dd> +<p>Use the GNU C library. This is the default except on ‘<samp class="samp">*-*-linux-*uclibc*</samp>’, ‘<samp class="samp">*-*-linux-*musl*</samp>’ and ‘<samp class="samp">*-*-linux-*android*</samp>’ targets. </p> </dd> <dt> +<span><code class="code">-muclibc</code><a class="copiable-link" href="#index-muclibc"> ¶</a></span> +</dt> <dd> +<p>Use uClibc C library. This is the default on ‘<samp class="samp">*-*-linux-*uclibc*</samp>’ targets. </p> </dd> <dt> +<span><code class="code">-mmusl</code><a class="copiable-link" href="#index-mmusl"> ¶</a></span> +</dt> <dd> +<p>Use the musl C library. This is the default on ‘<samp class="samp">*-*-linux-*musl*</samp>’ targets. </p> </dd> <dt> +<span><code class="code">-mbionic</code><a class="copiable-link" href="#index-mbionic"> ¶</a></span> +</dt> <dd> +<p>Use Bionic C library. This is the default on ‘<samp class="samp">*-*-linux-*android*</samp>’ targets. </p> </dd> <dt> +<span><code class="code">-mandroid</code><a class="copiable-link" href="#index-mandroid"> ¶</a></span> +</dt> <dd> +<p>Compile code compatible with Android platform. This is the default on ‘<samp class="samp">*-*-linux-*android*</samp>’ targets. </p> <p>When compiling, this option enables <samp class="option">-mbionic</samp>, <samp class="option">-fPIC</samp>, <samp class="option">-fno-exceptions</samp> and <samp class="option">-fno-rtti</samp> by default. When linking, this option makes the GCC driver pass Android-specific options to the linker. Finally, this option causes the preprocessor macro <code class="code">__ANDROID__</code> to be defined. </p> </dd> <dt> +<span><code class="code">-tno-android-cc</code><a class="copiable-link" href="#index-tno-android-cc"> ¶</a></span> +</dt> <dd> +<p>Disable compilation effects of <samp class="option">-mandroid</samp>, i.e., do not enable <samp class="option">-mbionic</samp>, <samp class="option">-fPIC</samp>, <samp class="option">-fno-exceptions</samp> and <samp class="option">-fno-rtti</samp> by default. </p> </dd> <dt> +<span><code class="code">-tno-android-ld</code><a class="copiable-link" href="#index-tno-android-ld"> ¶</a></span> +</dt> <dd> +<p>Disable linking effects of <samp class="option">-mandroid</samp>, i.e., pass standard Linux linking options to the linker. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/GNU_002fLinux-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/GNU_002fLinux-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/h8_002f300-function-attributes.html b/devdocs/gcc~13/h8_002f300-function-attributes.html new file mode 100644 index 00000000..cdda6560 --- /dev/null +++ b/devdocs/gcc~13/h8_002f300-function-attributes.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="H8_002f300-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="ia-64-function-attributes" accesskey="n" rel="next">IA-64 Function Attributes</a>, Previous: <a href="epiphany-function-attributes" accesskey="p" rel="prev">Epiphany Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="H8_002f300-Function-Attributes-1"><span>6.33.11 H8/300 Function Attributes<a class="copiable-link" href="#H8_002f300-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are available for H8/300 targets: </p> <dl class="table"> <dt> +<span><code class="code">function_vector</code><a class="copiable-link" href="#index-function_005fvector-function-attribute_002c-H8_002f300"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified function should be called through the function vector. Calling a function through the function vector reduces code size; however, the function vector has a limited size (maximum 128 entries on the H8/300 and 64 entries on the H8/300H and H8S) and shares space with the interrupt vector. </p> </dd> <dt> +<span><code class="code">interrupt_handler</code><a class="copiable-link" href="#index-interrupt_005fhandler-function-attribute_002c-H8_002f300"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> </dd> <dt> + <span><code class="code">saveall</code><a class="copiable-link" href="#index-saveall-function-attribute_002c-H8_002f300"> ¶</a></span> +</dt> <dd><p>Use this attribute on the H8/300, H8/300H, and H8S to indicate that all registers except the stack pointer should be saved in the prologue regardless of whether they are used or not. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/H8_002f300-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/H8_002f300-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/h8_002f300-options.html b/devdocs/gcc~13/h8_002f300-options.html new file mode 100644 index 00000000..746c93fb --- /dev/null +++ b/devdocs/gcc~13/h8_002f300-options.html @@ -0,0 +1,32 @@ +<div class="subsection-level-extent" id="H8_002f300-Options"> <div class="nav-panel"> <p> Next: <a href="hppa-options" accesskey="n" rel="next">HPPA Options</a>, Previous: <a href="gnu_002flinux-options" accesskey="p" rel="prev">GNU/Linux Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="H8_002f300-Options-1"><span>3.19.18 H8/300 Options<a class="copiable-link" href="#H8_002f300-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for the H8/300 implementations: </p> <dl class="table"> <dt> +<span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax-1"> ¶</a></span> +</dt> <dd> +<p>Shorten some address references at link time, when possible; uses the linker option <samp class="option">-relax</samp>. See <a data-manual="ld" href="https://sourceware.org/binutils/docs/ld/H8_002f300.html#H8_002f300"><code class="code">ld</code> and the H8/300</a> in Using ld, for a fuller description. </p> </dd> <dt> +<span><code class="code">-mh</code><a class="copiable-link" href="#index-mh"> ¶</a></span> +</dt> <dd> +<p>Generate code for the H8/300H. </p> </dd> <dt> +<span><code class="code">-ms</code><a class="copiable-link" href="#index-ms"> ¶</a></span> +</dt> <dd> +<p>Generate code for the H8S. </p> </dd> <dt> +<span><code class="code">-mn</code><a class="copiable-link" href="#index-mn"> ¶</a></span> +</dt> <dd> +<p>Generate code for the H8S and H8/300H in the normal mode. This switch must be used either with <samp class="option">-mh</samp> or <samp class="option">-ms</samp>. </p> </dd> <dt> +<span><code class="code">-ms2600</code><a class="copiable-link" href="#index-ms2600"> ¶</a></span> +</dt> <dd> +<p>Generate code for the H8S/2600. This switch must be used with <samp class="option">-ms</samp>. </p> </dd> <dt> +<span><code class="code">-mexr</code><a class="copiable-link" href="#index-mexr"> ¶</a></span> +</dt> <dd> +<p>Extended registers are stored on stack before execution of function with monitor attribute. Default option is <samp class="option">-mexr</samp>. This option is valid only for H8S targets. </p> </dd> <dt> + <span><code class="code">-mno-exr</code><a class="copiable-link" href="#index-mno-exr"> ¶</a></span> +</dt> <dd> +<p>Extended registers are not stored on stack before execution of function with monitor attribute. Default option is <samp class="option">-mno-exr</samp>. This option is valid only for H8S targets. </p> </dd> <dt> +<span><code class="code">-mint32</code><a class="copiable-link" href="#index-mint32"> ¶</a></span> +</dt> <dd> +<p>Make <code class="code">int</code> data 32 bits by default. </p> </dd> <dt> +<span><code class="code">-malign-300</code><a class="copiable-link" href="#index-malign-300"> ¶</a></span> +</dt> <dd><p>On the H8/300H and H8S, use the same alignment rules as for the H8/300. The default for the H8/300H and H8S is to align longs and floats on 4-byte boundaries. <samp class="option">-malign-300</samp> causes them to be aligned on 2-byte boundaries. This option has no effect on the H8/300. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="hppa-options">HPPA Options</a>, Previous: <a href="gnu_002flinux-options">GNU/Linux Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/H8_002f300-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/H8_002f300-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/h8_002f300-variable-attributes.html b/devdocs/gcc~13/h8_002f300-variable-attributes.html new file mode 100644 index 00000000..dc3eeb2f --- /dev/null +++ b/devdocs/gcc~13/h8_002f300-variable-attributes.html @@ -0,0 +1,12 @@ +<div class="subsection-level-extent" id="H8_002f300-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="ia-64-variable-attributes" accesskey="n" rel="next">IA-64 Variable Attributes</a>, Previous: <a href="blackfin-variable-attributes" accesskey="p" rel="prev">Blackfin Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="H8_002f300-Variable-Attributes-1"><span>6.34.5 H8/300 Variable Attributes<a class="copiable-link" href="#H8_002f300-Variable-Attributes-1"> ¶</a></span></h1> <p>These variable attributes are available for H8/300 targets: </p> <dl class="table"> <dt> + <span><code class="code">eightbit_data</code><a class="copiable-link" href="#index-eightbit_005fdata-variable-attribute_002c-H8_002f300"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified variable should be placed into the eight-bit data section. The compiler generates more efficient code for certain operations on data in the eight-bit data area. Note the eight-bit data area is limited to 256 bytes of data. </p> <p>You must use GAS and GLD from GNU binutils version 2.7 or later for this attribute to work correctly. </p> </dd> <dt> + <span><code class="code">tiny_data</code><a class="copiable-link" href="#index-tiny_005fdata-variable-attribute_002c-H8_002f300"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the H8/300H and H8S to indicate that the specified variable should be placed into the tiny data section. The compiler generates more efficient code for loads and stores on data in the tiny data section. Note the tiny data area is limited to slightly under 32KB of data. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/H8_002f300-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/H8_002f300-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/half-precision.html b/devdocs/gcc~13/half-precision.html new file mode 100644 index 00000000..d10c787c --- /dev/null +++ b/devdocs/gcc~13/half-precision.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Half-Precision"> <div class="nav-panel"> <p> Next: <a href="decimal-float" accesskey="n" rel="next">Decimal Floating Types</a>, Previous: <a href="floating-types" accesskey="p" rel="prev">Additional Floating Types</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Half-Precision-Floating-Point"><span>6.13 Half-Precision Floating Point<a class="copiable-link" href="#Half-Precision-Floating-Point"> ¶</a></span></h1> <p>On ARM and AArch64 targets, GCC supports half-precision (16-bit) floating point via the <code class="code">__fp16</code> type defined in the ARM C Language Extensions. On ARM systems, you must enable this type explicitly with the <samp class="option">-mfp16-format</samp> command-line option in order to use it. On x86 targets with SSE2 enabled, GCC supports half-precision (16-bit) floating point via the <code class="code">_Float16</code> type. For C++, x86 provides a builtin type named <code class="code">_Float16</code> which contains same data format as C. </p> <p>ARM targets support two incompatible representations for half-precision floating-point values. You must choose one of the representations and use it consistently in your program. </p> <p>Specifying <samp class="option">-mfp16-format=ieee</samp> selects the IEEE 754-2008 format. This format can represent normalized values in the range of <em class="math">2^{-14}</em> to 65504. There are 11 bits of significand precision, approximately 3 decimal digits. </p> <p>Specifying <samp class="option">-mfp16-format=alternative</samp> selects the ARM alternative format. This representation is similar to the IEEE format, but does not support infinities or NaNs. Instead, the range of exponents is extended, so that this format can represent normalized values in the range of <em class="math">2^{-14}</em> to 131008. </p> <p>The GCC port for AArch64 only supports the IEEE 754-2008 format, and does not require use of the <samp class="option">-mfp16-format</samp> command-line option. </p> <p>The <code class="code">__fp16</code> type may only be used as an argument to intrinsics defined in <code class="code"><arm_fp16.h></code>, or as a storage format. For purposes of arithmetic and other operations, <code class="code">__fp16</code> values in C or C++ expressions are automatically promoted to <code class="code">float</code>. </p> <p>The ARM target provides hardware support for conversions between <code class="code">__fp16</code> and <code class="code">float</code> values as an extension to VFP and NEON (Advanced SIMD), and from ARMv8-A provides hardware support for conversions between <code class="code">__fp16</code> and <code class="code">double</code> values. GCC generates code using these hardware instructions if you compile with options to select an FPU that provides them; for example, <samp class="option">-mfpu=neon-fp16 -mfloat-abi=softfp</samp>, in addition to the <samp class="option">-mfp16-format</samp> option to select a half-precision format. </p> <p>Language-level support for the <code class="code">__fp16</code> data type is independent of whether GCC generates code using hardware floating-point instructions. In cases where hardware support is not specified, GCC implements conversions between <code class="code">__fp16</code> and other types as library calls. </p> <p>It is recommended that portable code use the <code class="code">_Float16</code> type defined by ISO/IEC TS 18661-3:2015. See <a class="xref" href="floating-types">Additional Floating Types</a>. </p> <p>On x86 targets with SSE2 enabled, without <samp class="option">-mavx512fp16</samp>, all operations will be emulated by software emulation and the <code class="code">float</code> instructions. The default behavior for <code class="code">FLT_EVAL_METHOD</code> is to keep the intermediate result of the operation as 32-bit precision. This may lead to inconsistent behavior between software emulation and AVX512-FP16 instructions. Using <samp class="option">-fexcess-precision=16</samp> will force round back after each operation. </p> <p>Using <samp class="option">-mavx512fp16</samp> will generate AVX512-FP16 instructions instead of software emulation. The default behavior of <code class="code">FLT_EVAL_METHOD</code> is to round after each operation. The same is true with <samp class="option">-fexcess-precision=standard</samp> and <samp class="option">-mfpmath=sse</samp>. If there is no <samp class="option">-mfpmath=sse</samp>, <samp class="option">-fexcess-precision=standard</samp> alone does the same thing as before, It is useful for code that does not have <code class="code">_Float16</code> and runs on the x87 FPU. </p> </div> <div class="nav-panel"> <p> Next: <a href="decimal-float">Decimal Floating Types</a>, Previous: <a href="floating-types">Additional Floating Types</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Half-Precision.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Half-Precision.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/hex-floats.html b/devdocs/gcc~13/hex-floats.html new file mode 100644 index 00000000..1e023a00 --- /dev/null +++ b/devdocs/gcc~13/hex-floats.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Hex-Floats"> <div class="nav-panel"> <p> Next: <a href="fixed-point" accesskey="n" rel="next">Fixed-Point Types</a>, Previous: <a href="decimal-float" accesskey="p" rel="prev">Decimal Floating Types</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Hex-Floats-1"><span>6.15 Hex Floats<a class="copiable-link" href="#Hex-Floats-1"> ¶</a></span></h1> <p>ISO C99 and ISO C++17 support floating-point numbers written not only in the usual decimal notation, such as <code class="code">1.55e1</code>, but also numbers such as <code class="code">0x1.fp3</code> written in hexadecimal format. As a GNU extension, GCC supports this in C90 mode (except in some cases when strictly conforming) and in C++98, C++11 and C++14 modes. In that format the ‘<samp class="samp">0x</samp>’ hex introducer and the ‘<samp class="samp">p</samp>’ or ‘<samp class="samp">P</samp>’ exponent field are mandatory. The exponent is a decimal number that indicates the power of 2 by which the significant part is multiplied. Thus ‘<samp class="samp">0x1.f</samp>’ is 1 15/16, ‘<samp class="samp">p3</samp>’ multiplies it by 8, and the value of <code class="code">0x1.fp3</code> is the same as <code class="code">1.55e1</code>. </p> <p>Unlike for floating-point numbers in the decimal notation the exponent is always required in the hexadecimal notation. Otherwise the compiler would not be able to resolve the ambiguity of, e.g., <code class="code">0x1.f</code>. This could mean <code class="code">1.0f</code> or <code class="code">1.9375</code> since ‘<samp class="samp">f</samp>’ is also the extension for floating-point constants of type <code class="code">float</code>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Hex-Floats.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Hex-Floats.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/hints-implementation.html b/devdocs/gcc~13/hints-implementation.html new file mode 100644 index 00000000..8390cca8 --- /dev/null +++ b/devdocs/gcc~13/hints-implementation.html @@ -0,0 +1,11 @@ +<div class="section-level-extent" id="Hints-implementation"> <div class="nav-panel"> <p> Next: <a href="structures-unions-enumerations-and-bit-fields-implementation" accesskey="n" rel="next">Structures, Unions, Enumerations, and Bit-Fields</a>, Previous: <a href="arrays-and-pointers-implementation" accesskey="p" rel="prev">Arrays and Pointers</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Hints"><span>4.8 Hints<a class="copiable-link" href="#Hints"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>The extent to which suggestions made by using the <code class="code">register</code> storage-class specifier are effective (C90 6.5.1, C99 and C11 6.7.1). <p>The <code class="code">register</code> specifier affects code generation only in these ways: </p> <ul class="itemize mark-bullet"> <li>When used as part of the register variable extension, see <a class="ref" href="explicit-register-variables">Variables in Specified Registers</a>. </li> +<li>When <samp class="option">-O0</samp> is in use, the compiler allocates distinct stack memory for all variables that do not have the <code class="code">register</code> storage-class specifier; if <code class="code">register</code> is specified, the variable may have a shorter lifespan than the code would indicate and may never be placed in memory. </li> +<li>On some rare x86 targets, <code class="code">setjmp</code> doesn’t save the registers in all circumstances. In those cases, GCC doesn’t allocate any variables in registers unless they are marked <code class="code">register</code>. </li> +</ul> </li> +<li>The extent to which suggestions made by using the inline function specifier are effective (C99 and C11 6.7.4). <p>GCC will not inline any functions if the <samp class="option">-fno-inline</samp> option is used or if <samp class="option">-O0</samp> is used. Otherwise, GCC may still be unable to inline a function for many reasons; the <samp class="option">-Winline</samp> option may be used to determine if a function has not been inlined and why not. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Hints-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Hints-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/hppa-options.html b/devdocs/gcc~13/hppa-options.html new file mode 100644 index 00000000..bfe6fa51 --- /dev/null +++ b/devdocs/gcc~13/hppa-options.html @@ -0,0 +1,89 @@ +<div class="subsection-level-extent" id="HPPA-Options"> <div class="nav-panel"> <p> Next: <a href="ia-64-options" accesskey="n" rel="next">IA-64 Options</a>, Previous: <a href="h8_002f300-options" accesskey="p" rel="prev">H8/300 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="HPPA-Options-1"><span>3.19.19 HPPA Options<a class="copiable-link" href="#HPPA-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for the HPPA family of computers: </p> <dl class="table"> <dt> +<span><code class="code">-march=<var class="var">architecture-type</var></code><a class="copiable-link" href="#index-march-5"> ¶</a></span> +</dt> <dd> +<p>Generate code for the specified architecture. The choices for <var class="var">architecture-type</var> are ‘<samp class="samp">1.0</samp>’ for PA 1.0, ‘<samp class="samp">1.1</samp>’ for PA 1.1, and ‘<samp class="samp">2.0</samp>’ for PA 2.0 processors. Refer to <samp class="file">/usr/lib/sched.models</samp> on an HP-UX system to determine the proper architecture option for your machine. Code compiled for lower numbered architectures runs on higher numbered architectures, but not the other way around. </p> </dd> <dt> + <span><code class="code">-mpa-risc-1-0</code><a class="copiable-link" href="#index-mpa-risc-1-0"> ¶</a></span> +</dt> <dt><code class="code">-mpa-risc-1-1</code></dt> <dt><code class="code">-mpa-risc-2-0</code></dt> <dd> +<p>Synonyms for <samp class="option">-march=1.0</samp>, <samp class="option">-march=1.1</samp>, and <samp class="option">-march=2.0</samp> respectively. </p> </dd> <dt> + <span><code class="code">-matomic-libcalls</code><a class="copiable-link" href="#index-matomic-libcalls"> ¶</a></span> +</dt> <dd> +<p>Generate libcalls for atomic loads and stores when sync libcalls are disabled. This option is enabled by default. It only affects the generation of atomic libcalls by the HPPA backend. </p> <p>Both the sync and <samp class="file">libatomic</samp> libcall implementations use locking. As a result, processor stores are not atomic with respect to other atomic operations. Processor loads up to DImode are atomic with respect to other atomic operations provided they are implemented as a single access. </p> <p>The PA-RISC architecture does not support any atomic operations in hardware except for the <code class="code">ldcw</code> instruction. Thus, all atomic support is implemented using sync and atomic libcalls. Sync libcall support is in <samp class="file">libgcc.a</samp>. Atomic libcall support is in <samp class="file">libatomic</samp>. </p> <p>This option generates <code class="code">__atomic_exchange</code> calls for atomic stores. It also provides special handling for atomic DImode accesses on 32-bit targets. </p> </dd> <dt> +<span><code class="code">-mbig-switch</code><a class="copiable-link" href="#index-mbig-switch"> ¶</a></span> +</dt> <dd> +<p>Does nothing. Preserved for backward compatibility. </p> </dd> <dt> +<span><code class="code">-mcaller-copies</code><a class="copiable-link" href="#index-mcaller-copies"> ¶</a></span> +</dt> <dd> +<p>The caller copies function arguments passed by hidden reference. This option should be used with care as it is not compatible with the default 32-bit runtime. However, only aggregates larger than eight bytes are passed by hidden reference and the option provides better compatibility with OpenMP. </p> </dd> <dt> +<span><code class="code">-mcoherent-ldcw</code><a class="copiable-link" href="#index-mcoherent-ldcw"> ¶</a></span> +</dt> <dd> +<p>Use ldcw/ldcd coherent cache-control hint. </p> </dd> <dt> +<span><code class="code">-mdisable-fpregs</code><a class="copiable-link" href="#index-mdisable-fpregs"> ¶</a></span> +</dt> <dd> +<p>Disable floating-point registers. Equivalent to <code class="code">-msoft-float</code>. </p> </dd> <dt> +<span><code class="code">-mdisable-indexing</code><a class="copiable-link" href="#index-mdisable-indexing"> ¶</a></span> +</dt> <dd> +<p>Prevent the compiler from using indexing address modes. This avoids some rather obscure problems when compiling MIG generated code under MACH. </p> </dd> <dt> +<span><code class="code">-mfast-indirect-calls</code><a class="copiable-link" href="#index-mfast-indirect-calls"> ¶</a></span> +</dt> <dd> +<p>Generate code that assumes calls never cross space boundaries. This allows GCC to emit code that performs faster indirect calls. </p> <p>This option does not work in the presence of shared libraries or nested functions. </p> </dd> <dt> +<span><code class="code">-mfixed-range=<var class="var">register-range</var></code><a class="copiable-link" href="#index-mfixed-range"> ¶</a></span> +</dt> <dd> +<p>Generate code treating the given register range as fixed registers. A fixed register is one that the register allocator cannot use. This is useful when compiling kernel code. A register range is specified as two registers separated by a dash. Multiple register ranges can be specified separated by a comma. </p> </dd> <dt> +<span><code class="code">-mgas</code><a class="copiable-link" href="#index-mgas"> ¶</a></span> +</dt> <dd> +<p>Enable the use of assembler directives only GAS understands. </p> </dd> <dt> +<span><code class="code">-mgnu-ld</code><a class="copiable-link" href="#index-mgnu-ld"> ¶</a></span> +</dt> <dd> +<p>Use options specific to GNU <code class="command">ld</code>. This passes <samp class="option">-shared</samp> to <code class="command">ld</code> when building a shared library. It is the default when GCC is configured, explicitly or implicitly, with the GNU linker. This option does not affect which <code class="command">ld</code> is called; it only changes what parameters are passed to that <code class="command">ld</code>. The <code class="command">ld</code> that is called is determined by the <samp class="option">--with-ld</samp> configure option, GCC’s program search path, and finally by the user’s <code class="env">PATH</code>. The linker used by GCC can be printed using ‘<samp class="samp">which `gcc -print-prog-name=ld`</samp>’. This option is only available on the 64-bit HP-UX GCC, i.e. configured with ‘<samp class="samp">hppa*64*-*-hpux*</samp>’. </p> </dd> <dt> +<span><code class="code">-mhp-ld</code><a class="copiable-link" href="#index-mhp-ld"> ¶</a></span> +</dt> <dd> +<p>Use options specific to HP <code class="command">ld</code>. This passes <samp class="option">-b</samp> to <code class="command">ld</code> when building a shared library and passes <samp class="option">+Accept TypeMismatch</samp> to <code class="command">ld</code> on all links. It is the default when GCC is configured, explicitly or implicitly, with the HP linker. This option does not affect which <code class="command">ld</code> is called; it only changes what parameters are passed to that <code class="command">ld</code>. The <code class="command">ld</code> that is called is determined by the <samp class="option">--with-ld</samp> configure option, GCC’s program search path, and finally by the user’s <code class="env">PATH</code>. The linker used by GCC can be printed using ‘<samp class="samp">which `gcc -print-prog-name=ld`</samp>’. This option is only available on the 64-bit HP-UX GCC, i.e. configured with ‘<samp class="samp">hppa*64*-*-hpux*</samp>’. </p> </dd> <dt> +<span><code class="code">-mlinker-opt</code><a class="copiable-link" href="#index-mlinker-opt"> ¶</a></span> +</dt> <dd> +<p>Enable the optimization pass in the HP-UX linker. Note this makes symbolic debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9 linkers in which they give bogus error messages when linking some programs. </p> </dd> <dt> + <span><code class="code">-mlong-calls</code><a class="copiable-link" href="#index-mno-long-calls-2"> ¶</a></span> +</dt> <dd> +<p>Generate code that uses long call sequences. This ensures that a call is always able to reach linker generated stubs. The default is to generate long calls only when the distance from the call site to the beginning of the function or translation unit, as the case may be, exceeds a predefined limit set by the branch type being used. The limits for normal calls are 7,600,000 and 240,000 bytes, respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are always limited at 240,000 bytes. </p> <p>Distances are measured from the beginning of functions when using the <samp class="option">-ffunction-sections</samp> option, or when using the <samp class="option">-mgas</samp> and <samp class="option">-mno-portable-runtime</samp> options together under HP-UX with the SOM linker. </p> <p>It is normally not desirable to use this option as it degrades performance. However, it may be useful in large applications, particularly when partial linking is used to build the application. </p> <p>The types of long calls used depends on the capabilities of the assembler and linker, and the type of code being generated. The impact on systems that support long absolute calls, and long pic symbol-difference or pc-relative calls should be relatively small. However, an indirect call is used on 32-bit ELF systems in pic code and it is quite long. </p> </dd> <dt> +<span><code class="code">-mlong-load-store</code><a class="copiable-link" href="#index-mlong-load-store"> ¶</a></span> +</dt> <dd> +<p>Generate 3-instruction load and store sequences as sometimes required by the HP-UX 10 linker. This is equivalent to the ‘<samp class="samp">+k</samp>’ option to the HP compilers. </p> </dd> <dt> +<span><code class="code">-mjump-in-delay</code><a class="copiable-link" href="#index-mjump-in-delay"> ¶</a></span> +</dt> <dd> +<p>This option is ignored and provided for compatibility purposes only. </p> </dd> <dt> + <span><code class="code">-mno-space-regs</code><a class="copiable-link" href="#index-mno-space-regs"> ¶</a></span> +</dt> <dd> +<p>Generate code that assumes the target has no space registers. This allows GCC to generate faster indirect calls and use unscaled index address modes. </p> <p>Such code is suitable for level 0 PA systems and kernels. </p> </dd> <dt> +<span><code class="code">-mordered</code><a class="copiable-link" href="#index-mordered"> ¶</a></span> +</dt> <dd> +<p>Assume memory references are ordered and barriers are not needed. </p> </dd> <dt> +<span><code class="code">-mportable-runtime</code><a class="copiable-link" href="#index-mportable-runtime"> ¶</a></span> +</dt> <dd> +<p>Use the portable calling conventions proposed by HP for ELF systems. </p> </dd> <dt> +<span><code class="code">-mschedule=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-mschedule"> ¶</a></span> +</dt> <dd> +<p>Schedule code according to the constraints for the machine type <var class="var">cpu-type</var>. The choices for <var class="var">cpu-type</var> are ‘<samp class="samp">700</samp>’ ‘<samp class="samp">7100</samp>’, ‘<samp class="samp">7100LC</samp>’, ‘<samp class="samp">7200</samp>’, ‘<samp class="samp">7300</samp>’ and ‘<samp class="samp">8000</samp>’. Refer to <samp class="file">/usr/lib/sched.models</samp> on an HP-UX system to determine the proper scheduling option for your machine. The default scheduling is ‘<samp class="samp">8000</samp>’. </p> </dd> <dt> +<span><code class="code">-msio</code><a class="copiable-link" href="#index-msio"> ¶</a></span> +</dt> <dd> +<p>Generate the predefine, <code class="code">_SIO</code>, for server IO. The default is <samp class="option">-mwsio</samp>. This generates the predefines, <code class="code">__hp9000s700</code>, <code class="code">__hp9000s700__</code> and <code class="code">_WSIO</code>, for workstation IO. These options are available under HP-UX and HI-UX. </p> </dd> <dt> +<span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-4"> ¶</a></span> +</dt> <dd> +<p>Generate output containing library calls for floating point. <strong class="strong">Warning:</strong> the requisite libraries are not available for all HPPA targets. Normally the facilities of the machine’s usual C compiler are used, but this cannot be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for cross-compilation. </p> <p><samp class="option">-msoft-float</samp> changes the calling convention in the output file; therefore, it is only useful if you compile <em class="emph">all</em> of a program with this option. In particular, you need to compile <samp class="file">libgcc.a</samp>, the library that comes with GCC, with <samp class="option">-msoft-float</samp> in order for this to work. </p> </dd> <dt> +<span><code class="code">-msoft-mult</code><a class="copiable-link" href="#index-msoft-mult"> ¶</a></span> +</dt> <dd> +<p>Use software integer multiplication. </p> <p>This disables the use of the <code class="code">xmpyu</code> instruction. </p> </dd> <dt> +<span><code class="code">-munix=<var class="var">unix-std</var></code><a class="copiable-link" href="#index-march-6"> ¶</a></span> +</dt> <dd> +<p>Generate compiler predefines and select a startfile for the specified UNIX standard. The choices for <var class="var">unix-std</var> are ‘<samp class="samp">93</samp>’, ‘<samp class="samp">95</samp>’ and ‘<samp class="samp">98</samp>’. ‘<samp class="samp">93</samp>’ is supported on all HP-UX versions. ‘<samp class="samp">95</samp>’ is available on HP-UX 10.10 and later. ‘<samp class="samp">98</samp>’ is available on HP-UX 11.11 and later. The default values are ‘<samp class="samp">93</samp>’ for HP-UX 10.00, ‘<samp class="samp">95</samp>’ for HP-UX 10.10 though to 11.00, and ‘<samp class="samp">98</samp>’ for HP-UX 11.11 and later. </p> <p><samp class="option">-munix=93</samp> provides the same predefines as GCC 3.3 and 3.4. <samp class="option">-munix=95</samp> provides additional predefines for <code class="code">XOPEN_UNIX</code> and <code class="code">_XOPEN_SOURCE_EXTENDED</code>, and the startfile <samp class="file">unix95.o</samp>. <samp class="option">-munix=98</samp> provides additional predefines for <code class="code">_XOPEN_UNIX</code>, <code class="code">_XOPEN_SOURCE_EXTENDED</code>, <code class="code">_INCLUDE__STDC_A1_SOURCE</code> and <code class="code">_INCLUDE_XOPEN_SOURCE_500</code>, and the startfile <samp class="file">unix98.o</samp>. </p> <p>It is <em class="emph">important</em> to note that this option changes the interfaces for various library routines. It also affects the operational behavior of the C library. Thus, <em class="emph">extreme</em> care is needed in using this option. </p> <p>Library code that is intended to operate with more than one UNIX standard must test, set and restore the variable <code class="code">__xpg4_extended_mask</code> as appropriate. Most GNU software doesn’t provide this capability. </p> </dd> <dt> +<span><code class="code">-nolibdld</code><a class="copiable-link" href="#index-nolibdld"> ¶</a></span> +</dt> <dd> +<p>Suppress the generation of link options to search libdld.sl when the <samp class="option">-static</samp> option is specified on HP-UX 10 and later. </p> </dd> <dt> +<span><code class="code">-static</code><a class="copiable-link" href="#index-static-2"> ¶</a></span> +</dt> <dd> +<p>The HP-UX implementation of setlocale in libc has a dependency on libdld.sl. There isn’t an archive version of libdld.sl. Thus, when the <samp class="option">-static</samp> option is specified, special link options are needed to resolve this dependency. </p> <p>On HP-UX 10 and later, the GCC driver adds the necessary options to link with libdld.sl when the <samp class="option">-static</samp> option is specified. This causes the resulting binary to be dynamic. On the 64-bit port, the linkers generate dynamic binaries by default in any case. The <samp class="option">-nolibdld</samp> option can be used to prevent the GCC driver from adding these link options. </p> </dd> <dt> +<span><code class="code">-threads</code><a class="copiable-link" href="#index-threads"> ¶</a></span> +</dt> <dd><p>Add support for multithreading with the <em class="dfn">dce thread</em> library under HP-UX. This option sets flags for both the preprocessor and linker. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="ia-64-options">IA-64 Options</a>, Previous: <a href="h8_002f300-options">H8/300 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/HPPA-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/HPPA-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/ia-64-function-attributes.html b/devdocs/gcc~13/ia-64-function-attributes.html new file mode 100644 index 00000000..8a7bb69f --- /dev/null +++ b/devdocs/gcc~13/ia-64-function-attributes.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="IA-64-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="m32c-function-attributes" accesskey="n" rel="next">M32C Function Attributes</a>, Previous: <a href="h8_002f300-function-attributes" accesskey="p" rel="prev">H8/300 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="IA-64-Function-Attributes-1"><span>6.33.12 IA-64 Function Attributes<a class="copiable-link" href="#IA-64-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported on IA-64 targets: </p> <dl class="table"> <dt> +<span><code class="code">syscall_linkage</code><a class="copiable-link" href="#index-syscall_005flinkage-function-attribute_002c-IA-64"> ¶</a></span> +</dt> <dd> +<p>This attribute is used to modify the IA-64 calling convention by marking all input registers as live at all function exits. This makes it possible to restart a system call after an interrupt without having to save/restore the input registers. This also prevents kernel data from leaking into application code. </p> </dd> <dt> +<span><code class="code">version_id</code><a class="copiable-link" href="#index-version_005fid-function-attribute_002c-IA-64"> ¶</a></span> +</dt> <dd> +<p>This IA-64 HP-UX attribute, attached to a global variable or function, renames a symbol to contain a version string, thus allowing for function level versioning. HP-UX system header files may use function level versioning for some system calls. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern int foo () __attribute__((version_id ("20040821")));</pre> +</div> <p>Calls to <code class="code">foo</code> are mapped to calls to <code class="code">foo{20040821}</code>. </p> +</dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/IA-64-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/IA-64-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/ia-64-options.html b/devdocs/gcc~13/ia-64-options.html new file mode 100644 index 00000000..07818462 --- /dev/null +++ b/devdocs/gcc~13/ia-64-options.html @@ -0,0 +1,132 @@ +<div class="subsection-level-extent" id="IA-64-Options"> <div class="nav-panel"> <p> Next: <a href="lm32-options" accesskey="n" rel="next">LM32 Options</a>, Previous: <a href="hppa-options" accesskey="p" rel="prev">HPPA Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="IA-64-Options-1"><span>3.19.20 IA-64 Options<a class="copiable-link" href="#IA-64-Options-1"> ¶</a></span></h1> <p>These are the ‘<samp class="samp">-m</samp>’ options defined for the Intel IA-64 architecture. </p> <dl class="table"> <dt> +<span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian-6"> ¶</a></span> +</dt> <dd> +<p>Generate code for a big-endian target. This is the default for HP-UX. </p> </dd> <dt> +<span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian-6"> ¶</a></span> +</dt> <dd> +<p>Generate code for a little-endian target. This is the default for AIX5 and GNU/Linux. </p> </dd> <dt> + <span><code class="code">-mgnu-as</code><a class="copiable-link" href="#index-mgnu-as"> ¶</a></span> +</dt> <dt><code class="code">-mno-gnu-as</code></dt> <dd> +<p>Generate (or don’t) code for the GNU assembler. This is the default. </p> </dd> <dt> + <span><code class="code">-mgnu-ld</code><a class="copiable-link" href="#index-mgnu-ld-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-gnu-ld</code></dt> <dd> +<p>Generate (or don’t) code for the GNU linker. This is the default. </p> </dd> <dt> +<span><code class="code">-mno-pic</code><a class="copiable-link" href="#index-mno-pic"> ¶</a></span> +</dt> <dd> +<p>Generate code that does not use a global pointer register. The result is not position independent code, and violates the IA-64 ABI. </p> </dd> <dt> + <span><code class="code">-mvolatile-asm-stop</code><a class="copiable-link" href="#index-mvolatile-asm-stop"> ¶</a></span> +</dt> <dt><code class="code">-mno-volatile-asm-stop</code></dt> <dd> +<p>Generate (or don’t) a stop bit immediately before and after volatile asm statements. </p> </dd> <dt> + <span><code class="code">-mregister-names</code><a class="copiable-link" href="#index-mregister-names"> ¶</a></span> +</dt> <dt><code class="code">-mno-register-names</code></dt> <dd> +<p>Generate (or don’t) ‘<samp class="samp">in</samp>’, ‘<samp class="samp">loc</samp>’, and ‘<samp class="samp">out</samp>’ register names for the stacked registers. This may make assembler output more readable. </p> </dd> <dt> + <span><code class="code">-mno-sdata</code><a class="copiable-link" href="#index-mno-sdata-1"> ¶</a></span> +</dt> <dt><code class="code">-msdata</code></dt> <dd> +<p>Disable (or enable) optimizations that use the small data section. This may be useful for working around optimizer bugs. </p> </dd> <dt> +<span><code class="code">-mconstant-gp</code><a class="copiable-link" href="#index-mconstant-gp"> ¶</a></span> +</dt> <dd> +<p>Generate code that uses a single constant global pointer value. This is useful when compiling kernel code. </p> </dd> <dt> +<span><code class="code">-mauto-pic</code><a class="copiable-link" href="#index-mauto-pic"> ¶</a></span> +</dt> <dd> +<p>Generate code that is self-relocatable. This implies <samp class="option">-mconstant-gp</samp>. This is useful when compiling firmware code. </p> </dd> <dt> +<span><code class="code">-minline-float-divide-min-latency</code><a class="copiable-link" href="#index-minline-float-divide-min-latency"> ¶</a></span> +</dt> <dd> +<p>Generate code for inline divides of floating-point values using the minimum latency algorithm. </p> </dd> <dt> +<span><code class="code">-minline-float-divide-max-throughput</code><a class="copiable-link" href="#index-minline-float-divide-max-throughput"> ¶</a></span> +</dt> <dd> +<p>Generate code for inline divides of floating-point values using the maximum throughput algorithm. </p> </dd> <dt> +<span><code class="code">-mno-inline-float-divide</code><a class="copiable-link" href="#index-mno-inline-float-divide"> ¶</a></span> +</dt> <dd> +<p>Do not generate inline code for divides of floating-point values. </p> </dd> <dt> +<span><code class="code">-minline-int-divide-min-latency</code><a class="copiable-link" href="#index-minline-int-divide-min-latency"> ¶</a></span> +</dt> <dd> +<p>Generate code for inline divides of integer values using the minimum latency algorithm. </p> </dd> <dt> +<span><code class="code">-minline-int-divide-max-throughput</code><a class="copiable-link" href="#index-minline-int-divide-max-throughput"> ¶</a></span> +</dt> <dd> +<p>Generate code for inline divides of integer values using the maximum throughput algorithm. </p> </dd> <dt> + <span><code class="code">-mno-inline-int-divide</code><a class="copiable-link" href="#index-mno-inline-int-divide"> ¶</a></span> +</dt> <dd> +<p>Do not generate inline code for divides of integer values. </p> </dd> <dt> +<span><code class="code">-minline-sqrt-min-latency</code><a class="copiable-link" href="#index-minline-sqrt-min-latency"> ¶</a></span> +</dt> <dd> +<p>Generate code for inline square roots using the minimum latency algorithm. </p> </dd> <dt> +<span><code class="code">-minline-sqrt-max-throughput</code><a class="copiable-link" href="#index-minline-sqrt-max-throughput"> ¶</a></span> +</dt> <dd> +<p>Generate code for inline square roots using the maximum throughput algorithm. </p> </dd> <dt> +<span><code class="code">-mno-inline-sqrt</code><a class="copiable-link" href="#index-mno-inline-sqrt"> ¶</a></span> +</dt> <dd> +<p>Do not generate inline code for <code class="code">sqrt</code>. </p> </dd> <dt> + <span><code class="code">-mfused-madd</code><a class="copiable-link" href="#index-mfused-madd"> ¶</a></span> +</dt> <dt><code class="code">-mno-fused-madd</code></dt> <dd> +<p>Do (don’t) generate code that uses the fused multiply/add or multiply/subtract instructions. The default is to use these instructions. </p> </dd> <dt> + <span><code class="code">-mno-dwarf2-asm</code><a class="copiable-link" href="#index-mno-dwarf2-asm"> ¶</a></span> +</dt> <dt><code class="code">-mdwarf2-asm</code></dt> <dd> +<p>Don’t (or do) generate assembler code for the DWARF line number debugging info. This may be useful when not using the GNU assembler. </p> </dd> <dt> + <span><code class="code">-mearly-stop-bits</code><a class="copiable-link" href="#index-mearly-stop-bits"> ¶</a></span> +</dt> <dt><code class="code">-mno-early-stop-bits</code></dt> <dd> +<p>Allow stop bits to be placed earlier than immediately preceding the instruction that triggered the stop bit. This can improve instruction scheduling, but does not always do so. </p> </dd> <dt> +<span><code class="code">-mfixed-range=<var class="var">register-range</var></code><a class="copiable-link" href="#index-mfixed-range-1"> ¶</a></span> +</dt> <dd> +<p>Generate code treating the given register range as fixed registers. A fixed register is one that the register allocator cannot use. This is useful when compiling kernel code. A register range is specified as two registers separated by a dash. Multiple register ranges can be specified separated by a comma. </p> </dd> <dt> +<span><code class="code">-mtls-size=<var class="var">tls-size</var></code><a class="copiable-link" href="#index-mtls-size-1"> ¶</a></span> +</dt> <dd> +<p>Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 64. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-mtune-7"> ¶</a></span> +</dt> <dd> +<p>Tune the instruction scheduling for a particular CPU, Valid values are ‘<samp class="samp">itanium</samp>’, ‘<samp class="samp">itanium1</samp>’, ‘<samp class="samp">merced</samp>’, ‘<samp class="samp">itanium2</samp>’, and ‘<samp class="samp">mckinley</samp>’. </p> </dd> <dt> + <span><code class="code">-milp32</code><a class="copiable-link" href="#index-milp32"> ¶</a></span> +</dt> <dt><code class="code">-mlp64</code></dt> <dd> +<p>Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits. These are HP-UX specific flags. </p> </dd> <dt> + <span><code class="code">-mno-sched-br-data-spec</code><a class="copiable-link" href="#index-mno-sched-br-data-spec"> ¶</a></span> +</dt> <dt><code class="code">-msched-br-data-spec</code></dt> <dd> +<p>(Dis/En)able data speculative scheduling before reload. This results in generation of <code class="code">ld.a</code> instructions and the corresponding check instructions (<code class="code">ld.c</code> / <code class="code">chk.a</code>). The default setting is disabled. </p> </dd> <dt> + <span><code class="code">-msched-ar-data-spec</code><a class="copiable-link" href="#index-msched-ar-data-spec"> ¶</a></span> +</dt> <dt><code class="code">-mno-sched-ar-data-spec</code></dt> <dd> +<p>(En/Dis)able data speculative scheduling after reload. This results in generation of <code class="code">ld.a</code> instructions and the corresponding check instructions (<code class="code">ld.c</code> / <code class="code">chk.a</code>). The default setting is enabled. </p> </dd> <dt> + <span><code class="code">-mno-sched-control-spec</code><a class="copiable-link" href="#index-mno-sched-control-spec"> ¶</a></span> +</dt> <dt><code class="code">-msched-control-spec</code></dt> <dd> +<p>(Dis/En)able control speculative scheduling. This feature is available only during region scheduling (i.e. before reload). This results in generation of the <code class="code">ld.s</code> instructions and the corresponding check instructions <code class="code">chk.s</code>. The default setting is disabled. </p> </dd> <dt> + <span><code class="code">-msched-br-in-data-spec</code><a class="copiable-link" href="#index-msched-br-in-data-spec"> ¶</a></span> +</dt> <dt><code class="code">-mno-sched-br-in-data-spec</code></dt> <dd> +<p>(En/Dis)able speculative scheduling of the instructions that are dependent on the data speculative loads before reload. This is effective only with <samp class="option">-msched-br-data-spec</samp> enabled. The default setting is enabled. </p> </dd> <dt> + <span><code class="code">-msched-ar-in-data-spec</code><a class="copiable-link" href="#index-msched-ar-in-data-spec"> ¶</a></span> +</dt> <dt><code class="code">-mno-sched-ar-in-data-spec</code></dt> <dd> +<p>(En/Dis)able speculative scheduling of the instructions that are dependent on the data speculative loads after reload. This is effective only with <samp class="option">-msched-ar-data-spec</samp> enabled. The default setting is enabled. </p> </dd> <dt> + <span><code class="code">-msched-in-control-spec</code><a class="copiable-link" href="#index-msched-in-control-spec"> ¶</a></span> +</dt> <dt><code class="code">-mno-sched-in-control-spec</code></dt> <dd> +<p>(En/Dis)able speculative scheduling of the instructions that are dependent on the control speculative loads. This is effective only with <samp class="option">-msched-control-spec</samp> enabled. The default setting is enabled. </p> </dd> <dt> + <span><code class="code">-mno-sched-prefer-non-data-spec-insns</code><a class="copiable-link" href="#index-mno-sched-prefer-non-data-spec-insns"> ¶</a></span> +</dt> <dt><code class="code">-msched-prefer-non-data-spec-insns</code></dt> <dd> +<p>If enabled, data-speculative instructions are chosen for schedule only if there are no other choices at the moment. This makes the use of the data speculation much more conservative. The default setting is disabled. </p> </dd> <dt> + <span><code class="code">-mno-sched-prefer-non-control-spec-insns</code><a class="copiable-link" href="#index-mno-sched-prefer-non-control-spec-insns"> ¶</a></span> +</dt> <dt><code class="code">-msched-prefer-non-control-spec-insns</code></dt> <dd> +<p>If enabled, control-speculative instructions are chosen for schedule only if there are no other choices at the moment. This makes the use of the control speculation much more conservative. The default setting is disabled. </p> </dd> <dt> + <span><code class="code">-mno-sched-count-spec-in-critical-path</code><a class="copiable-link" href="#index-mno-sched-count-spec-in-critical-path"> ¶</a></span> +</dt> <dt><code class="code">-msched-count-spec-in-critical-path</code></dt> <dd> +<p>If enabled, speculative dependencies are considered during computation of the instructions priorities. This makes the use of the speculation a bit more conservative. The default setting is disabled. </p> </dd> <dt> +<span><code class="code">-msched-spec-ldc</code><a class="copiable-link" href="#index-msched-spec-ldc"> ¶</a></span> +</dt> <dd> +<p>Use a simple data speculation check. This option is on by default. </p> </dd> <dt> +<span><code class="code">-msched-control-spec-ldc</code><a class="copiable-link" href="#index-msched-spec-ldc-1"> ¶</a></span> +</dt> <dd> +<p>Use a simple check for control speculation. This option is on by default. </p> </dd> <dt> +<span><code class="code">-msched-stop-bits-after-every-cycle</code><a class="copiable-link" href="#index-msched-stop-bits-after-every-cycle"> ¶</a></span> +</dt> <dd> +<p>Place a stop bit after every cycle when scheduling. This option is on by default. </p> </dd> <dt> +<span><code class="code">-msched-fp-mem-deps-zero-cost</code><a class="copiable-link" href="#index-msched-fp-mem-deps-zero-cost"> ¶</a></span> +</dt> <dd> +<p>Assume that floating-point stores and loads are not likely to cause a conflict when placed into the same instruction group. This option is disabled by default. </p> </dd> <dt> +<span><code class="code">-msel-sched-dont-check-control-spec</code><a class="copiable-link" href="#index-msel-sched-dont-check-control-spec"> ¶</a></span> +</dt> <dd> +<p>Generate checks for control speculation in selective scheduling. This flag is disabled by default. </p> </dd> <dt> +<span><code class="code">-msched-max-memory-insns=<var class="var">max-insns</var></code><a class="copiable-link" href="#index-msched-max-memory-insns"> ¶</a></span> +</dt> <dd> +<p>Limit on the number of memory insns per instruction group, giving lower priority to subsequent memory insns attempting to schedule in the same instruction group. Frequently useful to prevent cache bank conflicts. The default value is 1. </p> </dd> <dt> +<span><code class="code">-msched-max-memory-insns-hard-limit</code><a class="copiable-link" href="#index-msched-max-memory-insns-hard-limit"> ¶</a></span> +</dt> <dd> +<p>Makes the limit specified by <samp class="option">msched-max-memory-insns</samp> a hard limit, disallowing more than that number in an instruction group. Otherwise, the limit is “soft”, meaning that non-memory operations are preferred when the limit is reached, but memory operations may still be scheduled. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="lm32-options">LM32 Options</a>, Previous: <a href="hppa-options">HPPA Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/IA-64-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/IA-64-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/ia-64-variable-attributes.html b/devdocs/gcc~13/ia-64-variable-attributes.html new file mode 100644 index 00000000..6127111b --- /dev/null +++ b/devdocs/gcc~13/ia-64-variable-attributes.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="IA-64-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="loongarch-variable-attributes" accesskey="n" rel="next">LoongArch Variable Attributes</a>, Previous: <a href="h8_002f300-variable-attributes" accesskey="p" rel="prev">H8/300 Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="IA-64-Variable-Attributes-1"><span>6.34.6 IA-64 Variable Attributes<a class="copiable-link" href="#IA-64-Variable-Attributes-1"> ¶</a></span></h1> <p>The IA-64 back end supports the following variable attribute: </p> <dl class="table"> <dt> +<span><code class="code">model (<var class="var">model-name</var>)</code><a class="copiable-link" href="#index-model-variable-attribute_002c-IA-64"> ¶</a></span> +</dt> <dd> <p>On IA-64, use this attribute to set the addressability of an object. At present, the only supported identifier for <var class="var">model-name</var> is <code class="code">small</code>, indicating addressability via “small” (22-bit) addresses (so that their addresses can be loaded with the <code class="code">addl</code> instruction). Caveat: such addressing is by definition not position independent and hence this attribute must not be used for objects defined by shared libraries. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/IA-64-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/IA-64-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/identifiers-implementation.html b/devdocs/gcc~13/identifiers-implementation.html new file mode 100644 index 00000000..1ea59dbe --- /dev/null +++ b/devdocs/gcc~13/identifiers-implementation.html @@ -0,0 +1,9 @@ +<div class="section-level-extent" id="Identifiers-implementation"> <div class="nav-panel"> <p> Next: <a href="characters-implementation" accesskey="n" rel="next">Characters</a>, Previous: <a href="environment-implementation" accesskey="p" rel="prev">Environment</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Identifiers"><span>4.3 Identifiers<a class="copiable-link" href="#Identifiers"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>Which additional multibyte characters may appear in identifiers and their correspondence to universal character names (C99 and C11 6.4.2). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. </p> </li> +<li>The number of significant initial characters in an identifier (C90 6.1.2, C90, C99 and C11 5.2.4.1, C99 and C11 6.4.2). <p>For internal names, all characters are significant. For external names, the number of significant characters are defined by the linker; for almost all targets, all characters are significant. </p> </li> +<li>Whether case distinctions are significant in an identifier with external linkage (C90 6.1.2). <p>This is a property of the linker. C99 and C11 require that case distinctions are always significant in identifiers with external linkage and systems without this property are not supported by GCC. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Identifiers-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Identifiers-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/incompatibilities.html b/devdocs/gcc~13/incompatibilities.html new file mode 100644 index 00000000..d347210a --- /dev/null +++ b/devdocs/gcc~13/incompatibilities.html @@ -0,0 +1,59 @@ +<div class="section-level-extent" id="Incompatibilities"> <div class="nav-panel"> <p> Next: <a href="fixed-headers" accesskey="n" rel="next">Fixed Header Files</a>, Previous: <a href="interoperation" accesskey="p" rel="prev">Interoperation</a>, Up: <a href="trouble" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Incompatibilities-of-GCC"><span>14.3 Incompatibilities of GCC<a class="copiable-link" href="#Incompatibilities-of-GCC"> ¶</a></span></h1> <p>There are several noteworthy incompatibilities between GNU C and K&R (non-ISO) versions of C. </p> <ul class="itemize mark-bullet"> <li> + GCC normally makes string constants read-only. If several identical-looking string constants are used, GCC stores only one copy of the string. <p>One consequence is that you cannot call <code class="code">mktemp</code> with a string constant argument. The function <code class="code">mktemp</code> always alters the string its argument points to. </p> <p>Another consequence is that <code class="code">sscanf</code> does not work on some very old systems when passed a string constant as its format control string or input. This is because <code class="code">sscanf</code> incorrectly tries to write into the string constant. Likewise <code class="code">fscanf</code> and <code class="code">scanf</code>. </p> <p>The solution to these problems is to change the program to use <code class="code">char</code>-array variables with initialization strings for these purposes instead of string constants. </p> </li> +<li> +<code class="code">-2147483648</code> is positive. <p>This is because 2147483648 cannot fit in the type <code class="code">int</code>, so (following the ISO C rules) its data type is <code class="code">unsigned long int</code>. Negating this value yields 2147483648 again. </p> </li> +<li>GCC does not substitute macro arguments when they appear inside of string constants. For example, the following macro in GCC <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define foo(a) "a"</pre> +</div> <p>will produce output <code class="code">"a"</code> regardless of what the argument <var class="var">a</var> is. </p> </li> +<li> + When you use <code class="code">setjmp</code> and <code class="code">longjmp</code>, the only automatic variables guaranteed to remain valid are those declared <code class="code">volatile</code>. This is a consequence of automatic register allocation. Consider this function: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">jmp_buf j; + +foo () +{ + int a, b; + + a = fun1 (); + if (setjmp (j)) + return a; + + a = fun2 (); + /* <span class="r"><code class="code">longjmp (j)</code> may occur in <code class="code">fun3</code>.</span> */ + return a + fun3 (); +}</pre> +</div> <p>Here <code class="code">a</code> may or may not be restored to its first value when the <code class="code">longjmp</code> occurs. If <code class="code">a</code> is allocated in a register, then its first value is restored; otherwise, it keeps the last value stored in it. </p> <p>If you use the <samp class="option">-W</samp> option with the <samp class="option">-O</samp> option, you will get a warning when GCC thinks such a problem might be possible. </p> </li> +<li>Programs that use preprocessing directives in the middle of macro arguments do not work with GCC. For example, a program like this will not work: <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">foobar ( +#define luser + hack)</pre></div> +</div> <p>ISO C does not permit such a construct. </p> </li> +<li>K&R compilers allow comments to cross over an inclusion boundary (i.e. started in an include file and ended in the including file). </li> +<li> + Declarations of external variables and functions within a block apply only to the block containing the declaration. In other words, they have the same scope as any other declaration in the same place. <p>In some other C compilers, an <code class="code">extern</code> declaration affects all the rest of the file even if it happens within a block. </p> </li> +<li>In traditional C, you can combine <code class="code">long</code>, etc., with a typedef name, as shown here: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int foo; +typedef long foo bar;</pre> +</div> <p>In ISO C, this is not allowed: <code class="code">long</code> and other type modifiers require an explicit <code class="code">int</code>. </p> </li> +<li> + PCC allows typedef names to be used as function parameters. </li> +<li>Traditional C allows the following erroneous pair of declarations to appear together in a given scope: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int foo; +typedef foo foo;</pre> +</div> </li> +<li>GCC treats all characters of identifiers as significant. According to K&R-1 (2.2), “No more than the first eight characters are significant, although more may be used.”. Also according to K&R-1 (2.2), “An identifier is a sequence of letters and digits; the first character must be a letter. The underscore _ counts as a letter.”, but GCC also allows dollar signs in identifiers. </li> +<li> + PCC allows whitespace in the middle of compound assignment operators such as ‘<samp class="samp">+=</samp>’. GCC, following the ISO standard, does not allow this. </li> +<li> + GCC complains about unterminated character constants inside of preprocessing conditionals that fail. Some programs have English comments enclosed in conditionals that are guaranteed to fail; if these comments contain apostrophes, GCC will probably report an error. For example, this code would produce an error: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#if 0 +You can't expect this to work. +#endif</pre> +</div> <p>The best solution to such a problem is to put the text into an actual C comment delimited by ‘<samp class="samp">/*…*/</samp>’. </p> </li> +<li>Many user programs contain the declaration ‘<samp class="samp">long time ();</samp>’. In the past, the system header files on many systems did not actually declare <code class="code">time</code>, so it did not matter what type your program declared it to return. But in systems with ISO C headers, <code class="code">time</code> is declared to return <code class="code">time_t</code>, and if that is not the same as <code class="code">long</code>, then ‘<samp class="samp">long time ();</samp>’ is erroneous. <p>The solution is to change your program to use appropriate system headers (<code class="code"><time.h></code> on systems with ISO C headers) and not to declare <code class="code">time</code> if the system header files declare it, or failing that to use <code class="code">time_t</code> as the return type of <code class="code">time</code>. </p> </li> +<li> + When compiling functions that return <code class="code">float</code>, PCC converts it to a double. GCC actually returns a <code class="code">float</code>. If you are concerned with PCC compatibility, you should declare your functions to return <code class="code">double</code>; you might as well say what you mean. </li> +<li> + When compiling functions that return structures or unions, GCC output code normally uses a method different from that used on most versions of Unix. As a result, code compiled with GCC cannot call a structure-returning function compiled with PCC, and vice versa. <p>The method used by GCC is as follows: a structure or union which is 1, 2, 4 or 8 bytes long is returned like a scalar. A structure or union with any other size is stored into an address supplied by the caller (usually in a special, fixed register, but on some machines it is passed on the stack). The target hook <code class="code">TARGET_STRUCT_VALUE_RTX</code> tells GCC where to pass this address. </p> <p>By contrast, PCC on most target machines returns structures and unions of any size by copying the data into an area of static storage, and then returning the address of that storage as if it were a pointer value. The caller must copy the data from that memory area to the place where the value is wanted. GCC does not use this method because it is slower and nonreentrant. </p> <p>On some newer machines, PCC uses a reentrant convention for all structure and union returning. GCC on most of these machines uses a compatible convention when returning structures and unions in memory, but still returns small structures and unions in registers. </p> <p>You can tell GCC to use a compatible convention for all structure and union returning with the option <samp class="option">-fpcc-struct-return</samp>. </p> </li> +<li> + GCC complains about program fragments such as ‘<samp class="samp">0x74ae-0x4000</samp>’ which appear to be two hexadecimal constants separated by the minus operator. Actually, this string is a single <em class="dfn">preprocessing token</em>. Each such token must correspond to one token in C. Since this does not, GCC prints an error message. Although it may appear obvious that what is meant is an operator and two values, the ISO C standard specifically requires that this be treated as erroneous. <p>A <em class="dfn">preprocessing token</em> is a <em class="dfn">preprocessing number</em> if it begins with a digit and is followed by letters, underscores, digits, periods and ‘<samp class="samp">e+</samp>’, ‘<samp class="samp">e-</samp>’, ‘<samp class="samp">E+</samp>’, ‘<samp class="samp">E-</samp>’, ‘<samp class="samp">p+</samp>’, ‘<samp class="samp">p-</samp>’, ‘<samp class="samp">P+</samp>’, or ‘<samp class="samp">P-</samp>’ character sequences. (In strict C90 mode, the sequences ‘<samp class="samp">p+</samp>’, ‘<samp class="samp">p-</samp>’, ‘<samp class="samp">P+</samp>’ and ‘<samp class="samp">P-</samp>’ cannot appear in preprocessing numbers.) </p> <p>To make the above program fragment valid, place whitespace in front of the minus sign. This whitespace will end the preprocessing number. </p> +</li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="fixed-headers">Fixed Header Files</a>, Previous: <a href="interoperation">Interoperation</a>, Up: <a href="trouble">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Incompatibilities.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Incompatibilities.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/incomplete-enums.html b/devdocs/gcc~13/incomplete-enums.html new file mode 100644 index 00000000..8f46ebe9 --- /dev/null +++ b/devdocs/gcc~13/incomplete-enums.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Incomplete-Enums"> <div class="nav-panel"> <p> Next: <a href="function-names" accesskey="n" rel="next">Function Names as Strings</a>, Previous: <a href="alternate-keywords" accesskey="p" rel="prev">Alternate Keywords</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Incomplete-enum-Types"><span>6.49 Incomplete enum Types<a class="copiable-link" href="#Incomplete-enum-Types"> ¶</a></span></h1> <p>You can define an <code class="code">enum</code> tag without specifying its possible values. This results in an incomplete type, much like what you get if you write <code class="code">struct foo</code> without describing the elements. A later declaration that does specify the possible values completes the type. </p> <p>You cannot allocate variables or storage using the type while it is incomplete. However, you can work with pointers to that type. </p> <p>This extension may not be very useful, but it makes the handling of <code class="code">enum</code> more consistent with the way <code class="code">struct</code> and <code class="code">union</code> are handled. </p> <p>This extension is not supported by GNU C++. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Incomplete-Enums.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Incomplete-Enums.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/index b/devdocs/gcc~13/index new file mode 100644 index 00000000..e8a05675 --- /dev/null +++ b/devdocs/gcc~13/index @@ -0,0 +1 @@ +((pages . ["index" "g_002b_002b-and-gcc" "developer-options" "invoking-gcc" "submodel-options" "invoking-g_002b_002b" "assembler-options" "standards" "directory-options" "debugging-options" "objective-c-and-objective-c_002b_002b-dialect-options" "link-options" "adapteva-epiphany-options" "amd-gcn-options" "overall-options" "c-dialect-options" "diagnostic-message-formatting-options" "aarch64-options" "preprocessor-options" "option-summary" "code-gen-options" "static-analyzer-options" "instrumentation-options" "blackfin-options" "c6x-options" "cris-options" "c-sky-options" "darwin-options" "c_002b_002b-dialect-options" "arm-options" "dec-alpha-options" "ebpf-options" "fr30-options" "ft32-options" "arc-options" "avr-options" "frv-options" "gnu_002flinux-options" "h8_002f300-options" "optimize-options" "hppa-options" "ia-64-options" "lm32-options" "loongarch-options" "m32c-options" "m32r_002fd-options" "m680x0-options" "warning-options" "mcore-options" "microblaze-options" "mmix-options" "mn10300-options" "moxie-options" "msp430-options" "nds32-options" "nios-ii-options" "nvidia-ptx-options" "openrisc-options" "mips-options" "pdp-11-options" "powerpc-options" "risc-v-options" "rl78-options" "rs_002f6000-and-powerpc-options" "rx-options" "s_002f390-and-zseries-options" "pru-options" "sh-options" "solaris-2-options" "sparc-options" "system-v-options" "v850-options" "vax-options" "x86-windows-options" "visium-options" "vms-options" "vxworks-options" "xstormy16-options" "zseries-options" "spec-files" "environment-variables" "x86-options" "xtensa-options" "precompiled-headers" "c_002b_002b-modules" "c_002b_002b-module-mapper" "c_002b_002b-module-preprocessing" "c_002b_002b-compiled-module-interface" "c-implementation" "translation-implementation" "environment-implementation" "identifiers-implementation" "characters-implementation" "integers-implementation" "floating-point-implementation" "arrays-and-pointers-implementation" "hints-implementation" "structures-unions-enumerations-and-bit-fields-implementation" "statements-implementation" "qualifiers-implementation" "declarators-implementation" "locale-specific-behavior-implementation" "library-functions-implementation" "preprocessing-directives-implementation" "c_002b_002b-implementation" "architecture-implementation" "exception-handling" "conditionally-supported-behavior" "statement-exprs" "local-labels" "labels-as-values" "nested-functions" "c-extensions" "nonlocal-gotos" "constructing-calls" "typeof" "conditionals" "_005f_005fint128" "long-long" "complex" "floating-types" "half-precision" "decimal-float" "hex-floats" "fixed-point" "named-address-spaces" "zero-length" "empty-structures" "variable-length" "variadic-macros" "escaped-newlines" "subscripting" "pointers-to-arrays" "pointer-arith" "compound-literals" "case-ranges" "variadic-pointer-args" "initializers" "designated-inits" "function-attributes" "cast-to-union" "mixed-labels-and-declarations" "aarch64-function-attributes" "amd-gcn-function-attributes" "arc-function-attributes" "arm-function-attributes" "avr-function-attributes" "blackfin-function-attributes" "bpf-function-attributes" "epiphany-function-attributes" "c-sky-function-attributes" "m32c-function-attributes" "ia-64-function-attributes" "m32r_002fd-function-attributes" "h8_002f300-function-attributes" "m68k-function-attributes" "mcore-function-attributes" "microblaze-function-attributes" "microsoft-windows-function-attributes" "msp430-function-attributes" "mips-function-attributes" "nds32-function-attributes" "nios-ii-function-attributes" "nvidia-ptx-function-attributes" "risc-v-function-attributes" "powerpc-function-attributes" "rl78-function-attributes" "rx-function-attributes" "s_002f390-function-attributes" "sh-function-attributes" "symbian-os-function-attributes" "v850-function-attributes" "visium-function-attributes" "x86-function-attributes" "common-function-attributes" "xstormy16-function-attributes" "variable-attributes" "common-variable-attributes" "arc-variable-attributes" "blackfin-variable-attributes" "h8_002f300-variable-attributes" "ia-64-variable-attributes" "loongarch-variable-attributes" "m32r_002fd-variable-attributes" "microsoft-windows-variable-attributes" "msp430-variable-attributes" "nvidia-ptx-variable-attributes" "powerpc-variable-attributes" "rl78-variable-attributes" "v850-variable-attributes" "xstormy16-variable-attributes" "common-type-attributes" "type-attributes" "arc-type-attributes" "bpf-type-attributes" "enumerator-attributes" "arm-type-attributes" "label-attributes" "statement-attributes" "attribute-syntax" "function-prototypes" "c_002b_002b-comments" "dollar-signs" "character-escapes" "alignment" "inline" "volatiles" "using-assembly-language-with-c" "basic-asm" "constraints" "simple-constraints" "multi-alternative" "modifiers" "asm-labels" "explicit-register-variables" "global-register-variables" "local-register-variables" "alternate-keywords" "size-of-an-asm" "incomplete-enums" "return-address" "_005f_005fatomic-builtins" "integer-overflow-builtins" "function-names" "vector-extensions" "offsetof" "_005f_005fsync-builtins" "x86-specific-memory-model-extensions-for-transactional-memory" "object-size-checking" "target-builtins" "extended-asm" "machine-constraints" "aarch64-built-in-functions" "alpha-built-in-functions" "altera-nios-ii-built-in-functions" "arc-built-in-functions" "arc-simd-built-in-functions" "arm-iwmmxt-built-in-functions" "arm-c-language-extensions-_0028acle_0029" "arm-floating-point-status-and-control-intrinsics" "arm-armv8-m-security-extensions" "avr-built-in-functions" "bpf-built-in-functions" "blackfin-built-in-functions" "fr-v-built-in-functions" "argument-types" "directly-mapped-integer-functions" "directly-mapped-media-functions" "raw-read_002fwrite-functions" "other-built-in-functions" "loongarch-base-built-in-functions" "mips-dsp-built-in-functions" "other-builtins" "mips-paired-single-support" "mips-loongson-built-in-functions" "paired-single-arithmetic" "paired-single-built-in-functions" "mips-3d-built-in-functions" "mips-simd-architecture-_0028msa_0029-support" "mips-simd-architecture-built-in-functions" "other-mips-built-in-functions" "msp430-built-in-functions" "nds32-built-in-functions" "basic-powerpc-built-in-functions" "basic-powerpc-built-in-functions-available-on-all-configurations" "basic-powerpc-built-in-functions-available-on-isa-2_002e05" "basic-powerpc-built-in-functions-available-on-isa-2_002e06" "basic-powerpc-built-in-functions-available-on-isa-2_002e07" "basic-powerpc-built-in-functions-available-on-isa-3_002e0" "basic-powerpc-built-in-functions-available-on-isa-3_002e1" "powerpc-altivec_002fvsx-built-in-functions" "powerpc-altivec-built-in-functions-on-isa-2_002e05" "powerpc-altivec-built-in-functions-available-on-isa-2_002e06" "powerpc-altivec-built-in-functions-available-on-isa-2_002e07" "powerpc-altivec-built-in-functions-available-on-isa-3_002e0" "powerpc-altivec-built-in-functions-available-on-isa-3_002e1" "powerpc-atomic-memory-operation-functions" "powerpc-matrix-multiply-assist-built-in-functions" "pru-built-in-functions" "risc-v-built-in-functions" "risc-v-vector-intrinsics" "rx-built-in-functions" "powerpc-hardware-transactional-memory-built-in-functions" "s_002f390-system-z-built-in-functions" "sh-built-in-functions" "sparc-vis-built-in-functions" "ti-c6x-built-in-functions" "x86-transactional-memory-intrinsics" "x86-control-flow-protection-intrinsics" "target-format-checks" "solaris-format-checks" "darwin-format-checks" "pragmas" "x86-built-in-functions" "aarch64-pragmas" "arm-pragmas" "m32c-pragmas" "pru-pragmas" "rs_002f6000-and-powerpc-pragmas" "s_002f390-pragmas" "darwin-pragmas" "solaris-pragmas" "symbol-renaming-pragmas" "structure-layout-pragmas" "weak-pragmas" "diagnostic-pragmas" "visibility-pragmas" "push_002fpop-macro-pragmas" "function-specific-option-pragmas" "loop-specific-pragmas" "unnamed-fields" "thread-local" "c99-thread-local-edits" "c_002b_002b98-thread-local-edits" "c_002b_002b-volatiles" "binary-constants" "c_002b_002b-extensions" "restricted-pointers" "vague-linkage" "c_002b_002b-interface" "template-instantiation" "bound-member-functions" "deprecated-features" "c_002b_002b-attributes" "function-multiversioning" "type-traits" "c_002b_002b-concepts" "backwards-compatibility" "objective-c" "gnu-objective-c-runtime-api" "modern-gnu-objective-c-runtime-api" "traditional-gnu-objective-c-runtime-api" "executing-code-before-main" "what-you-can-and-what-you-cannot-do-in-_002bload" "type-encoding" "garbage-collection" "_0040encode" "constant-string-objects" "exceptions" "legacy-type-encoding" "compatibility_005falias" "synchronization" "method-signatures" "messaging-with-the-gnu-objective-c-runtime" "using-fast-enumeration" "c99-like-fast-enumeration-syntax" "fast-enumeration-details" "fast-enumeration-protocol" "dynamically-registering-methods" "fast-enumeration" "forwarding-hook" "compatibility" "gcov" "gcov-intro" "invoking-gcov" "gcov-data-files" "cross-profiling" "freestanding-environments" "gcov-tool-intro" "gcov-tool" "invoking-gcov-tool" "gcov-dump" "gcov-dump-intro" "trouble" "lto-dump-intro" "invoking-gcov-dump" "lto-dump" "invoking-lto-dump" "actual-bugs" "interoperation" "standard-libraries" "incompatibilities" "fixed-headers" "disappointments" "c_002b_002b-misunderstandings" "static-definitions" "temporaries" "name-lookup" "warnings-and-errors" "copy-assignment" "non-bugs" "indices" "gcov-and-optimization"]) (entries . [((name . "1. Programming Languages Supported by GCC ¶") (path . "g_002b_002b-and-gcc") (type . "1. Programming Languages Supported by GCC")) ((name . "2. Language Standards Supported by GCC ¶") (path . "standards") (type . "2. Language Standards Supported by GCC")) ((name . "3. GCC Command Options ¶") (path . "invoking-gcc") (type . "3. GCC Command Options")) ((name . "3.1. Option Summary ¶") (path . "option-summary") (type . "3. GCC Command Options")) ((name . "3.2. Options Controlling the Kind of Output ¶") (path . "overall-options") (type . "3. GCC Command Options")) ((name . "3.3. Compiling C++ Programs ¶") (path . "invoking-g_002b_002b") (type . "3. GCC Command Options")) ((name . "3.4. Options Controlling C Dialect ¶") (path . "c-dialect-options") (type . "3. GCC Command Options")) ((name . "3.5. Options Controlling C++ Dialect ¶") (path . "c_002b_002b-dialect-options") (type . "3. GCC Command Options")) ((name . "3.6. Options Controlling Objective-C and Objective-C++ Dialects ¶") (path . "objective-c-and-objective-c_002b_002b-dialect-options") (type . "3. GCC Command Options")) ((name . "3.7. Options to Control Diagnostic Messages Formatting ¶") (path . "diagnostic-message-formatting-options") (type . "3. GCC Command Options")) ((name . "3.8. Options to Request or Suppress Warnings ¶") (path . "warning-options") (type . "3. GCC Command Options")) ((name . "3.9. Options That Control Static Analysis ¶") (path . "static-analyzer-options") (type . "3. GCC Command Options")) ((name . "3.10. Options for Debugging Your Program ¶") (path . "debugging-options") (type . "3. GCC Command Options")) ((name . "3.11. Options That Control Optimization ¶") (path . "optimize-options") (type . "3. GCC Command Options")) ((name . "3.12. Program Instrumentation Options ¶") (path . "instrumentation-options") (type . "3. GCC Command Options")) ((name . "3.13. Options Controlling the Preprocessor ¶") (path . "preprocessor-options") (type . "3. GCC Command Options")) ((name . "3.14. Passing Options to the Assembler ¶") (path . "assembler-options") (type . "3. GCC Command Options")) ((name . "3.15. Options for Linking ¶") (path . "link-options") (type . "3. GCC Command Options")) ((name . "3.16. Options for Directory Search ¶") (path . "directory-options") (type . "3. GCC Command Options")) ((name . "3.17. Options for Code Generation Conventions ¶") (path . "code-gen-options") (type . "3. GCC Command Options")) ((name . "3.18. GCC Developer Options ¶") (path . "developer-options") (type . "3. GCC Command Options")) ((name . "3.19. Machine-Dependent Options ¶") (path . "submodel-options") (type . "3. GCC Command Options")) ((name . "3.19.1. AArch64 Options ¶") (path . "aarch64-options") (type . "3. GCC Command Options")) ((name . "3.19.2. Adapteva Epiphany Options ¶") (path . "adapteva-epiphany-options") (type . "3. GCC Command Options")) ((name . "3.19.3. AMD GCN Options ¶") (path . "amd-gcn-options") (type . "3. GCC Command Options")) ((name . "3.19.4. ARC Options ¶") (path . "arc-options") (type . "3. GCC Command Options")) ((name . "3.19.5. ARM Options ¶") (path . "arm-options") (type . "3. GCC Command Options")) ((name . "3.19.6. AVR Options ¶") (path . "avr-options") (type . "3. GCC Command Options")) ((name . "3.19.7. Blackfin Options ¶") (path . "blackfin-options") (type . "3. GCC Command Options")) ((name . "3.19.8. C6X Options ¶") (path . "c6x-options") (type . "3. GCC Command Options")) ((name . "3.19.9. CRIS Options ¶") (path . "cris-options") (type . "3. GCC Command Options")) ((name . "3.19.10. C-SKY Options ¶") (path . "c-sky-options") (type . "3. GCC Command Options")) ((name . "3.19.11. Darwin Options ¶") (path . "darwin-options") (type . "3. GCC Command Options")) ((name . "3.19.12. DEC Alpha Options ¶") (path . "dec-alpha-options") (type . "3. GCC Command Options")) ((name . "3.19.13. eBPF Options ¶") (path . "ebpf-options") (type . "3. GCC Command Options")) ((name . "3.19.14. FR30 Options ¶") (path . "fr30-options") (type . "3. GCC Command Options")) ((name . "3.19.15. FT32 Options ¶") (path . "ft32-options") (type . "3. GCC Command Options")) ((name . "3.19.16. FRV Options ¶") (path . "frv-options") (type . "3. GCC Command Options")) ((name . "3.19.17. GNU/Linux Options ¶") (path . "gnu_002flinux-options") (type . "3. GCC Command Options")) ((name . "3.19.18. H8/300 Options ¶") (path . "h8_002f300-options") (type . "3. GCC Command Options")) ((name . "3.19.19. HPPA Options ¶") (path . "hppa-options") (type . "3. GCC Command Options")) ((name . "3.19.20. IA-64 Options ¶") (path . "ia-64-options") (type . "3. GCC Command Options")) ((name . "3.19.21. LM32 Options ¶") (path . "lm32-options") (type . "3. GCC Command Options")) ((name . "3.19.22. LoongArch Options ¶") (path . "loongarch-options") (type . "3. GCC Command Options")) ((name . "3.19.23. M32C Options ¶") (path . "m32c-options") (type . "3. GCC Command Options")) ((name . "3.19.24. M32R/D Options ¶") (path . "m32r_002fd-options") (type . "3. GCC Command Options")) ((name . "3.19.25. M680x0 Options ¶") (path . "m680x0-options") (type . "3. GCC Command Options")) ((name . "3.19.26. MCore Options ¶") (path . "mcore-options") (type . "3. GCC Command Options")) ((name . "3.19.27. MicroBlaze Options ¶") (path . "microblaze-options") (type . "3. GCC Command Options")) ((name . "3.19.28. MIPS Options ¶") (path . "mips-options") (type . "3. GCC Command Options")) ((name . "3.19.29. MMIX Options ¶") (path . "mmix-options") (type . "3. GCC Command Options")) ((name . "3.19.30. MN10300 Options ¶") (path . "mn10300-options") (type . "3. GCC Command Options")) ((name . "3.19.31. Moxie Options ¶") (path . "moxie-options") (type . "3. GCC Command Options")) ((name . "3.19.32. MSP430 Options ¶") (path . "msp430-options") (type . "3. GCC Command Options")) ((name . "3.19.33. NDS32 Options ¶") (path . "nds32-options") (type . "3. GCC Command Options")) ((name . "3.19.34. Nios II Options ¶") (path . "nios-ii-options") (type . "3. GCC Command Options")) ((name . "3.19.35. Nvidia PTX Options ¶") (path . "nvidia-ptx-options") (type . "3. GCC Command Options")) ((name . "3.19.36. OpenRISC Options ¶") (path . "openrisc-options") (type . "3. GCC Command Options")) ((name . "3.19.37. PDP-11 Options ¶") (path . "pdp-11-options") (type . "3. GCC Command Options")) ((name . "3.19.38. PowerPC Options ¶") (path . "powerpc-options") (type . "3. GCC Command Options")) ((name . "3.19.39. PRU Options ¶") (path . "pru-options") (type . "3. GCC Command Options")) ((name . "3.19.40. RISC-V Options ¶") (path . "risc-v-options") (type . "3. GCC Command Options")) ((name . "3.19.41. RL78 Options ¶") (path . "rl78-options") (type . "3. GCC Command Options")) ((name . "3.19.42. IBM RS/6000 and PowerPC Options ¶") (path . "rs_002f6000-and-powerpc-options") (type . "3. GCC Command Options")) ((name . "3.19.43. RX Options ¶") (path . "rx-options") (type . "3. GCC Command Options")) ((name . "3.19.44. S/390 and zSeries Options ¶") (path . "s_002f390-and-zseries-options") (type . "3. GCC Command Options")) ((name . "3.19.45. SH Options ¶") (path . "sh-options") (type . "3. GCC Command Options")) ((name . "3.19.46. Solaris 2 Options ¶") (path . "solaris-2-options") (type . "3. GCC Command Options")) ((name . "3.19.47. SPARC Options ¶") (path . "sparc-options") (type . "3. GCC Command Options")) ((name . "3.19.48. Options for System V ¶") (path . "system-v-options") (type . "3. GCC Command Options")) ((name . "3.19.49. V850 Options ¶") (path . "v850-options") (type . "3. GCC Command Options")) ((name . "3.19.50. VAX Options ¶") (path . "vax-options") (type . "3. GCC Command Options")) ((name . "3.19.51. Visium Options ¶") (path . "visium-options") (type . "3. GCC Command Options")) ((name . "3.19.52. VMS Options ¶") (path . "vms-options") (type . "3. GCC Command Options")) ((name . "3.19.53. VxWorks Options ¶") (path . "vxworks-options") (type . "3. GCC Command Options")) ((name . "3.19.54. x86 Options ¶") (path . "x86-options") (type . "3. GCC Command Options")) ((name . "3.19.55. x86 Windows Options ¶") (path . "x86-windows-options") (type . "3. GCC Command Options")) ((name . "3.19.56. Xstormy16 Options ¶") (path . "xstormy16-options") (type . "3. GCC Command Options")) ((name . "3.19.57. Xtensa Options ¶") (path . "xtensa-options") (type . "3. GCC Command Options")) ((name . "3.19.58. zSeries Options ¶") (path . "zseries-options") (type . "3. GCC Command Options")) ((name . "3.20. Specifying Subprocesses and the Switches to Pass to Them ¶") (path . "spec-files") (type . "3. GCC Command Options")) ((name . "3.21. Environment Variables Affecting GCC ¶") (path . "environment-variables") (type . "3. GCC Command Options")) ((name . "3.22. Using Precompiled Headers ¶") (path . "precompiled-headers") (type . "3. GCC Command Options")) ((name . "3.23. C++ Modules ¶") (path . "c_002b_002b-modules") (type . "3. GCC Command Options")) ((name . "3.23.1. Module Mapper ¶") (path . "c_002b_002b-module-mapper") (type . "3. GCC Command Options")) ((name . "3.23.2. Module Preprocessing ¶") (path . "c_002b_002b-module-preprocessing") (type . "3. GCC Command Options")) ((name . "3.23.3. Compiled Module Interface ¶") (path . "c_002b_002b-compiled-module-interface") (type . "3. GCC Command Options")) ((name . "4. C Implementation-Defined Behavior ¶") (path . "c-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.1. Translation ¶") (path . "translation-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.2. Environment ¶") (path . "environment-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.3. Identifiers ¶") (path . "identifiers-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.4. Characters ¶") (path . "characters-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.5. Integers ¶") (path . "integers-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.6. Floating Point ¶") (path . "floating-point-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.7. Arrays and Pointers ¶") (path . "arrays-and-pointers-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.8. Hints ¶") (path . "hints-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.9. Structures, Unions, Enumerations, and Bit-Fields ¶") (path . "structures-unions-enumerations-and-bit-fields-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.10. Qualifiers ¶") (path . "qualifiers-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.11. Declarators ¶") (path . "declarators-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.12. Statements ¶") (path . "statements-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.13. Preprocessing Directives ¶") (path . "preprocessing-directives-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.14. Library Functions ¶") (path . "library-functions-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.15. Architecture ¶") (path . "architecture-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "4.16. Locale-Specific Behavior ¶") (path . "locale-specific-behavior-implementation") (type . "4. C Implementation-Defined Behavior")) ((name . "5. C++ Implementation-Defined Behavior ¶") (path . "c_002b_002b-implementation") (type . "5. C++ Implementation-Defined Behavior")) ((name . "5.1. Conditionally-Supported Behavior ¶") (path . "conditionally-supported-behavior") (type . "5. C++ Implementation-Defined Behavior")) ((name . "5.2. Exception Handling ¶") (path . "exception-handling") (type . "5. C++ Implementation-Defined Behavior")) ((name . "6. Extensions to the C Language Family ¶") (path . "c-extensions") (type . "6. Extensions to the C Language Family")) ((name . "6.1. Statements and Declarations in Expressions ¶") (path . "statement-exprs") (type . "6. Extensions to the C Language Family")) ((name . "6.2. Locally Declared Labels ¶") (path . "local-labels") (type . "6. Extensions to the C Language Family")) ((name . "6.3. Labels as Values ¶") (path . "labels-as-values") (type . "6. Extensions to the C Language Family")) ((name . "6.4. Nested Functions ¶") (path . "nested-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.5. Nonlocal Gotos ¶") (path . "nonlocal-gotos") (type . "6. Extensions to the C Language Family")) ((name . "6.6. Constructing Function Calls ¶") (path . "constructing-calls") (type . "6. Extensions to the C Language Family")) ((name . "6.7. Referring to a Type with typeof ¶") (path . "typeof") (type . "6. Extensions to the C Language Family")) ((name . "6.8. Conditionals with Omitted Operands ¶") (path . "conditionals") (type . "6. Extensions to the C Language Family")) ((name . "6.9. 128-bit Integers ¶") (path . "_005f_005fint128") (type . "6. Extensions to the C Language Family")) ((name . "6.10. Double-Word Integers ¶") (path . "long-long") (type . "6. Extensions to the C Language Family")) ((name . "6.11. Complex Numbers ¶") (path . "complex") (type . "6. Extensions to the C Language Family")) ((name . "6.12. Additional Floating Types ¶") (path . "floating-types") (type . "6. Extensions to the C Language Family")) ((name . "6.13. Half-Precision Floating Point ¶") (path . "half-precision") (type . "6. Extensions to the C Language Family")) ((name . "6.14. Decimal Floating Types ¶") (path . "decimal-float") (type . "6. Extensions to the C Language Family")) ((name . "6.15. Hex Floats ¶") (path . "hex-floats") (type . "6. Extensions to the C Language Family")) ((name . "6.16. Fixed-Point Types ¶") (path . "fixed-point") (type . "6. Extensions to the C Language Family")) ((name . "6.17. Named Address Spaces ¶") (path . "named-address-spaces") (type . "6. Extensions to the C Language Family")) ((name . "6.18. Arrays of Length Zero ¶") (path . "zero-length") (type . "6. Extensions to the C Language Family")) ((name . "6.19. Structures with No Members ¶") (path . "empty-structures") (type . "6. Extensions to the C Language Family")) ((name . "6.20. Arrays of Variable Length ¶") (path . "variable-length") (type . "6. Extensions to the C Language Family")) ((name . "6.21. Macros with a Variable Number of Arguments. ¶") (path . "variadic-macros") (type . "6. Extensions to the C Language Family")) ((name . "6.22. Slightly Looser Rules for Escaped Newlines ¶") (path . "escaped-newlines") (type . "6. Extensions to the C Language Family")) ((name . "6.23. Non-Lvalue Arrays May Have Subscripts ¶") (path . "subscripting") (type . "6. Extensions to the C Language Family")) ((name . "6.24. Arithmetic on void- and Function-Pointers ¶") (path . "pointer-arith") (type . "6. Extensions to the C Language Family")) ((name . "6.25. Pointer Arguments in Variadic Functions ¶") (path . "variadic-pointer-args") (type . "6. Extensions to the C Language Family")) ((name . "6.26. Pointers to Arrays with Qualifiers Work as Expected ¶") (path . "pointers-to-arrays") (type . "6. Extensions to the C Language Family")) ((name . "6.27. Non-Constant Initializers ¶") (path . "initializers") (type . "6. Extensions to the C Language Family")) ((name . "6.28. Compound Literals ¶") (path . "compound-literals") (type . "6. Extensions to the C Language Family")) ((name . "6.29. Designated Initializers ¶") (path . "designated-inits") (type . "6. Extensions to the C Language Family")) ((name . "6.30. Case Ranges ¶") (path . "case-ranges") (type . "6. Extensions to the C Language Family")) ((name . "6.31. Cast to a Union Type ¶") (path . "cast-to-union") (type . "6. Extensions to the C Language Family")) ((name . "6.32. Mixed Declarations, Labels and Code ¶") (path . "mixed-labels-and-declarations") (type . "6. Extensions to the C Language Family")) ((name . "6.33. Declaring Attributes of Functions ¶") (path . "function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.1. Common Function Attributes ¶") (path . "common-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.2. AArch64 Function Attributes ¶") (path . "aarch64-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.3. AMD GCN Function Attributes ¶") (path . "amd-gcn-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.4. ARC Function Attributes ¶") (path . "arc-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.5. ARM Function Attributes ¶") (path . "arm-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.6. AVR Function Attributes ¶") (path . "avr-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.7. Blackfin Function Attributes ¶") (path . "blackfin-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.8. BPF Function Attributes ¶") (path . "bpf-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.9. C-SKY Function Attributes ¶") (path . "c-sky-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.10. Epiphany Function Attributes ¶") (path . "epiphany-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.11. H8/300 Function Attributes ¶") (path . "h8_002f300-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.12. IA-64 Function Attributes ¶") (path . "ia-64-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.13. M32C Function Attributes ¶") (path . "m32c-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.14. M32R/D Function Attributes ¶") (path . "m32r_002fd-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.15. m68k Function Attributes ¶") (path . "m68k-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.16. MCORE Function Attributes ¶") (path . "mcore-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.17. MicroBlaze Function Attributes ¶") (path . "microblaze-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.18. Microsoft Windows Function Attributes ¶") (path . "microsoft-windows-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.19. MIPS Function Attributes ¶") (path . "mips-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.20. MSP430 Function Attributes ¶") (path . "msp430-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.21. NDS32 Function Attributes ¶") (path . "nds32-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.22. Nios II Function Attributes ¶") (path . "nios-ii-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.23. Nvidia PTX Function Attributes ¶") (path . "nvidia-ptx-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.24. PowerPC Function Attributes ¶") (path . "powerpc-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.25. RISC-V Function Attributes ¶") (path . "risc-v-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.26. RL78 Function Attributes ¶") (path . "rl78-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.27. RX Function Attributes ¶") (path . "rx-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.28. S/390 Function Attributes ¶") (path . "s_002f390-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.29. SH Function Attributes ¶") (path . "sh-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.30. Symbian OS Function Attributes ¶") (path . "symbian-os-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.31. V850 Function Attributes ¶") (path . "v850-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.32. Visium Function Attributes ¶") (path . "visium-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.33. x86 Function Attributes ¶") (path . "x86-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.33.34. Xstormy16 Function Attributes ¶") (path . "xstormy16-function-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34. Specifying Attributes of Variables ¶") (path . "variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.1. Common Variable Attributes ¶") (path . "common-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.2. ARC Variable Attributes ¶") (path . "arc-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.4. Blackfin Variable Attributes ¶") (path . "blackfin-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.5. H8/300 Variable Attributes ¶") (path . "h8_002f300-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.6. IA-64 Variable Attributes ¶") (path . "ia-64-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.7. LoongArch Variable Attributes ¶") (path . "loongarch-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.8. M32R/D Variable Attributes ¶") (path . "m32r_002fd-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.9. Microsoft Windows Variable Attributes ¶") (path . "microsoft-windows-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.10. MSP430 Variable Attributes ¶") (path . "msp430-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.11. Nvidia PTX Variable Attributes ¶") (path . "nvidia-ptx-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.12. PowerPC Variable Attributes ¶") (path . "powerpc-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.13. RL78 Variable Attributes ¶") (path . "rl78-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.14. V850 Variable Attributes ¶") (path . "v850-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.34.16. Xstormy16 Variable Attributes ¶") (path . "xstormy16-variable-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.35. Specifying Attributes of Types ¶") (path . "type-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.35.1. Common Type Attributes ¶") (path . "common-type-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.35.2. ARC Type Attributes ¶") (path . "arc-type-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.35.3. ARM Type Attributes ¶") (path . "arm-type-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.35.4. BPF Type Attributes ¶") (path . "bpf-type-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.36. Label Attributes ¶") (path . "label-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.37. Enumerator Attributes ¶") (path . "enumerator-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.38. Statement Attributes ¶") (path . "statement-attributes") (type . "6. Extensions to the C Language Family")) ((name . "6.39. Attribute Syntax ¶") (path . "attribute-syntax") (type . "6. Extensions to the C Language Family")) ((name . "6.40. Prototypes and Old-Style Function Definitions ¶") (path . "function-prototypes") (type . "6. Extensions to the C Language Family")) ((name . "6.41. C++ Style Comments ¶") (path . "c_002b_002b-comments") (type . "6. Extensions to the C Language Family")) ((name . "6.42. Dollar Signs in Identifier Names ¶") (path . "dollar-signs") (type . "6. Extensions to the C Language Family")) ((name . "6.43. The Character ESC in Constants ¶") (path . "character-escapes") (type . "6. Extensions to the C Language Family")) ((name . "6.44. Determining the Alignment of Functions, Types or Variables ¶") (path . "alignment") (type . "6. Extensions to the C Language Family")) ((name . "6.45. An Inline Function is As Fast As a Macro ¶") (path . "inline") (type . "6. Extensions to the C Language Family")) ((name . "6.46. When is a Volatile Object Accessed? ¶") (path . "volatiles") (type . "6. Extensions to the C Language Family")) ((name . "6.47. How to Use Inline Assembly Language in C Code ¶") (path . "using-assembly-language-with-c") (type . "6. Extensions to the C Language Family")) ((name . "6.47.1. Basic Asm") (path . "basic-asm") (type . "6. Extensions to the C Language Family")) ((name . "6.47.2. Extended Asm - Assembler Instructions with C Expression Operands ¶") (path . "extended-asm") (type . "6. Extensions to the C Language Family")) ((name . "6.47.3. Constraints for asm Operands ¶") (path . "constraints") (type . "6. Extensions to the C Language Family")) ((name . "6.47.3.1. Simple Constraints ¶") (path . "simple-constraints") (type . "6. Extensions to the C Language Family")) ((name . "6.47.3.2. Multiple Alternative Constraints ¶") (path . "multi-alternative") (type . "6. Extensions to the C Language Family")) ((name . "6.47.3.3. Constraint Modifier Characters ¶") (path . "modifiers") (type . "6. Extensions to the C Language Family")) ((name . "6.47.3.4. Constraints for Particular Machines ¶") (path . "machine-constraints") (type . "6. Extensions to the C Language Family")) ((name . "6.47.4. Controlling Names Used in Assembler Code ¶") (path . "asm-labels") (type . "6. Extensions to the C Language Family")) ((name . "6.47.5. Variables in Specified Registers ¶") (path . "explicit-register-variables") (type . "6. Extensions to the C Language Family")) ((name . "6.47.5.1. Defining Global Register Variables ¶") (path . "global-register-variables") (type . "6. Extensions to the C Language Family")) ((name . "6.47.5.2. Specifying Registers for Local Variables ¶") (path . "local-register-variables") (type . "6. Extensions to the C Language Family")) ((name . "6.47.6. Size of an asm ¶") (path . "size-of-an-asm") (type . "6. Extensions to the C Language Family")) ((name . "6.48. Alternate Keywords ¶") (path . "alternate-keywords") (type . "6. Extensions to the C Language Family")) ((name . "6.49. Incomplete enum Types ¶") (path . "incomplete-enums") (type . "6. Extensions to the C Language Family")) ((name . "6.50. Function Names as Strings ¶") (path . "function-names") (type . "6. Extensions to the C Language Family")) ((name . "6.51. Getting the Return or Frame Address of a Function ¶") (path . "return-address") (type . "6. Extensions to the C Language Family")) ((name . "6.52. Using Vector Instructions through Built-in Functions ¶") (path . "vector-extensions") (type . "6. Extensions to the C Language Family")) ((name . "6.53. Support for offsetof ¶") (path . "offsetof") (type . "6. Extensions to the C Language Family")) ((name . "6.54. Legacy __sync Built-in Functions for Atomic Memory Access ¶") (path . "_005f_005fsync-builtins") (type . "6. Extensions to the C Language Family")) ((name . "6.55. Built-in Functions for Memory Model Aware Atomic Operations ¶") (path . "_005f_005fatomic-builtins") (type . "6. Extensions to the C Language Family")) ((name . "6.56. Built-in Functions to Perform Arithmetic with Overflow Checking ¶") (path . "integer-overflow-builtins") (type . "6. Extensions to the C Language Family")) ((name . "6.57. x86-Specific Memory Model Extensions for Transactional Memory ¶") (path . "x86-specific-memory-model-extensions-for-transactional-memory") (type . "6. Extensions to the C Language Family")) ((name . "6.58. Object Size Checking ¶") (path . "object-size-checking") (type . "6. Extensions to the C Language Family")) ((name . "6.59. Other Built-in Functions Provided by GCC ¶") (path . "other-builtins") (type . "6. Extensions to the C Language Family")) ((name . "6.60. Built-in Functions Specific to Particular Target Machines ¶") (path . "target-builtins") (type . "6. Extensions to the C Language Family")) ((name . "6.60.1. AArch64 Built-in Functions ¶") (path . "aarch64-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.2. Alpha Built-in Functions ¶") (path . "alpha-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.3. Altera Nios II Built-in Functions ¶") (path . "altera-nios-ii-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.4. ARC Built-in Functions ¶") (path . "arc-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.5. ARC SIMD Built-in Functions ¶") (path . "arc-simd-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.6. ARM iWMMXt Built-in Functions ¶") (path . "arm-iwmmxt-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.7. ARM C Language Extensions (ACLE) ¶") (path . "arm-c-language-extensions-_0028acle_0029") (type . "6. Extensions to the C Language Family")) ((name . "6.60.8. ARM Floating Point Status and Control Intrinsics ¶") (path . "arm-floating-point-status-and-control-intrinsics") (type . "6. Extensions to the C Language Family")) ((name . "6.60.9. ARM ARMv8-M Security Extensions ¶") (path . "arm-armv8-m-security-extensions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.10. AVR Built-in Functions ¶") (path . "avr-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.11. Blackfin Built-in Functions ¶") (path . "blackfin-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.12. BPF Built-in Functions ¶") (path . "bpf-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.13. FR-V Built-in Functions ¶") (path . "fr-v-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.13.1. Argument Types ¶") (path . "argument-types") (type . "6. Extensions to the C Language Family")) ((name . "6.60.13.2. Directly-Mapped Integer Functions ¶") (path . "directly-mapped-integer-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.13.3. Directly-Mapped Media Functions ¶") (path . "directly-mapped-media-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.13.4. Raw Read/Write Functions ¶") (path . "raw-read_002fwrite-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.13.5. Other Built-in Functions ¶") (path . "other-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.14. LoongArch Base Built-in Functions ¶") (path . "loongarch-base-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.15. MIPS DSP Built-in Functions ¶") (path . "mips-dsp-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.16. MIPS Paired-Single Support ¶") (path . "mips-paired-single-support") (type . "6. Extensions to the C Language Family")) ((name . "6.60.17. MIPS Loongson Built-in Functions ¶") (path . "mips-loongson-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.17.1. Paired-Single Arithmetic ¶") (path . "paired-single-arithmetic") (type . "6. Extensions to the C Language Family")) ((name . "6.60.17.2. Paired-Single Built-in Functions ¶") (path . "paired-single-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.17.3. MIPS-3D Built-in Functions ¶") (path . "mips-3d-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.18. MIPS SIMD Architecture (MSA) Support ¶") (path . "mips-simd-architecture-_0028msa_0029-support") (type . "6. Extensions to the C Language Family")) ((name . "6.60.18.1. MIPS SIMD Architecture Built-in Functions ¶") (path . "mips-simd-architecture-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.19. Other MIPS Built-in Functions ¶") (path . "other-mips-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.20. MSP430 Built-in Functions ¶") (path . "msp430-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.21. NDS32 Built-in Functions ¶") (path . "nds32-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.22. Basic PowerPC Built-in Functions ¶") (path . "basic-powerpc-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.22.1. Basic PowerPC Built-in Functions Available on all Configurations ¶") (path . "basic-powerpc-built-in-functions-available-on-all-configurations") (type . "6. Extensions to the C Language Family")) ((name . "6.60.22.2. Basic PowerPC Built-in Functions Available on ISA 2.05 ¶") (path . "basic-powerpc-built-in-functions-available-on-isa-2_002e05") (type . "6. Extensions to the C Language Family")) ((name . "6.60.22.3. Basic PowerPC Built-in Functions Available on ISA 2.06 ¶") (path . "basic-powerpc-built-in-functions-available-on-isa-2_002e06") (type . "6. Extensions to the C Language Family")) ((name . "6.60.22.4. Basic PowerPC Built-in Functions Available on ISA 2.07 ¶") (path . "basic-powerpc-built-in-functions-available-on-isa-2_002e07") (type . "6. Extensions to the C Language Family")) ((name . "6.60.22.5. Basic PowerPC Built-in Functions Available on ISA 3.0 ¶") (path . "basic-powerpc-built-in-functions-available-on-isa-3_002e0") (type . "6. Extensions to the C Language Family")) ((name . "6.60.22.6. Basic PowerPC Built-in Functions Available on ISA 3.1 ¶") (path . "basic-powerpc-built-in-functions-available-on-isa-3_002e1") (type . "6. Extensions to the C Language Family")) ((name . "6.60.23. PowerPC AltiVec/VSX Built-in Functions ¶") (path . "powerpc-altivec_002fvsx-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.23.1. PowerPC AltiVec Built-in Functions on ISA 2.05 ¶") (path . "powerpc-altivec-built-in-functions-on-isa-2_002e05") (type . "6. Extensions to the C Language Family")) ((name . "6.60.23.2. PowerPC AltiVec Built-in Functions Available on ISA 2.06 ¶") (path . "powerpc-altivec-built-in-functions-available-on-isa-2_002e06") (type . "6. Extensions to the C Language Family")) ((name . "6.60.23.3. PowerPC AltiVec Built-in Functions Available on ISA 2.07 ¶") (path . "powerpc-altivec-built-in-functions-available-on-isa-2_002e07") (type . "6. Extensions to the C Language Family")) ((name . "6.60.23.4. PowerPC AltiVec Built-in Functions Available on ISA 3.0 ¶") (path . "powerpc-altivec-built-in-functions-available-on-isa-3_002e0") (type . "6. Extensions to the C Language Family")) ((name . "6.60.23.5. PowerPC AltiVec Built-in Functions Available on ISA 3.1 ¶") (path . "powerpc-altivec-built-in-functions-available-on-isa-3_002e1") (type . "6. Extensions to the C Language Family")) ((name . "6.60.24. PowerPC Hardware Transactional Memory Built-in Functions ¶") (path . "powerpc-hardware-transactional-memory-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.25. PowerPC Atomic Memory Operation Functions ¶") (path . "powerpc-atomic-memory-operation-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.26. PowerPC Matrix-Multiply Assist Built-in Functions ¶") (path . "powerpc-matrix-multiply-assist-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.27. PRU Built-in Functions ¶") (path . "pru-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.28. RISC-V Built-in Functions ¶") (path . "risc-v-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.29. RISC-V Vector Intrinsics ¶") (path . "risc-v-vector-intrinsics") (type . "6. Extensions to the C Language Family")) ((name . "6.60.30. RX Built-in Functions ¶") (path . "rx-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.31. S/390 System z Built-in Functions ¶") (path . "s_002f390-system-z-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.32. SH Built-in Functions ¶") (path . "sh-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.33. SPARC VIS Built-in Functions ¶") (path . "sparc-vis-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.34. TI C6X Built-in Functions ¶") (path . "ti-c6x-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.35. x86 Built-in Functions ¶") (path . "x86-built-in-functions") (type . "6. Extensions to the C Language Family")) ((name . "6.60.36. x86 Transactional Memory Intrinsics ¶") (path . "x86-transactional-memory-intrinsics") (type . "6. Extensions to the C Language Family")) ((name . "6.60.37. x86 Control-Flow Protection Intrinsics ¶") (path . "x86-control-flow-protection-intrinsics") (type . "6. Extensions to the C Language Family")) ((name . "6.61. Format Checks Specific to Particular Target Machines ¶") (path . "target-format-checks") (type . "6. Extensions to the C Language Family")) ((name . "6.61.1. Solaris Format Checks ¶") (path . "solaris-format-checks") (type . "6. Extensions to the C Language Family")) ((name . "6.61.2. Darwin Format Checks ¶") (path . "darwin-format-checks") (type . "6. Extensions to the C Language Family")) ((name . "6.62. Pragmas Accepted by GCC ¶") (path . "pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.1. AArch64 Pragmas ¶") (path . "aarch64-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.2. ARM Pragmas ¶") (path . "arm-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.3. M32C Pragmas ¶") (path . "m32c-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.4. PRU Pragmas ¶") (path . "pru-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.5. RS/6000 and PowerPC Pragmas ¶") (path . "rs_002f6000-and-powerpc-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.6. S/390 Pragmas ¶") (path . "s_002f390-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.7. Darwin Pragmas ¶") (path . "darwin-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.8. Solaris Pragmas ¶") (path . "solaris-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.9. Symbol-Renaming Pragmas ¶") (path . "symbol-renaming-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.10. Structure-Layout Pragmas ¶") (path . "structure-layout-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.11. Weak Pragmas ¶") (path . "weak-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.12. Diagnostic Pragmas ¶") (path . "diagnostic-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.13. Visibility Pragmas ¶") (path . "visibility-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.14. Push/Pop Macro Pragmas ¶") (path . "push_002fpop-macro-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.15. Function Specific Option Pragmas ¶") (path . "function-specific-option-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.62.16. Loop-Specific Pragmas ¶") (path . "loop-specific-pragmas") (type . "6. Extensions to the C Language Family")) ((name . "6.63. Unnamed Structure and Union Fields ¶") (path . "unnamed-fields") (type . "6. Extensions to the C Language Family")) ((name . "6.64. Thread-Local Storage ¶") (path . "thread-local") (type . "6. Extensions to the C Language Family")) ((name . "6.64.1. ISO/IEC 9899:1999 Edits for Thread-Local Storage ¶") (path . "c99-thread-local-edits") (type . "6. Extensions to the C Language Family")) ((name . "6.64.2. ISO/IEC 14882:1998 Edits for Thread-Local Storage ¶") (path . "c_002b_002b98-thread-local-edits") (type . "6. Extensions to the C Language Family")) ((name . "6.65. Binary Constants using the ‘0b’ Prefix ¶") (path . "binary-constants") (type . "6. Extensions to the C Language Family")) ((name . "7. Extensions to the C++ Language ¶") (path . "c_002b_002b-extensions") (type . "7. Extensions to the C++ Language")) ((name . "7.1. When is a Volatile C++ Object Accessed? ¶") (path . "c_002b_002b-volatiles") (type . "7. Extensions to the C++ Language")) ((name . "7.2. Restricting Pointer Aliasing ¶") (path . "restricted-pointers") (type . "7. Extensions to the C++ Language")) ((name . "7.3. Vague Linkage ¶") (path . "vague-linkage") (type . "7. Extensions to the C++ Language")) ((name . "7.4. C++ Interface and Implementation Pragmas ¶") (path . "c_002b_002b-interface") (type . "7. Extensions to the C++ Language")) ((name . "7.5. Where’s the Template? ¶") (path . "template-instantiation") (type . "7. Extensions to the C++ Language")) ((name . "7.6. Extracting the Function Pointer from a Bound Pointer to Member Function ¶") (path . "bound-member-functions") (type . "7. Extensions to the C++ Language")) ((name . "7.7. C++-Specific Variable, Function, and Type Attributes ¶") (path . "c_002b_002b-attributes") (type . "7. Extensions to the C++ Language")) ((name . "7.8. Function Multiversioning ¶") (path . "function-multiversioning") (type . "7. Extensions to the C++ Language")) ((name . "7.9. Type Traits ¶") (path . "type-traits") (type . "7. Extensions to the C++ Language")) ((name . "7.10. C++ Concepts ¶") (path . "c_002b_002b-concepts") (type . "7. Extensions to the C++ Language")) ((name . "7.11. Deprecated Features ¶") (path . "deprecated-features") (type . "7. Extensions to the C++ Language")) ((name . "7.12. Backwards Compatibility ¶") (path . "backwards-compatibility") (type . "7. Extensions to the C++ Language")) ((name . "8. GNU Objective-C Features ¶") (path . "objective-c") (type . "8. GNU Objective-C Features")) ((name . "8.1. GNU Objective-C Runtime API ¶") (path . "gnu-objective-c-runtime-api") (type . "8. GNU Objective-C Features")) ((name . "8.1.1. Modern GNU Objective-C Runtime API ¶") (path . "modern-gnu-objective-c-runtime-api") (type . "8. GNU Objective-C Features")) ((name . "8.1.2. Traditional GNU Objective-C Runtime API ¶") (path . "traditional-gnu-objective-c-runtime-api") (type . "8. GNU Objective-C Features")) ((name . "8.2. +load: Executing Code before main ¶") (path . "executing-code-before-main") (type . "8. GNU Objective-C Features")) ((name . "8.2.1. What You Can and Cannot Do in +load ¶") (path . "what-you-can-and-what-you-cannot-do-in-_002bload") (type . "8. GNU Objective-C Features")) ((name . "8.3. Type Encoding ¶") (path . "type-encoding") (type . "8. GNU Objective-C Features")) ((name . "8.3.1. Legacy Type Encoding ¶") (path . "legacy-type-encoding") (type . "8. GNU Objective-C Features")) ((name . "8.3.2. @encode ¶") (path . "_0040encode") (type . "8. GNU Objective-C Features")) ((name . "8.3.3. Method Signatures ¶") (path . "method-signatures") (type . "8. GNU Objective-C Features")) ((name . "8.4. Garbage Collection ¶") (path . "garbage-collection") (type . "8. GNU Objective-C Features")) ((name . "8.5. Constant String Objects ¶") (path . "constant-string-objects") (type . "8. GNU Objective-C Features")) ((name . "8.6. compatibility_alias ¶") (path . "compatibility_005falias") (type . "8. GNU Objective-C Features")) ((name . "8.7. Exceptions ¶") (path . "exceptions") (type . "8. GNU Objective-C Features")) ((name . "8.8. Synchronization ¶") (path . "synchronization") (type . "8. GNU Objective-C Features")) ((name . "8.9. Fast Enumeration ¶") (path . "fast-enumeration") (type . "8. GNU Objective-C Features")) ((name . "8.9.1. Using Fast Enumeration ¶") (path . "using-fast-enumeration") (type . "8. GNU Objective-C Features")) ((name . "8.9.2. C99-Like Fast Enumeration Syntax ¶") (path . "c99-like-fast-enumeration-syntax") (type . "8. GNU Objective-C Features")) ((name . "8.9.3. Fast Enumeration Details ¶") (path . "fast-enumeration-details") (type . "8. GNU Objective-C Features")) ((name . "8.9.4. Fast Enumeration Protocol ¶") (path . "fast-enumeration-protocol") (type . "8. GNU Objective-C Features")) ((name . "8.10. Messaging with the GNU Objective-C Runtime ¶") (path . "messaging-with-the-gnu-objective-c-runtime") (type . "8. GNU Objective-C Features")) ((name . "8.10.1. Dynamically Registering Methods ¶") (path . "dynamically-registering-methods") (type . "8. GNU Objective-C Features")) ((name . "8.10.2. Forwarding Hook ¶") (path . "forwarding-hook") (type . "8. GNU Objective-C Features")) ((name . "9. Binary Compatibility ¶") (path . "compatibility") (type . "9. Binary Compatibility")) ((name . "10. gcov") (path . "gcov") (type . "10. gcov")) ((name . "10.1. Introduction to gcov ¶") (path . "gcov-intro") (type . "10. gcov")) ((name . "10.2. Invoking gcov ¶") (path . "invoking-gcov") (type . "10. gcov")) ((name . "10.3. Using gcov with GCC Optimization ¶") (path . "gcov-and-optimization") (type . "10. gcov")) ((name . "10.4. Brief Description of gcov Data Files ¶") (path . "gcov-data-files") (type . "10. gcov")) ((name . "10.5. Data File Relocation to Support Cross-Profiling ¶") (path . "cross-profiling") (type . "10. gcov")) ((name . "10.6. Profiling and Test Coverage in Freestanding Environments ¶") (path . "freestanding-environments") (type . "10. gcov")) ((name . "11. gcov-tool") (path . "gcov-tool") (type . "11. gcov-tool")) ((name . "11.1. Introduction to gcov-tool ¶") (path . "gcov-tool-intro") (type . "11. gcov-tool")) ((name . "11.2. Invoking gcov-tool ¶") (path . "invoking-gcov-tool") (type . "11. gcov-tool")) ((name . "12. gcov-dump") (path . "gcov-dump") (type . "12. gcov-dump")) ((name . "12.1. Introduction to gcov-dump ¶") (path . "gcov-dump-intro") (type . "12. gcov-dump")) ((name . "12.2. Invoking gcov-dump ¶") (path . "invoking-gcov-dump") (type . "12. gcov-dump")) ((name . "13. lto-dump") (path . "lto-dump") (type . "13. lto-dump")) ((name . "13.1. Introduction to lto-dump ¶") (path . "lto-dump-intro") (type . "13. lto-dump")) ((name . "13.2. Invoking lto-dump ¶") (path . "invoking-lto-dump") (type . "13. lto-dump")) ((name . "14. Known Causes of Trouble with GCC ¶") (path . "trouble") (type . "14. Known Causes of Trouble")) ((name . "14.1. Actual Bugs We Haven’t Fixed Yet ¶") (path . "actual-bugs") (type . "14. Known Causes of Trouble")) ((name . "14.2. Interoperation ¶") (path . "interoperation") (type . "14. Known Causes of Trouble")) ((name . "14.3. Incompatibilities of GCC ¶") (path . "incompatibilities") (type . "14. Known Causes of Trouble")) ((name . "14.4. Fixed Header Files ¶") (path . "fixed-headers") (type . "14. Known Causes of Trouble")) ((name . "14.5. Standard Libraries ¶") (path . "standard-libraries") (type . "14. Known Causes of Trouble")) ((name . "14.6. Disappointments and Misunderstandings ¶") (path . "disappointments") (type . "14. Known Causes of Trouble")) ((name . "14.7. Common Misunderstandings with GNU C++ ¶") (path . "c_002b_002b-misunderstandings") (type . "14. Known Causes of Trouble")) ((name . "14.7.1. Declare and Define Static Members ¶") (path . "static-definitions") (type . "14. Known Causes of Trouble")) ((name . "14.7.2. Name Lookup, Templates, and Accessing Members of Base Classes ¶") (path . "name-lookup") (type . "14. Known Causes of Trouble")) ((name . "14.7.3. Temporaries May Vanish Before You Expect ¶") (path . "temporaries") (type . "14. Known Causes of Trouble")) ((name . "14.7.4. Implicit Copy-Assignment for Virtual Bases ¶") (path . "copy-assignment") (type . "14. Known Causes of Trouble")) ((name . "14.8. Certain Changes We Don’t Want to Make ¶") (path . "non-bugs") (type . "14. Known Causes of Trouble")) ((name . "14.9. Warning Messages and Error Messages ¶") (path . "warnings-and-errors") (type . "14. Known Causes of Trouble")) ((name . "Appendix A Indices ¶") (path . "indices") (type . "1. Programming Languages Supported by GCC"))]) (types . [((name . "1. Programming Languages Supported by GCC") (count . 2) (slug . "1-programming-languages-supported-by-gcc")) ((name . "2. Language Standards Supported by GCC") (count . 1) (slug . "2-language-standards-supported-by-gcc")) ((name . "3. GCC Command Options") (count . 85) (slug . "3-gcc-command-options")) ((name . "4. C Implementation-Defined Behavior") (count . 17) (slug . "4-c-implementation-defined-behavior")) ((name . "5. C++ Implementation-Defined Behavior") (count . 3) (slug . "5-c-implementation-defined-behavior")) ((name . "6. Extensions to the C Language Family") (count . 207) (slug . "6-extensions-to-the-c-language-family")) ((name . "7. Extensions to the C++ Language") (count . 13) (slug . "7-extensions-to-the-c-language")) ((name . "8. GNU Objective-C Features") (count . 23) (slug . "8-gnu-objective-c-features")) ((name . "9. Binary Compatibility") (count . 1) (slug . "9-binary-compatibility")) ((name . "10. gcov") (count . 7) (slug . "10-gcov")) ((name . "11. gcov-tool") (count . 3) (slug . "11-gcov-tool")) ((name . "12. gcov-dump") (count . 3) (slug . "12-gcov-dump")) ((name . "13. lto-dump") (count . 3) (slug . "13-lto-dump")) ((name . "14. Known Causes of Trouble") (count . 14) (slug . "14-known-causes-of-trouble"))]))
\ No newline at end of file diff --git a/devdocs/gcc~13/index.html b/devdocs/gcc~13/index.html new file mode 100644 index 00000000..4118f1ac --- /dev/null +++ b/devdocs/gcc~13/index.html @@ -0,0 +1,102 @@ +<p>This file documents the use of the GNU compilers. </p> <p>Copyright © 1988-2023 Free Software Foundation, Inc. </p> <p>Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with the Invariant Sections being “Funding Free Software”, the Front-Cover Texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled “GNU Free Documentation License”. </p> <p>(a) The FSF’s Front-Cover Text is: </p> <blockquote class="quotation"> <p>A GNU Manual </p> +</blockquote> <p>(b) The FSF’s Back-Cover Text is: </p> <blockquote class="quotation"> <p>You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development. </p> +</blockquote> <div class="element-shortcontents" id="SEC_Shortcontents"> <h1 class="shortcontents-heading">Short Table of Contents</h1> <div class="shortcontents"> <ul class="toc-numbered-mark"> <li><a id="stoc-Programming-Languages-Supported-by-GCC" href="#toc-Programming-Languages-Supported-by-GCC">1 Programming Languages Supported by GCC</a></li> <li><a id="stoc-Language-Standards-Supported-by-GCC" href="#toc-Language-Standards-Supported-by-GCC">2 Language Standards Supported by GCC</a></li> <li><a id="stoc-GCC-Command-Options" href="#toc-GCC-Command-Options">3 GCC Command Options</a></li> <li><a id="stoc-C-Implementation-Defined-Behavior" href="#toc-C-Implementation-Defined-Behavior">4 C Implementation-Defined Behavior</a></li> <li><a id="stoc-C_002b_002b-Implementation-Defined-Behavior" href="#toc-C_002b_002b-Implementation-Defined-Behavior">5 C++ Implementation-Defined Behavior</a></li> <li><a id="stoc-Extensions-to-the-C-Language-Family" href="#toc-Extensions-to-the-C-Language-Family">6 Extensions to the C Language Family</a></li> <li><a id="stoc-Extensions-to-the-C_002b_002b-Language" href="#toc-Extensions-to-the-C_002b_002b-Language">7 Extensions to the C++ Language</a></li> <li><a id="stoc-GNU-Objective-C-Features" href="#toc-GNU-Objective-C-Features">8 GNU Objective-C Features</a></li> <li><a id="stoc-Binary-Compatibility" href="#toc-Binary-Compatibility">9 Binary Compatibility</a></li> <li><a id="stoc-gcov---a-Test-Coverage-Program" href="#toc-gcov---a-Test-Coverage-Program">10 <code class="command">gcov</code>—a Test Coverage Program</a></li> <li><a id="stoc-gcov-tool---an-Offline-Gcda-Profile-Processing-Tool" href="#toc-gcov-tool---an-Offline-Gcda-Profile-Processing-Tool">11 <code class="command">gcov-tool</code>—an Offline Gcda Profile Processing Tool</a></li> <li><a id="stoc-gcov-dump---an-Offline-Gcda-and-Gcno-Profile-Dump-Tool" href="#toc-gcov-dump---an-Offline-Gcda-and-Gcno-Profile-Dump-Tool">12 <code class="command">gcov-dump</code>—an Offline Gcda and Gcno Profile Dump Tool</a></li> <li><a id="stoc-lto-dump---Tool-for-dumping-LTO-object-files_002e" href="#toc-lto-dump---Tool-for-dumping-LTO-object-files_002e">13 <code class="command">lto-dump</code>—Tool for dumping LTO object files.</a></li> <li><a id="stoc-Known-Causes-of-Trouble-with-GCC" href="#toc-Known-Causes-of-Trouble-with-GCC">14 Known Causes of Trouble with GCC</a></li> <li><a id="stoc-Reporting-Bugs" href="#toc-Reporting-Bugs">15 Reporting Bugs</a></li> <li><a id="stoc-How-To-Get-Help-with-GCC" href="#toc-How-To-Get-Help-with-GCC">16 How To Get Help with GCC</a></li> <li><a id="stoc-Contributing-to-GCC-Development" href="#toc-Contributing-to-GCC-Development">17 Contributing to GCC Development</a></li> <li><a id="stoc-Funding-Free-Software" href="#toc-Funding-Free-Software">Funding Free Software</a></li> <li><a id="stoc-The-GNU-Project-and-GNU_002fLinux" href="#toc-The-GNU-Project-and-GNU_002fLinux">The GNU Project and GNU/Linux</a></li> <li><a id="stoc-GNU-General-Public-License" href="#toc-GNU-General-Public-License">GNU General Public License</a></li> <li><a id="stoc-GNU-Free-Documentation-License-1" href="#toc-GNU-Free-Documentation-License-1">GNU Free Documentation License</a></li> <li><a id="stoc-Contributors-to-GCC" href="#toc-Contributors-to-GCC">Contributors to GCC</a></li> <li><a id="stoc-Indices-1" href="#toc-Indices-1">Appendix A Indices</a></li> </ul> </div> </div> <div class="element-contents" id="SEC_Contents"> <h1 class="contents-heading">Table of Contents</h1> <div class="contents"> <ul class="toc-numbered-mark"> <li><a id="toc-Programming-Languages-Supported-by-GCC" href="g_002b_002b-and-gcc">1 Programming Languages Supported by GCC</a></li> <li> +<a id="toc-Language-Standards-Supported-by-GCC" href="standards">2 Language Standards Supported by GCC</a> <ul class="toc-numbered-mark"> <li><a id="toc-C-Language" href="standards#C-Language">2.1 C Language</a></li> <li><a id="toc-C_002b_002b-Language" href="standards#C_002b_002b-Language">2.2 C++ Language</a></li> <li><a id="toc-Objective-C-and-Objective-C_002b_002b-Languages" href="standards#Objective-C-and-Objective-C_002b_002b-Languages">2.3 Objective-C and Objective-C++ Languages</a></li> <li><a id="toc-Go-Language" href="standards#Go-Language">2.4 Go Language</a></li> <li><a id="toc-D-language" href="standards#D-language">2.5 D language</a></li> <li><a id="toc-References-for-Other-Languages" href="standards#References-for-Other-Languages">2.6 References for Other Languages</a></li> </ul> +</li> <li> +<a id="toc-GCC-Command-Options" href="invoking-gcc">3 GCC Command Options</a> <ul class="toc-numbered-mark"> <li><a id="toc-Option-Summary-1" href="option-summary">3.1 Option Summary</a></li> <li><a id="toc-Options-Controlling-the-Kind-of-Output" href="overall-options">3.2 Options Controlling the Kind of Output</a></li> <li><a id="toc-Compiling-C_002b_002b-Programs" href="invoking-g_002b_002b">3.3 Compiling C++ Programs</a></li> <li><a id="toc-Options-Controlling-C-Dialect" href="c-dialect-options">3.4 Options Controlling C Dialect</a></li> <li><a id="toc-Options-Controlling-C_002b_002b-Dialect" href="c_002b_002b-dialect-options">3.5 Options Controlling C++ Dialect</a></li> <li><a id="toc-Options-Controlling-Objective-C-and-Objective-C_002b_002b-Dialects" href="objective-c-and-objective-c_002b_002b-dialect-options">3.6 Options Controlling Objective-C and Objective-C++ Dialects</a></li> <li><a id="toc-Options-to-Control-Diagnostic-Messages-Formatting" href="diagnostic-message-formatting-options">3.7 Options to Control Diagnostic Messages Formatting</a></li> <li><a id="toc-Options-to-Request-or-Suppress-Warnings" href="warning-options">3.8 Options to Request or Suppress Warnings</a></li> <li><a id="toc-Options-That-Control-Static-Analysis" href="static-analyzer-options">3.9 Options That Control Static Analysis</a></li> <li><a id="toc-Options-for-Debugging-Your-Program" href="debugging-options">3.10 Options for Debugging Your Program</a></li> <li><a id="toc-Options-That-Control-Optimization" href="optimize-options">3.11 Options That Control Optimization</a></li> <li><a id="toc-Program-Instrumentation-Options" href="instrumentation-options">3.12 Program Instrumentation Options</a></li> <li><a id="toc-Options-Controlling-the-Preprocessor" href="preprocessor-options">3.13 Options Controlling the Preprocessor</a></li> <li><a id="toc-Passing-Options-to-the-Assembler" href="assembler-options">3.14 Passing Options to the Assembler</a></li> <li><a id="toc-Options-for-Linking" href="link-options">3.15 Options for Linking</a></li> <li><a id="toc-Options-for-Directory-Search" href="directory-options">3.16 Options for Directory Search</a></li> <li><a id="toc-Options-for-Code-Generation-Conventions" href="code-gen-options">3.17 Options for Code Generation Conventions</a></li> <li><a id="toc-GCC-Developer-Options" href="developer-options">3.18 GCC Developer Options</a></li> <li> +<a id="toc-Machine-Dependent-Options" href="submodel-options">3.19 Machine-Dependent Options</a> <ul class="toc-numbered-mark"> <li> +<a id="toc-AArch64-Options-1" href="aarch64-options">3.19.1 AArch64 Options</a> <ul class="toc-numbered-mark"> <li><a id="toc--march-and--mcpu-Feature-Modifiers" href="aarch64-options#g_t-march-and--mcpu-Feature-Modifiers">3.19.1.1 <samp class="option">-march</samp> and <samp class="option">-mcpu</samp> Feature Modifiers</a></li> </ul> +</li> <li><a id="toc-Adapteva-Epiphany-Options-1" href="adapteva-epiphany-options">3.19.2 Adapteva Epiphany Options</a></li> <li><a id="toc-AMD-GCN-Options-1" href="amd-gcn-options">3.19.3 AMD GCN Options</a></li> <li><a id="toc-ARC-Options-1" href="arc-options">3.19.4 ARC Options</a></li> <li><a id="toc-ARM-Options-1" href="arm-options">3.19.5 ARM Options</a></li> <li> +<a id="toc-AVR-Options-1" href="avr-options">3.19.6 AVR Options</a> <ul class="toc-numbered-mark"> <li><a id="toc-EIND-and-Devices-with-More-Than-128-Ki-Bytes-of-Flash" href="avr-options#EIND-and-Devices-with-More-Than-128-Ki-Bytes-of-Flash">3.19.6.1 <code class="code">EIND</code> and Devices with More Than 128 Ki Bytes of Flash</a></li> <li><a id="toc-Handling-of-the-RAMPD_002c-RAMPX_002c-RAMPY-and-RAMPZ-Special-Function-Registers" href="avr-options#Handling-of-the-RAMPD_002c-RAMPX_002c-RAMPY-and-RAMPZ-Special-Function-Registers">3.19.6.2 Handling of the <code class="code">RAMPD</code>, <code class="code">RAMPX</code>, <code class="code">RAMPY</code> and <code class="code">RAMPZ</code> Special Function Registers</a></li> <li><a id="toc-AVR-Built-in-Macros" href="avr-options#AVR-Built-in-Macros">3.19.6.3 AVR Built-in Macros</a></li> </ul> +</li> <li><a id="toc-Blackfin-Options-1" href="blackfin-options">3.19.7 Blackfin Options</a></li> <li><a id="toc-C6X-Options-1" href="c6x-options">3.19.8 C6X Options</a></li> <li><a id="toc-CRIS-Options-1" href="cris-options">3.19.9 CRIS Options</a></li> <li><a id="toc-C-SKY-Options-1" href="c-sky-options">3.19.10 C-SKY Options</a></li> <li><a id="toc-Darwin-Options-1" href="darwin-options">3.19.11 Darwin Options</a></li> <li><a id="toc-DEC-Alpha-Options-1" href="dec-alpha-options">3.19.12 DEC Alpha Options</a></li> <li><a id="toc-eBPF-Options-1" href="ebpf-options">3.19.13 eBPF Options</a></li> <li><a id="toc-FR30-Options-1" href="fr30-options">3.19.14 FR30 Options</a></li> <li><a id="toc-FT32-Options-1" href="ft32-options">3.19.15 FT32 Options</a></li> <li><a id="toc-FRV-Options-1" href="frv-options">3.19.16 FRV Options</a></li> <li><a id="toc-GNU_002fLinux-Options-1" href="gnu_002flinux-options">3.19.17 GNU/Linux Options</a></li> <li><a id="toc-H8_002f300-Options-1" href="h8_002f300-options">3.19.18 H8/300 Options</a></li> <li><a id="toc-HPPA-Options-1" href="hppa-options">3.19.19 HPPA Options</a></li> <li><a id="toc-IA-64-Options-1" href="ia-64-options">3.19.20 IA-64 Options</a></li> <li><a id="toc-LM32-Options-1" href="lm32-options">3.19.21 LM32 Options</a></li> <li><a id="toc-LoongArch-Options-1" href="loongarch-options">3.19.22 LoongArch Options</a></li> <li><a id="toc-M32C-Options-1" href="m32c-options">3.19.23 M32C Options</a></li> <li><a id="toc-M32R_002fD-Options-1" href="m32r_002fd-options">3.19.24 M32R/D Options</a></li> <li><a id="toc-M680x0-Options-1" href="m680x0-options">3.19.25 M680x0 Options</a></li> <li><a id="toc-MCore-Options-1" href="mcore-options">3.19.26 MCore Options</a></li> <li><a id="toc-MicroBlaze-Options-1" href="microblaze-options">3.19.27 MicroBlaze Options</a></li> <li><a id="toc-MIPS-Options-1" href="mips-options">3.19.28 MIPS Options</a></li> <li><a id="toc-MMIX-Options-1" href="mmix-options">3.19.29 MMIX Options</a></li> <li><a id="toc-MN10300-Options-1" href="mn10300-options">3.19.30 MN10300 Options</a></li> <li><a id="toc-Moxie-Options-1" href="moxie-options">3.19.31 Moxie Options</a></li> <li><a id="toc-MSP430-Options-1" href="msp430-options">3.19.32 MSP430 Options</a></li> <li><a id="toc-NDS32-Options-1" href="nds32-options">3.19.33 NDS32 Options</a></li> <li><a id="toc-Nios-II-Options-1" href="nios-ii-options">3.19.34 Nios II Options</a></li> <li><a id="toc-Nvidia-PTX-Options-1" href="nvidia-ptx-options">3.19.35 Nvidia PTX Options</a></li> <li><a id="toc-OpenRISC-Options-1" href="openrisc-options">3.19.36 OpenRISC Options</a></li> <li><a id="toc-PDP-11-Options-1" href="pdp-11-options">3.19.37 PDP-11 Options</a></li> <li><a id="toc-PowerPC-Options-1" href="powerpc-options">3.19.38 PowerPC Options</a></li> <li><a id="toc-PRU-Options-1" href="pru-options">3.19.39 PRU Options</a></li> <li><a id="toc-RISC-V-Options-1" href="risc-v-options">3.19.40 RISC-V Options</a></li> <li><a id="toc-RL78-Options-1" href="rl78-options">3.19.41 RL78 Options</a></li> <li><a id="toc-IBM-RS_002f6000-and-PowerPC-Options" href="rs_002f6000-and-powerpc-options">3.19.42 IBM RS/6000 and PowerPC Options</a></li> <li><a id="toc-RX-Options-1" href="rx-options">3.19.43 RX Options</a></li> <li><a id="toc-S_002f390-and-zSeries-Options-1" href="s_002f390-and-zseries-options">3.19.44 S/390 and zSeries Options</a></li> <li><a id="toc-SH-Options-1" href="sh-options">3.19.45 SH Options</a></li> <li><a id="toc-Solaris-2-Options-1" href="solaris-2-options">3.19.46 Solaris 2 Options</a></li> <li><a id="toc-SPARC-Options-1" href="sparc-options">3.19.47 SPARC Options</a></li> <li><a id="toc-Options-for-System-V" href="system-v-options">3.19.48 Options for System V</a></li> <li><a id="toc-V850-Options-1" href="v850-options">3.19.49 V850 Options</a></li> <li><a id="toc-VAX-Options-1" href="vax-options">3.19.50 VAX Options</a></li> <li><a id="toc-Visium-Options-1" href="visium-options">3.19.51 Visium Options</a></li> <li><a id="toc-VMS-Options-1" href="vms-options">3.19.52 VMS Options</a></li> <li><a id="toc-VxWorks-Options-1" href="vxworks-options">3.19.53 VxWorks Options</a></li> <li><a id="toc-x86-Options-1" href="x86-options">3.19.54 x86 Options</a></li> <li><a id="toc-x86-Windows-Options-1" href="x86-windows-options">3.19.55 x86 Windows Options</a></li> <li><a id="toc-Xstormy16-Options-1" href="xstormy16-options">3.19.56 Xstormy16 Options</a></li> <li><a id="toc-Xtensa-Options-1" href="xtensa-options">3.19.57 Xtensa Options</a></li> <li><a id="toc-zSeries-Options-1" href="zseries-options">3.19.58 zSeries Options</a></li> </ul> +</li> <li><a id="toc-Specifying-Subprocesses-and-the-Switches-to-Pass-to-Them" href="spec-files">3.20 Specifying Subprocesses and the Switches to Pass to Them</a></li> <li><a id="toc-Environment-Variables-Affecting-GCC" href="environment-variables">3.21 Environment Variables Affecting GCC</a></li> <li><a id="toc-Using-Precompiled-Headers" href="precompiled-headers">3.22 Using Precompiled Headers</a></li> <li> +<a id="toc-C_002b_002b-Modules-1" href="c_002b_002b-modules">3.23 C++ Modules</a> <ul class="toc-numbered-mark"> <li><a id="toc-Module-Mapper" href="c_002b_002b-module-mapper">3.23.1 Module Mapper</a></li> <li><a id="toc-Module-Preprocessing" href="c_002b_002b-module-preprocessing">3.23.2 Module Preprocessing</a></li> <li><a id="toc-Compiled-Module-Interface" href="c_002b_002b-compiled-module-interface">3.23.3 Compiled Module Interface</a></li> </ul> +</li> </ul> +</li> <li> +<a id="toc-C-Implementation-Defined-Behavior" href="c-implementation">4 C Implementation-Defined Behavior</a> <ul class="toc-numbered-mark"> <li><a id="toc-Translation" href="translation-implementation">4.1 Translation</a></li> <li><a id="toc-Environment" href="environment-implementation">4.2 Environment</a></li> <li><a id="toc-Identifiers" href="identifiers-implementation">4.3 Identifiers</a></li> <li><a id="toc-Characters" href="characters-implementation">4.4 Characters</a></li> <li><a id="toc-Integers" href="integers-implementation">4.5 Integers</a></li> <li><a id="toc-Floating-Point" href="floating-point-implementation">4.6 Floating Point</a></li> <li><a id="toc-Arrays-and-Pointers" href="arrays-and-pointers-implementation">4.7 Arrays and Pointers</a></li> <li><a id="toc-Hints" href="hints-implementation">4.8 Hints</a></li> <li><a id="toc-Structures_002c-Unions_002c-Enumerations_002c-and-Bit-Fields" href="structures-unions-enumerations-and-bit-fields-implementation">4.9 Structures, Unions, Enumerations, and Bit-Fields</a></li> <li><a id="toc-Qualifiers" href="qualifiers-implementation">4.10 Qualifiers</a></li> <li><a id="toc-Declarators" href="declarators-implementation">4.11 Declarators</a></li> <li><a id="toc-Statements" href="statements-implementation">4.12 Statements</a></li> <li><a id="toc-Preprocessing-Directives" href="preprocessing-directives-implementation">4.13 Preprocessing Directives</a></li> <li><a id="toc-Library-Functions" href="library-functions-implementation">4.14 Library Functions</a></li> <li><a id="toc-Architecture" href="architecture-implementation">4.15 Architecture</a></li> <li><a id="toc-Locale-Specific-Behavior" href="locale-specific-behavior-implementation">4.16 Locale-Specific Behavior</a></li> </ul> +</li> <li> +<a id="toc-C_002b_002b-Implementation-Defined-Behavior" href="c_002b_002b-implementation">5 C++ Implementation-Defined Behavior</a> <ul class="toc-numbered-mark"> <li><a id="toc-Conditionally-Supported-Behavior" href="conditionally-supported-behavior">5.1 Conditionally-Supported Behavior</a></li> <li><a id="toc-Exception-Handling" href="exception-handling">5.2 Exception Handling</a></li> </ul> +</li> <li> +<a id="toc-Extensions-to-the-C-Language-Family" href="c-extensions">6 Extensions to the C Language Family</a> <ul class="toc-numbered-mark"> <li><a id="toc-Statements-and-Declarations-in-Expressions" href="statement-exprs">6.1 Statements and Declarations in Expressions</a></li> <li><a id="toc-Locally-Declared-Labels" href="local-labels">6.2 Locally Declared Labels</a></li> <li><a id="toc-Labels-as-Values-1" href="labels-as-values">6.3 Labels as Values</a></li> <li><a id="toc-Nested-Functions-1" href="nested-functions">6.4 Nested Functions</a></li> <li><a id="toc-Nonlocal-Gotos-1" href="nonlocal-gotos">6.5 Nonlocal Gotos</a></li> <li><a id="toc-Constructing-Function-Calls" href="constructing-calls">6.6 Constructing Function Calls</a></li> <li><a id="toc-Referring-to-a-Type-with-typeof" href="typeof">6.7 Referring to a Type with <code class="code">typeof</code></a></li> <li><a id="toc-Conditionals-with-Omitted-Operands" href="conditionals">6.8 Conditionals with Omitted Operands</a></li> <li><a id="toc-128-bit-Integers" href="_005f_005fint128">6.9 128-bit Integers</a></li> <li><a id="toc-Double-Word-Integers" href="long-long">6.10 Double-Word Integers</a></li> <li><a id="toc-Complex-Numbers" href="complex">6.11 Complex Numbers</a></li> <li><a id="toc-Additional-Floating-Types" href="floating-types">6.12 Additional Floating Types</a></li> <li><a id="toc-Half-Precision-Floating-Point" href="half-precision">6.13 Half-Precision Floating Point</a></li> <li><a id="toc-Decimal-Floating-Types" href="decimal-float">6.14 Decimal Floating Types</a></li> <li><a id="toc-Hex-Floats-1" href="hex-floats">6.15 Hex Floats</a></li> <li><a id="toc-Fixed-Point-Types" href="fixed-point">6.16 Fixed-Point Types</a></li> <li> +<a id="toc-Named-Address-Spaces-1" href="named-address-spaces">6.17 Named Address Spaces</a> <ul class="toc-numbered-mark"> <li><a id="toc-AVR-Named-Address-Spaces-1" href="named-address-spaces#AVR-Named-Address-Spaces-1">6.17.1 AVR Named Address Spaces</a></li> <li><a id="toc-M32C-Named-Address-Spaces" href="named-address-spaces#M32C-Named-Address-Spaces">6.17.2 M32C Named Address Spaces</a></li> <li><a id="toc-PRU-Named-Address-Spaces" href="named-address-spaces#PRU-Named-Address-Spaces">6.17.3 PRU Named Address Spaces</a></li> <li><a id="toc-RL78-Named-Address-Spaces" href="named-address-spaces#RL78-Named-Address-Spaces">6.17.4 RL78 Named Address Spaces</a></li> <li><a id="toc-x86-Named-Address-Spaces" href="named-address-spaces#x86-Named-Address-Spaces">6.17.5 x86 Named Address Spaces</a></li> </ul> +</li> <li><a id="toc-Arrays-of-Length-Zero" href="zero-length">6.18 Arrays of Length Zero</a></li> <li><a id="toc-Structures-with-No-Members" href="empty-structures">6.19 Structures with No Members</a></li> <li><a id="toc-Arrays-of-Variable-Length" href="variable-length">6.20 Arrays of Variable Length</a></li> <li><a id="toc-Macros-with-a-Variable-Number-of-Arguments_002e" href="variadic-macros">6.21 Macros with a Variable Number of Arguments.</a></li> <li><a id="toc-Slightly-Looser-Rules-for-Escaped-Newlines" href="escaped-newlines">6.22 Slightly Looser Rules for Escaped Newlines</a></li> <li><a id="toc-Non-Lvalue-Arrays-May-Have-Subscripts" href="subscripting">6.23 Non-Lvalue Arrays May Have Subscripts</a></li> <li><a id="toc-Arithmetic-on-void--and-Function-Pointers" href="pointer-arith">6.24 Arithmetic on <code class="code">void</code>- and Function-Pointers</a></li> <li><a id="toc-Pointer-Arguments-in-Variadic-Functions" href="variadic-pointer-args">6.25 Pointer Arguments in Variadic Functions</a></li> <li><a id="toc-Pointers-to-Arrays-with-Qualifiers-Work-as-Expected" href="pointers-to-arrays">6.26 Pointers to Arrays with Qualifiers Work as Expected</a></li> <li><a id="toc-Non-Constant-Initializers" href="initializers">6.27 Non-Constant Initializers</a></li> <li><a id="toc-Compound-Literals-1" href="compound-literals">6.28 Compound Literals</a></li> <li><a id="toc-Designated-Initializers" href="designated-inits">6.29 Designated Initializers</a></li> <li><a id="toc-Case-Ranges-1" href="case-ranges">6.30 Case Ranges</a></li> <li><a id="toc-Cast-to-a-Union-Type" href="cast-to-union">6.31 Cast to a Union Type</a></li> <li><a id="toc-Mixed-Declarations_002c-Labels-and-Code" href="mixed-labels-and-declarations">6.32 Mixed Declarations, Labels and Code</a></li> <li> +<a id="toc-Declaring-Attributes-of-Functions" href="function-attributes">6.33 Declaring Attributes of Functions</a> <ul class="toc-numbered-mark"> <li><a id="toc-Common-Function-Attributes-1" href="common-function-attributes">6.33.1 Common Function Attributes</a></li> <li> +<a id="toc-AArch64-Function-Attributes-1" href="aarch64-function-attributes">6.33.2 AArch64 Function Attributes</a> <ul class="toc-numbered-mark"> <li><a id="toc-Inlining-rules" href="aarch64-function-attributes#Inlining-rules">6.33.2.1 Inlining rules</a></li> </ul> +</li> <li><a id="toc-AMD-GCN-Function-Attributes-1" href="amd-gcn-function-attributes">6.33.3 AMD GCN Function Attributes</a></li> <li><a id="toc-ARC-Function-Attributes-1" href="arc-function-attributes">6.33.4 ARC Function Attributes</a></li> <li><a id="toc-ARM-Function-Attributes-1" href="arm-function-attributes">6.33.5 ARM Function Attributes</a></li> <li><a id="toc-AVR-Function-Attributes-1" href="avr-function-attributes">6.33.6 AVR Function Attributes</a></li> <li><a id="toc-Blackfin-Function-Attributes-1" href="blackfin-function-attributes">6.33.7 Blackfin Function Attributes</a></li> <li><a id="toc-BPF-Function-Attributes-1" href="bpf-function-attributes">6.33.8 BPF Function Attributes</a></li> <li><a id="toc-C-SKY-Function-Attributes-1" href="c-sky-function-attributes">6.33.9 C-SKY Function Attributes</a></li> <li><a id="toc-Epiphany-Function-Attributes-1" href="epiphany-function-attributes">6.33.10 Epiphany Function Attributes</a></li> <li><a id="toc-H8_002f300-Function-Attributes-1" href="h8_002f300-function-attributes">6.33.11 H8/300 Function Attributes</a></li> <li><a id="toc-IA-64-Function-Attributes-1" href="ia-64-function-attributes">6.33.12 IA-64 Function Attributes</a></li> <li><a id="toc-M32C-Function-Attributes-1" href="m32c-function-attributes">6.33.13 M32C Function Attributes</a></li> <li><a id="toc-M32R_002fD-Function-Attributes-1" href="m32r_002fd-function-attributes">6.33.14 M32R/D Function Attributes</a></li> <li><a id="toc-m68k-Function-Attributes-1" href="m68k-function-attributes">6.33.15 m68k Function Attributes</a></li> <li><a id="toc-MCORE-Function-Attributes-1" href="mcore-function-attributes">6.33.16 MCORE Function Attributes</a></li> <li><a id="toc-MicroBlaze-Function-Attributes-1" href="microblaze-function-attributes">6.33.17 MicroBlaze Function Attributes</a></li> <li><a id="toc-Microsoft-Windows-Function-Attributes-1" href="microsoft-windows-function-attributes">6.33.18 Microsoft Windows Function Attributes</a></li> <li><a id="toc-MIPS-Function-Attributes-1" href="mips-function-attributes">6.33.19 MIPS Function Attributes</a></li> <li><a id="toc-MSP430-Function-Attributes-1" href="msp430-function-attributes">6.33.20 MSP430 Function Attributes</a></li> <li><a id="toc-NDS32-Function-Attributes-1" href="nds32-function-attributes">6.33.21 NDS32 Function Attributes</a></li> <li><a id="toc-Nios-II-Function-Attributes-1" href="nios-ii-function-attributes">6.33.22 Nios II Function Attributes</a></li> <li><a id="toc-Nvidia-PTX-Function-Attributes-1" href="nvidia-ptx-function-attributes">6.33.23 Nvidia PTX Function Attributes</a></li> <li><a id="toc-PowerPC-Function-Attributes-1" href="powerpc-function-attributes">6.33.24 PowerPC Function Attributes</a></li> <li><a id="toc-RISC-V-Function-Attributes-1" href="risc-v-function-attributes">6.33.25 RISC-V Function Attributes</a></li> <li><a id="toc-RL78-Function-Attributes-1" href="rl78-function-attributes">6.33.26 RL78 Function Attributes</a></li> <li><a id="toc-RX-Function-Attributes-1" href="rx-function-attributes">6.33.27 RX Function Attributes</a></li> <li><a id="toc-S_002f390-Function-Attributes-1" href="s_002f390-function-attributes">6.33.28 S/390 Function Attributes</a></li> <li><a id="toc-SH-Function-Attributes-1" href="sh-function-attributes">6.33.29 SH Function Attributes</a></li> <li><a id="toc-Symbian-OS-Function-Attributes-1" href="symbian-os-function-attributes">6.33.30 Symbian OS Function Attributes</a></li> <li><a id="toc-V850-Function-Attributes-1" href="v850-function-attributes">6.33.31 V850 Function Attributes</a></li> <li><a id="toc-Visium-Function-Attributes-1" href="visium-function-attributes">6.33.32 Visium Function Attributes</a></li> <li><a id="toc-x86-Function-Attributes-1" href="x86-function-attributes">6.33.33 x86 Function Attributes</a></li> <li><a id="toc-Xstormy16-Function-Attributes-1" href="xstormy16-function-attributes">6.33.34 Xstormy16 Function Attributes</a></li> </ul> +</li> <li> +<a id="toc-Specifying-Attributes-of-Variables" href="variable-attributes">6.34 Specifying Attributes of Variables</a> <ul class="toc-numbered-mark"> <li><a id="toc-Common-Variable-Attributes-1" href="common-variable-attributes">6.34.1 Common Variable Attributes</a></li> <li><a id="toc-ARC-Variable-Attributes-1" href="arc-variable-attributes">6.34.2 ARC Variable Attributes</a></li> <li><a id="toc-AVR-Variable-Attributes-1" href="variable-attributes">6.34.3 AVR Variable Attributes</a></li> <li><a id="toc-Blackfin-Variable-Attributes-1" href="blackfin-variable-attributes">6.34.4 Blackfin Variable Attributes</a></li> <li><a id="toc-H8_002f300-Variable-Attributes-1" href="h8_002f300-variable-attributes">6.34.5 H8/300 Variable Attributes</a></li> <li><a id="toc-IA-64-Variable-Attributes-1" href="ia-64-variable-attributes">6.34.6 IA-64 Variable Attributes</a></li> <li><a id="toc-LoongArch-Variable-Attributes-1" href="loongarch-variable-attributes">6.34.7 LoongArch Variable Attributes</a></li> <li><a id="toc-M32R_002fD-Variable-Attributes-1" href="m32r_002fd-variable-attributes">6.34.8 M32R/D Variable Attributes</a></li> <li><a id="toc-Microsoft-Windows-Variable-Attributes-1" href="microsoft-windows-variable-attributes">6.34.9 Microsoft Windows Variable Attributes</a></li> <li><a id="toc-MSP430-Variable-Attributes-1" href="msp430-variable-attributes">6.34.10 MSP430 Variable Attributes</a></li> <li><a id="toc-Nvidia-PTX-Variable-Attributes-1" href="nvidia-ptx-variable-attributes">6.34.11 Nvidia PTX Variable Attributes</a></li> <li><a id="toc-PowerPC-Variable-Attributes-1" href="powerpc-variable-attributes">6.34.12 PowerPC Variable Attributes</a></li> <li><a id="toc-RL78-Variable-Attributes-1" href="rl78-variable-attributes">6.34.13 RL78 Variable Attributes</a></li> <li><a id="toc-V850-Variable-Attributes-1" href="v850-variable-attributes">6.34.14 V850 Variable Attributes</a></li> <li><a id="toc-x86-Variable-Attributes-1" href="variable-attributes">6.34.15 x86 Variable Attributes</a></li> <li><a id="toc-Xstormy16-Variable-Attributes-1" href="xstormy16-variable-attributes">6.34.16 Xstormy16 Variable Attributes</a></li> </ul> +</li> <li> +<a id="toc-Specifying-Attributes-of-Types" href="type-attributes">6.35 Specifying Attributes of Types</a> <ul class="toc-numbered-mark"> <li><a id="toc-Common-Type-Attributes-1" href="common-type-attributes">6.35.1 Common Type Attributes</a></li> <li><a id="toc-ARC-Type-Attributes-1" href="arc-type-attributes">6.35.2 ARC Type Attributes</a></li> <li><a id="toc-ARM-Type-Attributes-1" href="arm-type-attributes">6.35.3 ARM Type Attributes</a></li> <li><a id="toc-BPF-Type-Attributes-1" href="bpf-type-attributes">6.35.4 BPF Type Attributes</a></li> <li><a id="toc-PowerPC-Type-Attributes-1" href="type-attributes">6.35.5 PowerPC Type Attributes</a></li> <li><a id="toc-x86-Type-Attributes-1" href="type-attributes">6.35.6 x86 Type Attributes</a></li> </ul> +</li> <li><a id="toc-Label-Attributes-1" href="label-attributes">6.36 Label Attributes</a></li> <li><a id="toc-Enumerator-Attributes-1" href="enumerator-attributes">6.37 Enumerator Attributes</a></li> <li><a id="toc-Statement-Attributes-1" href="statement-attributes">6.38 Statement Attributes</a></li> <li><a id="toc-Attribute-Syntax-1" href="attribute-syntax">6.39 Attribute Syntax</a></li> <li><a id="toc-Prototypes-and-Old-Style-Function-Definitions" href="function-prototypes">6.40 Prototypes and Old-Style Function Definitions</a></li> <li><a id="toc-C_002b_002b-Style-Comments" href="c_002b_002b-comments">6.41 C++ Style Comments</a></li> <li><a id="toc-Dollar-Signs-in-Identifier-Names" href="dollar-signs">6.42 Dollar Signs in Identifier Names</a></li> <li><a id="toc-The-Character-ESC-in-Constants" href="character-escapes">6.43 The Character <kbd class="key">ESC</kbd> in Constants</a></li> <li><a id="toc-Determining-the-Alignment-of-Functions_002c-Types-or-Variables" href="alignment">6.44 Determining the Alignment of Functions, Types or Variables</a></li> <li><a id="toc-An-Inline-Function-is-As-Fast-As-a-Macro" href="inline">6.45 An Inline Function is As Fast As a Macro</a></li> <li><a id="toc-When-is-a-Volatile-Object-Accessed_003f" href="volatiles">6.46 When is a Volatile Object Accessed?</a></li> <li> +<a id="toc-How-to-Use-Inline-Assembly-Language-in-C-Code" href="using-assembly-language-with-c">6.47 How to Use Inline Assembly Language in C Code</a> <ul class="toc-numbered-mark"> <li><a id="toc-Basic-Asm-----Assembler-Instructions-Without-Operands" href="basic-asm">6.47.1 Basic Asm — Assembler Instructions Without Operands</a></li> <li> +<a id="toc-Extended-Asm---Assembler-Instructions-with-C-Expression-Operands" href="extended-asm">6.47.2 Extended Asm - Assembler Instructions with C Expression Operands</a> <ul class="toc-numbered-mark"> <li><a id="toc-Volatile-1" href="extended-asm#Volatile-1">6.47.2.1 Volatile</a></li> <li><a id="toc-Assembler-Template" href="extended-asm#Assembler-Template">6.47.2.2 Assembler Template</a></li> <li><a id="toc-Output-Operands" href="extended-asm#Output-Operands">6.47.2.3 Output Operands</a></li> <li><a id="toc-Flag-Output-Operands" href="extended-asm#Flag-Output-Operands">6.47.2.4 Flag Output Operands</a></li> <li><a id="toc-Input-Operands" href="extended-asm#Input-Operands">6.47.2.5 Input Operands</a></li> <li><a id="toc-Clobbers-and-Scratch-Registers-1" href="extended-asm#Clobbers-and-Scratch-Registers-1">6.47.2.6 Clobbers and Scratch Registers</a></li> <li><a id="toc-Goto-Labels" href="extended-asm#Goto-Labels">6.47.2.7 Goto Labels</a></li> <li><a id="toc-Generic-Operand-Modifiers" href="extended-asm#Generic-Operand-Modifiers">6.47.2.8 Generic Operand Modifiers</a></li> <li><a id="toc-x86-Operand-Modifiers" href="extended-asm#x86-Operand-Modifiers">6.47.2.9 x86 Operand Modifiers</a></li> <li><a id="toc-x86-Floating-Point-asm-Operands" href="extended-asm#x86-Floating-Point-asm-Operands">6.47.2.10 x86 Floating-Point <code class="code">asm</code> Operands</a></li> <li><a id="toc-MSP430-Operand-Modifiers" href="extended-asm#MSP430-Operand-Modifiers">6.47.2.11 MSP430 Operand Modifiers</a></li> <li><a id="toc-LoongArch-Operand-Modifiers" href="extended-asm#LoongArch-Operand-Modifiers">6.47.2.12 LoongArch Operand Modifiers</a></li> </ul> +</li> <li> +<a id="toc-Constraints-for-asm-Operands" href="constraints">6.47.3 Constraints for <code class="code">asm</code> Operands</a> <ul class="toc-numbered-mark"> <li><a id="toc-Simple-Constraints-1" href="simple-constraints">6.47.3.1 Simple Constraints</a></li> <li><a id="toc-Multiple-Alternative-Constraints" href="multi-alternative">6.47.3.2 Multiple Alternative Constraints</a></li> <li><a id="toc-Constraint-Modifier-Characters" href="modifiers">6.47.3.3 Constraint Modifier Characters</a></li> <li><a id="toc-Constraints-for-Particular-Machines" href="machine-constraints">6.47.3.4 Constraints for Particular Machines</a></li> </ul> +</li> <li><a id="toc-Controlling-Names-Used-in-Assembler-Code" href="asm-labels">6.47.4 Controlling Names Used in Assembler Code</a></li> <li> +<a id="toc-Variables-in-Specified-Registers" href="explicit-register-variables">6.47.5 Variables in Specified Registers</a> <ul class="toc-numbered-mark"> <li><a id="toc-Defining-Global-Register-Variables" href="global-register-variables">6.47.5.1 Defining Global Register Variables</a></li> <li><a id="toc-Specifying-Registers-for-Local-Variables" href="local-register-variables">6.47.5.2 Specifying Registers for Local Variables</a></li> </ul> +</li> <li><a id="toc-Size-of-an-asm-1" href="size-of-an-asm">6.47.6 Size of an <code class="code">asm</code></a></li> </ul> +</li> <li><a id="toc-Alternate-Keywords-1" href="alternate-keywords">6.48 Alternate Keywords</a></li> <li><a id="toc-Incomplete-enum-Types" href="incomplete-enums">6.49 Incomplete <code class="code">enum</code> Types</a></li> <li><a id="toc-Function-Names-as-Strings" href="function-names">6.50 Function Names as Strings</a></li> <li><a id="toc-Getting-the-Return-or-Frame-Address-of-a-Function" href="return-address">6.51 Getting the Return or Frame Address of a Function</a></li> <li><a id="toc-Using-Vector-Instructions-through-Built-in-Functions" href="vector-extensions">6.52 Using Vector Instructions through Built-in Functions</a></li> <li><a id="toc-Support-for-offsetof" href="offsetof">6.53 Support for <code class="code">offsetof</code></a></li> <li><a id="toc-Legacy-_005f_005fsync-Built-in-Functions-for-Atomic-Memory-Access" href="_005f_005fsync-builtins">6.54 Legacy <code class="code">__sync</code> Built-in Functions for Atomic Memory Access</a></li> <li><a id="toc-Built-in-Functions-for-Memory-Model-Aware-Atomic-Operations" href="_005f_005fatomic-builtins">6.55 Built-in Functions for Memory Model Aware Atomic Operations</a></li> <li><a id="toc-Built-in-Functions-to-Perform-Arithmetic-with-Overflow-Checking" href="integer-overflow-builtins">6.56 Built-in Functions to Perform Arithmetic with Overflow Checking</a></li> <li><a id="toc-x86-Specific-Memory-Model-Extensions-for-Transactional-Memory" href="x86-specific-memory-model-extensions-for-transactional-memory">6.57 x86-Specific Memory Model Extensions for Transactional Memory</a></li> <li> +<a id="toc-Object-Size-Checking-1" href="object-size-checking">6.58 Object Size Checking</a> <ul class="toc-numbered-mark"> <li><a id="toc-Object-Size-Checking-Built-in-Functions" href="object-size-checking#Object-Size-Checking-Built-in-Functions">6.58.1 Object Size Checking Built-in Functions</a></li> <li> +<a id="toc-Object-Size-Checking-and-Source-Fortification" href="object-size-checking#Object-Size-Checking-and-Source-Fortification">6.58.2 Object Size Checking and Source Fortification</a> <ul class="toc-numbered-mark"> <li><a id="toc-Formatted-Output-Function-Checking" href="object-size-checking#Formatted-Output-Function-Checking">6.58.2.1 Formatted Output Function Checking</a></li> </ul> +</li> </ul> +</li> <li><a id="toc-Other-Built-in-Functions-Provided-by-GCC" href="other-builtins">6.59 Other Built-in Functions Provided by GCC</a></li> <li> +<a id="toc-Built-in-Functions-Specific-to-Particular-Target-Machines" href="target-builtins">6.60 Built-in Functions Specific to Particular Target Machines</a> <ul class="toc-numbered-mark"> <li><a id="toc-AArch64-Built-in-Functions-1" href="aarch64-built-in-functions">6.60.1 AArch64 Built-in Functions</a></li> <li><a id="toc-Alpha-Built-in-Functions-1" href="alpha-built-in-functions">6.60.2 Alpha Built-in Functions</a></li> <li><a id="toc-Altera-Nios-II-Built-in-Functions-1" href="altera-nios-ii-built-in-functions">6.60.3 Altera Nios II Built-in Functions</a></li> <li><a id="toc-ARC-Built-in-Functions-1" href="arc-built-in-functions">6.60.4 ARC Built-in Functions</a></li> <li><a id="toc-ARC-SIMD-Built-in-Functions-1" href="arc-simd-built-in-functions">6.60.5 ARC SIMD Built-in Functions</a></li> <li><a id="toc-ARM-iWMMXt-Built-in-Functions-1" href="arm-iwmmxt-built-in-functions">6.60.6 ARM iWMMXt Built-in Functions</a></li> <li><a id="toc-ARM-C-Language-Extensions-_0028ACLE_0029-1" href="arm-c-language-extensions-_0028acle_0029">6.60.7 ARM C Language Extensions (ACLE)</a></li> <li><a id="toc-ARM-Floating-Point-Status-and-Control-Intrinsics-1" href="arm-floating-point-status-and-control-intrinsics">6.60.8 ARM Floating Point Status and Control Intrinsics</a></li> <li><a id="toc-ARM-ARMv8-M-Security-Extensions-1" href="arm-armv8-m-security-extensions">6.60.9 ARM ARMv8-M Security Extensions</a></li> <li><a id="toc-AVR-Built-in-Functions-1" href="avr-built-in-functions">6.60.10 AVR Built-in Functions</a></li> <li><a id="toc-Blackfin-Built-in-Functions-1" href="blackfin-built-in-functions">6.60.11 Blackfin Built-in Functions</a></li> <li><a id="toc-BPF-Built-in-Functions-1" href="bpf-built-in-functions">6.60.12 BPF Built-in Functions</a></li> <li> +<a id="toc-FR-V-Built-in-Functions-1" href="fr-v-built-in-functions">6.60.13 FR-V Built-in Functions</a> <ul class="toc-numbered-mark"> <li><a id="toc-Argument-Types-1" href="argument-types">6.60.13.1 Argument Types</a></li> <li><a id="toc-Directly-Mapped-Integer-Functions" href="directly-mapped-integer-functions">6.60.13.2 Directly-Mapped Integer Functions</a></li> <li><a id="toc-Directly-Mapped-Media-Functions" href="directly-mapped-media-functions">6.60.13.3 Directly-Mapped Media Functions</a></li> <li><a id="toc-Raw-Read_002fWrite-Functions" href="raw-read_002fwrite-functions">6.60.13.4 Raw Read/Write Functions</a></li> <li><a id="toc-Other-Built-in-Functions-1" href="other-built-in-functions">6.60.13.5 Other Built-in Functions</a></li> </ul> +</li> <li><a id="toc-LoongArch-Base-Built-in-Functions-1" href="loongarch-base-built-in-functions">6.60.14 LoongArch Base Built-in Functions</a></li> <li><a id="toc-MIPS-DSP-Built-in-Functions-1" href="mips-dsp-built-in-functions">6.60.15 MIPS DSP Built-in Functions</a></li> <li><a id="toc-MIPS-Paired-Single-Support-1" href="mips-paired-single-support">6.60.16 MIPS Paired-Single Support</a></li> <li> +<a id="toc-MIPS-Loongson-Built-in-Functions-1" href="mips-loongson-built-in-functions">6.60.17 MIPS Loongson Built-in Functions</a> <ul class="toc-numbered-mark"> <li><a id="toc-Paired-Single-Arithmetic-1" href="paired-single-arithmetic">6.60.17.1 Paired-Single Arithmetic</a></li> <li><a id="toc-Paired-Single-Built-in-Functions-1" href="paired-single-built-in-functions">6.60.17.2 Paired-Single Built-in Functions</a></li> <li><a id="toc-MIPS-3D-Built-in-Functions-1" href="mips-3d-built-in-functions">6.60.17.3 MIPS-3D Built-in Functions</a></li> </ul> +</li> <li> +<a id="toc-MIPS-SIMD-Architecture-_0028MSA_0029-Support-1" href="mips-simd-architecture-_0028msa_0029-support">6.60.18 MIPS SIMD Architecture (MSA) Support</a> <ul class="toc-numbered-mark"> <li><a id="toc-MIPS-SIMD-Architecture-Built-in-Functions-1" href="mips-simd-architecture-built-in-functions">6.60.18.1 MIPS SIMD Architecture Built-in Functions</a></li> </ul> +</li> <li><a id="toc-Other-MIPS-Built-in-Functions-1" href="other-mips-built-in-functions">6.60.19 Other MIPS Built-in Functions</a></li> <li><a id="toc-MSP430-Built-in-Functions-1" href="msp430-built-in-functions">6.60.20 MSP430 Built-in Functions</a></li> <li><a id="toc-NDS32-Built-in-Functions-1" href="nds32-built-in-functions">6.60.21 NDS32 Built-in Functions</a></li> <li> +<a id="toc-Basic-PowerPC-Built-in-Functions-1" href="basic-powerpc-built-in-functions">6.60.22 Basic PowerPC Built-in Functions</a> <ul class="toc-numbered-mark"> <li><a id="toc-Basic-PowerPC-Built-in-Functions-Available-on-all-Configurations-1" href="basic-powerpc-built-in-functions-available-on-all-configurations">6.60.22.1 Basic PowerPC Built-in Functions Available on all Configurations</a></li> <li><a id="toc-Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e05-1" href="basic-powerpc-built-in-functions-available-on-isa-2_002e05">6.60.22.2 Basic PowerPC Built-in Functions Available on ISA 2.05</a></li> <li><a id="toc-Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e06-1" href="basic-powerpc-built-in-functions-available-on-isa-2_002e06">6.60.22.3 Basic PowerPC Built-in Functions Available on ISA 2.06</a></li> <li><a id="toc-Basic-PowerPC-Built-in-Functions-Available-on-ISA-2_002e07-1" href="basic-powerpc-built-in-functions-available-on-isa-2_002e07">6.60.22.4 Basic PowerPC Built-in Functions Available on ISA 2.07</a></li> <li><a id="toc-Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e0-1" href="basic-powerpc-built-in-functions-available-on-isa-3_002e0">6.60.22.5 Basic PowerPC Built-in Functions Available on ISA 3.0</a></li> <li><a id="toc-Basic-PowerPC-Built-in-Functions-Available-on-ISA-3_002e1-1" href="basic-powerpc-built-in-functions-available-on-isa-3_002e1">6.60.22.6 Basic PowerPC Built-in Functions Available on ISA 3.1</a></li> </ul> +</li> <li> +<a id="toc-PowerPC-AltiVec_002fVSX-Built-in-Functions-1" href="powerpc-altivec_002fvsx-built-in-functions">6.60.23 PowerPC AltiVec/VSX Built-in Functions</a> <ul class="toc-numbered-mark"> <li><a id="toc-PowerPC-AltiVec-Built-in-Functions-on-ISA-2_002e05-1" href="powerpc-altivec-built-in-functions-on-isa-2_002e05">6.60.23.1 PowerPC AltiVec Built-in Functions on ISA 2.05</a></li> <li><a id="toc-PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e06-1" href="powerpc-altivec-built-in-functions-available-on-isa-2_002e06">6.60.23.2 PowerPC AltiVec Built-in Functions Available on ISA 2.06</a></li> <li><a id="toc-PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e07-1" href="powerpc-altivec-built-in-functions-available-on-isa-2_002e07">6.60.23.3 PowerPC AltiVec Built-in Functions Available on ISA 2.07</a></li> <li><a id="toc-PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e0-1" href="powerpc-altivec-built-in-functions-available-on-isa-3_002e0">6.60.23.4 PowerPC AltiVec Built-in Functions Available on ISA 3.0</a></li> <li><a id="toc-PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e1-1" href="powerpc-altivec-built-in-functions-available-on-isa-3_002e1">6.60.23.5 PowerPC AltiVec Built-in Functions Available on ISA 3.1</a></li> </ul> +</li> <li> +<a id="toc-PowerPC-Hardware-Transactional-Memory-Built-in-Functions-1" href="powerpc-hardware-transactional-memory-built-in-functions">6.60.24 PowerPC Hardware Transactional Memory Built-in Functions</a> <ul class="toc-numbered-mark"> <li><a id="toc-PowerPC-HTM-Low-Level-Built-in-Functions" href="powerpc-hardware-transactional-memory-built-in-functions#PowerPC-HTM-Low-Level-Built-in-Functions">6.60.24.1 PowerPC HTM Low Level Built-in Functions</a></li> <li><a id="toc-PowerPC-HTM-High-Level-Inline-Functions" href="powerpc-hardware-transactional-memory-built-in-functions#PowerPC-HTM-High-Level-Inline-Functions">6.60.24.2 PowerPC HTM High Level Inline Functions</a></li> </ul> +</li> <li><a id="toc-PowerPC-Atomic-Memory-Operation-Functions-1" href="powerpc-atomic-memory-operation-functions">6.60.25 PowerPC Atomic Memory Operation Functions</a></li> <li><a id="toc-PowerPC-Matrix-Multiply-Assist-Built-in-Functions-1" href="powerpc-matrix-multiply-assist-built-in-functions">6.60.26 PowerPC Matrix-Multiply Assist Built-in Functions</a></li> <li><a id="toc-PRU-Built-in-Functions-1" href="pru-built-in-functions">6.60.27 PRU Built-in Functions</a></li> <li><a id="toc-RISC-V-Built-in-Functions-1" href="risc-v-built-in-functions">6.60.28 RISC-V Built-in Functions</a></li> <li><a id="toc-RISC-V-Vector-Intrinsics-1" href="risc-v-vector-intrinsics">6.60.29 RISC-V Vector Intrinsics</a></li> <li><a id="toc-RX-Built-in-Functions-1" href="rx-built-in-functions">6.60.30 RX Built-in Functions</a></li> <li><a id="toc-S_002f390-System-z-Built-in-Functions-1" href="s_002f390-system-z-built-in-functions">6.60.31 S/390 System z Built-in Functions</a></li> <li><a id="toc-SH-Built-in-Functions-1" href="sh-built-in-functions">6.60.32 SH Built-in Functions</a></li> <li><a id="toc-SPARC-VIS-Built-in-Functions-1" href="sparc-vis-built-in-functions">6.60.33 SPARC VIS Built-in Functions</a></li> <li><a id="toc-TI-C6X-Built-in-Functions-1" href="ti-c6x-built-in-functions">6.60.34 TI C6X Built-in Functions</a></li> <li><a id="toc-x86-Built-in-Functions-1" href="x86-built-in-functions">6.60.35 x86 Built-in Functions</a></li> <li><a id="toc-x86-Transactional-Memory-Intrinsics" href="x86-transactional-memory-intrinsics">6.60.36 x86 Transactional Memory Intrinsics</a></li> <li><a id="toc-x86-Control-Flow-Protection-Intrinsics" href="x86-control-flow-protection-intrinsics">6.60.37 x86 Control-Flow Protection Intrinsics</a></li> </ul> +</li> <li> +<a id="toc-Format-Checks-Specific-to-Particular-Target-Machines" href="target-format-checks">6.61 Format Checks Specific to Particular Target Machines</a> <ul class="toc-numbered-mark"> <li><a id="toc-Solaris-Format-Checks-1" href="solaris-format-checks">6.61.1 Solaris Format Checks</a></li> <li><a id="toc-Darwin-Format-Checks-1" href="darwin-format-checks">6.61.2 Darwin Format Checks</a></li> </ul> +</li> <li> +<a id="toc-Pragmas-Accepted-by-GCC" href="pragmas">6.62 Pragmas Accepted by GCC</a> <ul class="toc-numbered-mark"> <li><a id="toc-AArch64-Pragmas-1" href="aarch64-pragmas">6.62.1 AArch64 Pragmas</a></li> <li><a id="toc-ARM-Pragmas-1" href="arm-pragmas">6.62.2 ARM Pragmas</a></li> <li><a id="toc-M32C-Pragmas-1" href="m32c-pragmas">6.62.3 M32C Pragmas</a></li> <li><a id="toc-PRU-Pragmas-1" href="pru-pragmas">6.62.4 PRU Pragmas</a></li> <li><a id="toc-RS_002f6000-and-PowerPC-Pragmas-1" href="rs_002f6000-and-powerpc-pragmas">6.62.5 RS/6000 and PowerPC Pragmas</a></li> <li><a id="toc-S_002f390-Pragmas-1" href="s_002f390-pragmas">6.62.6 S/390 Pragmas</a></li> <li><a id="toc-Darwin-Pragmas-1" href="darwin-pragmas">6.62.7 Darwin Pragmas</a></li> <li><a id="toc-Solaris-Pragmas-1" href="solaris-pragmas">6.62.8 Solaris Pragmas</a></li> <li><a id="toc-Symbol-Renaming-Pragmas-1" href="symbol-renaming-pragmas">6.62.9 Symbol-Renaming Pragmas</a></li> <li><a id="toc-Structure-Layout-Pragmas-1" href="structure-layout-pragmas">6.62.10 Structure-Layout Pragmas</a></li> <li><a id="toc-Weak-Pragmas-1" href="weak-pragmas">6.62.11 Weak Pragmas</a></li> <li><a id="toc-Diagnostic-Pragmas-1" href="diagnostic-pragmas">6.62.12 Diagnostic Pragmas</a></li> <li><a id="toc-Visibility-Pragmas-1" href="visibility-pragmas">6.62.13 Visibility Pragmas</a></li> <li><a id="toc-Push_002fPop-Macro-Pragmas-1" href="push_002fpop-macro-pragmas">6.62.14 Push/Pop Macro Pragmas</a></li> <li><a id="toc-Function-Specific-Option-Pragmas-1" href="function-specific-option-pragmas">6.62.15 Function Specific Option Pragmas</a></li> <li><a id="toc-Loop-Specific-Pragmas-1" href="loop-specific-pragmas">6.62.16 Loop-Specific Pragmas</a></li> </ul> +</li> <li><a id="toc-Unnamed-Structure-and-Union-Fields" href="unnamed-fields">6.63 Unnamed Structure and Union Fields</a></li> <li> +<a id="toc-Thread-Local-Storage" href="thread-local">6.64 Thread-Local Storage</a> <ul class="toc-numbered-mark"> <li><a id="toc-ISO_002fIEC-9899_003a1999-Edits-for-Thread-Local-Storage" href="c99-thread-local-edits">6.64.1 ISO/IEC 9899:1999 Edits for Thread-Local Storage</a></li> <li><a id="toc-ISO_002fIEC-14882_003a1998-Edits-for-Thread-Local-Storage" href="c_002b_002b98-thread-local-edits">6.64.2 ISO/IEC 14882:1998 Edits for Thread-Local Storage</a></li> </ul> +</li> <li><a id="toc-Binary-Constants-using-the-0b-Prefix" href="binary-constants">6.65 Binary Constants using the ‘<samp class="samp">0b</samp>’ Prefix</a></li> </ul> +</li> <li> +<a id="toc-Extensions-to-the-C_002b_002b-Language" href="c_002b_002b-extensions">7 Extensions to the C++ Language</a> <ul class="toc-numbered-mark"> <li><a id="toc-When-is-a-Volatile-C_002b_002b-Object-Accessed_003f" href="c_002b_002b-volatiles">7.1 When is a Volatile C++ Object Accessed?</a></li> <li><a id="toc-Restricting-Pointer-Aliasing" href="restricted-pointers">7.2 Restricting Pointer Aliasing</a></li> <li><a id="toc-Vague-Linkage-1" href="vague-linkage">7.3 Vague Linkage</a></li> <li><a id="toc-C_002b_002b-Interface-and-Implementation-Pragmas" href="c_002b_002b-interface">7.4 C++ Interface and Implementation Pragmas</a></li> <li><a id="toc-Where_0027s-the-Template_003f" href="template-instantiation">7.5 Where’s the Template?</a></li> <li><a id="toc-Extracting-the-Function-Pointer-from-a-Bound-Pointer-to-Member-Function" href="bound-member-functions">7.6 Extracting the Function Pointer from a Bound Pointer to Member Function</a></li> <li><a id="toc-C_002b_002b-Specific-Variable_002c-Function_002c-and-Type-Attributes" href="c_002b_002b-attributes">7.7 C++-Specific Variable, Function, and Type Attributes</a></li> <li><a id="toc-Function-Multiversioning-1" href="function-multiversioning">7.8 Function Multiversioning</a></li> <li><a id="toc-Type-Traits-1" href="type-traits">7.9 Type Traits</a></li> <li><a id="toc-C_002b_002b-Concepts-1" href="c_002b_002b-concepts">7.10 C++ Concepts</a></li> <li><a id="toc-Deprecated-Features-1" href="deprecated-features">7.11 Deprecated Features</a></li> <li><a id="toc-Backwards-Compatibility-1" href="backwards-compatibility">7.12 Backwards Compatibility</a></li> </ul> +</li> <li> +<a id="toc-GNU-Objective-C-Features" href="objective-c">8 GNU Objective-C Features</a> <ul class="toc-numbered-mark"> <li> +<a id="toc-GNU-Objective-C-Runtime-API" href="gnu-objective-c-runtime-api">8.1 GNU Objective-C Runtime API</a> <ul class="toc-numbered-mark"> <li><a id="toc-Modern-GNU-Objective-C-Runtime-API" href="modern-gnu-objective-c-runtime-api">8.1.1 Modern GNU Objective-C Runtime API</a></li> <li><a id="toc-Traditional-GNU-Objective-C-Runtime-API" href="traditional-gnu-objective-c-runtime-api">8.1.2 Traditional GNU Objective-C Runtime API</a></li> </ul> +</li> <li> +<a id="toc-_002bload_003a-Executing-Code-before-main" href="executing-code-before-main">8.2 <code class="code">+load</code>: Executing Code before <code class="code">main</code></a> <ul class="toc-numbered-mark"> <li><a id="toc-What-You-Can-and-Cannot-Do-in-_002bload" href="what-you-can-and-what-you-cannot-do-in-_002bload">8.2.1 What You Can and Cannot Do in <code class="code">+load</code></a></li> </ul> +</li> <li> +<a id="toc-Type-Encoding" href="type-encoding">8.3 Type Encoding</a> <ul class="toc-numbered-mark"> <li><a id="toc-Legacy-Type-Encoding" href="legacy-type-encoding">8.3.1 Legacy Type Encoding</a></li> <li><a id="toc-_0040encode-1" href="_0040encode">8.3.2 <code class="code">@encode</code></a></li> <li><a id="toc-Method-Signatures" href="method-signatures">8.3.3 Method Signatures</a></li> </ul> +</li> <li><a id="toc-Garbage-Collection-1" href="garbage-collection">8.4 Garbage Collection</a></li> <li><a id="toc-Constant-String-Objects" href="constant-string-objects">8.5 Constant String Objects</a></li> <li><a id="toc-compatibility_005falias-1" href="compatibility_005falias">8.6 <code class="code">compatibility_alias</code></a></li> <li><a id="toc-Exceptions-1" href="exceptions">8.7 Exceptions</a></li> <li><a id="toc-Synchronization-1" href="synchronization">8.8 Synchronization</a></li> <li> +<a id="toc-Fast-Enumeration" href="fast-enumeration">8.9 Fast Enumeration</a> <ul class="toc-numbered-mark"> <li><a id="toc-Using-Fast-Enumeration" href="using-fast-enumeration">8.9.1 Using Fast Enumeration</a></li> <li><a id="toc-C99-Like-Fast-Enumeration-Syntax" href="c99-like-fast-enumeration-syntax">8.9.2 C99-Like Fast Enumeration Syntax</a></li> <li><a id="toc-Fast-Enumeration-Details" href="fast-enumeration-details">8.9.3 Fast Enumeration Details</a></li> <li><a id="toc-Fast-Enumeration-Protocol" href="fast-enumeration-protocol">8.9.4 Fast Enumeration Protocol</a></li> </ul> +</li> <li> +<a id="toc-Messaging-with-the-GNU-Objective-C-Runtime" href="messaging-with-the-gnu-objective-c-runtime">8.10 Messaging with the GNU Objective-C Runtime</a> <ul class="toc-numbered-mark"> <li><a id="toc-Dynamically-Registering-Methods" href="dynamically-registering-methods">8.10.1 Dynamically Registering Methods</a></li> <li><a id="toc-Forwarding-Hook" href="forwarding-hook">8.10.2 Forwarding Hook</a></li> </ul> +</li> </ul> +</li> <li><a id="toc-Binary-Compatibility" href="compatibility">9 Binary Compatibility</a></li> <li> +<a id="toc-gcov---a-Test-Coverage-Program" href="gcov">10 <code class="command">gcov</code>—a Test Coverage Program</a> <ul class="toc-numbered-mark"> <li><a id="toc-Introduction-to-gcov" href="gcov-intro">10.1 Introduction to <code class="command">gcov</code></a></li> <li><a id="toc-Invoking-gcov" href="invoking-gcov">10.2 Invoking <code class="command">gcov</code></a></li> <li><a id="toc-Using-gcov-with-GCC-Optimization" href="gcov-and-optimization">10.3 Using <code class="command">gcov</code> with GCC Optimization</a></li> <li><a id="toc-Brief-Description-of-gcov-Data-Files" href="gcov-data-files">10.4 Brief Description of <code class="command">gcov</code> Data Files</a></li> <li><a id="toc-Data-File-Relocation-to-Support-Cross-Profiling" href="cross-profiling">10.5 Data File Relocation to Support Cross-Profiling</a></li> <li> +<a id="toc-Profiling-and-Test-Coverage-in-Freestanding-Environments" href="freestanding-environments">10.6 Profiling and Test Coverage in Freestanding Environments</a> <ul class="toc-numbered-mark"> <li><a id="toc-Overview" href="freestanding-environments#Overview">10.6.1 Overview</a></li> <li><a id="toc-Tutorial" href="freestanding-environments#Tutorial">10.6.2 Tutorial</a></li> <li><a id="toc-System-Initialization-Caveats" href="freestanding-environments#System-Initialization-Caveats">10.6.3 System Initialization Caveats</a></li> </ul> +</li> </ul> +</li> <li> +<a id="toc-gcov-tool---an-Offline-Gcda-Profile-Processing-Tool" href="gcov-tool">11 <code class="command">gcov-tool</code>—an Offline Gcda Profile Processing Tool</a> <ul class="toc-numbered-mark"> <li><a id="toc-Introduction-to-gcov-tool" href="gcov-tool-intro">11.1 Introduction to <code class="command">gcov-tool</code></a></li> <li><a id="toc-Invoking-gcov-tool" href="invoking-gcov-tool">11.2 Invoking <code class="command">gcov-tool</code></a></li> </ul> +</li> <li> +<a id="toc-gcov-dump---an-Offline-Gcda-and-Gcno-Profile-Dump-Tool" href="gcov-dump">12 <code class="command">gcov-dump</code>—an Offline Gcda and Gcno Profile Dump Tool</a> <ul class="toc-numbered-mark"> <li><a id="toc-Introduction-to-gcov-dump" href="gcov-dump-intro">12.1 Introduction to <code class="command">gcov-dump</code></a></li> <li><a id="toc-Invoking-gcov-dump" href="invoking-gcov-dump">12.2 Invoking <code class="command">gcov-dump</code></a></li> </ul> +</li> <li> +<a id="toc-lto-dump---Tool-for-dumping-LTO-object-files_002e" href="lto-dump">13 <code class="command">lto-dump</code>—Tool for dumping LTO object files.</a> <ul class="toc-numbered-mark"> <li><a id="toc-Introduction-to-lto-dump" href="lto-dump-intro">13.1 Introduction to <code class="command">lto-dump</code></a></li> <li><a id="toc-Invoking-lto-dump-1" href="invoking-lto-dump">13.2 Invoking <code class="command">lto-dump</code></a></li> </ul> +</li> <li> +<a id="toc-Known-Causes-of-Trouble-with-GCC" href="trouble">14 Known Causes of Trouble with GCC</a> <ul class="toc-numbered-mark"> <li><a id="toc-Actual-Bugs-We-Haven_0027t-Fixed-Yet" href="actual-bugs">14.1 Actual Bugs We Haven’t Fixed Yet</a></li> <li><a id="toc-Interoperation-1" href="interoperation">14.2 Interoperation</a></li> <li><a id="toc-Incompatibilities-of-GCC" href="incompatibilities">14.3 Incompatibilities of GCC</a></li> <li><a id="toc-Fixed-Header-Files" href="fixed-headers">14.4 Fixed Header Files</a></li> <li><a id="toc-Standard-Libraries-1" href="standard-libraries">14.5 Standard Libraries</a></li> <li><a id="toc-Disappointments-and-Misunderstandings" href="disappointments">14.6 Disappointments and Misunderstandings</a></li> <li> +<a id="toc-Common-Misunderstandings-with-GNU-C_002b_002b" href="c_002b_002b-misunderstandings">14.7 Common Misunderstandings with GNU C++</a> <ul class="toc-numbered-mark"> <li><a id="toc-Declare-and-Define-Static-Members" href="static-definitions">14.7.1 Declare <em class="emph">and</em> Define Static Members</a></li> <li><a id="toc-Name-Lookup_002c-Templates_002c-and-Accessing-Members-of-Base-Classes" href="name-lookup">14.7.2 Name Lookup, Templates, and Accessing Members of Base Classes</a></li> <li><a id="toc-Temporaries-May-Vanish-Before-You-Expect" href="temporaries">14.7.3 Temporaries May Vanish Before You Expect</a></li> <li><a id="toc-Implicit-Copy-Assignment-for-Virtual-Bases" href="copy-assignment">14.7.4 Implicit Copy-Assignment for Virtual Bases</a></li> </ul> +</li> <li><a id="toc-Certain-Changes-We-Don_0027t-Want-to-Make" href="non-bugs">14.8 Certain Changes We Don’t Want to Make</a></li> <li><a id="toc-Warning-Messages-and-Error-Messages" href="warnings-and-errors">14.9 Warning Messages and Error Messages</a></li> </ul> +</li> <li> +<a id="toc-Reporting-Bugs" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Bugs.html">15 Reporting Bugs</a> <ul class="toc-numbered-mark"> <li><a id="toc-Have-You-Found-a-Bug_003f" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Bug-Criteria.html">15.1 Have You Found a Bug?</a></li> <li><a id="toc-How-and-Where-to-Report-Bugs" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Bug-Reporting.html">15.2 How and Where to Report Bugs</a></li> </ul> +</li> <li><a id="toc-How-To-Get-Help-with-GCC" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Service.html">16 How To Get Help with GCC</a></li> <li><a id="toc-Contributing-to-GCC-Development" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Contributing.html">17 Contributing to GCC Development</a></li> <li><a id="toc-Funding-Free-Software" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Funding.html">Funding Free Software</a></li> <li><a id="toc-The-GNU-Project-and-GNU_002fLinux" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/GNU-Project.html">The GNU Project and GNU/Linux</a></li> <li><a id="toc-GNU-General-Public-License" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Copying.html">GNU General Public License</a></li> <li> +<a id="toc-GNU-Free-Documentation-License-1" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/GNU-Free-Documentation-License.html">GNU Free Documentation License</a> <ul class="toc-numbered-mark"> <li><a id="toc-ADDENDUM_003a-How-to-use-this-License-for-your-documents" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/GNU-Free-Documentation-License.html#ADDENDUM_003a-How-to-use-this-License-for-your-documents">ADDENDUM: How to use this License for your documents</a></li> </ul> +</li> <li><a id="toc-Contributors-to-GCC" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Contributors.html">Contributors to GCC</a></li> <li> +<a id="toc-Indices-1" href="indices">Appendix A Indices</a> <ul class="toc-numbered-mark"> <li><a id="toc-Option-Index-1" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Option-Index.html" rel="index">A.1 Option Index</a></li> <li><a id="toc-Concept-and-Symbol-Index-1" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Concept-and-Symbol-Index.html" rel="index">A.2 Concept and Symbol Index</a></li> </ul> +</li> </ul> </div> </div> <div class="top-level-extent" id="Top"> <div class="nav-panel"> <p> Next: <a href="g_002b_002b-and-gcc" accesskey="n" rel="next">Programming Languages Supported by GCC</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="top" id="Introduction"><span>Introduction<a class="copiable-link" href="#Introduction"> ¶</a></span></h1> <p>This manual documents how to use the GNU compilers, as well as their features and incompatibilities, and how to report bugs. It corresponds to the compilers (GCC) version 13.1.0. The internals of the GNU compilers, including how to port them to new targets and some information about how to write front ends for new languages, are documented in a separate manual. See <a data-manual="gccint" href="https://gcc.gnu.org/onlinedocs/gccint/index.html#Top">Introduction</a> in GNU Compiler Collection (GCC) Internals. </p> <ul class="mini-toc"> <li><a href="g_002b_002b-and-gcc" accesskey="1">Programming Languages Supported by GCC</a></li> <li><a href="standards" accesskey="2">Language Standards Supported by GCC</a></li> <li><a href="invoking-gcc" accesskey="3">GCC Command Options</a></li> <li><a href="c-implementation" accesskey="4">C Implementation-Defined Behavior</a></li> <li><a href="c_002b_002b-implementation" accesskey="5">C++ Implementation-Defined Behavior</a></li> <li><a href="c-extensions" accesskey="6">Extensions to the C Language Family</a></li> <li><a href="c_002b_002b-extensions" accesskey="7">Extensions to the C++ Language</a></li> <li><a href="objective-c" accesskey="8">GNU Objective-C Features</a></li> <li><a href="compatibility" accesskey="9">Binary Compatibility</a></li> <li><a href="gcov"><code class="command">gcov</code>—a Test Coverage Program</a></li> <li><a href="gcov-tool"><code class="command">gcov-tool</code>—an Offline Gcda Profile Processing Tool</a></li> <li><a href="gcov-dump"><code class="command">gcov-dump</code>—an Offline Gcda and Gcno Profile Dump Tool</a></li> <li><a href="lto-dump"><code class="command">lto-dump</code>—Tool for dumping LTO object files.</a></li> <li><a href="trouble">Known Causes of Trouble with GCC</a></li> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Bugs.html">Reporting Bugs</a></li> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Service.html">How To Get Help with GCC</a></li> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Contributing.html">Contributing to GCC Development</a></li> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Funding.html">Funding Free Software</a></li> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/GNU-Project.html">The GNU Project and GNU/Linux</a></li> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Copying.html">GNU General Public License</a></li> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/GNU-Free-Documentation-License.html">GNU Free Documentation License</a></li> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Contributors.html">Contributors to GCC</a></li> <li><a href="indices">Indices</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="g_002b_002b-and-gcc" accesskey="n" rel="next">Programming Languages Supported by GCC</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/index.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/index.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/indices.html b/devdocs/gcc~13/indices.html new file mode 100644 index 00000000..9161a20b --- /dev/null +++ b/devdocs/gcc~13/indices.html @@ -0,0 +1,6 @@ +<div class="appendix-level-extent" id="Indices"> <div class="nav-panel"> <p> Previous: <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Contributors.html" accesskey="p" rel="prev">Contributors to GCC</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="appendix" id="Indices-1"><span>Appendix A Indices<a class="copiable-link" href="#Indices-1"> ¶</a></span></h1> <ul class="mini-toc"> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Option-Index.html" accesskey="1">Option Index</a></li> <li><a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Concept-and-Symbol-Index.html" accesskey="2">Concept and Symbol Index</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Indices.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Indices.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/initializers.html b/devdocs/gcc~13/initializers.html new file mode 100644 index 00000000..d457b9be --- /dev/null +++ b/devdocs/gcc~13/initializers.html @@ -0,0 +1,11 @@ +<div class="section-level-extent" id="Initializers"> <div class="nav-panel"> <p> Next: <a href="compound-literals" accesskey="n" rel="next">Compound Literals</a>, Previous: <a href="pointers-to-arrays" accesskey="p" rel="prev">Pointers to Arrays with Qualifiers Work as Expected</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Non-Constant-Initializers"><span>6.27 Non-Constant Initializers<a class="copiable-link" href="#Non-Constant-Initializers"> ¶</a></span></h1> <p>As in standard C++ and ISO C99, the elements of an aggregate initializer for an automatic variable are not required to be constant expressions in GNU C. Here is an example of an initializer with run-time varying elements: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">foo (float f, float g) +{ + float beat_freqs[2] = { f-g, f+g }; + /* <span class="r">…</span> */ +}</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Initializers.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Initializers.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/inline.html b/devdocs/gcc~13/inline.html new file mode 100644 index 00000000..39d462a5 --- /dev/null +++ b/devdocs/gcc~13/inline.html @@ -0,0 +1,19 @@ +<div class="section-level-extent" id="Inline"> <div class="nav-panel"> <p> Next: <a href="volatiles" accesskey="n" rel="next">When is a Volatile Object Accessed?</a>, Previous: <a href="alignment" accesskey="p" rel="prev">Determining the Alignment of Functions, Types or Variables</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="An-Inline-Function-is-As-Fast-As-a-Macro"><span>6.45 An Inline Function is As Fast As a Macro<a class="copiable-link" href="#An-Inline-Function-is-As-Fast-As-a-Macro"> ¶</a></span></h1> <p>By declaring a function inline, you can direct GCC to make calls to that function faster. One way GCC can achieve this is to integrate that function’s code into the code for its callers. This makes execution faster by eliminating the function-call overhead; in addition, if any of the actual argument values are constant, their known values may permit simplifications at compile time so that not all of the inline function’s code needs to be included. The effect on code size is less predictable; object code may be larger or smaller with function inlining, depending on the particular case. You can also direct GCC to try to integrate all “simple enough” functions into their callers with the option <samp class="option">-finline-functions</samp>. </p> <p>GCC implements three different semantics of declaring a function inline. One is available with <samp class="option">-std=gnu89</samp> or <samp class="option">-fgnu89-inline</samp> or when <code class="code">gnu_inline</code> attribute is present on all inline declarations, another when <samp class="option">-std=c99</samp>, <samp class="option">-std=gnu99</samp> or an option for a later C version is used (without <samp class="option">-fgnu89-inline</samp>), and the third is used when compiling C++. </p> <p>To declare a function inline, use the <code class="code">inline</code> keyword in its declaration, like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static inline int +inc (int *a) +{ + return (*a)++; +}</pre> +</div> <p>If you are writing a header file to be included in ISO C90 programs, write <code class="code">__inline__</code> instead of <code class="code">inline</code>. See <a class="xref" href="alternate-keywords">Alternate Keywords</a>. </p> <p>The three types of inlining behave similarly in two important cases: when the <code class="code">inline</code> keyword is used on a <code class="code">static</code> function, like the example above, and when a function is first declared without using the <code class="code">inline</code> keyword and then is defined with <code class="code">inline</code>, like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern int inc (int *a); +inline int +inc (int *a) +{ + return (*a)++; +}</pre> +</div> <p>In both of these common cases, the program behaves the same as if you had not used the <code class="code">inline</code> keyword, except for its speed. </p> <p>When a function is both inline and <code class="code">static</code>, if all calls to the function are integrated into the caller, and the function’s address is never used, then the function’s own assembler code is never referenced. In this case, GCC does not actually output assembler code for the function, unless you specify the option <samp class="option">-fkeep-inline-functions</samp>. If there is a nonintegrated call, then the function is compiled to assembler code as usual. The function must also be compiled as usual if the program refers to its address, because that cannot be inlined. </p> <p>Note that certain usages in a function definition can make it unsuitable for inline substitution. Among these usages are: variadic functions, use of <code class="code">alloca</code>, use of computed goto (see <a class="pxref" href="labels-as-values">Labels as Values</a>), use of nonlocal goto, use of nested functions, use of <code class="code">setjmp</code>, use of <code class="code">__builtin_longjmp</code> and use of <code class="code">__builtin_return</code> or <code class="code">__builtin_apply_args</code>. Using <samp class="option">-Winline</samp> warns when a function marked <code class="code">inline</code> could not be substituted, and gives the reason for the failure. </p> <p>As required by ISO C++, GCC considers member functions defined within the body of a class to be marked inline even if they are not explicitly declared with the <code class="code">inline</code> keyword. You can override this with <samp class="option">-fno-default-inline</samp>; see <a class="pxref" href="c_002b_002b-dialect-options">Options Controlling C++ Dialect</a>. </p> <p>GCC does not inline any functions when not optimizing unless you specify the ‘<samp class="samp">always_inline</samp>’ attribute for the function, like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">/* <span class="r">Prototype.</span> */ +inline void foo (const char) __attribute__((always_inline));</pre> +</div> <p>The remainder of this section is specific to GNU C90 inlining. </p> <p>When an inline function is not <code class="code">static</code>, then the compiler must assume that there may be calls from other source files; since a global symbol can be defined only once in any program, the function must not be defined in the other source files, so the calls therein cannot be integrated. Therefore, a non-<code class="code">static</code> inline function is always compiled on its own in the usual fashion. </p> <p>If you specify both <code class="code">inline</code> and <code class="code">extern</code> in the function definition, then the definition is used only for inlining. In no case is the function compiled on its own, not even if you refer to its address explicitly. Such an address becomes an external reference, as if you had only declared the function, and had not defined it. </p> <p>This combination of <code class="code">inline</code> and <code class="code">extern</code> has almost the effect of a macro. The way to use it is to put a function definition in a header file with these keywords, and put another copy of the definition (lacking <code class="code">inline</code> and <code class="code">extern</code>) in a library file. The definition in the header file causes most calls to the function to be inlined. If any uses of the function remain, they refer to the single copy in the library. </p> </div> <div class="nav-panel"> <p> Next: <a href="volatiles">When is a Volatile Object Accessed?</a>, Previous: <a href="alignment">Determining the Alignment of Functions, Types or Variables</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Inline.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Inline.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/instrumentation-options.html b/devdocs/gcc~13/instrumentation-options.html new file mode 100644 index 00000000..f4ea0835 --- /dev/null +++ b/devdocs/gcc~13/instrumentation-options.html @@ -0,0 +1,291 @@ +<div class="section-level-extent" id="Instrumentation-Options"> <div class="nav-panel"> <p> Next: <a href="preprocessor-options" accesskey="n" rel="next">Options Controlling the Preprocessor</a>, Previous: <a href="optimize-options" accesskey="p" rel="prev">Options That Control Optimization</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Program-Instrumentation-Options"><span>3.12 Program Instrumentation Options<a class="copiable-link" href="#Program-Instrumentation-Options"> ¶</a></span></h1> <p>GCC supports a number of command-line options that control adding run-time instrumentation to the code it normally generates. For example, one purpose of instrumentation is collect profiling statistics for use in finding program hot spots, code coverage analysis, or profile-guided optimizations. Another class of program instrumentation is adding run-time checking to detect programming errors like invalid pointer dereferences or out-of-bounds array accesses, as well as deliberately hostile attacks such as stack smashing or C++ vtable hijacking. There is also a general hook which can be used to implement other forms of tracing or function-level instrumentation for debug or program analysis purposes. </p> <dl class="table"> <dt> + <span><code class="code">-p</code><a class="copiable-link" href="#index-prof"> ¶</a></span> +</dt> <dt><code class="code">-pg</code></dt> <dd> +<p>Generate extra code to write profile information suitable for the analysis program <code class="command">prof</code> (for <samp class="option">-p</samp>) or <code class="command">gprof</code> (for <samp class="option">-pg</samp>). You must use this option when compiling the source files you want data about, and you must also use it when linking. </p> <p>You can use the function attribute <code class="code">no_instrument_function</code> to suppress profiling of individual functions when compiling with these options. See <a class="xref" href="common-function-attributes">Common Function Attributes</a>. </p> </dd> <dt> +<span><code class="code">-fprofile-arcs</code><a class="copiable-link" href="#index-fprofile-arcs"> ¶</a></span> +</dt> <dd> +<p>Add code so that program flow <em class="dfn">arcs</em> are instrumented. During execution the program records how many times each branch and call is executed and how many times it is taken or returns. On targets that support constructors with priority support, profiling properly handles constructors, destructors and C++ constructors (and destructors) of classes which are used as a type of a global variable. </p> <p>When the compiled program exits it saves this data to a file called <samp class="file"><var class="var">auxname</var>.gcda</samp> for each source file. The data may be used for profile-directed optimizations (<samp class="option">-fbranch-probabilities</samp>), or for test coverage analysis (<samp class="option">-ftest-coverage</samp>). Each object file’s <var class="var">auxname</var> is generated from the name of the output file, if explicitly specified and it is not the final executable, otherwise it is the basename of the source file. In both cases any suffix is removed (e.g. <samp class="file">foo.gcda</samp> for input file <samp class="file">dir/foo.c</samp>, or <samp class="file">dir/foo.gcda</samp> for output file specified as <samp class="option">-o dir/foo.o</samp>). </p> <p>Note that if a command line directly links source files, the corresponding <var class="var">.gcda</var> files will be prefixed with the unsuffixed name of the output file. E.g. <code class="code">gcc a.c b.c -o binary</code> would generate <samp class="file">binary-a.gcda</samp> and <samp class="file">binary-b.gcda</samp> files. </p> <p>See <a class="xref" href="cross-profiling">Data File Relocation to Support Cross-Profiling</a>. </p> </dd> <dt> + <span><code class="code">--coverage</code><a class="copiable-link" href="#index-gcov"> ¶</a></span> +</dt> <dd> <p>This option is used to compile and link code instrumented for coverage analysis. The option is a synonym for <samp class="option">-fprofile-arcs</samp> <samp class="option">-ftest-coverage</samp> (when compiling) and <samp class="option">-lgcov</samp> (when linking). See the documentation for those options for more details. </p> <ul class="itemize mark-bullet"> <li>Compile the source files with <samp class="option">-fprofile-arcs</samp> plus optimization and code generation options. For test coverage analysis, use the additional <samp class="option">-ftest-coverage</samp> option. You do not need to profile every source file in a program. </li> +<li>Compile the source files additionally with <samp class="option">-fprofile-abs-path</samp> to create absolute path names in the <samp class="file">.gcno</samp> files. This allows <code class="command">gcov</code> to find the correct sources in projects where compilations occur with different working directories. </li> +<li>Link your object files with <samp class="option">-lgcov</samp> or <samp class="option">-fprofile-arcs</samp> (the latter implies the former). </li> +<li>Run the program on a representative workload to generate the arc profile information. This may be repeated any number of times. You can run concurrent instances of your program, and provided that the file system supports locking, the data files will be correctly updated. Unless a strict ISO C dialect option is in effect, <code class="code">fork</code> calls are detected and correctly handled without double counting. <p>Moreover, an object file can be recompiled multiple times and the corresponding <samp class="file">.gcda</samp> file merges as long as the source file and the compiler options are unchanged. </p> </li> +<li>For profile-directed optimizations, compile the source files again with the same optimization and code generation options plus <samp class="option">-fbranch-probabilities</samp> (see <a class="pxref" href="optimize-options">Options that Control Optimization</a>). </li> +<li>For test coverage analysis, use <code class="command">gcov</code> to produce human readable information from the <samp class="file">.gcno</samp> and <samp class="file">.gcda</samp> files. Refer to the <code class="command">gcov</code> documentation for further information. </li> +</ul> <p>With <samp class="option">-fprofile-arcs</samp>, for each function of your program GCC creates a program flow graph, then finds a spanning tree for the graph. Only arcs that are not on the spanning tree have to be instrumented: the compiler adds code to count the number of times that these arcs are executed. When an arc is the only exit or only entrance to a block, the instrumentation code can be added to the block; otherwise, a new basic block must be created to hold the instrumentation code. </p> </dd> <dt> +<span><code class="code">-ftest-coverage</code><a class="copiable-link" href="#index-ftest-coverage"> ¶</a></span> +</dt> <dd> +<p>Produce a notes file that the <code class="command">gcov</code> code-coverage utility (see <a class="pxref" href="gcov"><code class="command">gcov</code>—a Test Coverage Program</a>) can use to show program coverage. Each source file’s note file is called <samp class="file"><var class="var">auxname</var>.gcno</samp>. Refer to the <samp class="option">-fprofile-arcs</samp> option above for a description of <var class="var">auxname</var> and instructions on how to generate test coverage data. Coverage data matches the source files more closely if you do not optimize. </p> </dd> <dt> +<span><code class="code">-fprofile-abs-path</code><a class="copiable-link" href="#index-fprofile-abs-path"> ¶</a></span> +</dt> <dd> +<p>Automatically convert relative source file names to absolute path names in the <samp class="file">.gcno</samp> files. This allows <code class="command">gcov</code> to find the correct sources in projects where compilations occur with different working directories. </p> </dd> <dt> +<span><code class="code">-fprofile-dir=<var class="var">path</var></code><a class="copiable-link" href="#index-fprofile-dir"> ¶</a></span> +</dt> <dd> <p>Set the directory to search for the profile data files in to <var class="var">path</var>. This option affects only the profile data generated by <samp class="option">-fprofile-generate</samp>, <samp class="option">-ftest-coverage</samp>, <samp class="option">-fprofile-arcs</samp> and used by <samp class="option">-fprofile-use</samp> and <samp class="option">-fbranch-probabilities</samp> and its related options. Both absolute and relative paths can be used. By default, GCC uses the current directory as <var class="var">path</var>, thus the profile data file appears in the same directory as the object file. In order to prevent the file name clashing, if the object file name is not an absolute path, we mangle the absolute path of the <samp class="file"><var class="var">sourcename</var>.gcda</samp> file and use it as the file name of a <samp class="file">.gcda</samp> file. See details about the file naming in <samp class="option">-fprofile-arcs</samp>. See similar option <samp class="option">-fprofile-note</samp>. </p> <p>When an executable is run in a massive parallel environment, it is recommended to save profile to different folders. That can be done with variables in <var class="var">path</var> that are exported during run-time: </p> <dl class="table"> <dt><code class="code">%p</code></dt> <dd> +<p>process ID. </p> </dd> <dt><code class="code">%q{VAR}</code></dt> <dd> +<p>value of environment variable <var class="var">VAR</var> </p> </dd> </dl> </dd> <dt> +<span><code class="code">-fprofile-generate</code><a class="copiable-link" href="#index-fprofile-generate"> ¶</a></span> +</dt> <dt><code class="code">-fprofile-generate=<var class="var">path</var></code></dt> <dd> <p>Enable options usually used for instrumenting application to produce profile useful for later recompilation with profile feedback based optimization. You must use <samp class="option">-fprofile-generate</samp> both when compiling and when linking your program. </p> <p>The following options are enabled: <samp class="option">-fprofile-arcs</samp>, <samp class="option">-fprofile-values</samp>, <samp class="option">-finline-functions</samp>, and <samp class="option">-fipa-bit-cp</samp>. </p> <p>If <var class="var">path</var> is specified, GCC looks at the <var class="var">path</var> to find the profile feedback data files. See <samp class="option">-fprofile-dir</samp>. </p> <p>To optimize the program based on the collected profile information, use <samp class="option">-fprofile-use</samp>. See <a class="xref" href="optimize-options">Options That Control Optimization</a>, for more information. </p> </dd> <dt> +<span><code class="code">-fprofile-info-section</code><a class="copiable-link" href="#index-fprofile-info-section"> ¶</a></span> +</dt> <dt><code class="code">-fprofile-info-section=<var class="var">name</var></code></dt> <dd> <p>Register the profile information in the specified section instead of using a constructor/destructor. The section name is <var class="var">name</var> if it is specified, otherwise the section name defaults to <code class="code">.gcov_info</code>. A pointer to the profile information generated by <samp class="option">-fprofile-arcs</samp> is placed in the specified section for each translation unit. This option disables the profile information registration through a constructor and it disables the profile information processing through a destructor. This option is not intended to be used in hosted environments such as GNU/Linux. It targets freestanding environments (for example embedded systems) with limited resources which do not support constructors/destructors or the C library file I/O. </p> <p>The linker could collect the input sections in a continuous memory block and define start and end symbols. A GNU linker script example which defines a linker output section follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">.gcov_info : +{ + PROVIDE (__gcov_info_start = .); + KEEP (*(.gcov_info)) + PROVIDE (__gcov_info_end = .); +}</pre> +</div> <p>The program could dump the profiling information registered in this linker set for example like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <gcov.h> +#include <stdio.h> +#include <stdlib.h> + +extern const struct gcov_info *const __gcov_info_start[]; +extern const struct gcov_info *const __gcov_info_end[]; + +static void +dump (const void *d, unsigned n, void *arg) +{ + const unsigned char *c = d; + + for (unsigned i = 0; i < n; ++i) + printf ("%02x", c[i]); +} + +static void +filename (const char *f, void *arg) +{ + __gcov_filename_to_gcfn (f, dump, arg ); +} + +static void * +allocate (unsigned length, void *arg) +{ + return malloc (length); +} + +static void +dump_gcov_info (void) +{ + const struct gcov_info *const *info = __gcov_info_start; + const struct gcov_info *const *end = __gcov_info_end; + + /* Obfuscate variable to prevent compiler optimizations. */ + __asm__ ("" : "+r" (info)); + + while (info != end) + { + void *arg = NULL; + __gcov_info_to_gcda (*info, filename, dump, allocate, arg); + putchar ('\n'); + ++info; + } +} + +int +main (void) +{ + dump_gcov_info (); + return 0; +}</pre> +</div> <p>The <code class="command">merge-stream</code> subcommand of <code class="command">gcov-tool</code> may be used to deserialize the data stream generated by the <code class="code">__gcov_filename_to_gcfn</code> and <code class="code">__gcov_info_to_gcda</code> functions and merge the profile information into <samp class="file">.gcda</samp> files on the host filesystem. </p> </dd> <dt> +<span><code class="code">-fprofile-note=<var class="var">path</var></code><a class="copiable-link" href="#index-fprofile-note"> ¶</a></span> +</dt> <dd> <p>If <var class="var">path</var> is specified, GCC saves <samp class="file">.gcno</samp> file into <var class="var">path</var> location. If you combine the option with multiple source files, the <samp class="file">.gcno</samp> file will be overwritten. </p> </dd> <dt> +<span><code class="code">-fprofile-prefix-path=<var class="var">path</var></code><a class="copiable-link" href="#index-fprofile-prefix-path"> ¶</a></span> +</dt> <dd> <p>This option can be used in combination with <samp class="option">profile-generate=</samp><var class="var">profile_dir</var> and <samp class="option">profile-use=</samp><var class="var">profile_dir</var> to inform GCC where is the base directory of built source tree. By default <var class="var">profile_dir</var> will contain files with mangled absolute paths of all object files in the built project. This is not desirable when directory used to build the instrumented binary differs from the directory used to build the binary optimized with profile feedback because the profile data will not be found during the optimized build. In such setups <samp class="option">-fprofile-prefix-path=</samp><var class="var">path</var> with <var class="var">path</var> pointing to the base directory of the build can be used to strip the irrelevant part of the path and keep all file names relative to the main build directory. </p> </dd> <dt> +<span><code class="code">-fprofile-prefix-map=<var class="var">old</var>=<var class="var">new</var></code><a class="copiable-link" href="#index-fprofile-prefix-map"> ¶</a></span> +</dt> <dd> +<p>When compiling files residing in directory <samp class="file"><var class="var">old</var></samp>, record profiling information (with <samp class="option">--coverage</samp>) describing them as if the files resided in directory <samp class="file"><var class="var">new</var></samp> instead. See also <samp class="option">-ffile-prefix-map</samp> and <samp class="option">-fcanon-prefix-map</samp>. </p> </dd> <dt> +<span><code class="code">-fprofile-update=<var class="var">method</var></code><a class="copiable-link" href="#index-fprofile-update"> ¶</a></span> +</dt> <dd> <p>Alter the update method for an application instrumented for profile feedback based optimization. The <var class="var">method</var> argument should be one of ‘<samp class="samp">single</samp>’, ‘<samp class="samp">atomic</samp>’ or ‘<samp class="samp">prefer-atomic</samp>’. The first one is useful for single-threaded applications, while the second one prevents profile corruption by emitting thread-safe code. </p> <p><strong class="strong">Warning:</strong> When an application does not properly join all threads (or creates an detached thread), a profile file can be still corrupted. </p> <p>Using ‘<samp class="samp">prefer-atomic</samp>’ would be transformed either to ‘<samp class="samp">atomic</samp>’, when supported by a target, or to ‘<samp class="samp">single</samp>’ otherwise. The GCC driver automatically selects ‘<samp class="samp">prefer-atomic</samp>’ when <samp class="option">-pthread</samp> is present in the command line. </p> </dd> <dt> +<span><code class="code">-fprofile-filter-files=<var class="var">regex</var></code><a class="copiable-link" href="#index-fprofile-filter-files"> ¶</a></span> +</dt> <dd> <p>Instrument only functions from files whose name matches any of the regular expressions (separated by semi-colons). </p> <p>For example, <samp class="option">-fprofile-filter-files=main\.c;module.*\.c</samp> will instrument only <samp class="file">main.c</samp> and all C files starting with ’module’. </p> </dd> <dt> +<span><code class="code">-fprofile-exclude-files=<var class="var">regex</var></code><a class="copiable-link" href="#index-fprofile-exclude-files"> ¶</a></span> +</dt> <dd> <p>Instrument only functions from files whose name does not match any of the regular expressions (separated by semi-colons). </p> <p>For example, <samp class="option">-fprofile-exclude-files=/usr/.*</samp> will prevent instrumentation of all files that are located in the <samp class="file">/usr/</samp> folder. </p> </dd> <dt> +<span><code class="code">-fprofile-reproducible=<span class="r">[</span>multithreaded<span class="r">|</span>parallel-runs<span class="r">|</span>serial<span class="r">]</span></code><a class="copiable-link" href="#index-fprofile-reproducible"> ¶</a></span> +</dt> <dd> +<p>Control level of reproducibility of profile gathered by <code class="code">-fprofile-generate</code>. This makes it possible to rebuild program with same outcome which is useful, for example, for distribution packages. </p> <p>With <samp class="option">-fprofile-reproducible=serial</samp> the profile gathered by <samp class="option">-fprofile-generate</samp> is reproducible provided the trained program behaves the same at each invocation of the train run, it is not multi-threaded and profile data streaming is always done in the same order. Note that profile streaming happens at the end of program run but also before <code class="code">fork</code> function is invoked. </p> <p>Note that it is quite common that execution counts of some part of programs depends, for example, on length of temporary file names or memory space randomization (that may affect hash-table collision rate). Such non-reproducible part of programs may be annotated by <code class="code">no_instrument_function</code> function attribute. <code class="command">gcov-dump</code> with <samp class="option">-l</samp> can be used to dump gathered data and verify that they are indeed reproducible. </p> <p>With <samp class="option">-fprofile-reproducible=parallel-runs</samp> collected profile stays reproducible regardless the order of streaming of the data into gcda files. This setting makes it possible to run multiple instances of instrumented program in parallel (such as with <code class="code">make -j</code>). This reduces quality of gathered data, in particular of indirect call profiling. </p> </dd> <dt> +<span><code class="code">-fsanitize=address</code><a class="copiable-link" href="#index-fsanitize_003daddress"> ¶</a></span> +</dt> <dd> +<p>Enable AddressSanitizer, a fast memory error detector. Memory access instructions are instrumented to detect out-of-bounds and use-after-free bugs. The option enables <samp class="option">-fsanitize-address-use-after-scope</samp>. See <a class="uref" href="https://github.com/google/sanitizers/wiki/AddressSanitizer">https://github.com/google/sanitizers/wiki/AddressSanitizer</a> for more details. The run-time behavior can be influenced using the <code class="env">ASAN_OPTIONS</code> environment variable. When set to <code class="code">help=1</code>, the available options are shown at startup of the instrumented program. See <a class="url" href="https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags">https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags</a> for a list of supported options. The option cannot be combined with <samp class="option">-fsanitize=thread</samp> or <samp class="option">-fsanitize=hwaddress</samp>. Note that the only target <samp class="option">-fsanitize=hwaddress</samp> is currently supported on is AArch64. </p> <p>To get more accurate stack traces, it is possible to use options such as <samp class="option">-O0</samp>, <samp class="option">-O1</samp>, or <samp class="option">-Og</samp> (which, for instance, prevent most function inlining), <samp class="option">-fno-optimize-sibling-calls</samp> (which prevents optimizing sibling and tail recursive calls; this option is implicit for <samp class="option">-O0</samp>, <samp class="option">-O1</samp>, or <samp class="option">-Og</samp>), or <samp class="option">-fno-ipa-icf</samp> (which disables Identical Code Folding for functions). Since multiple runs of the program may yield backtraces with different addresses due to ASLR (Address Space Layout Randomization), it may be desirable to turn ASLR off. On Linux, this can be achieved with ‘<samp class="samp">setarch `uname -m` -R ./prog</samp>’. </p> </dd> <dt> +<span><code class="code">-fsanitize=kernel-address</code><a class="copiable-link" href="#index-fsanitize_003dkernel-address"> ¶</a></span> +</dt> <dd> +<p>Enable AddressSanitizer for Linux kernel. See <a class="uref" href="https://github.com/google/kernel-sanitizers">https://github.com/google/kernel-sanitizers</a> for more details. </p> </dd> <dt> +<span><code class="code">-fsanitize=hwaddress</code><a class="copiable-link" href="#index-fsanitize_003dhwaddress"> ¶</a></span> +</dt> <dd> +<p>Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to ignore the top byte of a pointer to allow the detection of memory errors with a low memory overhead. Memory access instructions are instrumented to detect out-of-bounds and use-after-free bugs. The option enables <samp class="option">-fsanitize-address-use-after-scope</samp>. See <a class="uref" href="https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html">https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html</a> for more details. The run-time behavior can be influenced using the <code class="env">HWASAN_OPTIONS</code> environment variable. When set to <code class="code">help=1</code>, the available options are shown at startup of the instrumented program. The option cannot be combined with <samp class="option">-fsanitize=thread</samp> or <samp class="option">-fsanitize=address</samp>, and is currently only available on AArch64. </p> </dd> <dt> +<span><code class="code">-fsanitize=kernel-hwaddress</code><a class="copiable-link" href="#index-fsanitize_003dkernel-hwaddress"> ¶</a></span> +</dt> <dd> +<p>Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel. Similar to <samp class="option">-fsanitize=kernel-address</samp> but using an alternate instrumentation method, and similar to <samp class="option">-fsanitize=hwaddress</samp> but with instrumentation differences necessary for compiling the Linux kernel. These differences are to avoid hwasan library initialization calls and to account for the stack pointer having a different value in its top byte. </p> <p><em class="emph">Note:</em> This option has different defaults to the <samp class="option">-fsanitize=hwaddress</samp>. Instrumenting the stack and alloca calls are not on by default but are still possible by specifying the command-line options <samp class="option">--param hwasan-instrument-stack=1</samp> and <samp class="option">--param hwasan-instrument-allocas=1</samp> respectively. Using a random frame tag is not implemented for kernel instrumentation. </p> </dd> <dt> +<span><code class="code">-fsanitize=pointer-compare</code><a class="copiable-link" href="#index-fsanitize_003dpointer-compare"> ¶</a></span> +</dt> <dd> +<p>Instrument comparison operation (<, <=, >, >=) with pointer operands. The option must be combined with either <samp class="option">-fsanitize=kernel-address</samp> or <samp class="option">-fsanitize=address</samp> The option cannot be combined with <samp class="option">-fsanitize=thread</samp>. Note: By default the check is disabled at run time. To enable it, add <code class="code">detect_invalid_pointer_pairs=2</code> to the environment variable <code class="env">ASAN_OPTIONS</code>. Using <code class="code">detect_invalid_pointer_pairs=1</code> detects invalid operation only when both pointers are non-null. </p> </dd> <dt> +<span><code class="code">-fsanitize=pointer-subtract</code><a class="copiable-link" href="#index-fsanitize_003dpointer-subtract"> ¶</a></span> +</dt> <dd> +<p>Instrument subtraction with pointer operands. The option must be combined with either <samp class="option">-fsanitize=kernel-address</samp> or <samp class="option">-fsanitize=address</samp> The option cannot be combined with <samp class="option">-fsanitize=thread</samp>. Note: By default the check is disabled at run time. To enable it, add <code class="code">detect_invalid_pointer_pairs=2</code> to the environment variable <code class="env">ASAN_OPTIONS</code>. Using <code class="code">detect_invalid_pointer_pairs=1</code> detects invalid operation only when both pointers are non-null. </p> </dd> <dt> +<span><code class="code">-fsanitize=shadow-call-stack</code><a class="copiable-link" href="#index-fsanitize_003dshadow-call-stack"> ¶</a></span> +</dt> <dd> +<p>Enable ShadowCallStack, a security enhancement mechanism used to protect programs against return address overwrites (e.g. stack buffer overflows.) It works by saving a function’s return address to a separately allocated shadow call stack in the function prologue and restoring the return address from the shadow call stack in the function epilogue. Instrumentation only occurs in functions that need to save the return address to the stack. </p> <p>Currently it only supports the aarch64 platform. It is specifically designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option. For the user space programs, runtime support is not currently provided in libc and libgcc. Users who want to use this feature in user space need to provide their own support for the runtime. It should be noted that this may cause the ABI rules to be broken. </p> <p>On aarch64, the instrumentation makes use of the platform register <code class="code">x18</code>. This generally means that any code that may run on the same thread as code compiled with ShadowCallStack must be compiled with the flag <samp class="option">-ffixed-x18</samp>, otherwise functions compiled without <samp class="option">-ffixed-x18</samp> might clobber <code class="code">x18</code> and so corrupt the shadow stack pointer. </p> <p>Also, because there is no userspace runtime support, code compiled with ShadowCallStack cannot use exception handling. Use <samp class="option">-fno-exceptions</samp> to turn off exceptions. </p> <p>See <a class="uref" href="https://clang.llvm.org/docs/ShadowCallStack.html">https://clang.llvm.org/docs/ShadowCallStack.html</a> for more details. </p> </dd> <dt> +<span><code class="code">-fsanitize=thread</code><a class="copiable-link" href="#index-fsanitize_003dthread"> ¶</a></span> +</dt> <dd> +<p>Enable ThreadSanitizer, a fast data race detector. Memory access instructions are instrumented to detect data race bugs. See <a class="uref" href="https://github.com/google/sanitizers/wiki#threadsanitizer">https://github.com/google/sanitizers/wiki#threadsanitizer</a> for more details. The run-time behavior can be influenced using the <code class="env">TSAN_OPTIONS</code> environment variable; see <a class="url" href="https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags">https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags</a> for a list of supported options. The option cannot be combined with <samp class="option">-fsanitize=address</samp>, <samp class="option">-fsanitize=leak</samp>. </p> <p>Note that sanitized atomic builtins cannot throw exceptions when operating on invalid memory addresses with non-call exceptions (<samp class="option">-fnon-call-exceptions</samp>). </p> </dd> <dt> +<span><code class="code">-fsanitize=leak</code><a class="copiable-link" href="#index-fsanitize_003dleak"> ¶</a></span> +</dt> <dd> +<p>Enable LeakSanitizer, a memory leak detector. This option only matters for linking of executables. The executable is linked against a library that overrides <code class="code">malloc</code> and other allocator functions. See <a class="uref" href="https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer">https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer</a> for more details. The run-time behavior can be influenced using the <code class="env">LSAN_OPTIONS</code> environment variable. The option cannot be combined with <samp class="option">-fsanitize=thread</samp>. </p> </dd> <dt> +<span><code class="code">-fsanitize=undefined</code><a class="copiable-link" href="#index-fsanitize_003dundefined"> ¶</a></span> +</dt> <dd> +<p>Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector. Various computations are instrumented to detect undefined behavior at runtime. See <a class="uref" href="https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html">https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html</a> for more details. The run-time behavior can be influenced using the <code class="env">UBSAN_OPTIONS</code> environment variable. Current suboptions are: </p> <dl class="table"> <dt> +<span><code class="code">-fsanitize=shift</code><a class="copiable-link" href="#index-fsanitize_003dshift"> ¶</a></span> +</dt> <dd> +<p>This option enables checking that the result of a shift operation is not undefined. Note that what exactly is considered undefined differs slightly between C and C++, as well as between ISO C90 and C99, etc. This option has two suboptions, <samp class="option">-fsanitize=shift-base</samp> and <samp class="option">-fsanitize=shift-exponent</samp>. </p> </dd> <dt> +<span><code class="code">-fsanitize=shift-exponent</code><a class="copiable-link" href="#index-fsanitize_003dshift-exponent"> ¶</a></span> +</dt> <dd> +<p>This option enables checking that the second argument of a shift operation is not negative and is smaller than the precision of the promoted first argument. </p> </dd> <dt> +<span><code class="code">-fsanitize=shift-base</code><a class="copiable-link" href="#index-fsanitize_003dshift-base"> ¶</a></span> +</dt> <dd> +<p>If the second argument of a shift operation is within range, check that the result of a shift operation is not undefined. Note that what exactly is considered undefined differs slightly between C and C++, as well as between ISO C90 and C99, etc. </p> </dd> <dt> +<span><code class="code">-fsanitize=integer-divide-by-zero</code><a class="copiable-link" href="#index-fsanitize_003dinteger-divide-by-zero"> ¶</a></span> +</dt> <dd> +<p>Detect integer division by zero. </p> </dd> <dt> +<span><code class="code">-fsanitize=unreachable</code><a class="copiable-link" href="#index-fsanitize_003dunreachable"> ¶</a></span> +</dt> <dd> +<p>With this option, the compiler turns the <code class="code">__builtin_unreachable</code> call into a diagnostics message call instead. When reaching the <code class="code">__builtin_unreachable</code> call, the behavior is undefined. </p> </dd> <dt> +<span><code class="code">-fsanitize=vla-bound</code><a class="copiable-link" href="#index-fsanitize_003dvla-bound"> ¶</a></span> +</dt> <dd> +<p>This option instructs the compiler to check that the size of a variable length array is positive. </p> </dd> <dt> +<span><code class="code">-fsanitize=null</code><a class="copiable-link" href="#index-fsanitize_003dnull"> ¶</a></span> +</dt> <dd> +<p>This option enables pointer checking. Particularly, the application built with this option turned on will issue an error message when it tries to dereference a NULL pointer, or if a reference (possibly an rvalue reference) is bound to a NULL pointer, or if a method is invoked on an object pointed by a NULL pointer. </p> </dd> <dt> +<span><code class="code">-fsanitize=return</code><a class="copiable-link" href="#index-fsanitize_003dreturn"> ¶</a></span> +</dt> <dd> +<p>This option enables return statement checking. Programs built with this option turned on will issue an error message when the end of a non-void function is reached without actually returning a value. This option works in C++ only. </p> </dd> <dt> +<span><code class="code">-fsanitize=signed-integer-overflow</code><a class="copiable-link" href="#index-fsanitize_003dsigned-integer-overflow"> ¶</a></span> +</dt> <dd> +<p>This option enables signed integer overflow checking. We check that the result of <code class="code">+</code>, <code class="code">*</code>, and both unary and binary <code class="code">-</code> does not overflow in the signed arithmetics. This also detects <code class="code">INT_MIN / -1</code> signed division. Note, integer promotion rules must be taken into account. That is, the following is not an overflow: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">signed char a = SCHAR_MAX; +a++;</pre> +</div> </dd> <dt> +<span><code class="code">-fsanitize=bounds</code><a class="copiable-link" href="#index-fsanitize_003dbounds"> ¶</a></span> +</dt> <dd> +<p>This option enables instrumentation of array bounds. Various out of bounds accesses are detected. Flexible array members, flexible array member-like arrays, and initializers of variables with static storage are not instrumented, with the exception of flexible array member-like arrays for which <code class="code">-fstrict-flex-arrays</code> or <code class="code">-fstrict-flex-arrays=</code> options or <code class="code">strict_flex_array</code> attributes say they shouldn’t be treated like flexible array member-like arrays. </p> </dd> <dt> +<span><code class="code">-fsanitize=bounds-strict</code><a class="copiable-link" href="#index-fsanitize_003dbounds-strict"> ¶</a></span> +</dt> <dd> +<p>This option enables strict instrumentation of array bounds. Most out of bounds accesses are detected, including flexible array member-like arrays. Initializers of variables with static storage are not instrumented. </p> </dd> <dt> +<span><code class="code">-fsanitize=alignment</code><a class="copiable-link" href="#index-fsanitize_003dalignment"> ¶</a></span> +</dt> <dd> <p>This option enables checking of alignment of pointers when they are dereferenced, or when a reference is bound to insufficiently aligned target, or when a method or constructor is invoked on insufficiently aligned object. </p> </dd> <dt> +<span><code class="code">-fsanitize=object-size</code><a class="copiable-link" href="#index-fsanitize_003dobject-size"> ¶</a></span> +</dt> <dd> +<p>This option enables instrumentation of memory references using the <code class="code">__builtin_dynamic_object_size</code> function. Various out of bounds pointer accesses are detected. </p> </dd> <dt> +<span><code class="code">-fsanitize=float-divide-by-zero</code><a class="copiable-link" href="#index-fsanitize_003dfloat-divide-by-zero"> ¶</a></span> +</dt> <dd> +<p>Detect floating-point division by zero. Unlike other similar options, <samp class="option">-fsanitize=float-divide-by-zero</samp> is not enabled by <samp class="option">-fsanitize=undefined</samp>, since floating-point division by zero can be a legitimate way of obtaining infinities and NaNs. </p> </dd> <dt> +<span><code class="code">-fsanitize=float-cast-overflow</code><a class="copiable-link" href="#index-fsanitize_003dfloat-cast-overflow"> ¶</a></span> +</dt> <dd> +<p>This option enables floating-point type to integer conversion checking. We check that the result of the conversion does not overflow. Unlike other similar options, <samp class="option">-fsanitize=float-cast-overflow</samp> is not enabled by <samp class="option">-fsanitize=undefined</samp>. This option does not work well with <code class="code">FE_INVALID</code> exceptions enabled. </p> </dd> <dt> +<span><code class="code">-fsanitize=nonnull-attribute</code><a class="copiable-link" href="#index-fsanitize_003dnonnull-attribute"> ¶</a></span> +</dt> <dd> <p>This option enables instrumentation of calls, checking whether null values are not passed to arguments marked as requiring a non-null value by the <code class="code">nonnull</code> function attribute. </p> </dd> <dt> +<span><code class="code">-fsanitize=returns-nonnull-attribute</code><a class="copiable-link" href="#index-fsanitize_003dreturns-nonnull-attribute"> ¶</a></span> +</dt> <dd> <p>This option enables instrumentation of return statements in functions marked with <code class="code">returns_nonnull</code> function attribute, to detect returning of null values from such functions. </p> </dd> <dt> +<span><code class="code">-fsanitize=bool</code><a class="copiable-link" href="#index-fsanitize_003dbool"> ¶</a></span> +</dt> <dd> <p>This option enables instrumentation of loads from bool. If a value other than 0/1 is loaded, a run-time error is issued. </p> </dd> <dt> +<span><code class="code">-fsanitize=enum</code><a class="copiable-link" href="#index-fsanitize_003denum"> ¶</a></span> +</dt> <dd> <p>This option enables instrumentation of loads from an enum type. If a value outside the range of values for the enum type is loaded, a run-time error is issued. </p> </dd> <dt> +<span><code class="code">-fsanitize=vptr</code><a class="copiable-link" href="#index-fsanitize_003dvptr"> ¶</a></span> +</dt> <dd> <p>This option enables instrumentation of C++ member function calls, member accesses and some conversions between pointers to base and derived classes, to verify the referenced object has the correct dynamic type. </p> </dd> <dt> +<span><code class="code">-fsanitize=pointer-overflow</code><a class="copiable-link" href="#index-fsanitize_003dpointer-overflow"> ¶</a></span> +</dt> <dd> <p>This option enables instrumentation of pointer arithmetics. If the pointer arithmetics overflows, a run-time error is issued. </p> </dd> <dt> +<span><code class="code">-fsanitize=builtin</code><a class="copiable-link" href="#index-fsanitize_003dbuiltin"> ¶</a></span> +</dt> <dd> <p>This option enables instrumentation of arguments to selected builtin functions. If an invalid value is passed to such arguments, a run-time error is issued. E.g. passing 0 as the argument to <code class="code">__builtin_ctz</code> or <code class="code">__builtin_clz</code> invokes undefined behavior and is diagnosed by this option. </p> </dd> </dl> <p>Note that sanitizers tend to increase the rate of false positive warnings, most notably those around <samp class="option">-Wmaybe-uninitialized</samp>. We recommend against combining <samp class="option">-Werror</samp> and [the use of] sanitizers. </p> <p>While <samp class="option">-ftrapv</samp> causes traps for signed overflows to be emitted, <samp class="option">-fsanitize=undefined</samp> gives a diagnostic message. This currently works only for the C family of languages. </p> </dd> <dt> +<span><code class="code">-fno-sanitize=all</code><a class="copiable-link" href="#index-fno-sanitize_003dall"> ¶</a></span> +</dt> <dd> <p>This option disables all previously enabled sanitizers. <samp class="option">-fsanitize=all</samp> is not allowed, as some sanitizers cannot be used together. </p> </dd> <dt> +<span><code class="code">-fasan-shadow-offset=<var class="var">number</var></code><a class="copiable-link" href="#index-fasan-shadow-offset"> ¶</a></span> +</dt> <dd> +<p>This option forces GCC to use custom shadow offset in AddressSanitizer checks. It is useful for experimenting with different shadow memory layouts in Kernel AddressSanitizer. </p> </dd> <dt> +<span><code class="code">-fsanitize-sections=<var class="var">s1</var>,<var class="var">s2</var>,...</code><a class="copiable-link" href="#index-fsanitize-sections"> ¶</a></span> +</dt> <dd> +<p>Sanitize global variables in selected user-defined sections. <var class="var">si</var> may contain wildcards. </p> </dd> <dt> + <span><code class="code">-fsanitize-recover<span class="r">[</span>=<var class="var">opts</var><span class="r">]</span></code><a class="copiable-link" href="#index-fsanitize-recover"> ¶</a></span> +</dt> <dd> +<p><samp class="option">-fsanitize-recover=</samp> controls error recovery mode for sanitizers mentioned in comma-separated list of <var class="var">opts</var>. Enabling this option for a sanitizer component causes it to attempt to continue running the program as if no error happened. This means multiple runtime errors can be reported in a single program run, and the exit code of the program may indicate success even when errors have been reported. The <samp class="option">-fno-sanitize-recover=</samp> option can be used to alter this behavior: only the first detected error is reported and program then exits with a non-zero exit code. </p> <p>Currently this feature only works for <samp class="option">-fsanitize=undefined</samp> (and its suboptions except for <samp class="option">-fsanitize=unreachable</samp> and <samp class="option">-fsanitize=return</samp>), <samp class="option">-fsanitize=float-cast-overflow</samp>, <samp class="option">-fsanitize=float-divide-by-zero</samp>, <samp class="option">-fsanitize=bounds-strict</samp>, <samp class="option">-fsanitize=kernel-address</samp> and <samp class="option">-fsanitize=address</samp>. For these sanitizers error recovery is turned on by default, except <samp class="option">-fsanitize=address</samp>, for which this feature is experimental. <samp class="option">-fsanitize-recover=all</samp> and <samp class="option">-fno-sanitize-recover=all</samp> is also accepted, the former enables recovery for all sanitizers that support it, the latter disables recovery for all sanitizers that support it. </p> <p>Even if a recovery mode is turned on the compiler side, it needs to be also enabled on the runtime library side, otherwise the failures are still fatal. The runtime library defaults to <code class="code">halt_on_error=0</code> for ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for AddressSanitizer is <code class="code">halt_on_error=1</code>. This can be overridden through setting the <code class="code">halt_on_error</code> flag in the corresponding environment variable. </p> <p>Syntax without an explicit <var class="var">opts</var> parameter is deprecated. It is equivalent to specifying an <var class="var">opts</var> list of: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">undefined,float-cast-overflow,float-divide-by-zero,bounds-strict</pre> +</div> </dd> <dt> +<span><code class="code">-fsanitize-address-use-after-scope</code><a class="copiable-link" href="#index-fsanitize-address-use-after-scope"> ¶</a></span> +</dt> <dd> +<p>Enable sanitization of local variables to detect use-after-scope bugs. The option sets <samp class="option">-fstack-reuse</samp> to ‘<samp class="samp">none</samp>’. </p> </dd> <dt> + <span><code class="code">-fsanitize-trap<span class="r">[</span>=<var class="var">opts</var><span class="r">]</span></code><a class="copiable-link" href="#index-fsanitize-trap"> ¶</a></span> +</dt> <dd> +<p>The <samp class="option">-fsanitize-trap=</samp> option instructs the compiler to report for sanitizers mentioned in comma-separated list of <var class="var">opts</var> undefined behavior using <code class="code">__builtin_trap</code> rather than a <code class="code">libubsan</code> library routine. If this option is enabled for certain sanitizer, it takes precedence over the <samp class="option">-fsanitizer-recover=</samp> for that sanitizer, <code class="code">__builtin_trap</code> will be emitted and be fatal regardless of whether recovery is enabled or disabled using <samp class="option">-fsanitize-recover=</samp>. </p> <p>The advantage of this is that the <code class="code">libubsan</code> library is not needed and is not linked in, so this is usable even in freestanding environments. </p> <p>Currently this feature works with <samp class="option">-fsanitize=undefined</samp> (and its suboptions except for <samp class="option">-fsanitize=vptr</samp>), <samp class="option">-fsanitize=float-cast-overflow</samp>, <samp class="option">-fsanitize=float-divide-by-zero</samp> and <samp class="option">-fsanitize=bounds-strict</samp>. <code class="code">-fsanitize-trap=all</code> can be also specified, which enables it for <code class="code">undefined</code> suboptions, <samp class="option">-fsanitize=float-cast-overflow</samp>, <samp class="option">-fsanitize=float-divide-by-zero</samp> and <samp class="option">-fsanitize=bounds-strict</samp>. If <code class="code">-fsanitize-trap=undefined</code> or <code class="code">-fsanitize-trap=all</code> is used and <code class="code">-fsanitize=vptr</code> is enabled on the command line, the instrumentation is silently ignored as the instrumentation always needs <code class="code">libubsan</code> support, <samp class="option">-fsanitize-trap=vptr</samp> is not allowed. </p> </dd> <dt> +<span><code class="code">-fsanitize-undefined-trap-on-error</code><a class="copiable-link" href="#index-fsanitize-undefined-trap-on-error"> ¶</a></span> +</dt> <dd> +<p>The <samp class="option">-fsanitize-undefined-trap-on-error</samp> option is deprecated equivalent of <samp class="option">-fsanitize-trap=all</samp>. </p> </dd> <dt> +<span><code class="code">-fsanitize-coverage=trace-pc</code><a class="copiable-link" href="#index-fsanitize-coverage_003dtrace-pc"> ¶</a></span> +</dt> <dd> +<p>Enable coverage-guided fuzzing code instrumentation. Inserts a call to <code class="code">__sanitizer_cov_trace_pc</code> into every basic block. </p> </dd> <dt> +<span><code class="code">-fsanitize-coverage=trace-cmp</code><a class="copiable-link" href="#index-fsanitize-coverage_003dtrace-cmp"> ¶</a></span> +</dt> <dd> +<p>Enable dataflow guided fuzzing code instrumentation. Inserts a call to <code class="code">__sanitizer_cov_trace_cmp1</code>, <code class="code">__sanitizer_cov_trace_cmp2</code>, <code class="code">__sanitizer_cov_trace_cmp4</code> or <code class="code">__sanitizer_cov_trace_cmp8</code> for integral comparison with both operands variable or <code class="code">__sanitizer_cov_trace_const_cmp1</code>, <code class="code">__sanitizer_cov_trace_const_cmp2</code>, <code class="code">__sanitizer_cov_trace_const_cmp4</code> or <code class="code">__sanitizer_cov_trace_const_cmp8</code> for integral comparison with one operand constant, <code class="code">__sanitizer_cov_trace_cmpf</code> or <code class="code">__sanitizer_cov_trace_cmpd</code> for float or double comparisons and <code class="code">__sanitizer_cov_trace_switch</code> for switch statements. </p> </dd> <dt> +<span><code class="code">-fcf-protection=<span class="r">[</span>full<span class="r">|</span>branch<span class="r">|</span>return<span class="r">|</span>none<span class="r">|</span>check<span class="r">]</span></code><a class="copiable-link" href="#index-fcf-protection"> ¶</a></span> +</dt> <dd> +<p>Enable code instrumentation of control-flow transfers to increase program security by checking that target addresses of control-flow transfer instructions (such as indirect function call, function return, indirect jump) are valid. This prevents diverting the flow of control to an unexpected target. This is intended to protect against such threats as Return-oriented Programming (ROP), and similarly call/jmp-oriented programming (COP/JOP). </p> <p>The value <code class="code">branch</code> tells the compiler to implement checking of validity of control-flow transfer at the point of indirect branch instructions, i.e. call/jmp instructions. The value <code class="code">return</code> implements checking of validity at the point of returning from a function. The value <code class="code">full</code> is an alias for specifying both <code class="code">branch</code> and <code class="code">return</code>. The value <code class="code">none</code> turns off instrumentation. </p> <p>The value <code class="code">check</code> is used for the final link with link-time optimization (LTO). An error is issued if LTO object files are compiled with different <samp class="option">-fcf-protection</samp> values. The value <code class="code">check</code> is ignored at the compile time. </p> <p>The macro <code class="code">__CET__</code> is defined when <samp class="option">-fcf-protection</samp> is used. The first bit of <code class="code">__CET__</code> is set to 1 for the value <code class="code">branch</code> and the second bit of <code class="code">__CET__</code> is set to 1 for the <code class="code">return</code>. </p> <p>You can also use the <code class="code">nocf_check</code> attribute to identify which functions and calls should be skipped from instrumentation (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> <p>Currently the x86 GNU/Linux target provides an implementation based on Intel Control-flow Enforcement Technology (CET) which works for i686 processor or newer. </p> </dd> <dt> +<span><code class="code">-fharden-compares</code><a class="copiable-link" href="#index-fharden-compares"> ¶</a></span> +</dt> <dd> +<p>For every logical test that survives gimple optimizations and is <em class="emph">not</em> the condition in a conditional branch (for example, conditions tested for conditional moves, or to store in boolean variables), emit extra code to compute and verify the reversed condition, and to call <code class="code">__builtin_trap</code> if the results do not match. Use with ‘<samp class="samp">-fharden-conditional-branches</samp>’ to cover all conditionals. </p> </dd> <dt> +<span><code class="code">-fharden-conditional-branches</code><a class="copiable-link" href="#index-fharden-conditional-branches"> ¶</a></span> +</dt> <dd> +<p>For every non-vectorized conditional branch that survives gimple optimizations, emit extra code to compute and verify the reversed condition, and to call <code class="code">__builtin_trap</code> if the result is unexpected. Use with ‘<samp class="samp">-fharden-compares</samp>’ to cover all conditionals. </p> </dd> <dt> +<span><code class="code">-fstack-protector</code><a class="copiable-link" href="#index-fstack-protector"> ¶</a></span> +</dt> <dd> +<p>Emit extra code to check for buffer overflows, such as stack smashing attacks. This is done by adding a guard variable to functions with vulnerable objects. This includes functions that call <code class="code">alloca</code>, and functions with buffers larger than or equal to 8 bytes. The guards are initialized when a function is entered and then checked when the function exits. If a guard check fails, an error message is printed and the program exits. Only variables that are actually allocated on the stack are considered, optimized away variables or variables allocated in registers don’t count. </p> </dd> <dt> +<span><code class="code">-fstack-protector-all</code><a class="copiable-link" href="#index-fstack-protector-all"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-fstack-protector</samp> except that all functions are protected. </p> </dd> <dt> +<span><code class="code">-fstack-protector-strong</code><a class="copiable-link" href="#index-fstack-protector-strong"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-fstack-protector</samp> but includes additional functions to be protected — those that have local array definitions, or have references to local frame addresses. Only variables that are actually allocated on the stack are considered, optimized away variables or variables allocated in registers don’t count. </p> </dd> <dt> +<span><code class="code">-fstack-protector-explicit</code><a class="copiable-link" href="#index-fstack-protector-explicit"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-fstack-protector</samp> but only protects those functions which have the <code class="code">stack_protect</code> attribute. </p> </dd> <dt> +<span><code class="code">-fstack-check</code><a class="copiable-link" href="#index-fstack-check"> ¶</a></span> +</dt> <dd> +<p>Generate code to verify that you do not go beyond the boundary of the stack. You should specify this flag if you are running in an environment with multiple threads, but you only rarely need to specify it in a single-threaded environment since stack overflow is automatically detected on nearly all systems if there is only one stack. </p> <p>Note that this switch does not actually cause checking to be done; the operating system or the language runtime must do that. The switch causes generation of code to ensure that they see the stack being extended. </p> <p>You can additionally specify a string parameter: ‘<samp class="samp">no</samp>’ means no checking, ‘<samp class="samp">generic</samp>’ means force the use of old-style checking, ‘<samp class="samp">specific</samp>’ means use the best checking method and is equivalent to bare <samp class="option">-fstack-check</samp>. </p> <p>Old-style checking is a generic mechanism that requires no specific target support in the compiler but comes with the following drawbacks: </p> <ol class="enumerate"> <li> Modified allocation strategy for large objects: they are always allocated dynamically if their size exceeds a fixed threshold. Note this may change the semantics of some code. </li> +<li> Fixed limit on the size of the static frame of functions: when it is topped by a particular function, stack checking is not reliable and a warning is issued by the compiler. </li> +<li> Inefficiency: because of both the modified allocation strategy and the generic implementation, code performance is hampered. </li> +</ol> <p>Note that old-style stack checking is also the fallback method for ‘<samp class="samp">specific</samp>’ if no target support has been added in the compiler. </p> <p>‘<samp class="samp">-fstack-check=</samp>’ is designed for Ada’s needs to detect infinite recursion and stack overflows. ‘<samp class="samp">specific</samp>’ is an excellent choice when compiling Ada code. It is not generally sufficient to protect against stack-clash attacks. To protect against those you want ‘<samp class="samp">-fstack-clash-protection</samp>’. </p> </dd> <dt> +<span><code class="code">-fstack-clash-protection</code><a class="copiable-link" href="#index-fstack-clash-protection"> ¶</a></span> +</dt> <dd> +<p>Generate code to prevent stack clash style attacks. When this option is enabled, the compiler will only allocate one page of stack space at a time and each page is accessed immediately after allocation. Thus, it prevents allocations from jumping over any stack guard page provided by the operating system. </p> <p>Most targets do not fully support stack clash protection. However, on those targets <samp class="option">-fstack-clash-protection</samp> will protect dynamic stack allocations. <samp class="option">-fstack-clash-protection</samp> may also provide limited protection for static stack allocations if the target supports <samp class="option">-fstack-check=specific</samp>. </p> </dd> <dt> + <span><code class="code">-fstack-limit-register=<var class="var">reg</var></code><a class="copiable-link" href="#index-fstack-limit-register"> ¶</a></span> +</dt> <dt><code class="code">-fstack-limit-symbol=<var class="var">sym</var></code></dt> <dt><code class="code">-fno-stack-limit</code></dt> <dd> +<p>Generate code to ensure that the stack does not grow beyond a certain value, either the value of a register or the address of a symbol. If a larger stack is required, a signal is raised at run time. For most targets, the signal is raised before the stack overruns the boundary, so it is possible to catch the signal without taking special precautions. </p> <p>For instance, if the stack starts at absolute address ‘<samp class="samp">0x80000000</samp>’ and grows downwards, you can use the flags <samp class="option">-fstack-limit-symbol=__stack_limit</samp> and <samp class="option">-Wl,--defsym,__stack_limit=0x7ffe0000</samp> to enforce a stack limit of 128KB. Note that this may only work with the GNU linker. </p> <p>You can locally override stack limit checking by using the <code class="code">no_stack_limit</code> function attribute (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> </dd> <dt> +<span><code class="code">-fsplit-stack</code><a class="copiable-link" href="#index-fsplit-stack"> ¶</a></span> +</dt> <dd> +<p>Generate code to automatically split the stack before it overflows. The resulting program has a discontiguous stack which can only overflow if the program is unable to allocate any more memory. This is most useful when running threaded programs, as it is no longer necessary to calculate a good stack size to use for each thread. This is currently only implemented for the x86 targets running GNU/Linux. </p> <p>When code compiled with <samp class="option">-fsplit-stack</samp> calls code compiled without <samp class="option">-fsplit-stack</samp>, there may not be much stack space available for the latter code to run. If compiling all code, including library code, with <samp class="option">-fsplit-stack</samp> is not an option, then the linker can fix up these calls so that the code compiled without <samp class="option">-fsplit-stack</samp> always has a large stack. Support for this is implemented in the gold linker in GNU binutils release 2.21 and later. </p> </dd> <dt> +<span><code class="code">-fvtable-verify=<span class="r">[</span>std<span class="r">|</span>preinit<span class="r">|</span>none<span class="r">]</span></code><a class="copiable-link" href="#index-fvtable-verify"> ¶</a></span> +</dt> <dd> +<p>This option is only available when compiling C++ code. It turns on (or off, if using <samp class="option">-fvtable-verify=none</samp>) the security feature that verifies at run time, for every virtual call, that the vtable pointer through which the call is made is valid for the type of the object, and has not been corrupted or overwritten. If an invalid vtable pointer is detected at run time, an error is reported and execution of the program is immediately halted. </p> <p>This option causes run-time data structures to be built at program startup, which are used for verifying the vtable pointers. The options ‘<samp class="samp">std</samp>’ and ‘<samp class="samp">preinit</samp>’ control the timing of when these data structures are built. In both cases the data structures are built before execution reaches <code class="code">main</code>. Using <samp class="option">-fvtable-verify=std</samp> causes the data structures to be built after shared libraries have been loaded and initialized. <samp class="option">-fvtable-verify=preinit</samp> causes them to be built before shared libraries have been loaded and initialized. </p> <p>If this option appears multiple times in the command line with different values specified, ‘<samp class="samp">none</samp>’ takes highest priority over both ‘<samp class="samp">std</samp>’ and ‘<samp class="samp">preinit</samp>’; ‘<samp class="samp">preinit</samp>’ takes priority over ‘<samp class="samp">std</samp>’. </p> </dd> <dt> +<span><code class="code">-fvtv-debug</code><a class="copiable-link" href="#index-fvtv-debug"> ¶</a></span> +</dt> <dd> +<p>When used in conjunction with <samp class="option">-fvtable-verify=std</samp> or <samp class="option">-fvtable-verify=preinit</samp>, causes debug versions of the runtime functions for the vtable verification feature to be called. This flag also causes the compiler to log information about which vtable pointers it finds for each class. This information is written to a file named <samp class="file">vtv_set_ptr_data.log</samp> in the directory named by the environment variable <code class="env">VTV_LOGS_DIR</code> if that is defined or the current working directory otherwise. </p> <p>Note: This feature <em class="emph">appends</em> data to the log file. If you want a fresh log file, be sure to delete any existing one. </p> </dd> <dt> +<span><code class="code">-fvtv-counts</code><a class="copiable-link" href="#index-fvtv-counts"> ¶</a></span> +</dt> <dd> +<p>This is a debugging flag. When used in conjunction with <samp class="option">-fvtable-verify=std</samp> or <samp class="option">-fvtable-verify=preinit</samp>, this causes the compiler to keep track of the total number of virtual calls it encounters and the number of verifications it inserts. It also counts the number of calls to certain run-time library functions that it inserts and logs this information for each compilation unit. The compiler writes this information to a file named <samp class="file">vtv_count_data.log</samp> in the directory named by the environment variable <code class="env">VTV_LOGS_DIR</code> if that is defined or the current working directory otherwise. It also counts the size of the vtable pointer sets for each class, and writes this information to <samp class="file">vtv_class_set_sizes.log</samp> in the same directory. </p> <p>Note: This feature <em class="emph">appends</em> data to the log files. To get fresh log files, be sure to delete any existing ones. </p> </dd> <dt> +<span><code class="code">-finstrument-functions</code><a class="copiable-link" href="#index-finstrument-functions"> ¶</a></span> +</dt> <dd> +<p>Generate instrumentation calls for entry and exit to functions. Just after function entry and just before function exit, the following profiling functions are called with the address of the current function and its call site. (On some platforms, <code class="code">__builtin_return_address</code> does not work beyond the current function, so the call site information may not be available to the profiling functions otherwise.) </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __cyg_profile_func_enter (void *this_fn, + void *call_site); +void __cyg_profile_func_exit (void *this_fn, + void *call_site);</pre> +</div> <p>The first argument is the address of the start of the current function, which may be looked up exactly in the symbol table. </p> <p>This instrumentation is also done for functions expanded inline in other functions. The profiling calls indicate where, conceptually, the inline function is entered and exited. This means that addressable versions of such functions must be available. If all your uses of a function are expanded inline, this may mean an additional expansion of code size. If you use <code class="code">extern inline</code> in your C code, an addressable version of such functions must be provided. (This is normally the case anyway, but if you get lucky and the optimizer always expands the functions inline, you might have gotten away without providing static copies.) </p> <p>A function may be given the attribute <code class="code">no_instrument_function</code>, in which case this instrumentation is not done. This can be used, for example, for the profiling functions listed above, high-priority interrupt routines, and any functions from which the profiling functions cannot safely be called (perhaps signal handlers, if the profiling routines generate output or allocate memory). See <a class="xref" href="common-function-attributes">Common Function Attributes</a>. </p> </dd> <dt> +<span><code class="code">-finstrument-functions-once</code><a class="copiable-link" href="#index-finstrument-functions-once"> ¶</a></span> +</dt> <dd> +<p>This is similar to <samp class="option">-finstrument-functions</samp>, but the profiling functions are called only once per instrumented function, i.e. the first profiling function is called after the first entry into the instrumented function and the second profiling function is called before the exit corresponding to this first entry. </p> <p>The definition of <code class="code">once</code> for the purpose of this option is a little vague because the implementation is not protected against data races. As a result, the implementation only guarantees that the profiling functions are called at <em class="emph">least</em> once per process and at <em class="emph">most</em> once per thread, but the calls are always paired, that is to say, if a thread calls the first function, then it will call the second function, unless it never reaches the exit of the instrumented function. </p> </dd> <dt> +<span><code class="code">-finstrument-functions-exclude-file-list=<var class="var">file</var>,<var class="var">file</var>,…</code><a class="copiable-link" href="#index-finstrument-functions-exclude-file-list"> ¶</a></span> +</dt> <dd> <p>Set the list of functions that are excluded from instrumentation (see the description of <samp class="option">-finstrument-functions</samp>). If the file that contains a function definition matches with one of <var class="var">file</var>, then that function is not instrumented. The match is done on substrings: if the <var class="var">file</var> parameter is a substring of the file name, it is considered to be a match. </p> <p>For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-finstrument-functions-exclude-file-list=/bits/stl,include/sys</pre> +</div> <p>excludes any inline function defined in files whose pathnames contain <samp class="file">/bits/stl</samp> or <samp class="file">include/sys</samp>. </p> <p>If, for some reason, you want to include letter ‘<samp class="samp">,</samp>’ in one of <var class="var">sym</var>, write ‘<samp class="samp">\,</samp>’. For example, <samp class="option">-finstrument-functions-exclude-file-list='\,\,tmp'</samp> (note the single quote surrounding the option). </p> </dd> <dt> +<span><code class="code">-finstrument-functions-exclude-function-list=<var class="var">sym</var>,<var class="var">sym</var>,…</code><a class="copiable-link" href="#index-finstrument-functions-exclude-function-list"> ¶</a></span> +</dt> <dd> <p>This is similar to <samp class="option">-finstrument-functions-exclude-file-list</samp>, but this option sets the list of function names to be excluded from instrumentation. The function name to be matched is its user-visible name, such as <code class="code">vector<int> blah(const vector<int> &)</code>, not the internal mangled name (e.g., <code class="code">_Z4blahRSt6vectorIiSaIiEE</code>). The match is done on substrings: if the <var class="var">sym</var> parameter is a substring of the function name, it is considered to be a match. For C99 and C++ extended identifiers, the function name must be given in UTF-8, not using universal character names. </p> </dd> <dt> +<span><code class="code">-fpatchable-function-entry=<var class="var">N</var>[,<var class="var">M</var>]</code><a class="copiable-link" href="#index-fpatchable-function-entry"> ¶</a></span> +</dt> <dd> +<p>Generate <var class="var">N</var> NOPs right at the beginning of each function, with the function entry point before the <var class="var">M</var>th NOP. If <var class="var">M</var> is omitted, it defaults to <code class="code">0</code> so the function entry points to the address just at the first NOP. The NOP instructions reserve extra space which can be used to patch in any desired instrumentation at run time, provided that the code segment is writable. The amount of space is controllable indirectly via the number of NOPs; the NOP instruction used corresponds to the instruction emitted by the internal GCC back-end interface <code class="code">gen_nop</code>. This behavior is target-specific and may also depend on the architecture variant and/or other compilation options. </p> <p>For run-time identification, the starting addresses of these areas, which correspond to their respective function entries minus <var class="var">M</var>, are additionally collected in the <code class="code">__patchable_function_entries</code> section of the resulting binary. </p> <p>Note that the value of <code class="code">__attribute__ ((patchable_function_entry +(N,M)))</code> takes precedence over command-line option <samp class="option">-fpatchable-function-entry=N,M</samp>. This can be used to increase the area size or to remove it completely on a single function. If <code class="code">N=0</code>, no pad location is recorded. </p> <p>The NOP instructions are inserted at—and maybe before, depending on <var class="var">M</var>—the function entry address, even before the prologue. On PowerPC with the ELFv2 ABI, for a function with dual entry points, the local entry point is this function entry address. </p> <p>The maximum value of <var class="var">N</var> and <var class="var">M</var> is 65535. On PowerPC with the ELFv2 ABI, for a function with dual entry points, the supported values for <var class="var">M</var> are 0, 2, 6 and 14. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="preprocessor-options">Options Controlling the Preprocessor</a>, Previous: <a href="optimize-options">Options That Control Optimization</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Instrumentation-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Instrumentation-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/integer-overflow-builtins.html b/devdocs/gcc~13/integer-overflow-builtins.html new file mode 100644 index 00000000..b266f733 --- /dev/null +++ b/devdocs/gcc~13/integer-overflow-builtins.html @@ -0,0 +1,66 @@ +<div class="section-level-extent" id="Integer-Overflow-Builtins"> <div class="nav-panel"> <p> Next: <a href="x86-specific-memory-model-extensions-for-transactional-memory" accesskey="n" rel="next">x86-Specific Memory Model Extensions for Transactional Memory</a>, Previous: <a href="_005f_005fatomic-builtins" accesskey="p" rel="prev">Built-in Functions for Memory Model Aware Atomic Operations</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Built-in-Functions-to-Perform-Arithmetic-with-Overflow-Checking"><span>6.56 Built-in Functions to Perform Arithmetic with Overflow Checking<a class="copiable-link" href="#Built-in-Functions-to-Perform-Arithmetic-with-Overflow-Checking"> ¶</a></span></h1> <p>The following built-in functions allow performing simple arithmetic operations together with checking whether the operations overflowed. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fadd_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_add_overflow</strong> <code class="def-code-arguments">(<var class="var">type1</var> a, <var class="var">type2</var> b, <var class="var">type3</var> *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fadd_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fsadd_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_sadd_overflow</strong> <code class="def-code-arguments">(int a, int b, int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsadd_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fsaddl_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_saddl_overflow</strong> <code class="def-code-arguments">(long int a, long int b, long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsaddl_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fsaddll_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_saddll_overflow</strong> <code class="def-code-arguments">(long long int a, long long int b, long long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsaddll_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fuadd_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_uadd_overflow</strong> <code class="def-code-arguments">(unsigned int a, unsigned int b, unsigned int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fuadd_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fuaddl_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_uaddl_overflow</strong> <code class="def-code-arguments">(unsigned long int a, unsigned long int b, unsigned long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fuaddl_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fuaddll_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_uaddll_overflow</strong> <code class="def-code-arguments">(unsigned long long int a, unsigned long long int b, unsigned long long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fuaddll_005foverflow"> ¶</a></span> +</dt> <dd> <p>These built-in functions promote the first two operands into infinite precision signed type and perform addition on those promoted operands. The result is then cast to the type the third pointer argument points to and stored there. If the stored result is equal to the infinite precision result, the built-in functions return <code class="code">false</code>, otherwise they return <code class="code">true</code>. As the addition is performed in infinite signed precision, these built-in functions have fully defined behavior for all argument values. </p> <p>The first built-in function allows arbitrary integral types for operands and the result type must be pointer to some integral type other than enumerated or boolean type, the rest of the built-in functions have explicit integer types. </p> <p>The compiler will attempt to use hardware instructions to implement these built-in functions where possible, like conditional jump on overflow after addition, conditional jump on carry etc. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fsub_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_sub_overflow</strong> <code class="def-code-arguments">(<var class="var">type1</var> a, <var class="var">type2</var> b, <var class="var">type3</var> *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsub_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fssub_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_ssub_overflow</strong> <code class="def-code-arguments">(int a, int b, int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fssub_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fssubl_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_ssubl_overflow</strong> <code class="def-code-arguments">(long int a, long int b, long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fssubl_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fssubll_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_ssubll_overflow</strong> <code class="def-code-arguments">(long long int a, long long int b, long long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fssubll_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fusub_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_usub_overflow</strong> <code class="def-code-arguments">(unsigned int a, unsigned int b, unsigned int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fusub_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fusubl_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_usubl_overflow</strong> <code class="def-code-arguments">(unsigned long int a, unsigned long int b, unsigned long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fusubl_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fusubll_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_usubll_overflow</strong> <code class="def-code-arguments">(unsigned long long int a, unsigned long long int b, unsigned long long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fusubll_005foverflow"> ¶</a></span> +</dt> <dd> <p>These built-in functions are similar to the add overflow checking built-in functions above, except they perform subtraction, subtract the second argument from the first one, instead of addition. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fmul_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_mul_overflow</strong> <code class="def-code-arguments">(<var class="var">type1</var> a, <var class="var">type2</var> b, <var class="var">type3</var> *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fmul_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fsmul_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_smul_overflow</strong> <code class="def-code-arguments">(int a, int b, int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsmul_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fsmull_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_smull_overflow</strong> <code class="def-code-arguments">(long int a, long int b, long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsmull_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fsmulll_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_smulll_overflow</strong> <code class="def-code-arguments">(long long int a, long long int b, long long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsmulll_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fumul_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_umul_overflow</strong> <code class="def-code-arguments">(unsigned int a, unsigned int b, unsigned int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fumul_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fumull_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_umull_overflow</strong> <code class="def-code-arguments">(unsigned long int a, unsigned long int b, unsigned long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fumull_005foverflow"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fumulll_005foverflow"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_umulll_overflow</strong> <code class="def-code-arguments">(unsigned long long int a, unsigned long long int b, unsigned long long int *res)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fumulll_005foverflow"> ¶</a></span> +</dt> <dd> <p>These built-in functions are similar to the add overflow checking built-in functions above, except they perform multiplication, instead of addition. </p> </dd> +</dl> <p>The following built-in functions allow checking if simple arithmetic operation would overflow. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fadd_005foverflow_005fp"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_add_overflow_p</strong> <code class="def-code-arguments">(<var class="var">type1</var> a, <var class="var">type2</var> b, <var class="var">type3</var> c)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fadd_005foverflow_005fp"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fsub_005foverflow_005fp"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_sub_overflow_p</strong> <code class="def-code-arguments">(<var class="var">type1</var> a, <var class="var">type2</var> b, <var class="var">type3</var> c)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsub_005foverflow_005fp"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fmul_005foverflow_005fp"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_mul_overflow_p</strong> <code class="def-code-arguments">(<var class="var">type1</var> a, <var class="var">type2</var> b, <var class="var">type3</var> c)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fmul_005foverflow_005fp"> ¶</a></span> +</dt> <dd> <p>These built-in functions are similar to <code class="code">__builtin_add_overflow</code>, <code class="code">__builtin_sub_overflow</code>, or <code class="code">__builtin_mul_overflow</code>, except that they don’t store the result of the arithmetic operation anywhere and the last argument is not a pointer, but some expression with integral type other than enumerated or boolean type. </p> <p>The built-in functions promote the first two operands into infinite precision signed type and perform addition on those promoted operands. The result is then cast to the type of the third argument. If the cast result is equal to the infinite precision result, the built-in functions return <code class="code">false</code>, otherwise they return <code class="code">true</code>. The value of the third argument is ignored, just the side effects in the third argument are evaluated, and no integral argument promotions are performed on the last argument. If the third argument is a bit-field, the type used for the result cast has the precision and signedness of the given bit-field, rather than precision and signedness of the underlying type. </p> <p>For example, the following macro can be used to portably check, at compile-time, whether or not adding two constant integers will overflow, and perform the addition only when it is known to be safe and not to trigger a <samp class="option">-Woverflow</samp> warning. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define INT_ADD_OVERFLOW_P(a, b) \ + __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) + +enum { + A = INT_MAX, B = 3, + C = INT_ADD_OVERFLOW_P (A, B) ? 0 : A + B, + D = __builtin_add_overflow_p (1, SCHAR_MAX, (signed char) 0) +};</pre> +</div> <p>The compiler will attempt to use hardware instructions to implement these built-in functions where possible, like conditional jump on overflow after addition, conditional jump on carry etc. </p> </dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="x86-specific-memory-model-extensions-for-transactional-memory">x86-Specific Memory Model Extensions for Transactional Memory</a>, Previous: <a href="_005f_005fatomic-builtins">Built-in Functions for Memory Model Aware Atomic Operations</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Integer-Overflow-Builtins.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Integer-Overflow-Builtins.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/integers-implementation.html b/devdocs/gcc~13/integers-implementation.html new file mode 100644 index 00000000..39b22277 --- /dev/null +++ b/devdocs/gcc~13/integers-implementation.html @@ -0,0 +1,12 @@ +<div class="section-level-extent" id="Integers-implementation"> <div class="nav-panel"> <p> Next: <a href="floating-point-implementation" accesskey="n" rel="next">Floating Point</a>, Previous: <a href="characters-implementation" accesskey="p" rel="prev">Characters</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Integers"><span>4.5 Integers<a class="copiable-link" href="#Integers"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>Any extended integer types that exist in the implementation (C99 and C11 6.2.5). <p>GCC does not support any extended integer types. </p> </li> +<li>Whether signed integer types are represented using sign and magnitude, two’s complement, or one’s complement, and whether the extraordinary value is a trap representation or an ordinary value (C99 and C11 6.2.6.2). <p>GCC supports only two’s complement integer types, and all bit patterns are ordinary values. </p> </li> +<li>The rank of any extended integer type relative to another extended integer type with the same precision (C99 and C11 6.3.1.1). <p>GCC does not support any extended integer types. </p> </li> +<li>The result of, or the signal raised by, converting an integer to a signed integer type when the value cannot be represented in an object of that type (C90 6.2.1.2, C99 and C11 6.3.1.3). <p>For conversion to a type of width <em class="math">N</em>, the value is reduced modulo <em class="math">2^N</em> to be within range of the type; no signal is raised. </p> </li> +<li>The results of some bitwise operations on signed integers (C90 6.3, C99 and C11 6.5). <p>Bitwise operators act on the representation of the value including both the sign and value bits, where the sign bit is considered immediately above the highest-value value bit. Signed ‘<samp class="samp">>></samp>’ acts on negative numbers by sign extension. </p> <p>As an extension to the C language, GCC does not use the latitude given in C99 and C11 only to treat certain aspects of signed ‘<samp class="samp"><<</samp>’ as undefined. However, <samp class="option">-fsanitize=shift</samp> (and <samp class="option">-fsanitize=undefined</samp>) will diagnose such cases. They are also diagnosed where constant expressions are required. </p> </li> +<li>The sign of the remainder on integer division (C90 6.3.5). <p>GCC always follows the C99 and C11 requirement that the result of division is truncated towards zero. </p> </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="floating-point-implementation">Floating Point</a>, Previous: <a href="characters-implementation">Characters</a>, Up: <a href="c-implementation">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Integers-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Integers-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/interoperation.html b/devdocs/gcc~13/interoperation.html new file mode 100644 index 00000000..59d319c7 --- /dev/null +++ b/devdocs/gcc~13/interoperation.html @@ -0,0 +1,37 @@ +<div class="section-level-extent" id="Interoperation"> <div class="nav-panel"> <p> Next: <a href="incompatibilities" accesskey="n" rel="next">Incompatibilities of GCC</a>, Previous: <a href="actual-bugs" accesskey="p" rel="prev">Actual Bugs We Haven’t Fixed Yet</a>, Up: <a href="trouble" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Interoperation-1"><span>14.2 Interoperation<a class="copiable-link" href="#Interoperation-1"> ¶</a></span></h1> <p>This section lists various difficulties encountered in using GCC together with other compilers or with the assemblers, linkers, libraries and debuggers on certain systems. </p> <ul class="itemize mark-bullet"> <li>On many platforms, GCC supports a different ABI for C++ than do other compilers, so the object files compiled by GCC cannot be used with object files generated by another C++ compiler. <p>An area where the difference is most apparent is name mangling. The use of different name mangling is intentional, to protect you from more subtle problems. Compilers differ as to many internal details of C++ implementation, including: how class instances are laid out, how multiple inheritance is implemented, and how virtual function calls are handled. If the name encoding were made the same, your programs would link against libraries provided from other compilers—but the programs would then crash when run. Incompatible libraries are then detected at link time, rather than at run time. </p> </li> +<li>On some BSD systems, including some versions of Ultrix, use of profiling causes static variable destructors (currently used only in C++) not to be run. </li> +<li>On a SPARC, GCC aligns all values of type <code class="code">double</code> on an 8-byte boundary, and it expects every <code class="code">double</code> to be so aligned. The Sun compiler usually gives <code class="code">double</code> values 8-byte alignment, with one exception: function arguments of type <code class="code">double</code> may not be aligned. <p>As a result, if a function compiled with Sun CC takes the address of an argument of type <code class="code">double</code> and passes this pointer of type <code class="code">double *</code> to a function compiled with GCC, dereferencing the pointer may cause a fatal signal. </p> <p>One way to solve this problem is to compile your entire program with GCC. Another solution is to modify the function that is compiled with Sun CC to copy the argument into a local variable; local variables are always properly aligned. A third solution is to modify the function that uses the pointer to dereference it via the following function <code class="code">access_double</code> instead of directly with ‘<samp class="samp">*</samp>’: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">inline double +access_double (double *unaligned_ptr) +{ + union d2i { double d; int i[2]; }; + + union d2i *p = (union d2i *) unaligned_ptr; + union d2i u; + + u.i[0] = p->i[0]; + u.i[1] = p->i[1]; + + return u.d; +}</pre> +</div> <p>Storing into the pointer can be done likewise with the same union. </p> </li> +<li>On Solaris, the <code class="code">malloc</code> function in the <samp class="file">libmalloc.a</samp> library may allocate memory that is only 4 byte aligned. Since GCC on the SPARC assumes that doubles are 8 byte aligned, this may result in a fatal signal if doubles are stored in memory allocated by the <samp class="file">libmalloc.a</samp> library. <p>The solution is to not use the <samp class="file">libmalloc.a</samp> library. Use instead <code class="code">malloc</code> and related functions from <samp class="file">libc.a</samp>; they do not have this problem. </p> </li> +<li>On the HP PA machine, ADB sometimes fails to work on functions compiled with GCC. Specifically, it fails to work on functions that use <code class="code">alloca</code> or variable-size arrays. This is because GCC doesn’t generate HP-UX unwind descriptors for such functions. It may even be impossible to generate them. </li> +<li>Debugging (<samp class="option">-g</samp>) is not supported on the HP PA machine, unless you use the preliminary GNU tools. </li> +<li>Taking the address of a label may generate errors from the HP-UX PA assembler. GAS for the PA does not have this problem. </li> +<li>Using floating point parameters for indirect calls to static functions will not work when using the HP assembler. There simply is no way for GCC to specify what registers hold arguments for static functions when using the HP assembler. GAS for the PA does not have this problem. </li> +<li>In extremely rare cases involving some very large functions you may receive errors from the HP linker complaining about an out of bounds unconditional branch offset. This used to occur more often in previous versions of GCC, but is now exceptionally rare. If you should run into it, you can work around by making your function smaller. </li> +<li>GCC compiled code sometimes emits warnings from the HP-UX assembler of the form: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">(warning) Use of GR3 when + frame >= 8192 may cause conflict.</pre> +</div> <p>These warnings are harmless and can be safely ignored. </p> </li> +<li>In extremely rare cases involving some very large functions you may receive errors from the AIX Assembler complaining about a displacement that is too large. If you should run into it, you can work around by making your function smaller. </li> +<li>The <samp class="file">libstdc++.a</samp> library in GCC relies on the SVR4 dynamic linker semantics which merges global symbols between libraries and applications, especially necessary for C++ streams functionality. This is not the default behavior of AIX shared libraries and dynamic linking. <samp class="file">libstdc++.a</samp> is built on AIX with “runtime-linking” enabled so that symbol merging can occur. To utilize this feature, the application linked with <samp class="file">libstdc++.a</samp> must include the <samp class="option">-Wl,-brtl</samp> flag on the link line. G++ cannot impose this because this option may interfere with the semantics of the user program and users may not always use ‘<samp class="samp">g++</samp>’ to link his or her application. Applications are not required to use the <samp class="option">-Wl,-brtl</samp> flag on the link line—the rest of the <samp class="file">libstdc++.a</samp> library which is not dependent on the symbol merging semantics will continue to function correctly. </li> +<li>An application can interpose its own definition of functions for functions invoked by <samp class="file">libstdc++.a</samp> with “runtime-linking” enabled on AIX. To accomplish this the application must be linked with “runtime-linking” option and the functions explicitly must be exported by the application (<samp class="option">-Wl,-brtl,-bE:exportfile</samp>). </li> +<li>AIX on the RS/6000 provides support (NLS) for environments outside of the United States. Compilers and assemblers use NLS to support locale-specific representations of various objects including floating-point numbers (‘<samp class="samp">.</samp>’ vs ‘<samp class="samp">,</samp>’ for separating decimal fractions). There have been problems reported where the library linked with GCC does not produce the same floating-point formats that the assembler accepts. If you have this problem, set the <code class="env">LANG</code> environment variable to ‘<samp class="samp">C</samp>’ or ‘<samp class="samp">En_US</samp>’. </li> +<li> + Even if you specify <samp class="option">-fdollars-in-identifiers</samp>, you cannot successfully use ‘<samp class="samp">$</samp>’ in identifiers on the RS/6000 due to a restriction in the IBM assembler. GAS supports these identifiers. </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="incompatibilities">Incompatibilities of GCC</a>, Previous: <a href="actual-bugs">Actual Bugs We Haven’t Fixed Yet</a>, Up: <a href="trouble">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Interoperation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Interoperation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/invoking-g_002b_002b.html b/devdocs/gcc~13/invoking-g_002b_002b.html new file mode 100644 index 00000000..ca964f94 --- /dev/null +++ b/devdocs/gcc~13/invoking-g_002b_002b.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Invoking-G_002b_002b"> <div class="nav-panel"> <p> Next: <a href="c-dialect-options" accesskey="n" rel="next">Options Controlling C Dialect</a>, Previous: <a href="overall-options" accesskey="p" rel="prev">Options Controlling the Kind of Output</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Compiling-C_002b_002b-Programs"><span>3.3 Compiling C++ Programs<a class="copiable-link" href="#Compiling-C_002b_002b-Programs"> ¶</a></span></h1> <p>C++ source files conventionally use one of the suffixes ‘<samp class="samp">.C</samp>’, ‘<samp class="samp">.cc</samp>’, ‘<samp class="samp">.cpp</samp>’, ‘<samp class="samp">.CPP</samp>’, ‘<samp class="samp">.c++</samp>’, ‘<samp class="samp">.cp</samp>’, or ‘<samp class="samp">.cxx</samp>’; C++ header files often use ‘<samp class="samp">.hh</samp>’, ‘<samp class="samp">.hpp</samp>’, ‘<samp class="samp">.H</samp>’, or (for shared template code) ‘<samp class="samp">.tcc</samp>’; and preprocessed C++ files use the suffix ‘<samp class="samp">.ii</samp>’. GCC recognizes files with these names and compiles them as C++ programs even if you call the compiler the same way as for compiling C programs (usually with the name <code class="command">gcc</code>). </p> <p>However, the use of <code class="command">gcc</code> does not add the C++ library. <code class="command">g++</code> is a program that calls GCC and automatically specifies linking against the C++ library. It treats ‘<samp class="samp">.c</samp>’, ‘<samp class="samp">.h</samp>’ and ‘<samp class="samp">.i</samp>’ files as C++ source files instead of C source files unless <samp class="option">-x</samp> is used. This program is also useful when precompiling a C header file with a ‘<samp class="samp">.h</samp>’ extension for use in C++ compilations. On many systems, <code class="command">g++</code> is also installed with the name <code class="command">c++</code>. </p> <p>When you compile C++ programs, you may specify many of the same command-line options that you use for compiling programs in any language; or command-line options meaningful for C and related languages; or options that are meaningful only for C++ programs. See <a class="xref" href="c-dialect-options">Options Controlling C Dialect</a>, for explanations of options for languages related to C. See <a class="xref" href="c_002b_002b-dialect-options">Options Controlling C++ Dialect</a>, for explanations of options that are meaningful only for C++ programs. </p> </div> <div class="nav-panel"> <p> Next: <a href="c-dialect-options">Options Controlling C Dialect</a>, Previous: <a href="overall-options">Options Controlling the Kind of Output</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-G_002b_002b.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-G_002b_002b.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/invoking-gcc.html b/devdocs/gcc~13/invoking-gcc.html new file mode 100644 index 00000000..c8195db6 --- /dev/null +++ b/devdocs/gcc~13/invoking-gcc.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="Invoking-GCC"> <div class="nav-panel"> <p> Next: <a href="c-implementation" accesskey="n" rel="next">C Implementation-Defined Behavior</a>, Previous: <a href="standards" accesskey="p" rel="prev">Language Standards Supported by GCC</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="GCC-Command-Options"><span>3 GCC Command Options<a class="copiable-link" href="#GCC-Command-Options"> ¶</a></span></h1> <p>When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The “overall options” allow you to stop this process at an intermediate stage. For example, the <samp class="option">-c</samp> option says not to run the linker. Then the output consists of object files output by the assembler. See <a class="xref" href="overall-options">Options Controlling the Kind of Output</a>. </p> <p>Other options are passed on to one or more stages of processing. Some options control the preprocessor and others the compiler itself. Yet other options control the assembler and linker; most of these are not documented here, since you rarely need to use any of them. </p> <p>Most of the command-line options that you can use with GCC are useful for C programs; when an option is only useful with another language (usually C++), the explanation says so explicitly. If the description for a particular option does not mention a source language, you can use that option with all supported languages. </p> <p>The usual way to run GCC is to run the executable called <code class="command">gcc</code>, or <code class="command"><var class="var">machine</var>-gcc</code> when cross-compiling, or <code class="command"><var class="var">machine</var>-gcc-<var class="var">version</var></code> to run a specific version of GCC. When you compile C++ programs, you should invoke GCC as <code class="command">g++</code> instead. See <a class="xref" href="invoking-g_002b_002b">Compiling C++ Programs</a>, for information about the differences in behavior between <code class="command">gcc</code> and <code class="command">g++</code> when compiling C++ programs. </p> <p>The <code class="command">gcc</code> program accepts options and file names as operands. Many options have multi-letter names; therefore multiple single-letter options may <em class="emph">not</em> be grouped: <samp class="option">-dv</samp> is very different from ‘<samp class="samp">-d -v</samp>’. </p> <p>You can mix options and other arguments. For the most part, the order you use doesn’t matter. Order does matter when you use several options of the same kind; for example, if you specify <samp class="option">-L</samp> more than once, the directories are searched in the order specified. Also, the placement of the <samp class="option">-l</samp> option is significant. </p> <p>Many options have long names starting with ‘<samp class="samp">-f</samp>’ or with ‘<samp class="samp">-W</samp>’—for example, <samp class="option">-fmove-loop-invariants</samp>, <samp class="option">-Wformat</samp> and so on. Most of these have both positive and negative forms; the negative form of <samp class="option">-ffoo</samp> is <samp class="option">-fno-foo</samp>. This manual documents only one of these two forms, whichever one is not the default. </p> <p>Some options take one or more arguments typically separated either by a space or by the equals sign (‘<samp class="samp">=</samp>’) from the option name. Unless documented otherwise, an argument can be either numeric or a string. Numeric arguments must typically be small unsigned decimal or hexadecimal integers. Hexadecimal arguments must begin with the ‘<samp class="samp">0x</samp>’ prefix. Arguments to options that specify a size threshold of some sort may be arbitrarily large decimal or hexadecimal integers followed by a byte size suffix designating a multiple of bytes such as <code class="code">kB</code> and <code class="code">KiB</code> for kilobyte and kibibyte, respectively, <code class="code">MB</code> and <code class="code">MiB</code> for megabyte and mebibyte, <code class="code">GB</code> and <code class="code">GiB</code> for gigabyte and gigibyte, and so on. Such arguments are designated by <var class="var">byte-size</var> in the following text. Refer to the NIST, IEC, and other relevant national and international standards for the full listing and explanation of the binary and decimal byte size prefixes. </p> <p>See <a class="xref" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Option-Index.html">Option Index</a>, for an index to GCC’s options. </p> <ul class="mini-toc"> <li><a href="option-summary" accesskey="1">Option Summary</a></li> <li><a href="overall-options" accesskey="2">Options Controlling the Kind of Output</a></li> <li><a href="invoking-g_002b_002b" accesskey="3">Compiling C++ Programs</a></li> <li><a href="c-dialect-options" accesskey="4">Options Controlling C Dialect</a></li> <li><a href="c_002b_002b-dialect-options" accesskey="5">Options Controlling C++ Dialect</a></li> <li><a href="objective-c-and-objective-c_002b_002b-dialect-options" accesskey="6">Options Controlling Objective-C and Objective-C++ Dialects</a></li> <li><a href="diagnostic-message-formatting-options" accesskey="7">Options to Control Diagnostic Messages Formatting</a></li> <li><a href="warning-options" accesskey="8">Options to Request or Suppress Warnings</a></li> <li><a href="static-analyzer-options" accesskey="9">Options That Control Static Analysis</a></li> <li><a href="debugging-options">Options for Debugging Your Program</a></li> <li><a href="optimize-options">Options That Control Optimization</a></li> <li><a href="instrumentation-options">Program Instrumentation Options</a></li> <li><a href="preprocessor-options">Options Controlling the Preprocessor</a></li> <li><a href="assembler-options">Passing Options to the Assembler</a></li> <li><a href="link-options">Options for Linking</a></li> <li><a href="directory-options">Options for Directory Search</a></li> <li><a href="code-gen-options">Options for Code Generation Conventions</a></li> <li><a href="developer-options">GCC Developer Options</a></li> <li><a href="submodel-options">Machine-Dependent Options</a></li> <li><a href="spec-files">Specifying Subprocesses and the Switches to Pass to Them</a></li> <li><a href="environment-variables">Environment Variables Affecting GCC</a></li> <li><a href="precompiled-headers">Using Precompiled Headers</a></li> <li><a href="c_002b_002b-modules">C++ Modules</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="c-implementation">C Implementation-Defined Behavior</a>, Previous: <a href="standards">Language Standards Supported by GCC</a>, Up: <a href="index">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-GCC.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-GCC.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/invoking-gcov-dump.html b/devdocs/gcc~13/invoking-gcov-dump.html new file mode 100644 index 00000000..c1b87204 --- /dev/null +++ b/devdocs/gcc~13/invoking-gcov-dump.html @@ -0,0 +1,12 @@ +<div class="section-level-extent" id="Invoking-Gcov-dump"> <div class="nav-panel"> <p> Previous: <a href="gcov-dump-intro" accesskey="p" rel="prev">Introduction to <code class="command">gcov-dump</code></a>, Up: <a href="gcov-dump" accesskey="u" rel="up"><code class="command">gcov-dump</code>—an Offline Gcda and Gcno Profile Dump Tool</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Invoking-gcov-dump"><span>12.2 Invoking gcov-dump<a class="copiable-link" href="#Invoking-gcov-dump"> ¶</a></span></h1> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">Usage: gcov-dump <span class="r">[</span><var class="var">OPTION</var><span class="r">]</span> ... <var class="var">gcovfiles</var></pre> +</div> <p><code class="command">gcov-dump</code> accepts the following options: </p> <dl class="table"> <dt><code class="code">-h</code></dt> <dt><code class="code">--help</code></dt> <dd> +<p>Display help about using <code class="command">gcov-dump</code> (on the standard output), and exit without doing any further processing. </p> </dd> <dt><code class="code">-l</code></dt> <dt><code class="code">--long</code></dt> <dd> +<p>Dump content of records. </p> </dd> <dt><code class="code">-p</code></dt> <dt><code class="code">--positions</code></dt> <dd> +<p>Dump positions of records. </p> </dd> <dt><code class="code">-r</code></dt> <dt><code class="code">--raw</code></dt> <dd> +<p>Print content records in raw format. </p> </dd> <dt><code class="code">-s</code></dt> <dt><code class="code">--stable</code></dt> <dd> +<p>Print content in stable format usable for comparison. </p> </dd> <dt><code class="code">-v</code></dt> <dt><code class="code">--version</code></dt> <dd><p>Display the <code class="command">gcov-dump</code> version number (on the standard output), and exit without doing any further processing. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-Gcov-dump.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-Gcov-dump.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/invoking-gcov-tool.html b/devdocs/gcc~13/invoking-gcov-tool.html new file mode 100644 index 00000000..3faeb2f1 --- /dev/null +++ b/devdocs/gcc~13/invoking-gcov-tool.html @@ -0,0 +1,27 @@ +<div class="section-level-extent" id="Invoking-Gcov-tool"> <div class="nav-panel"> <p> Previous: <a href="gcov-tool-intro" accesskey="p" rel="prev">Introduction to <code class="command">gcov-tool</code></a>, Up: <a href="gcov-tool" accesskey="u" rel="up"><code class="command">gcov-tool</code>—an Offline Gcda Profile Processing Tool</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Invoking-gcov-tool"><span>11.2 Invoking gcov-tool<a class="copiable-link" href="#Invoking-gcov-tool"> ¶</a></span></h1> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcov-tool <span class="r">[</span><var class="var">global-options</var><span class="r">]</span> SUB_COMMAND <span class="r">[</span><var class="var">sub_command-options</var><span class="r">]</span> <var class="var">profile_dir</var></pre> +</div> <p><code class="command">gcov-tool</code> accepts the following options: </p> <dl class="table"> <dt><code class="code">-h</code></dt> <dt><code class="code">--help</code></dt> <dd> +<p>Display help about using <code class="command">gcov-tool</code> (on the standard output), and exit without doing any further processing. </p> </dd> <dt><code class="code">-v</code></dt> <dt><code class="code">--version</code></dt> <dd> +<p>Display the <code class="command">gcov-tool</code> version number (on the standard output), and exit without doing any further processing. </p> </dd> <dt><code class="code">merge</code></dt> <dd> +<p>Merge two profile directories. </p> +<dl class="table"> <dt><code class="code">-o <var class="var">directory</var></code></dt> <dt><code class="code">--output <var class="var">directory</var></code></dt> <dd> +<p>Set the output profile directory. Default output directory name is <var class="var">merged_profile</var>. </p> </dd> <dt><code class="code">-v</code></dt> <dt><code class="code">--verbose</code></dt> <dd> +<p>Set the verbose mode. </p> </dd> <dt><code class="code">-w <var class="var">w1</var>,<var class="var">w2</var></code></dt> <dt><code class="code">--weight <var class="var">w1</var>,<var class="var">w2</var></code></dt> <dd><p>Set the merge weights of the <var class="var">directory1</var> and <var class="var">directory2</var>, respectively. The default weights are 1 for both. </p></dd> </dl> </dd> <dt><code class="code">merge-stream</code></dt> <dd> +<p>Collect profiles with associated filenames from a <em class="emph">gcfn</em> and <em class="emph">gcda</em> data stream. Read the stream from the file specified by <var class="var">file</var> or from <samp class="file">stdin</samp>. Merge the profiles with associated profiles in the host filesystem. Apply the optional weights while merging profiles. </p> <p>For the generation of a <em class="emph">gcfn</em> and <em class="emph">gcda</em> data stream on the target system, please have a look at the <code class="code">__gcov_filename_to_gcfn()</code> and <code class="code">__gcov_info_to_gcda()</code> functions declared in <code class="code">#include <gcov.h></code>. </p> +<dl class="table"> <dt><code class="code">-v</code></dt> <dt><code class="code">--verbose</code></dt> <dd> +<p>Set the verbose mode. </p> </dd> <dt><code class="code">-w <var class="var">w1</var>,<var class="var">w2</var></code></dt> <dt><code class="code">--weight <var class="var">w1</var>,<var class="var">w2</var></code></dt> <dd><p>Set the merge weights of the profiles from the <em class="emph">gcfn</em> and <em class="emph">gcda</em> data stream and the associated profiles in the host filesystem, respectively. The default weights are 1 for both. </p></dd> </dl> </dd> <dt><code class="code">rewrite</code></dt> <dd> +<p>Read the specified profile directory and rewrite to a new directory. </p> +<dl class="table"> <dt><code class="code">-n <var class="var">long_long_value</var></code></dt> <dt><code class="code">--normalize <long_long_value></code></dt> <dd> +<p>Normalize the profile. The specified value is the max counter value in the new profile. </p> </dd> <dt><code class="code">-o <var class="var">directory</var></code></dt> <dt><code class="code">--output <var class="var">directory</var></code></dt> <dd> +<p>Set the output profile directory. Default output name is <var class="var">rewrite_profile</var>. </p> </dd> <dt><code class="code">-s <var class="var">float_or_simple-frac_value</var></code></dt> <dt><code class="code">--scale <var class="var">float_or_simple-frac_value</var></code></dt> <dd> +<p>Scale the profile counters. The specified value can be in floating point value, or simple fraction value form, such 1, 2, 2/3, and 5/3. </p> </dd> <dt><code class="code">-v</code></dt> <dt><code class="code">--verbose</code></dt> <dd><p>Set the verbose mode. </p></dd> </dl> </dd> <dt><code class="code">overlap</code></dt> <dd> +<p>Compute the overlap score between the two specified profile directories. The overlap score is computed based on the arc profiles. It is defined as the sum of min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all), for all arc counter i, where p1_counter[i] and p2_counter[i] are two matched counters and p1_sum_all and p2_sum_all are the sum of counter values in profile 1 and profile 2, respectively. </p> <dl class="table"> <dt><code class="code">-f</code></dt> <dt><code class="code">--function</code></dt> <dd> +<p>Print function level overlap score. </p> </dd> <dt><code class="code">-F</code></dt> <dt><code class="code">--fullname</code></dt> <dd> +<p>Print full gcda filename. </p> </dd> <dt><code class="code">-h</code></dt> <dt><code class="code">--hotonly</code></dt> <dd> +<p>Only print info for hot objects/functions. </p> </dd> <dt><code class="code">-o</code></dt> <dt><code class="code">--object</code></dt> <dd> +<p>Print object level overlap score. </p> </dd> <dt><code class="code">-t <var class="var">float</var></code></dt> <dt><code class="code">--hot_threshold <float></code></dt> <dd> +<p>Set the threshold for hot counter value. </p> </dd> <dt><code class="code">-v</code></dt> <dt><code class="code">--verbose</code></dt> <dd><p>Set the verbose mode. </p></dd> </dl> </dd> </dl> </div> <div class="nav-panel"> <p> Previous: <a href="gcov-tool-intro">Introduction to <code class="command">gcov-tool</code></a>, Up: <a href="gcov-tool"><code class="command">gcov-tool</code>—an Offline Gcda Profile Processing Tool</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-Gcov-tool.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-Gcov-tool.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/invoking-gcov.html b/devdocs/gcc~13/invoking-gcov.html new file mode 100644 index 00000000..015cad2f --- /dev/null +++ b/devdocs/gcc~13/invoking-gcov.html @@ -0,0 +1,324 @@ +<div class="section-level-extent" id="Invoking-Gcov"> <div class="nav-panel"> <p> Next: <a href="gcov-and-optimization" accesskey="n" rel="next">Using <code class="command">gcov</code> with GCC Optimization</a>, Previous: <a href="gcov-intro" accesskey="p" rel="prev">Introduction to <code class="command">gcov</code></a>, Up: <a href="gcov" accesskey="u" rel="up"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Invoking-gcov"><span>10.2 Invoking gcov<a class="copiable-link" href="#Invoking-gcov"> ¶</a></span></h1> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcov <span class="r">[</span><var class="var">options</var><span class="r">]</span> <var class="var">files</var></pre> +</div> <p><code class="command">gcov</code> accepts the following options: </p> <dl class="table"> <dt><code class="code">-a</code></dt> <dt><code class="code">--all-blocks</code></dt> <dd> +<p>Write individual execution counts for every basic block. Normally gcov outputs execution counts only for the main blocks of a line. With this option you can determine if blocks within a single line are not being executed. </p> </dd> <dt><code class="code">-b</code></dt> <dt><code class="code">--branch-probabilities</code></dt> <dd> +<p>Write branch frequencies to the output file, and write branch summary info to the standard output. This option allows you to see how often each branch in your program was taken. Unconditional branches will not be shown, unless the <samp class="option">-u</samp> option is given. </p> </dd> <dt><code class="code">-c</code></dt> <dt><code class="code">--branch-counts</code></dt> <dd> +<p>Write branch frequencies as the number of branches taken, rather than the percentage of branches taken. </p> </dd> <dt><code class="code">-d</code></dt> <dt><code class="code">--display-progress</code></dt> <dd> +<p>Display the progress on the standard output. </p> </dd> <dt><code class="code">-f</code></dt> <dt><code class="code">--function-summaries</code></dt> <dd> +<p>Output summaries for each function in addition to the file level summary. </p> </dd> <dt><code class="code">-h</code></dt> <dt><code class="code">--help</code></dt> <dd> +<p>Display help about using <code class="command">gcov</code> (on the standard output), and exit without doing any further processing. </p> </dd> <dt><code class="code">-j</code></dt> <dt><code class="code">--json-format</code></dt> <dd> +<p>Output gcov file in an easy-to-parse JSON intermediate format which does not require source code for generation. The JSON file is compressed with gzip compression algorithm and the files have <samp class="file">.gcov.json.gz</samp> extension. </p> <p>Structure of the JSON is following: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + "current_working_directory": "foo/bar", + "data_file": "a.out", + "format_version": "1", + "gcc_version": "11.1.1 20210510" + "files": ["$file"] +}</pre> +</div> <p>Fields of the root element have following semantics: </p> <ul class="itemize mark-bullet"> <li> +<var class="var">current_working_directory</var>: working directory where a compilation unit was compiled </li> +<li> +<var class="var">data_file</var>: name of the data file (GCDA) </li> +<li> +<var class="var">format_version</var>: semantic version of the format </li> +<li> +<var class="var">gcc_version</var>: version of the GCC compiler </li> +</ul> <p>Each <var class="var">file</var> has the following form: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + "file": "a.c", + "functions": ["$function"], + "lines": ["$line"] +}</pre> +</div> <p>Fields of the <var class="var">file</var> element have following semantics: </p> <ul class="itemize mark-bullet"> <li> +<var class="var">file_name</var>: name of the source file </li> +</ul> <p>Each <var class="var">function</var> has the following form: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + "blocks": 2, + "blocks_executed": 2, + "demangled_name": "foo", + "end_column": 1, + "end_line": 4, + "execution_count": 1, + "name": "foo", + "start_column": 5, + "start_line": 1 +}</pre> +</div> <p>Fields of the <var class="var">function</var> element have following semantics: </p> <ul class="itemize mark-bullet"> <li> +<var class="var">blocks</var>: number of blocks that are in the function </li> +<li> +<var class="var">blocks_executed</var>: number of executed blocks of the function </li> +<li> +<var class="var">demangled_name</var>: demangled name of the function </li> +<li> +<var class="var">end_column</var>: column in the source file where the function ends </li> +<li> +<var class="var">end_line</var>: line in the source file where the function ends </li> +<li> +<var class="var">execution_count</var>: number of executions of the function </li> +<li> +<var class="var">name</var>: name of the function </li> +<li> +<var class="var">start_column</var>: column in the source file where the function begins </li> +<li> +<var class="var">start_line</var>: line in the source file where the function begins </li> +</ul> <p>Note that line numbers and column numbers number from 1. In the current implementation, <var class="var">start_line</var> and <var class="var">start_column</var> do not include any template parameters and the leading return type but that this is likely to be fixed in the future. </p> <p>Each <var class="var">line</var> has the following form: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + "branches": ["$branch"], + "count": 2, + "line_number": 15, + "unexecuted_block": false, + "function_name": "foo", +}</pre> +</div> <p>Branches are present only with <var class="var">-b</var> option. Fields of the <var class="var">line</var> element have following semantics: </p> <ul class="itemize mark-bullet"> <li> +<var class="var">count</var>: number of executions of the line </li> +<li> +<var class="var">line_number</var>: line number </li> +<li> +<var class="var">unexecuted_block</var>: flag whether the line contains an unexecuted block (not all statements on the line are executed) </li> +<li> +<var class="var">function_name</var>: a name of a function this <var class="var">line</var> belongs to (for a line with an inlined statements can be not set) </li> +</ul> <p>Each <var class="var">branch</var> has the following form: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + "count": 11, + "fallthrough": true, + "throw": false +}</pre> +</div> <p>Fields of the <var class="var">branch</var> element have following semantics: </p> <ul class="itemize mark-bullet"> <li> +<var class="var">count</var>: number of executions of the branch </li> +<li> +<var class="var">fallthrough</var>: true when the branch is a fall through branch </li> +<li> +<var class="var">throw</var>: true when the branch is an exceptional branch </li> +</ul> </dd> <dt><code class="code">-H</code></dt> <dt><code class="code">--human-readable</code></dt> <dd> +<p>Write counts in human readable format (like 24.6k). </p> </dd> <dt><code class="code">-k</code></dt> <dt><code class="code">--use-colors</code></dt> <dd> <p>Use colors for lines of code that have zero coverage. We use red color for non-exceptional lines and cyan for exceptional. Same colors are used for basic blocks with <samp class="option">-a</samp> option. </p> </dd> <dt><code class="code">-l</code></dt> <dt><code class="code">--long-file-names</code></dt> <dd> +<p>Create long file names for included source files. For example, if the header file <samp class="file">x.h</samp> contains code, and was included in the file <samp class="file">a.c</samp>, then running <code class="command">gcov</code> on the file <samp class="file">a.c</samp> will produce an output file called <samp class="file">a.c##x.h.gcov</samp> instead of <samp class="file">x.h.gcov</samp>. This can be useful if <samp class="file">x.h</samp> is included in multiple source files and you want to see the individual contributions. If you use the ‘<samp class="samp">-p</samp>’ option, both the including and included file names will be complete path names. </p> </dd> <dt><code class="code">-m</code></dt> <dt><code class="code">--demangled-names</code></dt> <dd> +<p>Display demangled function names in output. The default is to show mangled function names. </p> </dd> <dt><code class="code">-n</code></dt> <dt><code class="code">--no-output</code></dt> <dd> +<p>Do not create the <code class="command">gcov</code> output file. </p> </dd> <dt><code class="code">-o <var class="var">directory|file</var></code></dt> <dt><code class="code">--object-directory <var class="var">directory</var></code></dt> <dt><code class="code">--object-file <var class="var">file</var></code></dt> <dd> +<p>Specify either the directory containing the gcov data files, or the object path name. The <samp class="file">.gcno</samp>, and <samp class="file">.gcda</samp> data files are searched for using this option. If a directory is specified, the data files are in that directory and named after the input file name, without its extension. If a file is specified here, the data files are named after that file, without its extension. </p> </dd> <dt><code class="code">-p</code></dt> <dt><code class="code">--preserve-paths</code></dt> <dd> +<p>Preserve complete path information in the names of generated <samp class="file">.gcov</samp> files. Without this option, just the filename component is used. With this option, all directories are used, with ‘<samp class="samp">/</samp>’ characters translated to ‘<samp class="samp">#</samp>’ characters, <samp class="file">.</samp> directory components removed and unremoveable <samp class="file">..</samp> components renamed to ‘<samp class="samp">^</samp>’. This is useful if sourcefiles are in several different directories. </p> </dd> <dt><code class="code">-q</code></dt> <dt><code class="code">--use-hotness-colors</code></dt> <dd> <p>Emit perf-like colored output for hot lines. Legend of the color scale is printed at the very beginning of the output file. </p> </dd> <dt><code class="code">-r</code></dt> <dt><code class="code">--relative-only</code></dt> <dd> +<p>Only output information about source files with a relative pathname (after source prefix elision). Absolute paths are usually system header files and coverage of any inline functions therein is normally uninteresting. </p> </dd> <dt><code class="code">-s <var class="var">directory</var></code></dt> <dt><code class="code">--source-prefix <var class="var">directory</var></code></dt> <dd> +<p>A prefix for source file names to remove when generating the output coverage files. This option is useful when building in a separate directory, and the pathname to the source directory is not wanted when determining the output file names. Note that this prefix detection is applied before determining whether the source file is absolute. </p> </dd> <dt><code class="code">-t</code></dt> <dt><code class="code">--stdout</code></dt> <dd> +<p>Output to standard output instead of output files. </p> </dd> <dt><code class="code">-u</code></dt> <dt><code class="code">--unconditional-branches</code></dt> <dd> +<p>When branch probabilities are given, include those of unconditional branches. Unconditional branches are normally not interesting. </p> </dd> <dt><code class="code">-v</code></dt> <dt><code class="code">--version</code></dt> <dd> +<p>Display the <code class="command">gcov</code> version number (on the standard output), and exit without doing any further processing. </p> </dd> <dt><code class="code">-w</code></dt> <dt><code class="code">--verbose</code></dt> <dd> +<p>Print verbose informations related to basic blocks and arcs. </p> </dd> <dt><code class="code">-x</code></dt> <dt><code class="code">--hash-filenames</code></dt> <dd> +<p>When using <var class="var">–preserve-paths</var>, gcov uses the full pathname of the source files to create an output filename. This can lead to long filenames that can overflow filesystem limits. This option creates names of the form <samp class="file"><var class="var">source-file</var>##<var class="var">md5</var>.gcov</samp>, where the <var class="var">source-file</var> component is the final filename part and the <var class="var">md5</var> component is calculated from the full mangled name that would have been used otherwise. The option is an alternative to the <var class="var">–preserve-paths</var> on systems which have a filesystem limit. </p> </dd> </dl> <p><code class="command">gcov</code> should be run with the current directory the same as that when you invoked the compiler. Otherwise it will not be able to locate the source files. <code class="command">gcov</code> produces files called <samp class="file"><var class="var">mangledname</var>.gcov</samp> in the current directory. These contain the coverage information of the source file they correspond to. One <samp class="file">.gcov</samp> file is produced for each source (or header) file containing code, which was compiled to produce the data files. The <var class="var">mangledname</var> part of the output file name is usually simply the source file name, but can be something more complicated if the ‘<samp class="samp">-l</samp>’ or ‘<samp class="samp">-p</samp>’ options are given. Refer to those options for details. </p> <p>If you invoke <code class="command">gcov</code> with multiple input files, the contributions from each input file are summed. Typically you would invoke it with the same list of files as the final link of your executable. </p> <p>The <samp class="file">.gcov</samp> files contain the ‘<samp class="samp">:</samp>’ separated fields along with program source code. The format is </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp"><var class="var">execution_count</var>:<var class="var">line_number</var>:<var class="var">source line text</var></pre> +</div> <p>Additional block information may succeed each line, when requested by command line option. The <var class="var">execution_count</var> is ‘<samp class="samp">-</samp>’ for lines containing no code. Unexecuted lines are marked ‘<samp class="samp">#####</samp>’ or ‘<samp class="samp">=====</samp>’, depending on whether they are reachable by non-exceptional paths or only exceptional paths such as C++ exception handlers, respectively. Given the ‘<samp class="samp">-a</samp>’ option, unexecuted blocks are marked ‘<samp class="samp">$$$$$</samp>’ or ‘<samp class="samp">%%%%%</samp>’, depending on whether a basic block is reachable via non-exceptional or exceptional paths. Executed basic blocks having a statement with zero <var class="var">execution_count</var> end with ‘<samp class="samp">*</samp>’ character and are colored with magenta color with the <samp class="option">-k</samp> option. This functionality is not supported in Ada. </p> <p>Note that GCC can completely remove the bodies of functions that are not needed – for instance if they are inlined everywhere. Such functions are marked with ‘<samp class="samp">-</samp>’, which can be confusing. Use the <samp class="option">-fkeep-inline-functions</samp> and <samp class="option">-fkeep-static-functions</samp> options to retain these functions and allow gcov to properly show their <var class="var">execution_count</var>. </p> <p>Some lines of information at the start have <var class="var">line_number</var> of zero. These preamble lines are of the form </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-:0:<var class="var">tag</var>:<var class="var">value</var></pre> +</div> <p>The ordering and number of these preamble lines will be augmented as <code class="command">gcov</code> development progresses — do not rely on them remaining unchanged. Use <var class="var">tag</var> to locate a particular preamble line. </p> <p>The additional block information is of the form </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp"><var class="var">tag</var> <var class="var">information</var></pre> +</div> <p>The <var class="var">information</var> is human readable, but designed to be simple enough for machine parsing too. </p> <p>When printing percentages, 0% and 100% are only printed when the values are <em class="emph">exactly</em> 0% and 100% respectively. Other values which would conventionally be rounded to 0% or 100% are instead printed as the nearest non-boundary value. </p> <p>When using <code class="command">gcov</code>, you must first compile your program with a special GCC option ‘<samp class="samp">--coverage</samp>’. This tells the compiler to generate additional information needed by gcov (basically a flow graph of the program) and also includes additional code in the object files for generating the extra profiling information needed by gcov. These additional files are placed in the directory where the object file is located. </p> <p>Running the program will cause profile output to be generated. For each source file compiled with <samp class="option">-fprofile-arcs</samp>, an accompanying <samp class="file">.gcda</samp> file will be placed in the object file directory. </p> <p>Running <code class="command">gcov</code> with your program’s source file names as arguments will now produce a listing of the code along with frequency of execution for each line. For example, if your program is called <samp class="file">tmp.cpp</samp>, this is what you see when you use the basic <code class="command">gcov</code> facility: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$ g++ --coverage tmp.cpp -c +$ g++ --coverage tmp.o +$ a.out +$ gcov tmp.cpp -m +File 'tmp.cpp' +Lines executed:92.86% of 14 +Creating 'tmp.cpp.gcov'</pre> +</div> <p>The file <samp class="file">tmp.cpp.gcov</samp> contains output from <code class="command">gcov</code>. Here is a sample: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-: 0:Source:tmp.cpp + -: 0:Working directory:/home/gcc/testcase + -: 0:Graph:tmp.gcno + -: 0:Data:tmp.gcda + -: 0:Runs:1 + -: 0:Programs:1 + -: 1:#include <stdio.h> + -: 2: + -: 3:template<class T> + -: 4:class Foo + -: 5:{ + -: 6: public: + 1*: 7: Foo(): b (1000) {} +------------------ +Foo<char>::Foo(): + #####: 7: Foo(): b (1000) {} +------------------ +Foo<int>::Foo(): + 1: 7: Foo(): b (1000) {} +------------------ + 2*: 8: void inc () { b++; } +------------------ +Foo<char>::inc(): + #####: 8: void inc () { b++; } +------------------ +Foo<int>::inc(): + 2: 8: void inc () { b++; } +------------------ + -: 9: + -: 10: private: + -: 11: int b; + -: 12:}; + -: 13: + -: 14:template class Foo<int>; + -: 15:template class Foo<char>; + -: 16: + -: 17:int + 1: 18:main (void) + -: 19:{ + -: 20: int i, total; + 1: 21: Foo<int> counter; + -: 22: + 1: 23: counter.inc(); + 1: 24: counter.inc(); + 1: 25: total = 0; + -: 26: + 11: 27: for (i = 0; i < 10; i++) + 10: 28: total += i; + -: 29: + 1*: 30: int v = total > 100 ? 1 : 2; + -: 31: + 1: 32: if (total != 45) + #####: 33: printf ("Failure\n"); + -: 34: else + 1: 35: printf ("Success\n"); + 1: 36: return 0; + -: 37:}</pre> +</div> <p>Note that line 7 is shown in the report multiple times. First occurrence presents total number of execution of the line and the next two belong to instances of class Foo constructors. As you can also see, line 30 contains some unexecuted basic blocks and thus execution count has asterisk symbol. </p> <p>When you use the <samp class="option">-a</samp> option, you will get individual block counts, and the output looks like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-: 0:Source:tmp.cpp + -: 0:Working directory:/home/gcc/testcase + -: 0:Graph:tmp.gcno + -: 0:Data:tmp.gcda + -: 0:Runs:1 + -: 0:Programs:1 + -: 1:#include <stdio.h> + -: 2: + -: 3:template<class T> + -: 4:class Foo + -: 5:{ + -: 6: public: + 1*: 7: Foo(): b (1000) {} +------------------ +Foo<char>::Foo(): + #####: 7: Foo(): b (1000) {} +------------------ +Foo<int>::Foo(): + 1: 7: Foo(): b (1000) {} +------------------ + 2*: 8: void inc () { b++; } +------------------ +Foo<char>::inc(): + #####: 8: void inc () { b++; } +------------------ +Foo<int>::inc(): + 2: 8: void inc () { b++; } +------------------ + -: 9: + -: 10: private: + -: 11: int b; + -: 12:}; + -: 13: + -: 14:template class Foo<int>; + -: 15:template class Foo<char>; + -: 16: + -: 17:int + 1: 18:main (void) + -: 19:{ + -: 20: int i, total; + 1: 21: Foo<int> counter; + 1: 21-block 0 + -: 22: + 1: 23: counter.inc(); + 1: 23-block 0 + 1: 24: counter.inc(); + 1: 24-block 0 + 1: 25: total = 0; + -: 26: + 11: 27: for (i = 0; i < 10; i++) + 1: 27-block 0 + 11: 27-block 1 + 10: 28: total += i; + 10: 28-block 0 + -: 29: + 1*: 30: int v = total > 100 ? 1 : 2; + 1: 30-block 0 + %%%%%: 30-block 1 + 1: 30-block 2 + -: 31: + 1: 32: if (total != 45) + 1: 32-block 0 + #####: 33: printf ("Failure\n"); + %%%%%: 33-block 0 + -: 34: else + 1: 35: printf ("Success\n"); + 1: 35-block 0 + 1: 36: return 0; + 1: 36-block 0 + -: 37:}</pre> +</div> <p>In this mode, each basic block is only shown on one line – the last line of the block. A multi-line block will only contribute to the execution count of that last line, and other lines will not be shown to contain code, unless previous blocks end on those lines. The total execution count of a line is shown and subsequent lines show the execution counts for individual blocks that end on that line. After each block, the branch and call counts of the block will be shown, if the <samp class="option">-b</samp> option is given. </p> <p>Because of the way GCC instruments calls, a call count can be shown after a line with no individual blocks. As you can see, line 33 contains a basic block that was not executed. </p> <p>When you use the <samp class="option">-b</samp> option, your output looks like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-: 0:Source:tmp.cpp + -: 0:Working directory:/home/gcc/testcase + -: 0:Graph:tmp.gcno + -: 0:Data:tmp.gcda + -: 0:Runs:1 + -: 0:Programs:1 + -: 1:#include <stdio.h> + -: 2: + -: 3:template<class T> + -: 4:class Foo + -: 5:{ + -: 6: public: + 1*: 7: Foo(): b (1000) {} +------------------ +Foo<char>::Foo(): +function Foo<char>::Foo() called 0 returned 0% blocks executed 0% + #####: 7: Foo(): b (1000) {} +------------------ +Foo<int>::Foo(): +function Foo<int>::Foo() called 1 returned 100% blocks executed 100% + 1: 7: Foo(): b (1000) {} +------------------ + 2*: 8: void inc () { b++; } +------------------ +Foo<char>::inc(): +function Foo<char>::inc() called 0 returned 0% blocks executed 0% + #####: 8: void inc () { b++; } +------------------ +Foo<int>::inc(): +function Foo<int>::inc() called 2 returned 100% blocks executed 100% + 2: 8: void inc () { b++; } +------------------ + -: 9: + -: 10: private: + -: 11: int b; + -: 12:}; + -: 13: + -: 14:template class Foo<int>; + -: 15:template class Foo<char>; + -: 16: + -: 17:int +function main called 1 returned 100% blocks executed 81% + 1: 18:main (void) + -: 19:{ + -: 20: int i, total; + 1: 21: Foo<int> counter; +call 0 returned 100% +branch 1 taken 100% (fallthrough) +branch 2 taken 0% (throw) + -: 22: + 1: 23: counter.inc(); +call 0 returned 100% +branch 1 taken 100% (fallthrough) +branch 2 taken 0% (throw) + 1: 24: counter.inc(); +call 0 returned 100% +branch 1 taken 100% (fallthrough) +branch 2 taken 0% (throw) + 1: 25: total = 0; + -: 26: + 11: 27: for (i = 0; i < 10; i++) +branch 0 taken 91% (fallthrough) +branch 1 taken 9% + 10: 28: total += i; + -: 29: + 1*: 30: int v = total > 100 ? 1 : 2; +branch 0 taken 0% (fallthrough) +branch 1 taken 100% + -: 31: + 1: 32: if (total != 45) +branch 0 taken 0% (fallthrough) +branch 1 taken 100% + #####: 33: printf ("Failure\n"); +call 0 never executed +branch 1 never executed +branch 2 never executed + -: 34: else + 1: 35: printf ("Success\n"); +call 0 returned 100% +branch 1 taken 100% (fallthrough) +branch 2 taken 0% (throw) + 1: 36: return 0; + -: 37:}</pre> +</div> <p>For each function, a line is printed showing how many times the function is called, how many times it returns and what percentage of the function’s blocks were executed. </p> <p>For each basic block, a line is printed after the last line of the basic block describing the branch or call that ends the basic block. There can be multiple branches and calls listed for a single source line if there are multiple basic blocks that end on that line. In this case, the branches and calls are each given a number. There is no simple way to map these branches and calls back to source constructs. In general, though, the lowest numbered branch or call will correspond to the leftmost construct on the source line. </p> <p>For a branch, if it was executed at least once, then a percentage indicating the number of times the branch was taken divided by the number of times the branch was executed will be printed. Otherwise, the message “never executed” is printed. </p> <p>For a call, if it was executed at least once, then a percentage indicating the number of times the call returned divided by the number of times the call was executed will be printed. This will usually be 100%, but may be less for functions that call <code class="code">exit</code> or <code class="code">longjmp</code>, and thus may not return every time they are called. </p> <p>The execution counts are cumulative. If the example program were executed again without removing the <samp class="file">.gcda</samp> file, the count for the number of times each line in the source was executed would be added to the results of the previous run(s). This is potentially useful in several ways. For example, it could be used to accumulate data over a number of program runs as part of a test verification suite, or to provide more accurate long-term information over a large number of program runs. </p> <p>The data in the <samp class="file">.gcda</samp> files is saved immediately before the program exits. For each source file compiled with <samp class="option">-fprofile-arcs</samp>, the profiling code first attempts to read in an existing <samp class="file">.gcda</samp> file; if the file doesn’t match the executable (differing number of basic block counts) it will ignore the contents of the file. It then adds in the new execution counts and finally writes the data to the file. </p> </div> <div class="nav-panel"> <p> Next: <a href="gcov-and-optimization">Using <code class="command">gcov</code> with GCC Optimization</a>, Previous: <a href="gcov-intro">Introduction to <code class="command">gcov</code></a>, Up: <a href="gcov"><code class="command">gcov</code>—a Test Coverage Program</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-Gcov.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-Gcov.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/invoking-lto-dump.html b/devdocs/gcc~13/invoking-lto-dump.html new file mode 100644 index 00000000..84bf9075 --- /dev/null +++ b/devdocs/gcc~13/invoking-lto-dump.html @@ -0,0 +1,23 @@ +<div class="section-level-extent" id="Invoking-lto-dump"> <div class="nav-panel"> <p> Previous: <a href="lto-dump-intro" accesskey="p" rel="prev">Introduction to <code class="command">lto-dump</code></a>, Up: <a href="lto-dump" accesskey="u" rel="up"><code class="command">lto-dump</code>—Tool for dumping LTO object files.</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Invoking-lto-dump-1"><span>13.2 Invoking lto-dump<a class="copiable-link" href="#Invoking-lto-dump-1"> ¶</a></span></h1> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">Usage: lto-dump <span class="r">[</span><var class="var">OPTION</var><span class="r">]</span> ... <var class="var">objfiles</var></pre> +</div> <p><code class="command">lto-dump</code> accepts the following options: </p> <dl class="table"> <dt><code class="code">-list</code></dt> <dd> +<p>Dumps list of details of functions and variables. </p> </dd> <dt><code class="code">-demangle</code></dt> <dd> +<p>Dump the demangled output. </p> </dd> <dt><code class="code">-defined-only</code></dt> <dd> +<p>Dump only the defined symbols. </p> </dd> <dt><code class="code">-print-value</code></dt> <dd> +<p>Dump initial values of the variables. </p> </dd> <dt><code class="code">-name-sort</code></dt> <dd> +<p>Sort the symbols alphabetically. </p> </dd> <dt><code class="code">-size-sort</code></dt> <dd> +<p>Sort the symbols according to size. </p> </dd> <dt><code class="code">-reverse-sort</code></dt> <dd> +<p>Dump the symbols in reverse order. </p> </dd> <dt><code class="code">-no-sort</code></dt> <dd> +<p>Dump the symbols in order of occurrence. </p> </dd> <dt><code class="code">-symbol=</code></dt> <dd> +<p>Dump the details of specific symbol. </p> </dd> <dt><code class="code">-objects</code></dt> <dd> +<p>Dump the details of LTO objects. </p> </dd> <dt><code class="code">-type-stats</code></dt> <dd> +<p>Dump the statistics of tree types. </p> </dd> <dt><code class="code">-tree-stats</code></dt> <dd> +<p>Dump the statistics of trees. </p> </dd> <dt><code class="code">-gimple-stats</code></dt> <dd> +<p>Dump the statistics of gimple statements. </p> </dd> <dt><code class="code">-dump-level=</code></dt> <dd> +<p>For deciding the optimization level of body. </p> </dd> <dt><code class="code">-dump-body=</code></dt> <dd> +<p>Dump the specific gimple body. </p> </dd> <dt><code class="code">-help</code></dt> <dd> +<p>Display the dump tool help. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-lto-dump.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Invoking-lto-dump.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/label-attributes.html b/devdocs/gcc~13/label-attributes.html new file mode 100644 index 00000000..ae48e321 --- /dev/null +++ b/devdocs/gcc~13/label-attributes.html @@ -0,0 +1,26 @@ +<div class="section-level-extent" id="Label-Attributes"> <div class="nav-panel"> <p> Next: <a href="enumerator-attributes" accesskey="n" rel="next">Enumerator Attributes</a>, Previous: <a href="type-attributes" accesskey="p" rel="prev">Specifying Attributes of Types</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Label-Attributes-1"><span>6.36 Label Attributes<a class="copiable-link" href="#Label-Attributes-1"> ¶</a></span></h1> <p>GCC allows attributes to be set on C labels. See <a class="xref" href="attribute-syntax">Attribute Syntax</a>, for details of the exact syntax for using attributes. Other attributes are available for functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>), variables (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>), enumerators (see <a class="pxref" href="enumerator-attributes">Enumerator Attributes</a>), statements (see <a class="pxref" href="statement-attributes">Statement Attributes</a>), and for types (see <a class="pxref" href="type-attributes">Specifying Attributes of Types</a>). A label attribute followed by a declaration appertains to the label and not the declaration. </p> <p>This example uses the <code class="code">cold</code> label attribute to indicate the <code class="code">ErrorHandling</code> branch is unlikely to be taken and that the <code class="code">ErrorHandling</code> label is unused: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm goto ("some asm" : : : : NoError); + +/* This branch (the fall-through from the asm) is less commonly used */ +ErrorHandling: + __attribute__((cold, unused)); /* Semi-colon is required here */ + printf("error\n"); + return 0; + +NoError: + printf("no error\n"); + return 1;</pre> +</div> <dl class="table"> <dt> +<span><code class="code">unused</code><a class="copiable-link" href="#index-unused-label-attribute"> ¶</a></span> +</dt> <dd> +<p>This feature is intended for program-generated code that may contain unused labels, but which is compiled with <samp class="option">-Wall</samp>. It is not normally appropriate to use in it human-written code, though it could be useful in cases where the code that jumps to the label is contained within an <code class="code">#ifdef</code> conditional. </p> </dd> <dt> +<span><code class="code">hot</code><a class="copiable-link" href="#index-hot-label-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">hot</code> attribute on a label is used to inform the compiler that the path following the label is more likely than paths that are not so annotated. This attribute is used in cases where <code class="code">__builtin_expect</code> cannot be used, for instance with computed goto or <code class="code">asm goto</code>. </p> </dd> <dt> +<span><code class="code">cold</code><a class="copiable-link" href="#index-cold-label-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">cold</code> attribute on labels is used to inform the compiler that the path following the label is unlikely to be executed. This attribute is used in cases where <code class="code">__builtin_expect</code> cannot be used, for instance with computed goto or <code class="code">asm goto</code>. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="enumerator-attributes">Enumerator Attributes</a>, Previous: <a href="type-attributes">Specifying Attributes of Types</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Label-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Label-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/labels-as-values.html b/devdocs/gcc~13/labels-as-values.html new file mode 100644 index 00000000..47422c16 --- /dev/null +++ b/devdocs/gcc~13/labels-as-values.html @@ -0,0 +1,15 @@ +<div class="section-level-extent" id="Labels-as-Values"> <div class="nav-panel"> <p> Next: <a href="nested-functions" accesskey="n" rel="next">Nested Functions</a>, Previous: <a href="local-labels" accesskey="p" rel="prev">Locally Declared Labels</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Labels-as-Values-1"><span>6.3 Labels as Values<a class="copiable-link" href="#Labels-as-Values-1"> ¶</a></span></h1> <p>You can get the address of a label defined in the current function (or a containing function) with the unary operator ‘<samp class="samp">&&</samp>’. The value has type <code class="code">void *</code>. This value is a constant and can be used wherever a constant of that type is valid. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void *ptr; +/* <span class="r">…</span> */ +ptr = &&foo;</pre> +</div> <p>To use these values, you need to be able to jump to one. This is done with the computed goto statement<a class="footnote" id="DOCF6" href="#FOOT6"><sup>6</sup></a>, <code class="code">goto *<var class="var">exp</var>;</code>. For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">goto *ptr;</pre> +</div> <p>Any expression of type <code class="code">void *</code> is allowed. </p> <p>One way of using these constants is in initializing a static array that serves as a jump table: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static void *array[] = { &&foo, &&bar, &&hack };</pre> +</div> <p>Then you can select a label with indexing, like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">goto *array[i];</pre> +</div> <p>Note that this does not check whether the subscript is in bounds—array indexing in C never does that. </p> <p>Such an array of label values serves a purpose much like that of the <code class="code">switch</code> statement. The <code class="code">switch</code> statement is cleaner, so use that rather than an array unless the problem does not fit a <code class="code">switch</code> statement very well. </p> <p>Another use of label values is in an interpreter for threaded code. The labels within the interpreter function can be stored in the threaded code for super-fast dispatching. </p> <p>You may not use this mechanism to jump to code in a different function. If you do that, totally unpredictable things happen. The best way to avoid this is to store the label address only in automatic variables and never pass it as an argument. </p> <p>An alternate way to write the above example is </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static const int array[] = { &&foo - &&foo, &&bar - &&foo, + &&hack - &&foo }; +goto *(&&foo + array[i]);</pre> +</div> <p>This is more friendly to code living in shared libraries, as it reduces the number of dynamic relocations that are needed, and by consequence, allows the data to be read-only. This alternative with label differences is not supported for the AVR target, please use the first approach for AVR programs. </p> <p>The <code class="code">&&foo</code> expressions for the same label might have different values if the containing function is inlined or cloned. If a program relies on them being always the same, <code class="code">__attribute__((__noinline__,__noclone__))</code> should be used to prevent inlining and cloning. If <code class="code">&&foo</code> is used in a static variable initializer, inlining and cloning is forbidden. </p> </div> <div class="footnotes-segment"> <h2 class="footnotes-heading">Footnotes</h2> <h3 class="footnote-body-heading"><a id="FOOT6" href="#DOCF6">(6)</a></h3> <p>The analogous feature in Fortran is called an assigned goto, but that name seems inappropriate in C, where one can do more than simply store label addresses in label variables.</p> </div> <div class="nav-panel"> <p> Next: <a href="nested-functions">Nested Functions</a>, Previous: <a href="local-labels">Locally Declared Labels</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Labels-as-Values.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Labels-as-Values.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/legacy-type-encoding.html b/devdocs/gcc~13/legacy-type-encoding.html new file mode 100644 index 00000000..8842689a --- /dev/null +++ b/devdocs/gcc~13/legacy-type-encoding.html @@ -0,0 +1,10 @@ +<div class="subsection-level-extent" id="Legacy-type-encoding"> <div class="nav-panel"> <p> Next: <a href="_0040encode" accesskey="n" rel="next"><code class="code">@encode</code></a>, Up: <a href="type-encoding" accesskey="u" rel="up">Type Encoding</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Legacy-Type-Encoding"><span>8.3.1 Legacy Type Encoding<a class="copiable-link" href="#Legacy-Type-Encoding"> ¶</a></span></h1> <p>Unfortunately, historically GCC used to have a number of bugs in its encoding code. The NeXT runtime expects GCC to emit type encodings in this historical format (compatible with GCC-3.3), so when using the NeXT runtime, GCC will introduce on purpose a number of incorrect encodings: </p> <ul class="itemize mark-bullet"> <li>the read-only qualifier of the pointee gets emitted before the ’^’. The read-only qualifier of the pointer itself gets ignored, unless it is a typedef. Also, the ’r’ is only emitted for the outermost type. </li> +<li>32-bit longs are encoded as ’l’ or ’L’, but not always. For typedefs, the compiler uses ’i’ or ’I’ instead if encoding a struct field or a pointer. </li> +<li> +<code class="code">enum</code>s are always encoded as ’i’ (int) even if they are actually unsigned or long. </li> +</ul> <p>In addition to that, the NeXT runtime uses a different encoding for bitfields. It encodes them as <code class="code">b</code> followed by the size, without a bit offset or the underlying field type. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Legacy-type-encoding.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Legacy-type-encoding.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/library-functions-implementation.html b/devdocs/gcc~13/library-functions-implementation.html new file mode 100644 index 00000000..b357070d --- /dev/null +++ b/devdocs/gcc~13/library-functions-implementation.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Library-functions-implementation"> <div class="nav-panel"> <p> Next: <a href="architecture-implementation" accesskey="n" rel="next">Architecture</a>, Previous: <a href="preprocessing-directives-implementation" accesskey="p" rel="prev">Preprocessing Directives</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Library-Functions"><span>4.14 Library Functions<a class="copiable-link" href="#Library-Functions"> ¶</a></span></h1> <p>The behavior of most of these points are dependent on the implementation of the C library, and are not defined by GCC itself. </p> <ul class="itemize mark-bullet"> <li>The null pointer constant to which the macro <code class="code">NULL</code> expands (C90 7.1.6, C99 7.17, C11 7.19). <p>In <code class="code"><stddef.h></code>, <code class="code">NULL</code> expands to <code class="code">((void *)0)</code>. GCC does not provide the other headers which define <code class="code">NULL</code> and some library implementations may use other definitions in those headers. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Library-functions-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Library-functions-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/link-options.html b/devdocs/gcc~13/link-options.html new file mode 100644 index 00000000..38f0ea70 --- /dev/null +++ b/devdocs/gcc~13/link-options.html @@ -0,0 +1,112 @@ +<div class="section-level-extent" id="Link-Options"> <div class="nav-panel"> <p> Next: <a href="directory-options" accesskey="n" rel="next">Options for Directory Search</a>, Previous: <a href="assembler-options" accesskey="p" rel="prev">Passing Options to the Assembler</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-for-Linking"><span>3.15 Options for Linking<a class="copiable-link" href="#Options-for-Linking"> ¶</a></span></h1> <p>These options come into play when the compiler links object files into an executable output file. They are meaningless if the compiler is not doing a link step. </p> <dl class="table"> <dt> +<span><code class="code"><var class="var">object-file-name</var></code><a class="copiable-link" href="#index-file-names"> ¶</a></span> +</dt> <dd> +<p>A file name that does not end in a special recognized suffix is considered to name an object file or library. (Object files are distinguished from libraries by the linker according to the file contents.) If linking is done, these object files are used as input to the linker. </p> </dd> <dt> + <span><code class="code">-c</code><a class="copiable-link" href="#index-c-1"> ¶</a></span> +</dt> <dt><code class="code">-S</code></dt> <dt><code class="code">-E</code></dt> <dd> +<p>If any of these options is used, then the linker is not run, and object file names should not be used as arguments. See <a class="xref" href="overall-options">Options Controlling the Kind of Output</a>. </p> </dd> <dt> +<span><code class="code">-flinker-output=<var class="var">type</var></code><a class="copiable-link" href="#index-flinker-output"> ¶</a></span> +</dt> <dd> +<p>This option controls code generation of the link-time optimizer. By default the linker output is automatically determined by the linker plugin. For debugging the compiler and if incremental linking with a non-LTO object file is desired, it may be useful to control the type manually. </p> <p>If <var class="var">type</var> is ‘<samp class="samp">exec</samp>’, code generation produces a static binary. In this case <samp class="option">-fpic</samp> and <samp class="option">-fpie</samp> are both disabled. </p> <p>If <var class="var">type</var> is ‘<samp class="samp">dyn</samp>’, code generation produces a shared library. In this case <samp class="option">-fpic</samp> or <samp class="option">-fPIC</samp> is preserved, but not enabled automatically. This allows to build shared libraries without position-independent code on architectures where this is possible, i.e. on x86. </p> <p>If <var class="var">type</var> is ‘<samp class="samp">pie</samp>’, code generation produces an <samp class="option">-fpie</samp> executable. This results in similar optimizations as ‘<samp class="samp">exec</samp>’ except that <samp class="option">-fpie</samp> is not disabled if specified at compilation time. </p> <p>If <var class="var">type</var> is ‘<samp class="samp">rel</samp>’, the compiler assumes that incremental linking is done. The sections containing intermediate code for link-time optimization are merged, pre-optimized, and output to the resulting object file. In addition, if <samp class="option">-ffat-lto-objects</samp> is specified, binary code is produced for future non-LTO linking. The object file produced by incremental linking is smaller than a static library produced from the same object files. At link time the result of incremental linking also loads faster than a static library assuming that the majority of objects in the library are used. </p> <p>Finally ‘<samp class="samp">nolto-rel</samp>’ configures the compiler for incremental linking where code generation is forced, a final binary is produced, and the intermediate code for later link-time optimization is stripped. When multiple object files are linked together the resulting code is better optimized than with link-time optimizations disabled (for example, cross-module inlining happens), but most of benefits of whole program optimizations are lost. </p> <p>During the incremental link (by <samp class="option">-r</samp>) the linker plugin defaults to <samp class="option">rel</samp>. With current interfaces to GNU Binutils it is however not possible to incrementally link LTO objects and non-LTO objects into a single mixed object file. If any of object files in incremental link cannot be used for link-time optimization, the linker plugin issues a warning and uses ‘<samp class="samp">nolto-rel</samp>’. To maintain whole program optimization, it is recommended to link such objects into static library instead. Alternatively it is possible to use H.J. Lu’s binutils with support for mixed objects. </p> </dd> <dt> +<span><code class="code">-fuse-ld=bfd</code><a class="copiable-link" href="#index-fuse-ld_003dbfd"> ¶</a></span> +</dt> <dd> +<p>Use the <code class="command">bfd</code> linker instead of the default linker. </p> </dd> <dt> +<span><code class="code">-fuse-ld=gold</code><a class="copiable-link" href="#index-fuse-ld_003dgold"> ¶</a></span> +</dt> <dd> +<p>Use the <code class="command">gold</code> linker instead of the default linker. </p> </dd> <dt> +<span><code class="code">-fuse-ld=lld</code><a class="copiable-link" href="#index-fuse-ld_003dlld"> ¶</a></span> +</dt> <dd> +<p>Use the LLVM <code class="command">lld</code> linker instead of the default linker. </p> </dd> <dt> +<span><code class="code">-fuse-ld=mold</code><a class="copiable-link" href="#index-fuse-ld_003dmold"> ¶</a></span> +</dt> <dd> +<p>Use the Modern Linker (<code class="command">mold</code>) instead of the default linker. </p> </dd> <dt> + <span><code class="code">-l<var class="var">library</var></code><a class="copiable-link" href="#index-Libraries"> ¶</a></span> +</dt> <dt><code class="code">-l <var class="var">library</var></code></dt> <dd> +<p>Search the library named <var class="var">library</var> when linking. (The second alternative with the library as a separate argument is only for POSIX compliance and is not recommended.) </p> <p>The <samp class="option">-l</samp> option is passed directly to the linker by GCC. Refer to your linker documentation for exact details. The general description below applies to the GNU linker. </p> <p>The linker searches a standard list of directories for the library. The directories searched include several standard system directories plus any that you specify with <samp class="option">-L</samp>. </p> <p>Static libraries are archives of object files, and have file names like <samp class="file">lib<var class="var">library</var>.a</samp>. Some targets also support shared libraries, which typically have names like <samp class="file">lib<var class="var">library</var>.so</samp>. If both static and shared libraries are found, the linker gives preference to linking with the shared library unless the <samp class="option">-static</samp> option is used. </p> <p>It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, ‘<samp class="samp">foo.o -lz bar.o</samp>’ searches library ‘<samp class="samp">z</samp>’ after file <samp class="file">foo.o</samp> but before <samp class="file">bar.o</samp>. If <samp class="file">bar.o</samp> refers to functions in ‘<samp class="samp">z</samp>’, those functions may not be loaded. </p> </dd> <dt> +<span><code class="code">-lobjc</code><a class="copiable-link" href="#index-lobjc"> ¶</a></span> +</dt> <dd> +<p>You need this special case of the <samp class="option">-l</samp> option in order to link an Objective-C or Objective-C++ program. </p> </dd> <dt> +<span><code class="code">-nostartfiles</code><a class="copiable-link" href="#index-nostartfiles"> ¶</a></span> +</dt> <dd> +<p>Do not use the standard system startup files when linking. The standard system libraries are used normally, unless <samp class="option">-nostdlib</samp>, <samp class="option">-nolibc</samp>, or <samp class="option">-nodefaultlibs</samp> is used. </p> </dd> <dt> +<span><code class="code">-nodefaultlibs</code><a class="copiable-link" href="#index-nodefaultlibs"> ¶</a></span> +</dt> <dd> +<p>Do not use the standard system libraries when linking. Only the libraries you specify are passed to the linker, and options specifying linkage of the system libraries, such as <samp class="option">-static-libgcc</samp> or <samp class="option">-shared-libgcc</samp>, are ignored. The standard startup files are used normally, unless <samp class="option">-nostartfiles</samp> is used. </p> <p>The compiler may generate calls to <code class="code">memcmp</code>, <code class="code">memset</code>, <code class="code">memcpy</code> and <code class="code">memmove</code>. These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified. </p> </dd> <dt> +<span><code class="code">-nolibc</code><a class="copiable-link" href="#index-nolibc"> ¶</a></span> +</dt> <dd> +<p>Do not use the C library or system libraries tightly coupled with it when linking. Still link with the startup files, <samp class="file">libgcc</samp> or toolchain provided language support libraries such as <samp class="file">libgnat</samp>, <samp class="file">libgfortran</samp> or <samp class="file">libstdc++</samp> unless options preventing their inclusion are used as well. This typically removes <samp class="option">-lc</samp> from the link command line, as well as system libraries that normally go with it and become meaningless when absence of a C library is assumed, for example <samp class="option">-lpthread</samp> or <samp class="option">-lm</samp> in some configurations. This is intended for bare-board targets when there is indeed no C library available. </p> </dd> <dt> +<span><code class="code">-nostdlib</code><a class="copiable-link" href="#index-nostdlib"> ¶</a></span> +</dt> <dd> +<p>Do not use the standard system startup files or libraries when linking. No startup files and only the libraries you specify are passed to the linker, and options specifying linkage of the system libraries, such as <samp class="option">-static-libgcc</samp> or <samp class="option">-shared-libgcc</samp>, are ignored. </p> <p>The compiler may generate calls to <code class="code">memcmp</code>, <code class="code">memset</code>, <code class="code">memcpy</code> and <code class="code">memmove</code>. These entries are usually resolved by entries in libc. These entry points should be supplied through some other mechanism when this option is specified. </p> <p>One of the standard libraries bypassed by <samp class="option">-nostdlib</samp> and <samp class="option">-nodefaultlibs</samp> is <samp class="file">libgcc.a</samp>, a library of internal subroutines which GCC uses to overcome shortcomings of particular machines, or special needs for some languages. (See <a data-manual="gccint" href="https://gcc.gnu.org/onlinedocs/gccint/Interface.html#Interface">Interfacing to GCC Output</a> in GNU Compiler Collection (GCC) Internals, for more discussion of <samp class="file">libgcc.a</samp>.) In most cases, you need <samp class="file">libgcc.a</samp> even when you want to avoid other standard libraries. In other words, when you specify <samp class="option">-nostdlib</samp> or <samp class="option">-nodefaultlibs</samp> you should usually specify <samp class="option">-lgcc</samp> as well. This ensures that you have no unresolved references to internal GCC library subroutines. (An example of such an internal subroutine is <code class="code">__main</code>, used to ensure C++ constructors are called; see <a data-manual="gccint" href="https://gcc.gnu.org/onlinedocs/gccint/Collect2.html#Collect2"><code class="code">collect2</code></a> in GNU Compiler Collection (GCC) Internals.) </p> </dd> <dt> +<span><code class="code">-nostdlib++</code><a class="copiable-link" href="#index-nostdlib_002b_002b"> ¶</a></span> +</dt> <dd> +<p>Do not implicitly link with standard C++ libraries. </p> </dd> <dt> + <span><code class="code">-e <var class="var">entry</var></code><a class="copiable-link" href="#index-e"> ¶</a></span> +</dt> <dt><code class="code">--entry=<var class="var">entry</var></code></dt> <dd> <p>Specify that the program entry point is <var class="var">entry</var>. The argument is interpreted by the linker; the GNU linker accepts either a symbol name or an address. </p> </dd> <dt> +<span><code class="code">-pie</code><a class="copiable-link" href="#index-pie"> ¶</a></span> +</dt> <dd> +<p>Produce a dynamically linked position independent executable on targets that support it. For predictable results, you must also specify the same set of options used for compilation (<samp class="option">-fpie</samp>, <samp class="option">-fPIE</samp>, or model suboptions) when you specify this linker option. </p> </dd> <dt> +<span><code class="code">-no-pie</code><a class="copiable-link" href="#index-no-pie"> ¶</a></span> +</dt> <dd> +<p>Don’t produce a dynamically linked position independent executable. </p> </dd> <dt> +<span><code class="code">-static-pie</code><a class="copiable-link" href="#index-static-pie"> ¶</a></span> +</dt> <dd> +<p>Produce a static position independent executable on targets that support it. A static position independent executable is similar to a static executable, but can be loaded at any address without a dynamic linker. For predictable results, you must also specify the same set of options used for compilation (<samp class="option">-fpie</samp>, <samp class="option">-fPIE</samp>, or model suboptions) when you specify this linker option. </p> </dd> <dt> +<span><code class="code">-pthread</code><a class="copiable-link" href="#index-pthread-1"> ¶</a></span> +</dt> <dd> +<p>Link with the POSIX threads library. This option is supported on GNU/Linux targets, most other Unix derivatives, and also on x86 Cygwin and MinGW targets. On some targets this option also sets flags for the preprocessor, so it should be used consistently for both compilation and linking. </p> </dd> <dt> +<span><code class="code">-r</code><a class="copiable-link" href="#index-r"> ¶</a></span> +</dt> <dd> +<p>Produce a relocatable object as output. This is also known as partial linking. </p> </dd> <dt> +<span><code class="code">-rdynamic</code><a class="copiable-link" href="#index-rdynamic"> ¶</a></span> +</dt> <dd> +<p>Pass the flag <samp class="option">-export-dynamic</samp> to the ELF linker, on targets that support it. This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. This option is needed for some uses of <code class="code">dlopen</code> or to allow obtaining backtraces from within a program. </p> </dd> <dt> +<span><code class="code">-s</code><a class="copiable-link" href="#index-s"> ¶</a></span> +</dt> <dd> +<p>Remove all symbol table and relocation information from the executable. </p> </dd> <dt> +<span><code class="code">-static</code><a class="copiable-link" href="#index-static"> ¶</a></span> +</dt> <dd> +<p>On systems that support dynamic linking, this overrides <samp class="option">-pie</samp> and prevents linking with the shared libraries. On other systems, this option has no effect. </p> </dd> <dt> +<span><code class="code">-shared</code><a class="copiable-link" href="#index-shared"> ¶</a></span> +</dt> <dd> +<p>Produce a shared object which can then be linked with other objects to form an executable. Not all systems support this option. For predictable results, you must also specify the same set of options used for compilation (<samp class="option">-fpic</samp>, <samp class="option">-fPIC</samp>, or model suboptions) when you specify this linker option.<a class="footnote" id="DOCF1" href="#FOOT1"><sup>1</sup></a> </p> </dd> <dt> + <span><code class="code">-shared-libgcc</code><a class="copiable-link" href="#index-shared-libgcc"> ¶</a></span> +</dt> <dt><code class="code">-static-libgcc</code></dt> <dd> +<p>On systems that provide <samp class="file">libgcc</samp> as a shared library, these options force the use of either the shared or static version, respectively. If no shared version of <samp class="file">libgcc</samp> was built when the compiler was configured, these options have no effect. </p> <p>There are several situations in which an application should use the shared <samp class="file">libgcc</samp> instead of the static version. The most common of these is when the application wishes to throw and catch exceptions across different shared libraries. In that case, each of the libraries as well as the application itself should use the shared <samp class="file">libgcc</samp>. </p> <p>Therefore, the G++ driver automatically adds <samp class="option">-shared-libgcc</samp> whenever you build a shared library or a main executable, because C++ programs typically use exceptions, so this is the right thing to do. </p> <p>If, instead, you use the GCC driver to create shared libraries, you may find that they are not always linked with the shared <samp class="file">libgcc</samp>. If GCC finds, at its configuration time, that you have a non-GNU linker or a GNU linker that does not support option <samp class="option">--eh-frame-hdr</samp>, it links the shared version of <samp class="file">libgcc</samp> into shared libraries by default. Otherwise, it takes advantage of the linker and optimizes away the linking with the shared version of <samp class="file">libgcc</samp>, linking with the static version of libgcc by default. This allows exceptions to propagate through such shared libraries, without incurring relocation costs at library load time. </p> <p>However, if a library or main executable is supposed to throw or catch exceptions, you must link it using the G++ driver, or using the option <samp class="option">-shared-libgcc</samp>, such that it is linked with the shared <samp class="file">libgcc</samp>. </p> </dd> <dt> +<span><code class="code">-static-libasan</code><a class="copiable-link" href="#index-static-libasan"> ¶</a></span> +</dt> <dd> +<p>When the <samp class="option">-fsanitize=address</samp> option is used to link a program, the GCC driver automatically links against <samp class="option">libasan</samp>. If <samp class="file">libasan</samp> is available as a shared library, and the <samp class="option">-static</samp> option is not used, then this links against the shared version of <samp class="file">libasan</samp>. The <samp class="option">-static-libasan</samp> option directs the GCC driver to link <samp class="file">libasan</samp> statically, without necessarily linking other libraries statically. </p> </dd> <dt> +<span><code class="code">-static-libtsan</code><a class="copiable-link" href="#index-static-libtsan"> ¶</a></span> +</dt> <dd> +<p>When the <samp class="option">-fsanitize=thread</samp> option is used to link a program, the GCC driver automatically links against <samp class="option">libtsan</samp>. If <samp class="file">libtsan</samp> is available as a shared library, and the <samp class="option">-static</samp> option is not used, then this links against the shared version of <samp class="file">libtsan</samp>. The <samp class="option">-static-libtsan</samp> option directs the GCC driver to link <samp class="file">libtsan</samp> statically, without necessarily linking other libraries statically. </p> </dd> <dt> +<span><code class="code">-static-liblsan</code><a class="copiable-link" href="#index-static-liblsan"> ¶</a></span> +</dt> <dd> +<p>When the <samp class="option">-fsanitize=leak</samp> option is used to link a program, the GCC driver automatically links against <samp class="option">liblsan</samp>. If <samp class="file">liblsan</samp> is available as a shared library, and the <samp class="option">-static</samp> option is not used, then this links against the shared version of <samp class="file">liblsan</samp>. The <samp class="option">-static-liblsan</samp> option directs the GCC driver to link <samp class="file">liblsan</samp> statically, without necessarily linking other libraries statically. </p> </dd> <dt> +<span><code class="code">-static-libubsan</code><a class="copiable-link" href="#index-static-libubsan"> ¶</a></span> +</dt> <dd> +<p>When the <samp class="option">-fsanitize=undefined</samp> option is used to link a program, the GCC driver automatically links against <samp class="option">libubsan</samp>. If <samp class="file">libubsan</samp> is available as a shared library, and the <samp class="option">-static</samp> option is not used, then this links against the shared version of <samp class="file">libubsan</samp>. The <samp class="option">-static-libubsan</samp> option directs the GCC driver to link <samp class="file">libubsan</samp> statically, without necessarily linking other libraries statically. </p> </dd> <dt> +<span><code class="code">-static-libstdc++</code><a class="copiable-link" href="#index-static-libstdc_002b_002b"> ¶</a></span> +</dt> <dd> +<p>When the <code class="command">g++</code> program is used to link a C++ program, it normally automatically links against <samp class="option">libstdc++</samp>. If <samp class="file">libstdc++</samp> is available as a shared library, and the <samp class="option">-static</samp> option is not used, then this links against the shared version of <samp class="file">libstdc++</samp>. That is normally fine. However, it is sometimes useful to freeze the version of <samp class="file">libstdc++</samp> used by the program without going all the way to a fully static link. The <samp class="option">-static-libstdc++</samp> option directs the <code class="command">g++</code> driver to link <samp class="file">libstdc++</samp> statically, without necessarily linking other libraries statically. </p> </dd> <dt> +<span><code class="code">-symbolic</code><a class="copiable-link" href="#index-symbolic"> ¶</a></span> +</dt> <dd> +<p>Bind references to global symbols when building a shared object. Warn about any unresolved references (unless overridden by the link editor option <samp class="option">-Xlinker -z -Xlinker defs</samp>). Only a few systems support this option. </p> </dd> <dt> + <span><code class="code">-T <var class="var">script</var></code><a class="copiable-link" href="#index-T"> ¶</a></span> +</dt> <dd> +<p>Use <var class="var">script</var> as the linker script. This option is supported by most systems using the GNU linker. On some targets, such as bare-board targets without an operating system, the <samp class="option">-T</samp> option may be required when linking to avoid references to undefined symbols. </p> </dd> <dt> +<span><code class="code">-Xlinker <var class="var">option</var></code><a class="copiable-link" href="#index-Xlinker"> ¶</a></span> +</dt> <dd> +<p>Pass <var class="var">option</var> as an option to the linker. You can use this to supply system-specific linker options that GCC does not recognize. </p> <p>If you want to pass an option that takes a separate argument, you must use <samp class="option">-Xlinker</samp> twice, once for the option and once for the argument. For example, to pass <samp class="option">-assert definitions</samp>, you must write <samp class="option">-Xlinker -assert -Xlinker definitions</samp>. It does not work to write <samp class="option">-Xlinker "-assert definitions"</samp>, because this passes the entire string as a single argument, which is not what the linker expects. </p> <p>When using the GNU linker, it is usually more convenient to pass arguments to linker options using the <samp class="option"><var class="var">option</var>=<var class="var">value</var></samp> syntax than as separate arguments. For example, you can specify <samp class="option">-Xlinker -Map=output.map</samp> rather than <samp class="option">-Xlinker -Map -Xlinker output.map</samp>. Other linkers may not support this syntax for command-line options. </p> </dd> <dt> +<span><code class="code">-Wl,<var class="var">option</var></code><a class="copiable-link" href="#index-Wl"> ¶</a></span> +</dt> <dd> +<p>Pass <var class="var">option</var> as an option to the linker. If <var class="var">option</var> contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, <samp class="option">-Wl,-Map,output.map</samp> passes <samp class="option">-Map output.map</samp> to the linker. When using the GNU linker, you can also get the same effect with <samp class="option">-Wl,-Map=output.map</samp>. </p> </dd> <dt> +<span><code class="code">-u <var class="var">symbol</var></code><a class="copiable-link" href="#index-u"> ¶</a></span> +</dt> <dd> +<p>Pretend the symbol <var class="var">symbol</var> is undefined, to force linking of library modules to define it. You can use <samp class="option">-u</samp> multiple times with different symbols to force loading of additional library modules. </p> </dd> <dt> +<span><code class="code">-z <var class="var">keyword</var></code><a class="copiable-link" href="#index-z"> ¶</a></span> +</dt> <dd><p><samp class="option">-z</samp> is passed directly on to the linker along with the keyword <var class="var">keyword</var>. See the section in the documentation of your linker for permitted values and their meanings. </p></dd> </dl> </div> <div class="footnotes-segment"> <h2 class="footnotes-heading">Footnotes</h2> <h3 class="footnote-body-heading"><a id="FOOT1" href="#DOCF1">(1)</a></h3> <p>On some systems, ‘<samp class="samp">gcc -shared</samp>’ needs to build supplementary stub code for constructors to work. On multi-libbed systems, ‘<samp class="samp">gcc -shared</samp>’ must select the correct support libraries to link against. Failing to supply the correct flags may lead to subtle defects. Supplying them in cases where they are not necessary is innocuous. <samp class="option">-shared</samp> suppresses the addition of startup code to alter the floating-point environment as done with <samp class="option">-ffast-math</samp>, <samp class="option">-Ofast</samp> or <samp class="option">-funsafe-math-optimizations</samp> on some targets.</p> </div> <div class="nav-panel"> <p> Next: <a href="directory-options">Options for Directory Search</a>, Previous: <a href="assembler-options">Passing Options to the Assembler</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Link-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Link-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/lm32-options.html b/devdocs/gcc~13/lm32-options.html new file mode 100644 index 00000000..959fc149 --- /dev/null +++ b/devdocs/gcc~13/lm32-options.html @@ -0,0 +1,21 @@ +<div class="subsection-level-extent" id="LM32-Options"> <div class="nav-panel"> <p> Next: <a href="loongarch-options" accesskey="n" rel="next">LoongArch Options</a>, Previous: <a href="ia-64-options" accesskey="p" rel="prev">IA-64 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="LM32-Options-1"><span>3.19.21 LM32 Options<a class="copiable-link" href="#LM32-Options-1"> ¶</a></span></h1> <p>These <samp class="option">-m</samp> options are defined for the LatticeMico32 architecture: </p> <dl class="table"> <dt> +<span><code class="code">-mbarrel-shift-enabled</code><a class="copiable-link" href="#index-mbarrel-shift-enabled"> ¶</a></span> +</dt> <dd> +<p>Enable barrel-shift instructions. </p> </dd> <dt> +<span><code class="code">-mdivide-enabled</code><a class="copiable-link" href="#index-mdivide-enabled"> ¶</a></span> +</dt> <dd> +<p>Enable divide and modulus instructions. </p> </dd> <dt> +<span><code class="code">-mmultiply-enabled</code><a class="copiable-link" href="#index-multiply-enabled"> ¶</a></span> +</dt> <dd> +<p>Enable multiply instructions. </p> </dd> <dt> +<span><code class="code">-msign-extend-enabled</code><a class="copiable-link" href="#index-msign-extend-enabled"> ¶</a></span> +</dt> <dd> +<p>Enable sign extend instructions. </p> </dd> <dt> +<span><code class="code">-muser-enabled</code><a class="copiable-link" href="#index-muser-enabled"> ¶</a></span> +</dt> <dd> +<p>Enable user-defined instructions. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/LM32-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/LM32-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/local-labels.html b/devdocs/gcc~13/local-labels.html new file mode 100644 index 00000000..229f6a1e --- /dev/null +++ b/devdocs/gcc~13/local-labels.html @@ -0,0 +1,37 @@ +<div class="section-level-extent" id="Local-Labels"> <div class="nav-panel"> <p> Next: <a href="labels-as-values" accesskey="n" rel="next">Labels as Values</a>, Previous: <a href="statement-exprs" accesskey="p" rel="prev">Statements and Declarations in Expressions</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Locally-Declared-Labels"><span>6.2 Locally Declared Labels<a class="copiable-link" href="#Locally-Declared-Labels"> ¶</a></span></h1> <p>GCC allows you to declare <em class="dfn">local labels</em> in any nested block scope. A local label is just like an ordinary label, but you can only reference it (with a <code class="code">goto</code> statement, or by taking its address) within the block in which it is declared. </p> <p>A local label declaration looks like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__label__ <var class="var">label</var>;</pre> +</div> <p>or </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__label__ <var class="var">label1</var>, <var class="var">label2</var>, /* <span class="r">…</span> */;</pre> +</div> <p>Local label declarations must come at the beginning of the block, before any ordinary declarations or statements. </p> <p>The label declaration defines the label <em class="emph">name</em>, but does not define the label itself. You must do this in the usual way, with <code class="code"><var class="var">label</var>:</code>, within the statements of the statement expression. </p> <p>The local label feature is useful for complex macros. If a macro contains nested loops, a <code class="code">goto</code> can be useful for breaking out of them. However, an ordinary label whose scope is the whole function cannot be used: if the macro can be expanded several times in one function, the label is multiply defined in that function. A local label avoids this problem. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define SEARCH(value, array, target) \ +do { \ + __label__ found; \ + typeof (target) _SEARCH_target = (target); \ + typeof (*(array)) *_SEARCH_array = (array); \ + int i, j; \ + int value; \ + for (i = 0; i < max; i++) \ + for (j = 0; j < max; j++) \ + if (_SEARCH_array[i][j] == _SEARCH_target) \ + { (value) = i; goto found; } \ + (value) = -1; \ + found:; \ +} while (0)</pre> +</div> <p>This could also be written using a statement expression: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define SEARCH(array, target) \ +({ \ + __label__ found; \ + typeof (target) _SEARCH_target = (target); \ + typeof (*(array)) *_SEARCH_array = (array); \ + int i, j; \ + int value; \ + for (i = 0; i < max; i++) \ + for (j = 0; j < max; j++) \ + if (_SEARCH_array[i][j] == _SEARCH_target) \ + { value = i; goto found; } \ + value = -1; \ + found: \ + value; \ +})</pre> +</div> <p>Local label declarations also make the labels they declare visible to nested functions, if there are any. See <a class="xref" href="nested-functions">Nested Functions</a>, for details. </p> </div> <div class="nav-panel"> <p> Next: <a href="labels-as-values">Labels as Values</a>, Previous: <a href="statement-exprs">Statements and Declarations in Expressions</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Local-Labels.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Local-Labels.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/local-register-variables.html b/devdocs/gcc~13/local-register-variables.html new file mode 100644 index 00000000..bd7e9057 --- /dev/null +++ b/devdocs/gcc~13/local-register-variables.html @@ -0,0 +1,19 @@ +<div class="subsubsection-level-extent" id="Local-Register-Variables"> <div class="nav-panel"> <p> Previous: <a href="global-register-variables" accesskey="p" rel="prev">Defining Global Register Variables</a>, Up: <a href="explicit-register-variables" accesskey="u" rel="up">Variables in Specified Registers</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Specifying-Registers-for-Local-Variables"><span>6.47.5.2 Specifying Registers for Local Variables<a class="copiable-link" href="#Specifying-Registers-for-Local-Variables"> ¶</a></span></h1> <p>You can define a local register variable and associate it with a specified register like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">register int *foo asm ("r12");</pre> +</div> <p>Here <code class="code">r12</code> is the name of the register that should be used. Note that this is the same syntax used for defining global register variables, but for a local variable the declaration appears within a function. The <code class="code">register</code> keyword is required, and cannot be combined with <code class="code">static</code>. The register name must be a valid register name for the target platform. </p> <p>Do not use type qualifiers such as <code class="code">const</code> and <code class="code">volatile</code>, as the outcome may be contrary to expectations. In particular, when the <code class="code">const</code> qualifier is used, the compiler may substitute the variable with its initializer in <code class="code">asm</code> statements, which may cause the corresponding operand to appear in a different register. </p> <p>As with global register variables, it is recommended that you choose a register that is normally saved and restored by function calls on your machine, so that calls to library routines will not clobber it. </p> <p>The only supported use for this feature is to specify registers for input and output operands when calling Extended <code class="code">asm</code> (see <a class="pxref" href="extended-asm">Extended Asm - Assembler Instructions with C Expression Operands</a>). This may be necessary if the constraints for a particular machine don’t provide sufficient control to select the desired register. To force an operand into a register, create a local variable and specify the register name after the variable’s declaration. Then use the local variable for the <code class="code">asm</code> operand and specify any constraint letter that matches the register: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">register int *p1 asm ("r0") = …; +register int *p2 asm ("r1") = …; +register int *result asm ("r0"); +asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2));</pre> +</div> <p><em class="emph">Warning:</em> In the above example, be aware that a register (for example <code class="code">r0</code>) can be call-clobbered by subsequent code, including function calls and library calls for arithmetic operators on other variables (for example the initialization of <code class="code">p2</code>). In this case, use temporary variables for expressions between the register assignments: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int t1 = …; +register int *p1 asm ("r0") = …; +register int *p2 asm ("r1") = t1; +register int *result asm ("r0"); +asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2));</pre> +</div> <p>Defining a register variable does not reserve the register. Other than when invoking the Extended <code class="code">asm</code>, the contents of the specified register are not guaranteed. For this reason, the following uses are explicitly <em class="emph">not</em> supported. If they appear to work, it is only happenstance, and may stop working as intended due to (seemingly) unrelated changes in surrounding code, or even minor changes in the optimization of a future version of gcc: </p> <ul class="itemize mark-bullet"> <li>Passing parameters to or from Basic <code class="code">asm</code> </li> +<li>Passing parameters to or from Extended <code class="code">asm</code> without using input or output operands. </li> +<li>Passing parameters to or from routines written in assembler (or other languages) using non-standard calling conventions. </li> +</ul> <p>Some developers use Local Register Variables in an attempt to improve gcc’s allocation of registers, especially in large functions. In this case the register name is essentially a hint to the register allocator. While in some instances this can generate better code, improvements are subject to the whims of the allocator/optimizers. Since there are no guarantees that your improvements won’t be lost, this usage of Local Register Variables is discouraged. </p> <p>On the MIPS platform, there is related use for local register variables with slightly different characteristics (see <a data-manual="gccint" href="https://gcc.gnu.org/onlinedocs/gccint/MIPS-Coprocessors.html#MIPS-Coprocessors">Defining coprocessor specifics for MIPS targets</a> in GNU Compiler Collection (GCC) Internals). </p> </div> <div class="nav-panel"> <p> Previous: <a href="global-register-variables">Defining Global Register Variables</a>, Up: <a href="explicit-register-variables">Variables in Specified Registers</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Local-Register-Variables.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Local-Register-Variables.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/locale-specific-behavior-implementation.html b/devdocs/gcc~13/locale-specific-behavior-implementation.html new file mode 100644 index 00000000..dc66dd78 --- /dev/null +++ b/devdocs/gcc~13/locale-specific-behavior-implementation.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Locale-specific-behavior-implementation"> <div class="nav-panel"> <p> Previous: <a href="architecture-implementation" accesskey="p" rel="prev">Architecture</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Locale-Specific-Behavior"><span>4.16 Locale-Specific Behavior<a class="copiable-link" href="#Locale-Specific-Behavior"> ¶</a></span></h1> <p>The behavior of these points are dependent on the implementation of the C library, and are not defined by GCC itself. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Locale-specific-behavior-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Locale-specific-behavior-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/long-long.html b/devdocs/gcc~13/long-long.html new file mode 100644 index 00000000..43fc609c --- /dev/null +++ b/devdocs/gcc~13/long-long.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Long-Long"> <div class="nav-panel"> <p> Next: <a href="complex" accesskey="n" rel="next">Complex Numbers</a>, Previous: <a href="_005f_005fint128" accesskey="p" rel="prev">128-bit Integers</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Double-Word-Integers"><span>6.10 Double-Word Integers<a class="copiable-link" href="#Double-Word-Integers"> ¶</a></span></h1> <p>ISO C99 and ISO C++11 support data types for integers that are at least 64 bits wide, and as an extension GCC supports them in C90 and C++98 modes. Simply write <code class="code">long long int</code> for a signed integer, or <code class="code">unsigned long long int</code> for an unsigned integer. To make an integer constant of type <code class="code">long long int</code>, add the suffix ‘<samp class="samp">LL</samp>’ to the integer. To make an integer constant of type <code class="code">unsigned long +long int</code>, add the suffix ‘<samp class="samp">ULL</samp>’ to the integer. </p> <p>You can use these types in arithmetic like any other integer types. Addition, subtraction, and bitwise boolean operations on these types are open-coded on all types of machines. Multiplication is open-coded if the machine supports a fullword-to-doubleword widening multiply instruction. Division and shifts are open-coded only on machines that provide special support. The operations that are not open-coded use special library routines that come with GCC. </p> <p>There may be pitfalls when you use <code class="code">long long</code> types for function arguments without function prototypes. If a function expects type <code class="code">int</code> for its argument, and you pass a value of type <code class="code">long long int</code>, confusion results because the caller and the subroutine disagree about the number of bytes for the argument. Likewise, if the function expects <code class="code">long long int</code> and you pass <code class="code">int</code>. The best way to avoid such problems is to use prototypes. </p> </div> <div class="nav-panel"> <p> Next: <a href="complex">Complex Numbers</a>, Previous: <a href="_005f_005fint128">128-bit Integers</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Long-Long.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Long-Long.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/loongarch-base-built-in-functions.html b/devdocs/gcc~13/loongarch-base-built-in-functions.html new file mode 100644 index 00000000..bed8728f --- /dev/null +++ b/devdocs/gcc~13/loongarch-base-built-in-functions.html @@ -0,0 +1,109 @@ +<div class="subsection-level-extent" id="LoongArch-Base-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="mips-dsp-built-in-functions" accesskey="n" rel="next">MIPS DSP Built-in Functions</a>, Previous: <a href="fr-v-built-in-functions" accesskey="p" rel="prev">FR-V Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="LoongArch-Base-Built-in-Functions-1"><span>6.60.14 LoongArch Base Built-in Functions<a class="copiable-link" href="#LoongArch-Base-Built-in-Functions-1"> ¶</a></span></h1> <p>These built-in functions are available for LoongArch. </p> <p>Data Type Description: </p> +<ul class="itemize mark-bullet"> <li> +<code class="code">imm0_31</code>, a compile-time constant in range 0 to 31; </li> +<li> +<code class="code">imm0_16383</code>, a compile-time constant in range 0 to 16383; </li> +<li> +<code class="code">imm0_32767</code>, a compile-time constant in range 0 to 32767; </li> +<li> +<code class="code">imm_n2048_2047</code>, a compile-time constant in range -2048 to 2047; </li> +</ul> <p>The intrinsics provided are listed below: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_loongarch_movfcsr2gr (imm0_31) +void __builtin_loongarch_movgr2fcsr (imm0_31, unsigned int) +void __builtin_loongarch_cacop_d (imm0_31, unsigned long int, imm_n2048_2047) +unsigned int __builtin_loongarch_cpucfg (unsigned int) +void __builtin_loongarch_asrtle_d (long int, long int) +void __builtin_loongarch_asrtgt_d (long int, long int) +long int __builtin_loongarch_lddir_d (long int, imm0_31) +void __builtin_loongarch_ldpte_d (long int, imm0_31) + +int __builtin_loongarch_crc_w_b_w (char, int) +int __builtin_loongarch_crc_w_h_w (short, int) +int __builtin_loongarch_crc_w_w_w (int, int) +int __builtin_loongarch_crc_w_d_w (long int, int) +int __builtin_loongarch_crcc_w_b_w (char, int) +int __builtin_loongarch_crcc_w_h_w (short, int) +int __builtin_loongarch_crcc_w_w_w (int, int) +int __builtin_loongarch_crcc_w_d_w (long int, int) + +unsigned int __builtin_loongarch_csrrd_w (imm0_16383) +unsigned int __builtin_loongarch_csrwr_w (unsigned int, imm0_16383) +unsigned int __builtin_loongarch_csrxchg_w (unsigned int, unsigned int, imm0_16383) +unsigned long int __builtin_loongarch_csrrd_d (imm0_16383) +unsigned long int __builtin_loongarch_csrwr_d (unsigned long int, imm0_16383) +unsigned long int __builtin_loongarch_csrxchg_d (unsigned long int, unsigned long int, imm0_16383) + +unsigned char __builtin_loongarch_iocsrrd_b (unsigned int) +unsigned short __builtin_loongarch_iocsrrd_h (unsigned int) +unsigned int __builtin_loongarch_iocsrrd_w (unsigned int) +unsigned long int __builtin_loongarch_iocsrrd_d (unsigned int) +void __builtin_loongarch_iocsrwr_b (unsigned char, unsigned int) +void __builtin_loongarch_iocsrwr_h (unsigned short, unsigned int) +void __builtin_loongarch_iocsrwr_w (unsigned int, unsigned int) +void __builtin_loongarch_iocsrwr_d (unsigned long int, unsigned int) + +void __builtin_loongarch_dbar (imm0_32767) +void __builtin_loongarch_ibar (imm0_32767) + +void __builtin_loongarch_syscall (imm0_32767) +void __builtin_loongarch_break (imm0_32767)</pre> +</div> <p><em class="emph">Note:</em>Since the control register is divided into 32-bit and 64-bit, but the access instruction is not distinguished. So GCC renames the control instructions when implementing intrinsics. </p> <p>Take the csrrd instruction as an example, built-in functions are implemented as follows: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__builtin_loongarch_csrrd_w // When reading the 32-bit control register use. +__builtin_loongarch_csrrd_d // When reading the 64-bit control register use.</pre> +</div> <p>For the convenience of use, the built-in functions are encapsulated, the encapsulated functions and <code class="code">__drdtime_t, __rdtime_t</code> are defined in the <code class="code">larchintrin.h</code>. So if you call the following function you need to include <code class="code">larchintrin.h</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef struct drdtime{ + unsigned long dvalue; + unsigned long dtimeid; +} __drdtime_t; + +typedef struct rdtime{ + unsigned int value; + unsigned int timeid; +} __rdtime_t;</pre> +</div> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__drdtime_t __rdtime_d (void) +__rdtime_t __rdtimel_w (void) +__rdtime_t __rdtimeh_w (void) +unsigned int __movfcsr2gr (imm0_31) +void __movgr2fcsr (imm0_31, unsigned int) +void __cacop_d (imm0_31, unsigned long, imm_n2048_2047) +unsigned int __cpucfg (unsigned int) +void __asrtle_d (long int, long int) +void __asrtgt_d (long int, long int) +long int __lddir_d (long int, imm0_31) +void __ldpte_d (long int, imm0_31) + +int __crc_w_b_w (char, int) +int __crc_w_h_w (short, int) +int __crc_w_w_w (int, int) +int __crc_w_d_w (long int, int) +int __crcc_w_b_w (char, int) +int __crcc_w_h_w (short, int) +int __crcc_w_w_w (int, int) +int __crcc_w_d_w (long int, int) + +unsigned int __csrrd_w (imm0_16383) +unsigned int __csrwr_w (unsigned int, imm0_16383) +unsigned int __csrxchg_w (unsigned int, unsigned int, imm0_16383) +unsigned long __csrrd_d (imm0_16383) +unsigned long __csrwr_d (unsigned long, imm0_16383) +unsigned long __csrxchg_d (unsigned long, unsigned long, imm0_16383) + +unsigned char __iocsrrd_b (unsigned int) +unsigned short __iocsrrd_h (unsigned int) +unsigned int __iocsrrd_w (unsigned int) +unsigned long __iocsrrd_d (unsigned int) +void __iocsrwr_b (unsigned char, unsigned int) +void __iocsrwr_h (unsigned short, unsigned int) +void __iocsrwr_w (unsigned int, unsigned int) +void __iocsrwr_d (unsigned long, unsigned int) + +void __dbar (imm0_32767) +void __ibar (imm0_32767) + +void __syscall (imm0_32767) +void __break (imm0_32767)</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="mips-dsp-built-in-functions">MIPS DSP Built-in Functions</a>, Previous: <a href="fr-v-built-in-functions">FR-V Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/LoongArch-Base-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/LoongArch-Base-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/loongarch-options.html b/devdocs/gcc~13/loongarch-options.html new file mode 100644 index 00000000..30e9ed59 --- /dev/null +++ b/devdocs/gcc~13/loongarch-options.html @@ -0,0 +1,64 @@ +<div class="subsection-level-extent" id="LoongArch-Options"> <div class="nav-panel"> <p> Next: <a href="m32c-options" accesskey="n" rel="next">M32C Options</a>, Previous: <a href="lm32-options" accesskey="p" rel="prev">LM32 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="LoongArch-Options-1"><span>3.19.22 LoongArch Options<a class="copiable-link" href="#LoongArch-Options-1"> ¶</a></span></h1> <p>These command-line options are defined for LoongArch targets: </p> <dl class="table"> <dt> +<span><code class="code">-march=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-march-7"> ¶</a></span> +</dt> <dd> +<p>Generate instructions for the machine type <var class="var">cpu-type</var>. In contrast to <samp class="option">-mtune=<var class="var">cpu-type</var></samp>, which merely tunes the generated code for the specified <var class="var">cpu-type</var>, <samp class="option">-march=<var class="var">cpu-type</var></samp> allows GCC to generate code that may not run at all on processors other than the one indicated. Specifying <samp class="option">-march=<var class="var">cpu-type</var></samp> implies <samp class="option">-mtune=<var class="var">cpu-type</var></samp>, except where noted otherwise. </p> <p>The choices for <var class="var">cpu-type</var> are: </p> <dl class="table"> <dt>‘<samp class="samp">native</samp>’</dt> <dd><p>This selects the CPU to generate code for at compilation time by determining the processor type of the compiling machine. Using <samp class="option">-march=native</samp> enables all instruction subsets supported by the local machine (hence the result might not run on different machines). Using <samp class="option">-mtune=native</samp> produces code optimized for the local machine under the constraints of the selected instruction set. </p></dd> <dt>‘<samp class="samp">loongarch64</samp>’</dt> <dd><p>A generic CPU with 64-bit extensions. </p></dd> <dt>‘<samp class="samp">la464</samp>’</dt> <dd><p>LoongArch LA464 CPU with LBT, LSX, LASX, LVZ. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-mtune-8"> ¶</a></span> +</dt> <dd> +<p>Optimize the output for the given processor, specified by microarchitecture name. </p> </dd> <dt> +<span><code class="code">-mabi=<var class="var">base-abi-type</var></code><a class="copiable-link" href="#index-mabi-2"> ¶</a></span> +</dt> <dd> +<p>Generate code for the specified calling convention. <var class="var">base-abi-type</var> can be one of: </p> +<dl class="table"> <dt>‘<samp class="samp">lp64d</samp>’</dt> <dd><p>Uses 64-bit general purpose registers and 32/64-bit floating-point registers for parameter passing. Data model is LP64, where ‘<samp class="samp">int</samp>’ is 32 bits, while ‘<samp class="samp">long int</samp>’ and pointers are 64 bits. </p></dd> <dt>‘<samp class="samp">lp64f</samp>’</dt> <dd><p>Uses 64-bit general purpose registers and 32-bit floating-point registers for parameter passing. Data model is LP64, where ‘<samp class="samp">int</samp>’ is 32 bits, while ‘<samp class="samp">long int</samp>’ and pointers are 64 bits. </p></dd> <dt>‘<samp class="samp">lp64s</samp>’</dt> <dd><p>Uses 64-bit general purpose registers and no floating-point registers for parameter passing. Data model is LP64, where ‘<samp class="samp">int</samp>’ is 32 bits, while ‘<samp class="samp">long int</samp>’ and pointers are 64 bits. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mfpu=<var class="var">fpu-type</var></code><a class="copiable-link" href="#index-mfpu-2"> ¶</a></span> +</dt> <dd> +<p>Generate code for the specified FPU type, which can be one of: </p> +<dl class="table"> <dt>‘<samp class="samp">64</samp>’</dt> <dd><p>Allow the use of hardware floating-point instructions for 32-bit and 64-bit operations. </p></dd> <dt>‘<samp class="samp">32</samp>’</dt> <dd><p>Allow the use of hardware floating-point instructions for 32-bit operations. </p></dd> <dt>‘<samp class="samp">none</samp>’</dt> <dt>‘<samp class="samp">0</samp>’</dt> <dd><p>Prevent the use of hardware floating-point instructions. </p></dd> </dl> </dd> <dt> +<span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-5"> ¶</a></span> +</dt> <dd> +<p>Force <samp class="option">-mfpu=none</samp> and prevents the use of floating-point registers for parameter passing. This option may change the target ABI. </p> </dd> <dt> +<span><code class="code">-msingle-float</code><a class="copiable-link" href="#index-msingle-float"> ¶</a></span> +</dt> <dd> +<p>Force <samp class="option">-mfpu=32</samp> and allow the use of 32-bit floating-point registers for parameter passing. This option may change the target ABI. </p> </dd> <dt> +<span><code class="code">-mdouble-float</code><a class="copiable-link" href="#index-mdouble-float-1"> ¶</a></span> +</dt> <dd> +<p>Force <samp class="option">-mfpu=64</samp> and allow the use of 32/64-bit floating-point registers for parameter passing. This option may change the target ABI. </p> </dd> <dt> +<span><code class="code">-mbranch-cost=<var class="var">n</var></code><a class="copiable-link" href="#index-mbranch-cost-2"> ¶</a></span> +</dt> <dd> +<p>Set the cost of branches to roughly <var class="var">n</var> instructions. </p> </dd> <dt> +<span><code class="code">-mcheck-zero-division</code><a class="copiable-link" href="#index-mcheck-zero-division"> ¶</a></span> +</dt> <dt><code class="code">-mno-check-zero-divison</code></dt> <dd> +<p>Trap (do not trap) on integer division by zero. The default is <samp class="option">-mcheck-zero-division</samp> for <samp class="option">-O0</samp> or <samp class="option">-Og</samp>, and <samp class="option">-mno-check-zero-division</samp> for other optimization levels. </p> </dd> <dt> +<span><code class="code">-mcond-move-int</code><a class="copiable-link" href="#index-mcond-move-int"> ¶</a></span> +</dt> <dt><code class="code">-mno-cond-move-int</code></dt> <dd> +<p>Conditional moves for integral data in general-purpose registers are enabled (disabled). The default is <samp class="option">-mcond-move-int</samp>. </p> </dd> <dt> +<span><code class="code">-mcond-move-float</code><a class="copiable-link" href="#index-mcond-move-float"> ¶</a></span> +</dt> <dt><code class="code">-mno-cond-move-float</code></dt> <dd> +<p>Conditional moves for floating-point registers are enabled (disabled). The default is <samp class="option">-mcond-move-float</samp>. </p> </dd> <dt> +<span><code class="code">-mmemcpy</code><a class="copiable-link" href="#index-mmemcpy"> ¶</a></span> +</dt> <dt><code class="code">-mno-memcpy</code></dt> <dd> +<p>Force (do not force) the use of <code class="code">memcpy</code> for non-trivial block moves. The default is <samp class="option">-mno-memcpy</samp>, which allows GCC to inline most constant-sized copies. Setting optimization level to <samp class="option">-Os</samp> also forces the use of <code class="code">memcpy</code>, but <samp class="option">-mno-memcpy</samp> may override this behavior if explicitly specified, regardless of the order these options on the command line. </p> </dd> <dt> +<span><code class="code">-mstrict-align</code><a class="copiable-link" href="#index-mstrict-align-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-strict-align</code></dt> <dd> +<p>Avoid or allow generating memory accesses that may not be aligned on a natural object boundary as described in the architecture specification. The default is <samp class="option">-mno-strict-align</samp>. </p> </dd> <dt> +<span><code class="code">-msmall-data-limit=<var class="var">number</var></code><a class="copiable-link" href="#index-msmall-data-limit"> ¶</a></span> +</dt> <dd> +<p>Put global and static data smaller than <var class="var">number</var> bytes into a special section (on some targets). The default value is 0. </p> </dd> <dt> +<span><code class="code">-mmax-inline-memcpy-size=<var class="var">n</var></code><a class="copiable-link" href="#index-mmax-inline-memcpy-size"> ¶</a></span> +</dt> <dd> +<p>Inline all block moves (such as calls to <code class="code">memcpy</code> or structure copies) less than or equal to <var class="var">n</var> bytes. The default value of <var class="var">n</var> is 1024. </p> </dd> <dt><code class="code">-mcmodel=<var class="var">code-model</var></code></dt> <dd> +<p>Set the code model to one of: </p> +<dl class="table"> <dt>‘<samp class="samp">tiny-static (Not implemented yet)</samp>’</dt> <dt>‘<samp class="samp">tiny (Not implemented yet)</samp>’</dt> <dt>‘<samp class="samp">normal</samp>’</dt> <dd> +<p>The text segment must be within 128MB addressing space. The data segment must be within 2GB addressing space. </p> </dd> <dt>‘<samp class="samp">medium</samp>’</dt> <dd> +<p>The text segment and data segment must be within 2GB addressing space. </p> </dd> <dt>‘<samp class="samp">large (Not implemented yet)</samp>’</dt> <dt>‘<samp class="samp">extreme</samp>’</dt> <dd><p>This mode does not limit the size of the code segment and data segment. The <samp class="option">-mcmodel=extreme</samp> option is incompatible with <samp class="option">-fplt</samp> and <samp class="option">-mno-explicit-relocs</samp>. </p></dd> </dl> <p>The default code model is <code class="code">normal</code>. </p> </dd> <dt> + <span><code class="code">-mexplicit-relocs</code><a class="copiable-link" href="#index-mexplicit-relocs-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-explicit-relocs</code></dt> <dd> +<p>Use or do not use assembler relocation operators when dealing with symbolic addresses. The alternative is to use assembler macros instead, which may limit optimization. The default value for the option is determined during GCC build-time by detecting corresponding assembler support: <code class="code">-mexplicit-relocs</code> if said support is present, <code class="code">-mno-explicit-relocs</code> otherwise. This option is mostly useful for debugging, or interoperation with assemblers different from the build-time one. </p> </dd> <dt> +<span><code class="code">-mdirect-extern-access</code><a class="copiable-link" href="#index-mdirect-extern-access"> ¶</a></span> +</dt> <dt><code class="code">-mno-direct-extern-access</code></dt> <dd> +<p>Do not use or use GOT to access external symbols. The default is <samp class="option">-mno-direct-extern-access</samp>: GOT is used for external symbols with default visibility, but not used for other external symbols. </p> <p>With <samp class="option">-mdirect-extern-access</samp>, GOT is not used and all external symbols are PC-relatively addressed. It is <strong class="strong">only</strong> suitable for environments where no dynamic link is performed, like firmwares, OS kernels, executables linked with <samp class="option">-static</samp> or <samp class="option">-static-pie</samp>. <samp class="option">-mdirect-extern-access</samp> is not compatible with <samp class="option">-fPIC</samp> or <samp class="option">-fpic</samp>. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="m32c-options">M32C Options</a>, Previous: <a href="lm32-options">LM32 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/LoongArch-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/LoongArch-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/loongarch-variable-attributes.html b/devdocs/gcc~13/loongarch-variable-attributes.html new file mode 100644 index 00000000..cf2c7a6a --- /dev/null +++ b/devdocs/gcc~13/loongarch-variable-attributes.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="LoongArch-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="m32r_002fd-variable-attributes" accesskey="n" rel="next">M32R/D Variable Attributes</a>, Previous: <a href="ia-64-variable-attributes" accesskey="p" rel="prev">IA-64 Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="LoongArch-Variable-Attributes-1"><span>6.34.7 LoongArch Variable Attributes<a class="copiable-link" href="#LoongArch-Variable-Attributes-1"> ¶</a></span></h1> <p>One attribute is currently defined for the LoongArch. </p> <dl class="table"> <dt> +<span><code class="code">model("<var class="var">name</var>")</code><a class="copiable-link" href="#index-model-variable-attribute_002c-LoongArch"> ¶</a></span> +</dt> <dd><p>Use this attribute on the LoongArch to use a different code model for addressing this variable, than the code model specified by the global <samp class="option">-mcmodel</samp> option. This attribute is mostly useful if a <code class="code">section</code> attribute and/or a linker script will locate this object specially. Currently the only supported values of <var class="var">name</var> are <code class="code">normal</code> and <code class="code">extreme</code>. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/LoongArch-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/LoongArch-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/loop-specific-pragmas.html b/devdocs/gcc~13/loop-specific-pragmas.html new file mode 100644 index 00000000..285f8e81 --- /dev/null +++ b/devdocs/gcc~13/loop-specific-pragmas.html @@ -0,0 +1,23 @@ +<div class="subsection-level-extent" id="Loop-Specific-Pragmas"> <div class="nav-panel"> <p> Previous: <a href="function-specific-option-pragmas" accesskey="p" rel="prev">Function Specific Option Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Loop-Specific-Pragmas-1"><span>6.62.16 Loop-Specific Pragmas<a class="copiable-link" href="#Loop-Specific-Pragmas-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">#pragma GCC ivdep</code><a class="copiable-link" href="#index-pragma-GCC-ivdep"> ¶</a></span> +</dt> <dd> <p>With this pragma, the programmer asserts that there are no loop-carried dependencies which would prevent consecutive iterations of the following loop from executing concurrently with SIMD (single instruction multiple data) instructions. </p> <p>For example, the compiler can only unconditionally vectorize the following loop with the pragma: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void foo (int n, int *a, int *b, int *c) +{ + int i, j; +#pragma GCC ivdep + for (i = 0; i < n; ++i) + a[i] = b[i] + c[i]; +}</pre> +</div> <p>In this example, using the <code class="code">restrict</code> qualifier had the same effect. In the following example, that would not be possible. Assume <em class="math">k < -m</em> or <em class="math">k >= m</em>. Only with the pragma, the compiler knows that it can unconditionally vectorize the following loop: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void ignore_vec_dep (int *a, int k, int c, int m) +{ +#pragma GCC ivdep + for (int i = 0; i < m; i++) + a[i] = a[i + k] * c; +}</pre> +</div> </dd> <dt> +<span><code class="code">#pragma GCC unroll <var class="var">n</var></code><a class="copiable-link" href="#index-pragma-GCC-unroll-n"> ¶</a></span> +</dt> <dd> <p>You can use this pragma to control how many times a loop should be unrolled. It must be placed immediately before a <code class="code">for</code>, <code class="code">while</code> or <code class="code">do</code> loop or a <code class="code">#pragma GCC ivdep</code>, and applies only to the loop that follows. <var class="var">n</var> is an integer constant expression specifying the unrolling factor. The values of <em class="math">0</em> and <em class="math">1</em> block any unrolling of the loop. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Loop-Specific-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Loop-Specific-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/lto-dump-intro.html b/devdocs/gcc~13/lto-dump-intro.html new file mode 100644 index 00000000..07b372dc --- /dev/null +++ b/devdocs/gcc~13/lto-dump-intro.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="lto-dump-Intro"> <div class="nav-panel"> <p> Next: <a href="invoking-lto-dump" accesskey="n" rel="next">Invoking <code class="command">lto-dump</code></a>, Up: <a href="lto-dump" accesskey="u" rel="up"><code class="command">lto-dump</code>—Tool for dumping LTO object files.</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Introduction-to-lto-dump"><span>13.1 Introduction to lto-dump<a class="copiable-link" href="#Introduction-to-lto-dump"> ¶</a></span></h1> <p><code class="command">lto-dump</code> is a tool you can use in conjunction with GCC to dump link time optimization object files. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/lto-dump-Intro.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/lto-dump-Intro.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/lto-dump.html b/devdocs/gcc~13/lto-dump.html new file mode 100644 index 00000000..38a52349 --- /dev/null +++ b/devdocs/gcc~13/lto-dump.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="lto-dump"> <div class="nav-panel"> <p> Next: <a href="trouble" accesskey="n" rel="next">Known Causes of Trouble with GCC</a>, Previous: <a href="gcov-dump" accesskey="p" rel="prev"><code class="command">gcov-dump</code>—an Offline Gcda and Gcno Profile Dump Tool</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="lto-dump---Tool-for-dumping-LTO-object-files_002e"><span>13 lto-dump—Tool for dumping LTO object files.<a class="copiable-link" href="#lto-dump---Tool-for-dumping-LTO-object-files_002e"> ¶</a></span></h1> <ul class="mini-toc"> <li><a href="lto-dump-intro" accesskey="1">Introduction to <code class="command">lto-dump</code></a></li> <li><a href="invoking-lto-dump" accesskey="2">Invoking <code class="command">lto-dump</code></a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/lto-dump.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/lto-dump.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/m32c-function-attributes.html b/devdocs/gcc~13/m32c-function-attributes.html new file mode 100644 index 00000000..1d49ec39 --- /dev/null +++ b/devdocs/gcc~13/m32c-function-attributes.html @@ -0,0 +1,26 @@ +<div class="subsection-level-extent" id="M32C-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="m32r_002fd-function-attributes" accesskey="n" rel="next">M32R/D Function Attributes</a>, Previous: <a href="ia-64-function-attributes" accesskey="p" rel="prev">IA-64 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="M32C-Function-Attributes-1"><span>6.33.13 M32C Function Attributes<a class="copiable-link" href="#M32C-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the M32C back end: </p> <dl class="table"> <dt> +<span><code class="code">bank_switch</code><a class="copiable-link" href="#index-bank_005fswitch-function-attribute_002c-M32C"> ¶</a></span> +</dt> <dd> +<p>When added to an interrupt handler with the M32C port, causes the prologue and epilogue to use bank switching to preserve the registers rather than saving them on the stack. </p> </dd> <dt> +<span><code class="code">fast_interrupt</code><a class="copiable-link" href="#index-fast_005finterrupt-function-attribute_002c-M32C"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the M32C port to indicate that the specified function is a fast interrupt handler. This is just like the <code class="code">interrupt</code> attribute, except that <code class="code">freit</code> is used to return instead of <code class="code">reit</code>. </p> </dd> <dt> +<span><code class="code">function_vector</code><a class="copiable-link" href="#index-function_005fvector-function-attribute_002c-M16C_002fM32C"> ¶</a></span> +</dt> <dd> +<p>On M16C/M32C targets, the <code class="code">function_vector</code> attribute declares a special page subroutine call function. Use of this attribute reduces the code size by 2 bytes for each call generated to the subroutine. The argument to the attribute is the vector number entry from the special page vector table which contains the 16 low-order bits of the subroutine’s entry address. Each vector table has special page number (18 to 255) that is used in <code class="code">jsrs</code> instructions. Jump addresses of the routines are generated by adding 0x0F0000 (in case of M16C targets) or 0xFF0000 (in case of M32C targets), to the 2-byte addresses set in the vector table. Therefore you need to ensure that all the special page vector routines should get mapped within the address range 0x0F0000 to 0x0FFFFF (for M16C) and 0xFF0000 to 0xFFFFFF (for M32C). </p> <p>In the following example 2 bytes are saved for each call to function <code class="code">foo</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void foo (void) __attribute__((function_vector(0x18))); +void foo (void) +{ +} + +void bar (void) +{ + foo(); +}</pre> +</div> <p>If functions are defined in one file and are called in another file, then be sure to write this declaration in both files. </p> <p>This attribute is ignored for R8C target. </p> </dd> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-M32C"> ¶</a></span> +</dt> <dd><p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="m32r_002fd-function-attributes">M32R/D Function Attributes</a>, Previous: <a href="ia-64-function-attributes">IA-64 Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32C-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32C-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/m32c-options.html b/devdocs/gcc~13/m32c-options.html new file mode 100644 index 00000000..b803110b --- /dev/null +++ b/devdocs/gcc~13/m32c-options.html @@ -0,0 +1,15 @@ +<div class="subsection-level-extent" id="M32C-Options"> <div class="nav-panel"> <p> Next: <a href="m32r_002fd-options" accesskey="n" rel="next">M32R/D Options</a>, Previous: <a href="loongarch-options" accesskey="p" rel="prev">LoongArch Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="M32C-Options-1"><span>3.19.23 M32C Options<a class="copiable-link" href="#M32C-Options-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">-mcpu=<var class="var">name</var></code><a class="copiable-link" href="#index-mcpu_003d-2"> ¶</a></span> +</dt> <dd> +<p>Select the CPU for which code is generated. <var class="var">name</var> may be one of ‘<samp class="samp">r8c</samp>’ for the R8C/Tiny series, ‘<samp class="samp">m16c</samp>’ for the M16C (up to /60) series, ‘<samp class="samp">m32cm</samp>’ for the M16C/80 series, or ‘<samp class="samp">m32c</samp>’ for the M32C/80 series. </p> </dd> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-4"> ¶</a></span> +</dt> <dd> +<p>Specifies that the program will be run on the simulator. This causes an alternate runtime library to be linked in which supports, for example, file I/O. You must not use this option when generating programs that will run on real hardware; you must provide your own runtime library for whatever I/O functions are needed. </p> </dd> <dt> +<span><code class="code">-memregs=<var class="var">number</var></code><a class="copiable-link" href="#index-memregs_003d"> ¶</a></span> +</dt> <dd> +<p>Specifies the number of memory-based pseudo-registers GCC uses during code generation. These pseudo-registers are used like real registers, so there is a tradeoff between GCC’s ability to fit the code into available registers, and the performance penalty of using memory instead of registers. Note that all modules in a program must be compiled with the same value for this option. Because of that, you must not use this option with GCC’s default runtime libraries. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32C-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32C-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/m32c-pragmas.html b/devdocs/gcc~13/m32c-pragmas.html new file mode 100644 index 00000000..70919cb8 --- /dev/null +++ b/devdocs/gcc~13/m32c-pragmas.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="M32C-Pragmas"> <div class="nav-panel"> <p> Next: <a href="pru-pragmas" accesskey="n" rel="next">PRU Pragmas</a>, Previous: <a href="arm-pragmas" accesskey="p" rel="prev">ARM Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="M32C-Pragmas-1"><span>6.62.3 M32C Pragmas<a class="copiable-link" href="#M32C-Pragmas-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">GCC memregs <var class="var">number</var></code><a class="copiable-link" href="#index-pragma_002c-memregs"> ¶</a></span> +</dt> <dd> +<p>Overrides the command-line option <code class="code">-memregs=</code> for the current file. Use with care! This pragma must be before any function in the file, and mixing different memregs values in different objects may make them incompatible. This pragma is useful when a performance-critical function uses a memreg for temporary values, as it may allow you to reduce the number of memregs used. </p> </dd> <dt> +<span><code class="code">ADDRESS <var class="var">name</var> <var class="var">address</var></code><a class="copiable-link" href="#index-pragma_002c-address"> ¶</a></span> +</dt> <dd> +<p>For any declared symbols matching <var class="var">name</var>, this does three things to that symbol: it forces the symbol to be located at the given address (a number), it forces the symbol to be volatile, and it changes the symbol’s scope to be static. This pragma exists for compatibility with other compilers, but note that the common <code class="code">1234H</code> numeric syntax is not supported (use <code class="code">0x1234</code> instead). Example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#pragma ADDRESS port3 0x103 +char port3;</pre> +</div> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32C-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32C-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/m32r_002fd-function-attributes.html b/devdocs/gcc~13/m32r_002fd-function-attributes.html new file mode 100644 index 00000000..e10b7eec --- /dev/null +++ b/devdocs/gcc~13/m32r_002fd-function-attributes.html @@ -0,0 +1,12 @@ +<div class="subsection-level-extent" id="M32R_002fD-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="m68k-function-attributes" accesskey="n" rel="next">m68k Function Attributes</a>, Previous: <a href="m32c-function-attributes" accesskey="p" rel="prev">M32C Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="M32R_002fD-Function-Attributes-1"><span>6.33.14 M32R/D Function Attributes<a class="copiable-link" href="#M32R_002fD-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the M32R/D back end: </p> <dl class="table"> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-M32R_002fD"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> </dd> <dt> + <span><code class="code">model (<var class="var">model-name</var>)</code><a class="copiable-link" href="#index-model-function-attribute_002c-M32R_002fD"> ¶</a></span> +</dt> <dd> <p>On the M32R/D, use this attribute to set the addressability of an object, and of the code generated for a function. The identifier <var class="var">model-name</var> is one of <code class="code">small</code>, <code class="code">medium</code>, or <code class="code">large</code>, representing each of the code models. </p> <p>Small model objects live in the lower 16MB of memory (so that their addresses can be loaded with the <code class="code">ld24</code> instruction), and are callable with the <code class="code">bl</code> instruction. </p> <p>Medium model objects may live anywhere in the 32-bit address space (the compiler generates <code class="code">seth/add3</code> instructions to load their addresses), and are callable with the <code class="code">bl</code> instruction. </p> <p>Large model objects may live anywhere in the 32-bit address space (the compiler generates <code class="code">seth/add3</code> instructions to load their addresses), and may not be reachable with the <code class="code">bl</code> instruction (the compiler generates the much slower <code class="code">seth/add3/jl</code> instruction sequence). </p> +</dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32R_002fD-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32R_002fD-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/m32r_002fd-options.html b/devdocs/gcc~13/m32r_002fd-options.html new file mode 100644 index 00000000..27cc4bba --- /dev/null +++ b/devdocs/gcc~13/m32r_002fd-options.html @@ -0,0 +1,63 @@ +<div class="subsection-level-extent" id="M32R_002fD-Options"> <div class="nav-panel"> <p> Next: <a href="m680x0-options" accesskey="n" rel="next">M680x0 Options</a>, Previous: <a href="m32c-options" accesskey="p" rel="prev">M32C Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="M32R_002fD-Options-1"><span>3.19.24 M32R/D Options<a class="copiable-link" href="#M32R_002fD-Options-1"> ¶</a></span></h1> <p>These <samp class="option">-m</samp> options are defined for Renesas M32R/D architectures: </p> <dl class="table"> <dt> +<span><code class="code">-m32r2</code><a class="copiable-link" href="#index-m32r2"> ¶</a></span> +</dt> <dd> +<p>Generate code for the M32R/2. </p> </dd> <dt> +<span><code class="code">-m32rx</code><a class="copiable-link" href="#index-m32rx"> ¶</a></span> +</dt> <dd> +<p>Generate code for the M32R/X. </p> </dd> <dt> +<span><code class="code">-m32r</code><a class="copiable-link" href="#index-m32r"> ¶</a></span> +</dt> <dd> +<p>Generate code for the M32R. This is the default. </p> </dd> <dt> +<span><code class="code">-mmodel=small</code><a class="copiable-link" href="#index-mmodel_003dsmall"> ¶</a></span> +</dt> <dd> +<p>Assume all objects live in the lower 16MB of memory (so that their addresses can be loaded with the <code class="code">ld24</code> instruction), and assume all subroutines are reachable with the <code class="code">bl</code> instruction. This is the default. </p> <p>The addressability of a particular object can be set with the <code class="code">model</code> attribute. </p> </dd> <dt> +<span><code class="code">-mmodel=medium</code><a class="copiable-link" href="#index-mmodel_003dmedium"> ¶</a></span> +</dt> <dd> +<p>Assume objects may be anywhere in the 32-bit address space (the compiler generates <code class="code">seth/add3</code> instructions to load their addresses), and assume all subroutines are reachable with the <code class="code">bl</code> instruction. </p> </dd> <dt> +<span><code class="code">-mmodel=large</code><a class="copiable-link" href="#index-mmodel_003dlarge"> ¶</a></span> +</dt> <dd> +<p>Assume objects may be anywhere in the 32-bit address space (the compiler generates <code class="code">seth/add3</code> instructions to load their addresses), and assume subroutines may not be reachable with the <code class="code">bl</code> instruction (the compiler generates the much slower <code class="code">seth/add3/jl</code> instruction sequence). </p> </dd> <dt> +<span><code class="code">-msdata=none</code><a class="copiable-link" href="#index-msdata_003dnone-1"> ¶</a></span> +</dt> <dd> +<p>Disable use of the small data area. Variables are put into one of <code class="code">.data</code>, <code class="code">.bss</code>, or <code class="code">.rodata</code> (unless the <code class="code">section</code> attribute has been specified). This is the default. </p> <p>The small data area consists of sections <code class="code">.sdata</code> and <code class="code">.sbss</code>. Objects may be explicitly put in the small data area with the <code class="code">section</code> attribute using one of these sections. </p> </dd> <dt> +<span><code class="code">-msdata=sdata</code><a class="copiable-link" href="#index-msdata_003dsdata"> ¶</a></span> +</dt> <dd> +<p>Put small global and static data in the small data area, but do not generate special code to reference them. </p> </dd> <dt> +<span><code class="code">-msdata=use</code><a class="copiable-link" href="#index-msdata_003duse"> ¶</a></span> +</dt> <dd> +<p>Put small global and static data in the small data area, and generate special instructions to reference them. </p> </dd> <dt> + <span><code class="code">-G <var class="var">num</var></code><a class="copiable-link" href="#index-G-1"> ¶</a></span> +</dt> <dd> +<p>Put global and static objects less than or equal to <var class="var">num</var> bytes into the small data or BSS sections instead of the normal data or BSS sections. The default value of <var class="var">num</var> is 8. The <samp class="option">-msdata</samp> option must be set to one of ‘<samp class="samp">sdata</samp>’ or ‘<samp class="samp">use</samp>’ for this option to have any effect. </p> <p>All modules should be compiled with the same <samp class="option">-G <var class="var">num</var></samp> value. Compiling with different values of <var class="var">num</var> may or may not work; if it doesn’t the linker gives an error message—incorrect code is not generated. </p> </dd> <dt> +<span><code class="code">-mdebug</code><a class="copiable-link" href="#index-mdebug"> ¶</a></span> +</dt> <dd> +<p>Makes the M32R-specific code in the compiler display some statistics that might help in debugging programs. </p> </dd> <dt> +<span><code class="code">-malign-loops</code><a class="copiable-link" href="#index-malign-loops"> ¶</a></span> +</dt> <dd> +<p>Align all loops to a 32-byte boundary. </p> </dd> <dt> +<span><code class="code">-mno-align-loops</code><a class="copiable-link" href="#index-mno-align-loops"> ¶</a></span> +</dt> <dd> +<p>Do not enforce a 32-byte alignment for loops. This is the default. </p> </dd> <dt> +<span><code class="code">-missue-rate=<var class="var">number</var></code><a class="copiable-link" href="#index-missue-rate_003dnumber"> ¶</a></span> +</dt> <dd> +<p>Issue <var class="var">number</var> instructions per cycle. <var class="var">number</var> can only be 1 or 2. </p> </dd> <dt> +<span><code class="code">-mbranch-cost=<var class="var">number</var></code><a class="copiable-link" href="#index-mbranch-cost_003dnumber"> ¶</a></span> +</dt> <dd> +<p><var class="var">number</var> can only be 1 or 2. If it is 1 then branches are preferred over conditional code, if it is 2, then the opposite applies. </p> </dd> <dt> +<span><code class="code">-mflush-trap=<var class="var">number</var></code><a class="copiable-link" href="#index-mflush-trap_003dnumber"> ¶</a></span> +</dt> <dd> +<p>Specifies the trap number to use to flush the cache. The default is 12. Valid numbers are between 0 and 15 inclusive. </p> </dd> <dt> +<span><code class="code">-mno-flush-trap</code><a class="copiable-link" href="#index-mno-flush-trap"> ¶</a></span> +</dt> <dd> +<p>Specifies that the cache cannot be flushed by using a trap. </p> </dd> <dt> +<span><code class="code">-mflush-func=<var class="var">name</var></code><a class="copiable-link" href="#index-mflush-func_003dname"> ¶</a></span> +</dt> <dd> +<p>Specifies the name of the operating system function to call to flush the cache. The default is ‘<samp class="samp">_flush_cache</samp>’, but a function call is only used if a trap is not available. </p> </dd> <dt> +<span><code class="code">-mno-flush-func</code><a class="copiable-link" href="#index-mno-flush-func"> ¶</a></span> +</dt> <dd> +<p>Indicates that there is no OS function for flushing the cache. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="m680x0-options">M680x0 Options</a>, Previous: <a href="m32c-options">M32C Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32R_002fD-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32R_002fD-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/m32r_002fd-variable-attributes.html b/devdocs/gcc~13/m32r_002fd-variable-attributes.html new file mode 100644 index 00000000..e447f31a --- /dev/null +++ b/devdocs/gcc~13/m32r_002fd-variable-attributes.html @@ -0,0 +1,10 @@ +<div class="subsection-level-extent" id="M32R_002fD-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="microsoft-windows-variable-attributes" accesskey="n" rel="next">Microsoft Windows Variable Attributes</a>, Previous: <a href="loongarch-variable-attributes" accesskey="p" rel="prev">LoongArch Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="M32R_002fD-Variable-Attributes-1"><span>6.34.8 M32R/D Variable Attributes<a class="copiable-link" href="#M32R_002fD-Variable-Attributes-1"> ¶</a></span></h1> <p>One attribute is currently defined for the M32R/D. </p> <dl class="table"> <dt> + <span><code class="code">model (<var class="var">model-name</var>)</code><a class="copiable-link" href="#index-model-name-variable-attribute_002c-M32R_002fD"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the M32R/D to set the addressability of an object. The identifier <var class="var">model-name</var> is one of <code class="code">small</code>, <code class="code">medium</code>, or <code class="code">large</code>, representing each of the code models. </p> <p>Small model objects live in the lower 16MB of memory (so that their addresses can be loaded with the <code class="code">ld24</code> instruction). </p> <p>Medium and large model objects may live anywhere in the 32-bit address space (the compiler generates <code class="code">seth/add3</code> instructions to load their addresses). </p> +</dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32R_002fD-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M32R_002fD-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/m680x0-options.html b/devdocs/gcc~13/m680x0-options.html new file mode 100644 index 00000000..5e2ffc4c --- /dev/null +++ b/devdocs/gcc~13/m680x0-options.html @@ -0,0 +1,175 @@ +<div class="subsection-level-extent" id="M680x0-Options"> <div class="nav-panel"> <p> Next: <a href="mcore-options" accesskey="n" rel="next">MCore Options</a>, Previous: <a href="m32r_002fd-options" accesskey="p" rel="prev">M32R/D Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="M680x0-Options-1"><span>3.19.25 M680x0 Options<a class="copiable-link" href="#M680x0-Options-1"> ¶</a></span></h1> <p>These are the ‘<samp class="samp">-m</samp>’ options defined for M680x0 and ColdFire processors. The default settings depend on which architecture was selected when the compiler was configured; the defaults for the most common choices are given below. </p> <dl class="table"> <dt> +<span><code class="code">-march=<var class="var">arch</var></code><a class="copiable-link" href="#index-march-8"> ¶</a></span> +</dt> <dd> +<p>Generate code for a specific M680x0 or ColdFire instruction set architecture. Permissible values of <var class="var">arch</var> for M680x0 architectures are: ‘<samp class="samp">68000</samp>’, ‘<samp class="samp">68010</samp>’, ‘<samp class="samp">68020</samp>’, ‘<samp class="samp">68030</samp>’, ‘<samp class="samp">68040</samp>’, ‘<samp class="samp">68060</samp>’ and ‘<samp class="samp">cpu32</samp>’. ColdFire architectures are selected according to Freescale’s ISA classification and the permissible values are: ‘<samp class="samp">isaa</samp>’, ‘<samp class="samp">isaaplus</samp>’, ‘<samp class="samp">isab</samp>’ and ‘<samp class="samp">isac</samp>’. </p> <p>GCC defines a macro <code class="code">__mcf<var class="var">arch</var>__</code> whenever it is generating code for a ColdFire target. The <var class="var">arch</var> in this macro is one of the <samp class="option">-march</samp> arguments given above. </p> <p>When used together, <samp class="option">-march</samp> and <samp class="option">-mtune</samp> select code that runs on a family of similar processors but that is optimized for a particular microarchitecture. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu</var></code><a class="copiable-link" href="#index-mcpu-7"> ¶</a></span> +</dt> <dd> +<p>Generate code for a specific M680x0 or ColdFire processor. The M680x0 <var class="var">cpu</var>s are: ‘<samp class="samp">68000</samp>’, ‘<samp class="samp">68010</samp>’, ‘<samp class="samp">68020</samp>’, ‘<samp class="samp">68030</samp>’, ‘<samp class="samp">68040</samp>’, ‘<samp class="samp">68060</samp>’, ‘<samp class="samp">68302</samp>’, ‘<samp class="samp">68332</samp>’ and ‘<samp class="samp">cpu32</samp>’. The ColdFire <var class="var">cpu</var>s are given by the table below, which also classifies the CPUs into families: </p> <table class="multitable"> <thead><tr> +<th width="20%"><strong class="strong">Family</strong></th> +<th width="80%"><strong class="strong">‘<samp class="samp">-mcpu</samp>’ arguments</strong></th> +</tr></thead> <tbody> +<tr> +<td width="20%">‘<samp class="samp">51</samp>’</td> +<td width="80%">‘<samp class="samp">51</samp>’ ‘<samp class="samp">51ac</samp>’ ‘<samp class="samp">51ag</samp>’ ‘<samp class="samp">51cn</samp>’ ‘<samp class="samp">51em</samp>’ ‘<samp class="samp">51je</samp>’ ‘<samp class="samp">51jf</samp>’ ‘<samp class="samp">51jg</samp>’ ‘<samp class="samp">51jm</samp>’ ‘<samp class="samp">51mm</samp>’ ‘<samp class="samp">51qe</samp>’ ‘<samp class="samp">51qm</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5206</samp>’</td> +<td width="80%">‘<samp class="samp">5202</samp>’ ‘<samp class="samp">5204</samp>’ ‘<samp class="samp">5206</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5206e</samp>’</td> +<td width="80%">‘<samp class="samp">5206e</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5208</samp>’</td> +<td width="80%">‘<samp class="samp">5207</samp>’ ‘<samp class="samp">5208</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5211a</samp>’</td> +<td width="80%">‘<samp class="samp">5210a</samp>’ ‘<samp class="samp">5211a</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5213</samp>’</td> +<td width="80%">‘<samp class="samp">5211</samp>’ ‘<samp class="samp">5212</samp>’ ‘<samp class="samp">5213</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5216</samp>’</td> +<td width="80%">‘<samp class="samp">5214</samp>’ ‘<samp class="samp">5216</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">52235</samp>’</td> +<td width="80%">‘<samp class="samp">52230</samp>’ ‘<samp class="samp">52231</samp>’ ‘<samp class="samp">52232</samp>’ ‘<samp class="samp">52233</samp>’ ‘<samp class="samp">52234</samp>’ ‘<samp class="samp">52235</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5225</samp>’</td> +<td width="80%">‘<samp class="samp">5224</samp>’ ‘<samp class="samp">5225</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">52259</samp>’</td> +<td width="80%">‘<samp class="samp">52252</samp>’ ‘<samp class="samp">52254</samp>’ ‘<samp class="samp">52255</samp>’ ‘<samp class="samp">52256</samp>’ ‘<samp class="samp">52258</samp>’ ‘<samp class="samp">52259</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5235</samp>’</td> +<td width="80%">‘<samp class="samp">5232</samp>’ ‘<samp class="samp">5233</samp>’ ‘<samp class="samp">5234</samp>’ ‘<samp class="samp">5235</samp>’ ‘<samp class="samp">523x</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5249</samp>’</td> +<td width="80%">‘<samp class="samp">5249</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5250</samp>’</td> +<td width="80%">‘<samp class="samp">5250</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5271</samp>’</td> +<td width="80%">‘<samp class="samp">5270</samp>’ ‘<samp class="samp">5271</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5272</samp>’</td> +<td width="80%">‘<samp class="samp">5272</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5275</samp>’</td> +<td width="80%">‘<samp class="samp">5274</samp>’ ‘<samp class="samp">5275</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5282</samp>’</td> +<td width="80%">‘<samp class="samp">5280</samp>’ ‘<samp class="samp">5281</samp>’ ‘<samp class="samp">5282</samp>’ ‘<samp class="samp">528x</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">53017</samp>’</td> +<td width="80%">‘<samp class="samp">53011</samp>’ ‘<samp class="samp">53012</samp>’ ‘<samp class="samp">53013</samp>’ ‘<samp class="samp">53014</samp>’ ‘<samp class="samp">53015</samp>’ ‘<samp class="samp">53016</samp>’ ‘<samp class="samp">53017</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5307</samp>’</td> +<td width="80%">‘<samp class="samp">5307</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5329</samp>’</td> +<td width="80%">‘<samp class="samp">5327</samp>’ ‘<samp class="samp">5328</samp>’ ‘<samp class="samp">5329</samp>’ ‘<samp class="samp">532x</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5373</samp>’</td> +<td width="80%">‘<samp class="samp">5372</samp>’ ‘<samp class="samp">5373</samp>’ ‘<samp class="samp">537x</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5407</samp>’</td> +<td width="80%">‘<samp class="samp">5407</samp>’</td> +</tr> <tr> +<td width="20%">‘<samp class="samp">5475</samp>’</td> +<td width="80%">‘<samp class="samp">5470</samp>’ ‘<samp class="samp">5471</samp>’ ‘<samp class="samp">5472</samp>’ ‘<samp class="samp">5473</samp>’ ‘<samp class="samp">5474</samp>’ ‘<samp class="samp">5475</samp>’ ‘<samp class="samp">547x</samp>’ ‘<samp class="samp">5480</samp>’ ‘<samp class="samp">5481</samp>’ ‘<samp class="samp">5482</samp>’ ‘<samp class="samp">5483</samp>’ ‘<samp class="samp">5484</samp>’ ‘<samp class="samp">5485</samp>’</td> +</tr> </tbody> </table> <p><samp class="option">-mcpu=<var class="var">cpu</var></samp> overrides <samp class="option">-march=<var class="var">arch</var></samp> if <var class="var">arch</var> is compatible with <var class="var">cpu</var>. Other combinations of <samp class="option">-mcpu</samp> and <samp class="option">-march</samp> are rejected. </p> <p>GCC defines the macro <code class="code">__mcf_cpu_<var class="var">cpu</var></code> when ColdFire target <var class="var">cpu</var> is selected. It also defines <code class="code">__mcf_family_<var class="var">family</var></code>, where the value of <var class="var">family</var> is given by the table above. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">tune</var></code><a class="copiable-link" href="#index-mtune-9"> ¶</a></span> +</dt> <dd> +<p>Tune the code for a particular microarchitecture within the constraints set by <samp class="option">-march</samp> and <samp class="option">-mcpu</samp>. The M680x0 microarchitectures are: ‘<samp class="samp">68000</samp>’, ‘<samp class="samp">68010</samp>’, ‘<samp class="samp">68020</samp>’, ‘<samp class="samp">68030</samp>’, ‘<samp class="samp">68040</samp>’, ‘<samp class="samp">68060</samp>’ and ‘<samp class="samp">cpu32</samp>’. The ColdFire microarchitectures are: ‘<samp class="samp">cfv1</samp>’, ‘<samp class="samp">cfv2</samp>’, ‘<samp class="samp">cfv3</samp>’, ‘<samp class="samp">cfv4</samp>’ and ‘<samp class="samp">cfv4e</samp>’. </p> <p>You can also use <samp class="option">-mtune=68020-40</samp> for code that needs to run relatively well on 68020, 68030 and 68040 targets. <samp class="option">-mtune=68020-60</samp> is similar but includes 68060 targets as well. These two options select the same tuning decisions as <samp class="option">-m68020-40</samp> and <samp class="option">-m68020-60</samp> respectively. </p> <p>GCC defines the macros <code class="code">__mc<var class="var">arch</var></code> and <code class="code">__mc<var class="var">arch</var>__</code> when tuning for 680x0 architecture <var class="var">arch</var>. It also defines <code class="code">mc<var class="var">arch</var></code> unless either <samp class="option">-ansi</samp> or a non-GNU <samp class="option">-std</samp> option is used. If GCC is tuning for a range of architectures, as selected by <samp class="option">-mtune=68020-40</samp> or <samp class="option">-mtune=68020-60</samp>, it defines the macros for every architecture in the range. </p> <p>GCC also defines the macro <code class="code">__m<var class="var">uarch</var>__</code> when tuning for ColdFire microarchitecture <var class="var">uarch</var>, where <var class="var">uarch</var> is one of the arguments given above. </p> </dd> <dt> + <span><code class="code">-m68000</code><a class="copiable-link" href="#index-m68000"> ¶</a></span> +</dt> <dt><code class="code">-mc68000</code></dt> <dd> +<p>Generate output for a 68000. This is the default when the compiler is configured for 68000-based systems. It is equivalent to <samp class="option">-march=68000</samp>. </p> <p>Use this option for microcontrollers with a 68000 or EC000 core, including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356. </p> </dd> <dt> +<span><code class="code">-m68010</code><a class="copiable-link" href="#index-m68010"> ¶</a></span> +</dt> <dd> +<p>Generate output for a 68010. This is the default when the compiler is configured for 68010-based systems. It is equivalent to <samp class="option">-march=68010</samp>. </p> </dd> <dt> + <span><code class="code">-m68020</code><a class="copiable-link" href="#index-m68020"> ¶</a></span> +</dt> <dt><code class="code">-mc68020</code></dt> <dd> +<p>Generate output for a 68020. This is the default when the compiler is configured for 68020-based systems. It is equivalent to <samp class="option">-march=68020</samp>. </p> </dd> <dt> +<span><code class="code">-m68030</code><a class="copiable-link" href="#index-m68030"> ¶</a></span> +</dt> <dd> +<p>Generate output for a 68030. This is the default when the compiler is configured for 68030-based systems. It is equivalent to <samp class="option">-march=68030</samp>. </p> </dd> <dt> +<span><code class="code">-m68040</code><a class="copiable-link" href="#index-m68040"> ¶</a></span> +</dt> <dd> +<p>Generate output for a 68040. This is the default when the compiler is configured for 68040-based systems. It is equivalent to <samp class="option">-march=68040</samp>. </p> <p>This option inhibits the use of 68881/68882 instructions that have to be emulated by software on the 68040. Use this option if your 68040 does not have code to emulate those instructions. </p> </dd> <dt> +<span><code class="code">-m68060</code><a class="copiable-link" href="#index-m68060"> ¶</a></span> +</dt> <dd> +<p>Generate output for a 68060. This is the default when the compiler is configured for 68060-based systems. It is equivalent to <samp class="option">-march=68060</samp>. </p> <p>This option inhibits the use of 68020 and 68881/68882 instructions that have to be emulated by software on the 68060. Use this option if your 68060 does not have code to emulate those instructions. </p> </dd> <dt> +<span><code class="code">-mcpu32</code><a class="copiable-link" href="#index-mcpu32"> ¶</a></span> +</dt> <dd> +<p>Generate output for a CPU32. This is the default when the compiler is configured for CPU32-based systems. It is equivalent to <samp class="option">-march=cpu32</samp>. </p> <p>Use this option for microcontrollers with a CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334, 68336, 68340, 68341, 68349 and 68360. </p> </dd> <dt> +<span><code class="code">-m5200</code><a class="copiable-link" href="#index-m5200"> ¶</a></span> +</dt> <dd> +<p>Generate output for a 520X ColdFire CPU. This is the default when the compiler is configured for 520X-based systems. It is equivalent to <samp class="option">-mcpu=5206</samp>, and is now deprecated in favor of that option. </p> <p>Use this option for microcontroller with a 5200 core, including the MCF5202, MCF5203, MCF5204 and MCF5206. </p> </dd> <dt> +<span><code class="code">-m5206e</code><a class="copiable-link" href="#index-m5206e"> ¶</a></span> +</dt> <dd> +<p>Generate output for a 5206e ColdFire CPU. The option is now deprecated in favor of the equivalent <samp class="option">-mcpu=5206e</samp>. </p> </dd> <dt> +<span><code class="code">-m528x</code><a class="copiable-link" href="#index-m528x"> ¶</a></span> +</dt> <dd> +<p>Generate output for a member of the ColdFire 528X family. The option is now deprecated in favor of the equivalent <samp class="option">-mcpu=528x</samp>. </p> </dd> <dt> +<span><code class="code">-m5307</code><a class="copiable-link" href="#index-m5307"> ¶</a></span> +</dt> <dd> +<p>Generate output for a ColdFire 5307 CPU. The option is now deprecated in favor of the equivalent <samp class="option">-mcpu=5307</samp>. </p> </dd> <dt> +<span><code class="code">-m5407</code><a class="copiable-link" href="#index-m5407"> ¶</a></span> +</dt> <dd> +<p>Generate output for a ColdFire 5407 CPU. The option is now deprecated in favor of the equivalent <samp class="option">-mcpu=5407</samp>. </p> </dd> <dt> +<span><code class="code">-mcfv4e</code><a class="copiable-link" href="#index-mcfv4e"> ¶</a></span> +</dt> <dd> +<p>Generate output for a ColdFire V4e family CPU (e.g. 547x/548x). This includes use of hardware floating-point instructions. The option is equivalent to <samp class="option">-mcpu=547x</samp>, and is now deprecated in favor of that option. </p> </dd> <dt> +<span><code class="code">-m68020-40</code><a class="copiable-link" href="#index-m68020-40"> ¶</a></span> +</dt> <dd> +<p>Generate output for a 68040, without using any of the new instructions. This results in code that can run relatively efficiently on either a 68020/68881 or a 68030 or a 68040. The generated code does use the 68881 instructions that are emulated on the 68040. </p> <p>The option is equivalent to <samp class="option">-march=68020</samp> <samp class="option">-mtune=68020-40</samp>. </p> </dd> <dt> +<span><code class="code">-m68020-60</code><a class="copiable-link" href="#index-m68020-60"> ¶</a></span> +</dt> <dd> +<p>Generate output for a 68060, without using any of the new instructions. This results in code that can run relatively efficiently on either a 68020/68881 or a 68030 or a 68040. The generated code does use the 68881 instructions that are emulated on the 68060. </p> <p>The option is equivalent to <samp class="option">-march=68020</samp> <samp class="option">-mtune=68020-60</samp>. </p> </dd> <dt> + <span><code class="code">-mhard-float</code><a class="copiable-link" href="#index-mhard-float-2"> ¶</a></span> +</dt> <dt><code class="code">-m68881</code></dt> <dd> +<p>Generate floating-point instructions. This is the default for 68020 and above, and for ColdFire devices that have an FPU. It defines the macro <code class="code">__HAVE_68881__</code> on M680x0 targets and <code class="code">__mcffpu__</code> on ColdFire targets. </p> </dd> <dt> +<span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-6"> ¶</a></span> +</dt> <dd> +<p>Do not generate floating-point instructions; use library calls instead. This is the default for 68000, 68010, and 68832 targets. It is also the default for ColdFire devices that have no FPU. </p> </dd> <dt> + <span><code class="code">-mdiv</code><a class="copiable-link" href="#index-mdiv-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-div</code></dt> <dd> +<p>Generate (do not generate) ColdFire hardware divide and remainder instructions. If <samp class="option">-march</samp> is used without <samp class="option">-mcpu</samp>, the default is “on” for ColdFire architectures and “off” for M680x0 architectures. Otherwise, the default is taken from the target CPU (either the default CPU, or the one specified by <samp class="option">-mcpu</samp>). For example, the default is “off” for <samp class="option">-mcpu=5206</samp> and “on” for <samp class="option">-mcpu=5206e</samp>. </p> <p>GCC defines the macro <code class="code">__mcfhwdiv__</code> when this option is enabled. </p> </dd> <dt> +<span><code class="code">-mshort</code><a class="copiable-link" href="#index-mshort"> ¶</a></span> +</dt> <dd> +<p>Consider type <code class="code">int</code> to be 16 bits wide, like <code class="code">short int</code>. Additionally, parameters passed on the stack are also aligned to a 16-bit boundary even on targets whose API mandates promotion to 32-bit. </p> </dd> <dt> +<span><code class="code">-mno-short</code><a class="copiable-link" href="#index-mno-short"> ¶</a></span> +</dt> <dd> +<p>Do not consider type <code class="code">int</code> to be 16 bits wide. This is the default. </p> </dd> <dt> + <span><code class="code">-mnobitfield</code><a class="copiable-link" href="#index-mnobitfield"> ¶</a></span> +</dt> <dt><code class="code">-mno-bitfield</code></dt> <dd> +<p>Do not use the bit-field instructions. The <samp class="option">-m68000</samp>, <samp class="option">-mcpu32</samp> and <samp class="option">-m5200</samp> options imply <samp class="option">-mnobitfield</samp>. </p> </dd> <dt> +<span><code class="code">-mbitfield</code><a class="copiable-link" href="#index-mbitfield"> ¶</a></span> +</dt> <dd> +<p>Do use the bit-field instructions. The <samp class="option">-m68020</samp> option implies <samp class="option">-mbitfield</samp>. This is the default if you use a configuration designed for a 68020. </p> </dd> <dt> +<span><code class="code">-mrtd</code><a class="copiable-link" href="#index-mrtd"> ¶</a></span> +</dt> <dd> +<p>Use a different function-calling convention, in which functions that take a fixed number of arguments return with the <code class="code">rtd</code> instruction, which pops their arguments while returning. This saves one instruction in the caller since there is no need to pop the arguments there. </p> <p>This calling convention is incompatible with the one normally used on Unix, so you cannot use it if you need to call libraries compiled with the Unix compiler. </p> <p>Also, you must provide function prototypes for all functions that take variable numbers of arguments (including <code class="code">printf</code>); otherwise incorrect code is generated for calls to those functions. </p> <p>In addition, seriously incorrect code results if you call a function with too many arguments. (Normally, extra arguments are harmlessly ignored.) </p> <p>The <code class="code">rtd</code> instruction is supported by the 68010, 68020, 68030, 68040, 68060 and CPU32 processors, but not by the 68000 or 5200. </p> <p>The default is <samp class="option">-mno-rtd</samp>. </p> </dd> <dt> + <span><code class="code">-malign-int</code><a class="copiable-link" href="#index-malign-int"> ¶</a></span> +</dt> <dt><code class="code">-mno-align-int</code></dt> <dd> +<p>Control whether GCC aligns <code class="code">int</code>, <code class="code">long</code>, <code class="code">long long</code>, <code class="code">float</code>, <code class="code">double</code>, and <code class="code">long double</code> variables on a 32-bit boundary (<samp class="option">-malign-int</samp>) or a 16-bit boundary (<samp class="option">-mno-align-int</samp>). Aligning variables on 32-bit boundaries produces code that runs somewhat faster on processors with 32-bit busses at the expense of more memory. </p> <p><strong class="strong">Warning:</strong> if you use the <samp class="option">-malign-int</samp> switch, GCC aligns structures containing the above types differently than most published application binary interface specifications for the m68k. </p> <p>Use the pc-relative addressing mode of the 68000 directly, instead of using a global offset table. At present, this option implies <samp class="option">-fpic</samp>, allowing at most a 16-bit offset for pc-relative addressing. <samp class="option">-fPIC</samp> is not presently supported with <samp class="option">-mpcrel</samp>, though this could be supported for 68020 and higher processors. </p> </dd> <dt> + <span><code class="code">-mno-strict-align</code><a class="copiable-link" href="#index-mno-strict-align-1"> ¶</a></span> +</dt> <dt><code class="code">-mstrict-align</code></dt> <dd> +<p>Do not (do) assume that unaligned memory references are handled by the system. </p> </dd> <dt><code class="code">-msep-data</code></dt> <dd> +<p>Generate code that allows the data segment to be located in a different area of memory from the text segment. This allows for execute-in-place in an environment without virtual memory management. This option implies <samp class="option">-fPIC</samp>. </p> </dd> <dt><code class="code">-mno-sep-data</code></dt> <dd> +<p>Generate code that assumes that the data segment follows the text segment. This is the default. </p> </dd> <dt><code class="code">-mid-shared-library</code></dt> <dd> +<p>Generate code that supports shared libraries via the library ID method. This allows for execute-in-place and shared libraries in an environment without virtual memory management. This option implies <samp class="option">-fPIC</samp>. </p> </dd> <dt><code class="code">-mno-id-shared-library</code></dt> <dd> +<p>Generate code that doesn’t assume ID-based shared libraries are being used. This is the default. </p> </dd> <dt><code class="code">-mshared-library-id=n</code></dt> <dd> +<p>Specifies the identification number of the ID-based shared library being compiled. Specifying a value of 0 generates more compact code; specifying other values forces the allocation of that number to the current library, but is no more space- or time-efficient than omitting this option. </p> </dd> <dt> + <span><code class="code">-mxgot</code><a class="copiable-link" href="#index-mxgot"> ¶</a></span> +</dt> <dt><code class="code">-mno-xgot</code></dt> <dd> +<p>When generating position-independent code for ColdFire, generate code that works if the GOT has more than 8192 entries. This code is larger and slower than code generated without this option. On M680x0 processors, this option is not needed; <samp class="option">-fPIC</samp> suffices. </p> <p>GCC normally uses a single instruction to load values from the GOT. While this is relatively efficient, it only works if the GOT is smaller than about 64k. Anything larger causes the linker to report an error such as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">relocation truncated to fit: R_68K_GOT16O foobar</pre> +</div> <p>If this happens, you should recompile your code with <samp class="option">-mxgot</samp>. It should then work with very large GOTs. However, code generated with <samp class="option">-mxgot</samp> is less efficient, since it takes 4 instructions to fetch the value of a global symbol. </p> <p>Note that some linkers, including newer versions of the GNU linker, can create multiple GOTs and sort GOT entries. If you have such a linker, you should only need to use <samp class="option">-mxgot</samp> when compiling a single object file that accesses more than 8192 GOT entries. Very few do. </p> <p>These options have no effect unless GCC is generating position-independent code. </p> </dd> <dt> +<span><code class="code">-mlong-jump-table-offsets</code><a class="copiable-link" href="#index-mlong-jump-table-offsets"> ¶</a></span> +</dt> <dd> +<p>Use 32-bit offsets in <code class="code">switch</code> tables. The default is to use 16-bit offsets. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="mcore-options">MCore Options</a>, Previous: <a href="m32r_002fd-options">M32R/D Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M680x0-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/M680x0-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/m68k-function-attributes.html b/devdocs/gcc~13/m68k-function-attributes.html new file mode 100644 index 00000000..2d7ffea8 --- /dev/null +++ b/devdocs/gcc~13/m68k-function-attributes.html @@ -0,0 +1,11 @@ +<div class="subsection-level-extent" id="m68k-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="mcore-function-attributes" accesskey="n" rel="next">MCORE Function Attributes</a>, Previous: <a href="m32r_002fd-function-attributes" accesskey="p" rel="prev">M32R/D Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="m68k-Function-Attributes-1"><span>6.33.15 m68k Function Attributes<a class="copiable-link" href="#m68k-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the m68k back end: </p> <dl class="table"> <dt> + <span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-m68k"> ¶</a></span> +</dt> <dt><code class="code">interrupt_handler</code></dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. Either name may be used. </p> </dd> <dt> +<span><code class="code">interrupt_thread</code><a class="copiable-link" href="#index-interrupt_005fthread-function-attribute_002c-fido"> ¶</a></span> +</dt> <dd><p>Use this attribute on fido, a subarchitecture of the m68k, to indicate that the specified function is an interrupt handler that is designed to run as a thread. The compiler omits generate prologue/epilogue sequences and replaces the return instruction with a <code class="code">sleep</code> instruction. This attribute is available only on fido. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/m68k-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/m68k-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/machine-constraints.html b/devdocs/gcc~13/machine-constraints.html new file mode 100644 index 00000000..78fdd56e --- /dev/null +++ b/devdocs/gcc~13/machine-constraints.html @@ -0,0 +1,640 @@ +<div class="subsubsection-level-extent" id="Machine-Constraints"> <div class="nav-panel"> <p> Previous: <a href="modifiers" accesskey="p" rel="prev">Constraint Modifier Characters</a>, Up: <a href="constraints" accesskey="u" rel="up">Constraints for <code class="code">asm</code> Operands</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection subsection-level-set-subsubsection" id="Constraints-for-Particular-Machines"><span>6.47.3.4 Constraints for Particular Machines<a class="copiable-link" href="#Constraints-for-Particular-Machines"> ¶</a></span></h1> <p>Whenever possible, you should use the general-purpose constraint letters in <code class="code">asm</code> arguments, since they will convey meaning more readily to people reading your code. Failing that, use the constraint letters that usually have very similar meanings across architectures. The most commonly used constraints are ‘<samp class="samp">m</samp>’ and ‘<samp class="samp">r</samp>’ (for memory and general-purpose registers respectively; see <a class="pxref" href="simple-constraints">Simple Constraints</a>), and ‘<samp class="samp">I</samp>’, usually the letter indicating the most common immediate-constant format. </p> <p>Each architecture defines additional constraints. These constraints are used by the compiler itself for instruction generation, as well as for <code class="code">asm</code> statements; therefore, some of the constraints are not particularly useful for <code class="code">asm</code>. Here is a summary of some of the machine-dependent constraints available on some particular machines; it includes both constraints that are useful for <code class="code">asm</code> and constraints that aren’t. The compiler source file mentioned in the table heading for each architecture is the definitive reference for the meanings of that architecture’s constraints. </p> <dl class="table"> <dt>AArch64 family—<samp class="file">config/aarch64/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">k</code></dt> <dd> +<p>The stack pointer register (<code class="code">SP</code>) </p> </dd> <dt><code class="code">w</code></dt> <dd> +<p>Floating point register, Advanced SIMD vector register or SVE vector register </p> </dd> <dt><code class="code">x</code></dt> <dd> +<p>Like <code class="code">w</code>, but restricted to registers 0 to 15 inclusive. </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>Like <code class="code">w</code>, but restricted to registers 0 to 7 inclusive. </p> </dd> <dt><code class="code">Upl</code></dt> <dd> +<p>One of the low eight SVE predicate registers (<code class="code">P0</code> to <code class="code">P7</code>) </p> </dd> <dt><code class="code">Upa</code></dt> <dd> +<p>Any of the SVE predicate registers (<code class="code">P0</code> to <code class="code">P15</code>) </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>Integer constant that is valid as an immediate operand in an <code class="code">ADD</code> instruction </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Integer constant that is valid as an immediate operand in a <code class="code">SUB</code> instruction (once negated) </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Integer constant that can be used with a 32-bit logical instruction </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Integer constant that can be used with a 64-bit logical instruction </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Integer constant that is valid as an immediate operand in a 32-bit <code class="code">MOV</code> pseudo instruction. The <code class="code">MOV</code> may be assembled to one of several different machine instructions depending on the value </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>Integer constant that is valid as an immediate operand in a 64-bit <code class="code">MOV</code> pseudo instruction </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>An absolute symbolic address or a label reference </p> </dd> <dt><code class="code">Y</code></dt> <dd> +<p>Floating point constant zero </p> </dd> <dt><code class="code">Z</code></dt> <dd> +<p>Integer constant zero </p> </dd> <dt><code class="code">Ush</code></dt> <dd> +<p>The high part (bits 12 and upwards) of the pc-relative address of a symbol within 4GB of the instruction </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>A memory address which uses a single base register with no offset </p> </dd> <dt><code class="code">Ump</code></dt> <dd> +<p>A memory address suitable for a load/store pair instruction in SI, DI, SF and DF modes </p> </dd> </dl> </dd> <dt>AMD GCN —<samp class="file">config/gcn/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">I</code></dt> <dd> +<p>Immediate integer in the range −16 to 64 </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Immediate 16-bit signed integer </p> </dd> <dt><code class="code">Kf</code></dt> <dd> +<p>Immediate constant −1 </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Immediate 15-bit unsigned integer </p> </dd> <dt><code class="code">A</code></dt> <dd> +<p>Immediate constant that can be inlined in an instruction encoding: integer −16..64, or float 0.0, +/−0.5, +/−1.0, +/−2.0, +/−4.0, 1.0/(2.0*PI) </p> </dd> <dt><code class="code">B</code></dt> <dd> +<p>Immediate 32-bit signed integer that can be attached to an instruction encoding </p> </dd> <dt><code class="code">C</code></dt> <dd> +<p>Immediate 32-bit integer in range −16..4294967295 (i.e. 32-bit unsigned integer or ‘<samp class="samp">A</samp>’ constraint) </p> </dd> <dt><code class="code">DA</code></dt> <dd> +<p>Immediate 64-bit constant that can be split into two ‘<samp class="samp">A</samp>’ constants </p> </dd> <dt><code class="code">DB</code></dt> <dd> +<p>Immediate 64-bit constant that can be split into two ‘<samp class="samp">B</samp>’ constants </p> </dd> <dt><code class="code">U</code></dt> <dd> +<p>Any <code class="code">unspec</code> </p> </dd> <dt><code class="code">Y</code></dt> <dd> +<p>Any <code class="code">symbol_ref</code> or <code class="code">label_ref</code> </p> </dd> <dt><code class="code">v</code></dt> <dd> +<p>VGPR register </p> </dd> <dt><code class="code">Sg</code></dt> <dd> +<p>SGPR register </p> </dd> <dt><code class="code">SD</code></dt> <dd> +<p>SGPR registers valid for instruction destinations, including VCC, M0 and EXEC </p> </dd> <dt><code class="code">SS</code></dt> <dd> +<p>SGPR registers valid for instruction sources, including VCC, M0, EXEC and SCC </p> </dd> <dt><code class="code">Sm</code></dt> <dd> +<p>SGPR registers valid as a source for scalar memory instructions (excludes M0 and EXEC) </p> </dd> <dt><code class="code">Sv</code></dt> <dd> +<p>SGPR registers valid as a source or destination for vector instructions (excludes EXEC) </p> </dd> <dt><code class="code">ca</code></dt> <dd> +<p>All condition registers: SCC, VCCZ, EXECZ </p> </dd> <dt><code class="code">cs</code></dt> <dd> +<p>Scalar condition register: SCC </p> </dd> <dt><code class="code">cV</code></dt> <dd> +<p>Vector condition register: VCC, VCC_LO, VCC_HI </p> </dd> <dt><code class="code">e</code></dt> <dd> +<p>EXEC register (EXEC_LO and EXEC_HI) </p> </dd> <dt><code class="code">RB</code></dt> <dd> +<p>Memory operand with address space suitable for <code class="code">buffer_*</code> instructions </p> </dd> <dt><code class="code">RF</code></dt> <dd> +<p>Memory operand with address space suitable for <code class="code">flat_*</code> instructions </p> </dd> <dt><code class="code">RS</code></dt> <dd> +<p>Memory operand with address space suitable for <code class="code">s_*</code> instructions </p> </dd> <dt><code class="code">RL</code></dt> <dd> +<p>Memory operand with address space suitable for <code class="code">ds_*</code> LDS instructions </p> </dd> <dt><code class="code">RG</code></dt> <dd> +<p>Memory operand with address space suitable for <code class="code">ds_*</code> GDS instructions </p> </dd> <dt><code class="code">RD</code></dt> <dd> +<p>Memory operand with address space suitable for any <code class="code">ds_*</code> instructions </p> </dd> <dt><code class="code">RM</code></dt> <dd> +<p>Memory operand with address space suitable for <code class="code">global_*</code> instructions </p> </dd> </dl> </dd> <dt>ARC —<samp class="file">config/arc/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">q</code></dt> <dd> +<p>Registers usable in ARCompact 16-bit instructions: <code class="code">r0</code>-<code class="code">r3</code>, <code class="code">r12</code>-<code class="code">r15</code>. This constraint can only match when the <samp class="option">-mq</samp> option is in effect. </p> </dd> <dt><code class="code">e</code></dt> <dd><p>Registers usable as base-regs of memory addresses in ARCompact 16-bit memory instructions: <code class="code">r0</code>-<code class="code">r3</code>, <code class="code">r12</code>-<code class="code">r15</code>, <code class="code">sp</code>. This constraint can only match when the <samp class="option">-mq</samp> option is in effect. </p></dd> <dt><code class="code">D</code></dt> <dd> +<p>ARC FPX (dpfp) 64-bit registers. <code class="code">D0</code>, <code class="code">D1</code>. </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>A signed 12-bit integer constant. </p> </dd> <dt><code class="code">Cal</code></dt> <dd> +<p>constant for arithmetic/logical operations. This might be any constant that can be put into a long immediate by the assmbler or linker without involving a PIC relocation. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>A 3-bit unsigned integer constant. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>A 6-bit unsigned integer constant. </p> </dd> <dt><code class="code">CnL</code></dt> <dd> +<p>One’s complement of a 6-bit unsigned integer constant. </p> </dd> <dt><code class="code">CmL</code></dt> <dd> +<p>Two’s complement of a 6-bit unsigned integer constant. </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>A 5-bit unsigned integer constant. </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>A 7-bit unsigned integer constant. </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>A 8-bit unsigned integer constant. </p> </dd> <dt><code class="code">H</code></dt> <dd><p>Any const_double value. </p></dd> </dl> </dd> <dt>ARM family—<samp class="file">config/arm/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">h</code></dt> <dd> +<p>In Thumb state, the core registers <code class="code">r8</code>-<code class="code">r15</code>. </p> </dd> <dt><code class="code">k</code></dt> <dd> +<p>The stack pointer register. </p> </dd> <dt><code class="code">l</code></dt> <dd> +<p>In Thumb State the core registers <code class="code">r0</code>-<code class="code">r7</code>. In ARM state this is an alias for the <code class="code">r</code> constraint. </p> </dd> <dt><code class="code">t</code></dt> <dd> +<p>VFP floating-point registers <code class="code">s0</code>-<code class="code">s31</code>. Used for 32 bit values. </p> </dd> <dt><code class="code">w</code></dt> <dd> +<p>VFP floating-point registers <code class="code">d0</code>-<code class="code">d31</code> and the appropriate subset <code class="code">d0</code>-<code class="code">d15</code> based on command line options. Used for 64 bit values only. Not valid for Thumb1. </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>The iWMMX co-processor registers. </p> </dd> <dt><code class="code">z</code></dt> <dd> +<p>The iWMMX GR registers. </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>The floating-point constant 0.0 </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>Integer that is valid as an immediate operand in a data processing instruction. That is, an integer in the range 0 to 255 rotated by a multiple of 2 </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Integer in the range −4095 to 4095 </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Integer that satisfies constraint ‘<samp class="samp">I</samp>’ when inverted (ones complement) </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Integer that satisfies constraint ‘<samp class="samp">I</samp>’ when negated (twos complement) </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Integer in the range 0 to 32 </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>A memory reference where the exact address is in a single register (‘‘<samp class="samp">m</samp>’’ is preferable for <code class="code">asm</code> statements) </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>An item in the constant pool </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>A symbol in the text segment of the current file </p> </dd> <dt><code class="code">Uv</code></dt> <dd> +<p>A memory reference suitable for VFP load/store insns (reg+constant offset) </p> </dd> <dt><code class="code">Uy</code></dt> <dd> +<p>A memory reference suitable for iWMMXt load/store instructions. </p> </dd> <dt><code class="code">Uq</code></dt> <dd><p>A memory reference suitable for the ARMv4 ldrsb instruction. </p></dd> </dl> </dd> <dt>AVR family—<samp class="file">config/avr/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">l</code></dt> <dd> +<p>Registers from r0 to r15 </p> </dd> <dt><code class="code">a</code></dt> <dd> +<p>Registers from r16 to r23 </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>Registers from r16 to r31 </p> </dd> <dt><code class="code">w</code></dt> <dd> +<p>Registers from r24 to r31. These registers can be used in ‘<samp class="samp">adiw</samp>’ command </p> </dd> <dt><code class="code">e</code></dt> <dd> +<p>Pointer register (r26–r31) </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>Base pointer register (r28–r31) </p> </dd> <dt><code class="code">q</code></dt> <dd> +<p>Stack pointer register (SPH:SPL) </p> </dd> <dt><code class="code">t</code></dt> <dd> +<p>Temporary register r0 </p> </dd> <dt><code class="code">x</code></dt> <dd> +<p>Register pair X (r27:r26) </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>Register pair Y (r29:r28) </p> </dd> <dt><code class="code">z</code></dt> <dd> +<p>Register pair Z (r31:r30) </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>Constant greater than −1, less than 64 </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Constant greater than −64, less than 1 </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Constant integer 2 </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Constant integer 0 </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Constant that fits in 8 bits </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>Constant integer −1 </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>Constant integer 8, 16, or 24 </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>Constant integer 1 </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>A floating point constant 0.0 </p> </dd> <dt><code class="code">Q</code></dt> <dd><p>A memory address based on Y or Z pointer with displacement. </p></dd> </dl> </dd> <dt>Blackfin family—<samp class="file">config/bfin/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>P register </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>D register </p> </dd> <dt><code class="code">z</code></dt> <dd> +<p>A call clobbered P register. </p> </dd> <dt><code class="code">q<var class="var">n</var></code></dt> <dd> +<p>A single register. If <var class="var">n</var> is in the range 0 to 7, the corresponding D register. If it is <code class="code">A</code>, then the register P0. </p> </dd> <dt><code class="code">D</code></dt> <dd> +<p>Even-numbered D register </p> </dd> <dt><code class="code">W</code></dt> <dd> +<p>Odd-numbered D register </p> </dd> <dt><code class="code">e</code></dt> <dd> +<p>Accumulator register. </p> </dd> <dt><code class="code">A</code></dt> <dd> +<p>Even-numbered accumulator register. </p> </dd> <dt><code class="code">B</code></dt> <dd> +<p>Odd-numbered accumulator register. </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>I register </p> </dd> <dt><code class="code">v</code></dt> <dd> +<p>B register </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>M register </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>Registers used for circular buffering, i.e. I, B, or L registers. </p> </dd> <dt><code class="code">C</code></dt> <dd> +<p>The CC register. </p> </dd> <dt><code class="code">t</code></dt> <dd> +<p>LT0 or LT1. </p> </dd> <dt><code class="code">k</code></dt> <dd> +<p>LC0 or LC1. </p> </dd> <dt><code class="code">u</code></dt> <dd> +<p>LB0 or LB1. </p> </dd> <dt><code class="code">x</code></dt> <dd> +<p>Any D, P, B, M, I or L register. </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>Additional registers typically used only in prologues and epilogues: RETS, RETN, RETI, RETX, RETE, ASTAT, SEQSTAT and USP. </p> </dd> <dt><code class="code">w</code></dt> <dd> +<p>Any register except accumulators or CC. </p> </dd> <dt><code class="code">Ksh</code></dt> <dd> +<p>Signed 16 bit integer (in the range −32768 to 32767) </p> </dd> <dt><code class="code">Kuh</code></dt> <dd> +<p>Unsigned 16 bit integer (in the range 0 to 65535) </p> </dd> <dt><code class="code">Ks7</code></dt> <dd> +<p>Signed 7 bit integer (in the range −64 to 63) </p> </dd> <dt><code class="code">Ku7</code></dt> <dd> +<p>Unsigned 7 bit integer (in the range 0 to 127) </p> </dd> <dt><code class="code">Ku5</code></dt> <dd> +<p>Unsigned 5 bit integer (in the range 0 to 31) </p> </dd> <dt><code class="code">Ks4</code></dt> <dd> +<p>Signed 4 bit integer (in the range −8 to 7) </p> </dd> <dt><code class="code">Ks3</code></dt> <dd> +<p>Signed 3 bit integer (in the range −3 to 4) </p> </dd> <dt><code class="code">Ku3</code></dt> <dd> +<p>Unsigned 3 bit integer (in the range 0 to 7) </p> </dd> <dt><code class="code">P<var class="var">n</var></code></dt> <dd> +<p>Constant <var class="var">n</var>, where <var class="var">n</var> is a single-digit constant in the range 0 to 4. </p> </dd> <dt><code class="code">PA</code></dt> <dd> +<p>An integer equal to one of the MACFLAG_XXX constants that is suitable for use with either accumulator. </p> </dd> <dt><code class="code">PB</code></dt> <dd> +<p>An integer equal to one of the MACFLAG_XXX constants that is suitable for use only with accumulator A1. </p> </dd> <dt><code class="code">M1</code></dt> <dd> +<p>Constant 255. </p> </dd> <dt><code class="code">M2</code></dt> <dd> +<p>Constant 65535. </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>An integer constant with exactly a single bit set. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>An integer constant with all bits set except exactly one. </p> </dd> <dt><code class="code">H</code></dt> <dt><code class="code">Q</code></dt> <dd><p>Any SYMBOL_REF. </p></dd> </dl> </dd> <dt>C-SKY—<samp class="file">config/csky/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>The mini registers r0 - r7. </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>The low registers r0 - r15. </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>C register. </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>HI and LO registers. </p> </dd> <dt><code class="code">l</code></dt> <dd> +<p>LO register. </p> </dd> <dt><code class="code">h</code></dt> <dd> +<p>HI register. </p> </dd> <dt><code class="code">v</code></dt> <dd> +<p>Vector registers. </p> </dd> <dt><code class="code">z</code></dt> <dd> +<p>Stack pointer register (SP). </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>A memory address which uses a base register with a short offset or with a index register with its scale. </p> </dd> <dt><code class="code">W</code></dt> <dd><p>A memory address which uses a base register with a index register with its scale. </p></dd> </dl> </dd> <dt>Epiphany—<samp class="file">config/epiphany/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">U16</code></dt> <dd> +<p>An unsigned 16-bit constant. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>An unsigned 5-bit constant. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>A signed 11-bit constant. </p> </dd> <dt><code class="code">Cm1</code></dt> <dd> +<p>A signed 11-bit constant added to −1. Can only match when the <samp class="option">-m1reg-<var class="var">reg</var></samp> option is active. </p> </dd> <dt><code class="code">Cl1</code></dt> <dd> +<p>Left-shift of −1, i.e., a bit mask with a block of leading ones, the rest being a block of trailing zeroes. Can only match when the <samp class="option">-m1reg-<var class="var">reg</var></samp> option is active. </p> </dd> <dt><code class="code">Cr1</code></dt> <dd> +<p>Right-shift of −1, i.e., a bit mask with a trailing block of ones, the rest being zeroes. Or to put it another way, one less than a power of two. Can only match when the <samp class="option">-m1reg-<var class="var">reg</var></samp> option is active. </p> </dd> <dt><code class="code">Cal</code></dt> <dd> +<p>Constant for arithmetic/logical operations. This is like <code class="code">i</code>, except that for position independent code, no symbols / expressions needing relocations are allowed. </p> </dd> <dt><code class="code">Csy</code></dt> <dd> +<p>Symbolic constant for call/jump instruction. </p> </dd> <dt><code class="code">Rcs</code></dt> <dd> +<p>The register class usable in short insns. This is a register class constraint, and can thus drive register allocation. This constraint won’t match unless <samp class="option">-mprefer-short-insn-regs</samp> is in effect. </p> </dd> <dt><code class="code">Rsc</code></dt> <dd> +<p>The register class of registers that can be used to hold a sibcall call address. I.e., a caller-saved register. </p> </dd> <dt><code class="code">Rct</code></dt> <dd> +<p>Core control register class. </p> </dd> <dt><code class="code">Rgs</code></dt> <dd> +<p>The register group usable in short insns. This constraint does not use a register class, so that it only passively matches suitable registers, and doesn’t drive register allocation. </p> </dd> <dt><code class="code">Rra</code></dt> <dd> +<p>Matches the return address if it can be replaced with the link register. </p> </dd> <dt><code class="code">Rcc</code></dt> <dd> +<p>Matches the integer condition code register. </p> </dd> <dt><code class="code">Sra</code></dt> <dd> +<p>Matches the return address if it is in a stack slot. </p> </dd> <dt><code class="code">Cfm</code></dt> <dd><p>Matches control register values to switch fp mode, which are encapsulated in <code class="code">UNSPEC_FP_MODE</code>. </p></dd> </dl> </dd> <dt>FRV—<samp class="file">config/frv/frv.h</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>Register in the class <code class="code">ACC_REGS</code> (<code class="code">acc0</code> to <code class="code">acc7</code>). </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>Register in the class <code class="code">EVEN_ACC_REGS</code> (<code class="code">acc0</code> to <code class="code">acc7</code>). </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>Register in the class <code class="code">CC_REGS</code> (<code class="code">fcc0</code> to <code class="code">fcc3</code> and <code class="code">icc0</code> to <code class="code">icc3</code>). </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>Register in the class <code class="code">GPR_REGS</code> (<code class="code">gr0</code> to <code class="code">gr63</code>). </p> </dd> <dt><code class="code">e</code></dt> <dd> +<p>Register in the class <code class="code">EVEN_REGS</code> (<code class="code">gr0</code> to <code class="code">gr63</code>). Odd registers are excluded not in the class but through the use of a machine mode larger than 4 bytes. </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>Register in the class <code class="code">FPR_REGS</code> (<code class="code">fr0</code> to <code class="code">fr63</code>). </p> </dd> <dt><code class="code">h</code></dt> <dd> +<p>Register in the class <code class="code">FEVEN_REGS</code> (<code class="code">fr0</code> to <code class="code">fr63</code>). Odd registers are excluded not in the class but through the use of a machine mode larger than 4 bytes. </p> </dd> <dt><code class="code">l</code></dt> <dd> +<p>Register in the class <code class="code">LR_REG</code> (the <code class="code">lr</code> register). </p> </dd> <dt><code class="code">q</code></dt> <dd> +<p>Register in the class <code class="code">QUAD_REGS</code> (<code class="code">gr2</code> to <code class="code">gr63</code>). Register numbers not divisible by 4 are excluded not in the class but through the use of a machine mode larger than 8 bytes. </p> </dd> <dt><code class="code">t</code></dt> <dd> +<p>Register in the class <code class="code">ICC_REGS</code> (<code class="code">icc0</code> to <code class="code">icc3</code>). </p> </dd> <dt><code class="code">u</code></dt> <dd> +<p>Register in the class <code class="code">FCC_REGS</code> (<code class="code">fcc0</code> to <code class="code">fcc3</code>). </p> </dd> <dt><code class="code">v</code></dt> <dd> +<p>Register in the class <code class="code">ICR_REGS</code> (<code class="code">cc4</code> to <code class="code">cc7</code>). </p> </dd> <dt><code class="code">w</code></dt> <dd> +<p>Register in the class <code class="code">FCR_REGS</code> (<code class="code">cc0</code> to <code class="code">cc3</code>). </p> </dd> <dt><code class="code">x</code></dt> <dd> +<p>Register in the class <code class="code">QUAD_FPR_REGS</code> (<code class="code">fr0</code> to <code class="code">fr63</code>). Register numbers not divisible by 4 are excluded not in the class but through the use of a machine mode larger than 8 bytes. </p> </dd> <dt><code class="code">z</code></dt> <dd> +<p>Register in the class <code class="code">SPR_REGS</code> (<code class="code">lcr</code> and <code class="code">lr</code>). </p> </dd> <dt><code class="code">A</code></dt> <dd> +<p>Register in the class <code class="code">QUAD_ACC_REGS</code> (<code class="code">acc0</code> to <code class="code">acc7</code>). </p> </dd> <dt><code class="code">B</code></dt> <dd> +<p>Register in the class <code class="code">ACCG_REGS</code> (<code class="code">accg0</code> to <code class="code">accg7</code>). </p> </dd> <dt><code class="code">C</code></dt> <dd> +<p>Register in the class <code class="code">CR_REGS</code> (<code class="code">cc0</code> to <code class="code">cc7</code>). </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>Floating point constant zero </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>6-bit signed integer constant </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>10-bit signed integer constant </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>16-bit signed integer constant </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>16-bit unsigned integer constant </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>12-bit signed integer constant that is negative—i.e. in the range of −2048 to −1 </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>Constant zero </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>12-bit signed integer constant that is greater than zero—i.e. in the range of 1 to 2047. </p> </dd> </dl> </dd> <dt>FT32—<samp class="file">config/ft32/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">A</code></dt> <dd> +<p>An absolute address </p> </dd> <dt><code class="code">B</code></dt> <dd> +<p>An offset address </p> </dd> <dt><code class="code">W</code></dt> <dd> +<p>A register indirect memory operand </p> </dd> <dt><code class="code">e</code></dt> <dd> +<p>An offset address. </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>An offset address. </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>The constant zero or one </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>A 16-bit signed constant (−32768 … 32767) </p> </dd> <dt><code class="code">w</code></dt> <dd> +<p>A bitfield mask suitable for bext or bins </p> </dd> <dt><code class="code">x</code></dt> <dd> +<p>An inverted bitfield mask suitable for bext or bins </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>A 16-bit unsigned constant, multiple of 4 (0 … 65532) </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>A 20-bit signed constant (−524288 … 524287) </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>A constant for a bitfield width (1 … 16) </p> </dd> <dt><code class="code">KA</code></dt> <dd> +<p>A 10-bit signed constant (−512 … 511) </p> </dd> </dl> </dd> <dt>Hewlett-Packard PA-RISC—<samp class="file">config/pa/pa.h</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>General register 1 </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>Floating point register </p> </dd> <dt><code class="code">q</code></dt> <dd> +<p>Shift amount register </p> </dd> <dt><code class="code">x</code></dt> <dd> +<p>Floating point register (deprecated) </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>Upper floating point register (32-bit), floating point register (64-bit) </p> </dd> <dt><code class="code">Z</code></dt> <dd> +<p>Any register </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>Signed 11-bit integer constant </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Signed 14-bit integer constant </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Integer constant that can be deposited with a <code class="code">zdepi</code> instruction </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Signed 5-bit integer constant </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Integer constant 0 </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>Integer constant that can be loaded with a <code class="code">ldil</code> instruction </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>Integer constant whose value plus one is a power of 2 </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>Integer constant that can be used for <code class="code">and</code> operations in <code class="code">depi</code> and <code class="code">extru</code> instructions </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>Integer constant 31 </p> </dd> <dt><code class="code">U</code></dt> <dd> +<p>Integer constant 63 </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>Floating-point constant 0.0 </p> </dd> <dt><code class="code">A</code></dt> <dd> +<p>A <code class="code">lo_sum</code> data-linkage-table memory operand </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>A memory operand that can be used as the destination operand of an integer store instruction </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>A scaled or unscaled indexed memory operand </p> </dd> <dt><code class="code">T</code></dt> <dd> +<p>A memory operand for floating-point loads and stores </p> </dd> <dt><code class="code">W</code></dt> <dd><p>A register indirect memory operand </p></dd> </dl> </dd> <dt>Intel IA-64—<samp class="file">config/ia64/ia64.h</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>General register <code class="code">r0</code> to <code class="code">r3</code> for <code class="code">addl</code> instruction </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>Branch register </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>Predicate register (‘<samp class="samp">c</samp>’ as in “conditional”) </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>Application register residing in M-unit </p> </dd> <dt><code class="code">e</code></dt> <dd> +<p>Application register residing in I-unit </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>Floating-point register </p> </dd> <dt><code class="code">m</code></dt> <dd> +<p>Memory operand. If used together with ‘<samp class="samp"><</samp>’ or ‘<samp class="samp">></samp>’, the operand can have postincrement and postdecrement which require printing with ‘<samp class="samp">%Pn</samp>’ on IA-64. </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>Floating-point constant 0.0 or 1.0 </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>14-bit signed integer constant </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>22-bit signed integer constant </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>8-bit signed integer constant for logical instructions </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>8-bit adjusted signed integer constant for compare pseudo-ops </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>6-bit unsigned integer constant for shift counts </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>9-bit signed integer constant for load and store postincrements </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>The constant zero </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>0 or −1 for <code class="code">dep</code> instruction </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>Non-volatile memory for floating-point loads and stores </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>Integer constant in the range 1 to 4 for <code class="code">shladd</code> instruction </p> </dd> <dt><code class="code">S</code></dt> <dd><p>Memory operand except postincrement and postdecrement. This is now roughly the same as ‘<samp class="samp">m</samp>’ when not used together with ‘<samp class="samp"><</samp>’ or ‘<samp class="samp">></samp>’. </p></dd> </dl> </dd> <dt>M32C—<samp class="file">config/m32c/m32c.cc</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">Rsp</code></dt> <dt><code class="code">Rfb</code></dt> <dt><code class="code">Rsb</code></dt> <dd> +<p>‘<samp class="samp">$sp</samp>’, ‘<samp class="samp">$fb</samp>’, ‘<samp class="samp">$sb</samp>’. </p> </dd> <dt><code class="code">Rcr</code></dt> <dd> +<p>Any control register, when they’re 16 bits wide (nothing if control registers are 24 bits wide) </p> </dd> <dt><code class="code">Rcl</code></dt> <dd> +<p>Any control register, when they’re 24 bits wide. </p> </dd> <dt><code class="code">R0w</code></dt> <dt><code class="code">R1w</code></dt> <dt><code class="code">R2w</code></dt> <dt><code class="code">R3w</code></dt> <dd> +<p>$r0, $r1, $r2, $r3. </p> </dd> <dt><code class="code">R02</code></dt> <dd> +<p>$r0 or $r2, or $r2r0 for 32 bit values. </p> </dd> <dt><code class="code">R13</code></dt> <dd> +<p>$r1 or $r3, or $r3r1 for 32 bit values. </p> </dd> <dt><code class="code">Rdi</code></dt> <dd> +<p>A register that can hold a 64 bit value. </p> </dd> <dt><code class="code">Rhl</code></dt> <dd> +<p>$r0 or $r1 (registers with addressable high/low bytes) </p> </dd> <dt><code class="code">R23</code></dt> <dd> +<p>$r2 or $r3 </p> </dd> <dt><code class="code">Raa</code></dt> <dd> +<p>Address registers </p> </dd> <dt><code class="code">Raw</code></dt> <dd> +<p>Address registers when they’re 16 bits wide. </p> </dd> <dt><code class="code">Ral</code></dt> <dd> +<p>Address registers when they’re 24 bits wide. </p> </dd> <dt><code class="code">Rqi</code></dt> <dd> +<p>Registers that can hold QI values. </p> </dd> <dt><code class="code">Rad</code></dt> <dd> +<p>Registers that can be used with displacements ($a0, $a1, $sb). </p> </dd> <dt><code class="code">Rsi</code></dt> <dd> +<p>Registers that can hold 32 bit values. </p> </dd> <dt><code class="code">Rhi</code></dt> <dd> +<p>Registers that can hold 16 bit values. </p> </dd> <dt><code class="code">Rhc</code></dt> <dd> +<p>Registers chat can hold 16 bit values, including all control registers. </p> </dd> <dt><code class="code">Rra</code></dt> <dd> +<p>$r0 through R1, plus $a0 and $a1. </p> </dd> <dt><code class="code">Rfl</code></dt> <dd> +<p>The flags register. </p> </dd> <dt><code class="code">Rmm</code></dt> <dd> +<p>The memory-based pseudo-registers $mem0 through $mem15. </p> </dd> <dt><code class="code">Rpi</code></dt> <dd> +<p>Registers that can hold pointers (16 bit registers for r8c, m16c; 24 bit registers for m32cm, m32c). </p> </dd> <dt><code class="code">Rpa</code></dt> <dd> +<p>Matches multiple registers in a PARALLEL to form a larger register. Used to match function return values. </p> </dd> <dt><code class="code">Is3</code></dt> <dd> +<p>−8 … 7 </p> </dd> <dt><code class="code">IS1</code></dt> <dd> +<p>−128 … 127 </p> </dd> <dt><code class="code">IS2</code></dt> <dd> +<p>−32768 … 32767 </p> </dd> <dt><code class="code">IU2</code></dt> <dd> +<p>0 … 65535 </p> </dd> <dt><code class="code">In4</code></dt> <dd> +<p>−8 … −1 or 1 … 8 </p> </dd> <dt><code class="code">In5</code></dt> <dd> +<p>−16 … −1 or 1 … 16 </p> </dd> <dt><code class="code">In6</code></dt> <dd> +<p>−32 … −1 or 1 … 32 </p> </dd> <dt><code class="code">IM2</code></dt> <dd> +<p>−65536 … −1 </p> </dd> <dt><code class="code">Ilb</code></dt> <dd> +<p>An 8 bit value with exactly one bit set. </p> </dd> <dt><code class="code">Ilw</code></dt> <dd> +<p>A 16 bit value with exactly one bit set. </p> </dd> <dt><code class="code">Sd</code></dt> <dd> +<p>The common src/dest memory addressing modes. </p> </dd> <dt><code class="code">Sa</code></dt> <dd> +<p>Memory addressed using $a0 or $a1. </p> </dd> <dt><code class="code">Si</code></dt> <dd> +<p>Memory addressed with immediate addresses. </p> </dd> <dt><code class="code">Ss</code></dt> <dd> +<p>Memory addressed using the stack pointer ($sp). </p> </dd> <dt><code class="code">Sf</code></dt> <dd> +<p>Memory addressed using the frame base register ($fb). </p> </dd> <dt><code class="code">Ss</code></dt> <dd> +<p>Memory addressed using the small base register ($sb). </p> </dd> <dt><code class="code">S1</code></dt> <dd><p>$r1h </p></dd> </dl> </dd> <dt>LoongArch—<samp class="file">config/loongarch/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">f</code></dt> <dd><p>A floating-point register (if available). </p></dd> <dt><code class="code">k</code></dt> <dd><p>A memory operand whose address is formed by a base register and (optionally scaled) index register. </p></dd> <dt><code class="code">l</code></dt> <dd><p>A signed 16-bit constant. </p></dd> <dt><code class="code">m</code></dt> <dd><p>A memory operand whose address is formed by a base register and offset that is suitable for use in instructions with the same addressing mode as <code class="code">st.w</code> and <code class="code">ld.w</code>. </p></dd> <dt><code class="code">I</code></dt> <dd><p>A signed 12-bit constant (for arithmetic instructions). </p></dd> <dt><code class="code">K</code></dt> <dd><p>An unsigned 12-bit constant (for logic instructions). </p></dd> <dt><code class="code">ZB</code></dt> <dd><p>An address that is held in a general-purpose register. The offset is zero. </p></dd> <dt><code class="code">ZC</code></dt> <dd><p>A memory operand whose address is formed by a base register and offset that is suitable for use in instructions with the same addressing mode as <code class="code">ll.w</code> and <code class="code">sc.w</code>. </p></dd> </dl> </dd> <dt>MicroBlaze—<samp class="file">config/microblaze/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">d</code></dt> <dd> +<p>A general register (<code class="code">r0</code> to <code class="code">r31</code>). </p> </dd> <dt><code class="code">z</code></dt> <dd> +<p>A status register (<code class="code">rmsr</code>, <code class="code">$fcc1</code> to <code class="code">$fcc7</code>). </p> </dd> </dl> </dd> <dt>MIPS—<samp class="file">config/mips/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">d</code></dt> <dd> +<p>A general-purpose register. This is equivalent to <code class="code">r</code> unless generating MIPS16 code, in which case the MIPS16 register set is used. </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>A floating-point register (if available). </p> </dd> <dt><code class="code">h</code></dt> <dd> +<p>Formerly the <code class="code">hi</code> register. This constraint is no longer supported. </p> </dd> <dt><code class="code">l</code></dt> <dd> +<p>The <code class="code">lo</code> register. Use this register to store values that are no bigger than a word. </p> </dd> <dt><code class="code">x</code></dt> <dd> +<p>The concatenated <code class="code">hi</code> and <code class="code">lo</code> registers. Use this register to store doubleword values. </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>A register suitable for use in an indirect jump. This will always be <code class="code">$25</code> for <samp class="option">-mabicalls</samp>. </p> </dd> <dt><code class="code">v</code></dt> <dd> +<p>Register <code class="code">$3</code>. Do not use this constraint in new code; it is retained only for compatibility with glibc. </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>Equivalent to <code class="code">r</code>; retained for backwards compatibility. </p> </dd> <dt><code class="code">z</code></dt> <dd> +<p>A floating-point condition code register. </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>A signed 16-bit constant (for arithmetic instructions). </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Integer zero. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>An unsigned 16-bit constant (for logic instructions). </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>A signed 32-bit constant in which the lower 16 bits are zero. Such constants can be loaded using <code class="code">lui</code>. </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>A constant that cannot be loaded using <code class="code">lui</code>, <code class="code">addiu</code> or <code class="code">ori</code>. </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>A constant in the range −65535 to −1 (inclusive). </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>A signed 15-bit constant. </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>A constant in the range 1 to 65535 (inclusive). </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>Floating-point zero. </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>An address that can be used in a non-macro load or store. </p> </dd> <dt><code class="code">ZC</code></dt> <dd> +<p>A memory operand whose address is formed by a base register and offset that is suitable for use in instructions with the same addressing mode as <code class="code">ll</code> and <code class="code">sc</code>. </p> </dd> <dt><code class="code">ZD</code></dt> <dd><p>An address suitable for a <code class="code">prefetch</code> instruction, or for any other instruction with the same addressing mode as <code class="code">prefetch</code>. </p></dd> </dl> </dd> <dt>Motorola 680x0—<samp class="file">config/m68k/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>Address register </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>Data register </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>68881 floating-point register, if available </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>Integer in the range 1 to 8 </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>16-bit signed number </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Signed number whose magnitude is greater than 0x80 </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Integer in the range −8 to −1 </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Signed number whose magnitude is greater than 0x100 </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>Range 24 to 31, rotatert:SI 8 to 1 expressed as rotate </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>16 (for rotate using swap) </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>Range 8 to 15, rotatert:HI 8 to 1 expressed as rotate </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>Numbers that mov3q can handle </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>Floating point constant that is not a 68881 constant </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>Operands that satisfy ’m’ when -mpcrel is in effect </p> </dd> <dt><code class="code">T</code></dt> <dd> +<p>Operands that satisfy ’s’ when -mpcrel is not in effect </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>Address register indirect addressing mode </p> </dd> <dt><code class="code">U</code></dt> <dd> +<p>Register offset addressing </p> </dd> <dt><code class="code">W</code></dt> <dd> +<p>const_call_operand </p> </dd> <dt><code class="code">Cs</code></dt> <dd> +<p>symbol_ref or const </p> </dd> <dt><code class="code">Ci</code></dt> <dd> +<p>const_int </p> </dd> <dt><code class="code">C0</code></dt> <dd> +<p>const_int 0 </p> </dd> <dt><code class="code">Cj</code></dt> <dd> +<p>Range of signed numbers that don’t fit in 16 bits </p> </dd> <dt><code class="code">Cmvq</code></dt> <dd> +<p>Integers valid for mvq </p> </dd> <dt><code class="code">Capsw</code></dt> <dd> +<p>Integers valid for a moveq followed by a swap </p> </dd> <dt><code class="code">Cmvz</code></dt> <dd> +<p>Integers valid for mvz </p> </dd> <dt><code class="code">Cmvs</code></dt> <dd> +<p>Integers valid for mvs </p> </dd> <dt><code class="code">Ap</code></dt> <dd> +<p>push_operand </p> </dd> <dt><code class="code">Ac</code></dt> <dd> +<p>Non-register operands allowed in clr </p> </dd> </dl> </dd> <dt>Moxie—<samp class="file">config/moxie/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">A</code></dt> <dd> +<p>An absolute address </p> </dd> <dt><code class="code">B</code></dt> <dd> +<p>An offset address </p> </dd> <dt><code class="code">W</code></dt> <dd> +<p>A register indirect memory operand </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>A constant in the range of 0 to 255. </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>A constant in the range of 0 to −255. </p> </dd> </dl> </dd> <dt>MSP430–<samp class="file">config/msp430/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">R12</code></dt> <dd> +<p>Register R12. </p> </dd> <dt><code class="code">R13</code></dt> <dd> +<p>Register R13. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Integer constant 1. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Integer constant -1^20..1^19. </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Integer constant 1-4. </p> </dd> <dt><code class="code">Ya</code></dt> <dd> +<p>Memory references which do not require an extended MOVX instruction. </p> </dd> <dt><code class="code">Yl</code></dt> <dd> +<p>Memory reference, labels only. </p> </dd> <dt><code class="code">Ys</code></dt> <dd> +<p>Memory reference, stack only. </p> </dd> </dl> </dd> <dt>NDS32—<samp class="file">config/nds32/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">w</code></dt> <dd><p>LOW register class $r0 to $r7 constraint for V3/V3M ISA. </p></dd> <dt><code class="code">l</code></dt> <dd><p>LOW register class $r0 to $r7. </p></dd> <dt><code class="code">d</code></dt> <dd><p>MIDDLE register class $r0 to $r11, $r16 to $r19. </p></dd> <dt><code class="code">h</code></dt> <dd><p>HIGH register class $r12 to $r14, $r20 to $r31. </p></dd> <dt><code class="code">t</code></dt> <dd><p>Temporary assist register $ta (i.e. $r15). </p></dd> <dt><code class="code">k</code></dt> <dd><p>Stack register $sp. </p></dd> <dt><code class="code">Iu03</code></dt> <dd><p>Unsigned immediate 3-bit value. </p></dd> <dt><code class="code">In03</code></dt> <dd><p>Negative immediate 3-bit value in the range of −7–0. </p></dd> <dt><code class="code">Iu04</code></dt> <dd><p>Unsigned immediate 4-bit value. </p></dd> <dt><code class="code">Is05</code></dt> <dd><p>Signed immediate 5-bit value. </p></dd> <dt><code class="code">Iu05</code></dt> <dd><p>Unsigned immediate 5-bit value. </p></dd> <dt><code class="code">In05</code></dt> <dd><p>Negative immediate 5-bit value in the range of −31–0. </p></dd> <dt><code class="code">Ip05</code></dt> <dd><p>Unsigned immediate 5-bit value for movpi45 instruction with range 16–47. </p></dd> <dt><code class="code">Iu06</code></dt> <dd><p>Unsigned immediate 6-bit value constraint for addri36.sp instruction. </p></dd> <dt><code class="code">Iu08</code></dt> <dd><p>Unsigned immediate 8-bit value. </p></dd> <dt><code class="code">Iu09</code></dt> <dd><p>Unsigned immediate 9-bit value. </p></dd> <dt><code class="code">Is10</code></dt> <dd><p>Signed immediate 10-bit value. </p></dd> <dt><code class="code">Is11</code></dt> <dd><p>Signed immediate 11-bit value. </p></dd> <dt><code class="code">Is15</code></dt> <dd><p>Signed immediate 15-bit value. </p></dd> <dt><code class="code">Iu15</code></dt> <dd><p>Unsigned immediate 15-bit value. </p></dd> <dt><code class="code">Ic15</code></dt> <dd><p>A constant which is not in the range of imm15u but ok for bclr instruction. </p></dd> <dt><code class="code">Ie15</code></dt> <dd><p>A constant which is not in the range of imm15u but ok for bset instruction. </p></dd> <dt><code class="code">It15</code></dt> <dd><p>A constant which is not in the range of imm15u but ok for btgl instruction. </p></dd> <dt><code class="code">Ii15</code></dt> <dd><p>A constant whose compliment value is in the range of imm15u and ok for bitci instruction. </p></dd> <dt><code class="code">Is16</code></dt> <dd><p>Signed immediate 16-bit value. </p></dd> <dt><code class="code">Is17</code></dt> <dd><p>Signed immediate 17-bit value. </p></dd> <dt><code class="code">Is19</code></dt> <dd><p>Signed immediate 19-bit value. </p></dd> <dt><code class="code">Is20</code></dt> <dd><p>Signed immediate 20-bit value. </p></dd> <dt><code class="code">Ihig</code></dt> <dd><p>The immediate value that can be simply set high 20-bit. </p></dd> <dt><code class="code">Izeb</code></dt> <dd><p>The immediate value 0xff. </p></dd> <dt><code class="code">Izeh</code></dt> <dd><p>The immediate value 0xffff. </p></dd> <dt><code class="code">Ixls</code></dt> <dd><p>The immediate value 0x01. </p></dd> <dt><code class="code">Ix11</code></dt> <dd><p>The immediate value 0x7ff. </p></dd> <dt><code class="code">Ibms</code></dt> <dd><p>The immediate value with power of 2. </p></dd> <dt><code class="code">Ifex</code></dt> <dd><p>The immediate value with power of 2 minus 1. </p></dd> <dt><code class="code">U33</code></dt> <dd><p>Memory constraint for 333 format. </p></dd> <dt><code class="code">U45</code></dt> <dd><p>Memory constraint for 45 format. </p></dd> <dt><code class="code">U37</code></dt> <dd><p>Memory constraint for 37 format. </p></dd> </dl> </dd> <dt>Nios II family—<samp class="file">config/nios2/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">I</code></dt> <dd> +<p>Integer that is valid as an immediate operand in an instruction taking a signed 16-bit number. Range −32768 to 32767. </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Integer that is valid as an immediate operand in an instruction taking an unsigned 16-bit number. Range 0 to 65535. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Integer that is valid as an immediate operand in an instruction taking only the upper 16-bits of a 32-bit number. Range 32-bit numbers with the lower 16-bits being 0. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Integer that is valid as an immediate operand for a shift instruction. Range 0 to 31. </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Integer that is valid as an immediate operand for only the value 0. Can be used in conjunction with the format modifier <code class="code">z</code> to use <code class="code">r0</code> instead of <code class="code">0</code> in the assembly output. </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>Integer that is valid as an immediate operand for a custom instruction opcode. Range 0 to 255. </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>An immediate operand for R2 andchi/andci instructions. </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>Matches immediates which are addresses in the small data section and therefore can be added to <code class="code">gp</code> as a 16-bit immediate to re-create their 32-bit value. </p> </dd> <dt><code class="code">U</code></dt> <dd> +<p>Matches constants suitable as an operand for the rdprs and cache instructions. </p> </dd> <dt><code class="code">v</code></dt> <dd> +<p>A memory operand suitable for Nios II R2 load/store exclusive instructions. </p> </dd> <dt><code class="code">w</code></dt> <dd> +<p>A memory operand suitable for load/store IO and cache instructions. </p> </dd> </dl> </dd> <dt>OpenRISC—<samp class="file">config/or1k/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">I</code></dt> <dd> +<p>Integer that is valid as an immediate operand in an instruction taking a signed 16-bit number. Range −32768 to 32767. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Integer that is valid as an immediate operand in an instruction taking an unsigned 16-bit number. Range 0 to 65535. </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Signed 16-bit constant shifted left 16 bits. (Used with <code class="code">l.movhi</code>) </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>Zero </p> </dd> </dl> </dd> <dt>PDP-11—<samp class="file">config/pdp11/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>Floating point registers AC0 through AC3. These can be loaded from/to memory with a single instruction. </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>Odd numbered general registers (R1, R3, R5). These are used for 16-bit multiply operations. </p> </dd> <dt><code class="code">D</code></dt> <dd> +<p>A memory reference that is encoded within the opcode, but not auto-increment or auto-decrement. </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>Any of the floating point registers (AC0 through AC5). </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>Floating point constant 0. </p> </dd> <dt><code class="code">h</code></dt> <dd> +<p>Floating point registers AC4 and AC5. These cannot be loaded from/to memory with a single instruction. </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>An integer constant that fits in 16 bits. </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>An integer constant whose low order 16 bits are zero. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>An integer constant that does not meet the constraints for codes ‘<samp class="samp">I</samp>’ or ‘<samp class="samp">J</samp>’. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>The integer constant 1. </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>The integer constant −1. </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>The integer constant 0. </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>Integer constants 0 through 3; shifts by these amounts are handled as multiple single-bit shifts rather than a single variable-length shift. </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>A memory reference which requires an additional word (address or offset) after the opcode. </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>A memory reference that is encoded within the opcode. </p> </dd> </dl> </dd> <dt>PowerPC and IBM RS6000—<samp class="file">config/rs6000/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">r</code></dt> <dd> +<p>A general purpose register (GPR), <code class="code">r0</code>…<code class="code">r31</code>. </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>A base register. Like <code class="code">r</code>, but <code class="code">r0</code> is not allowed, so <code class="code">r1</code>…<code class="code">r31</code>. </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>A floating point register (FPR), <code class="code">f0</code>…<code class="code">f31</code>. </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>A floating point register. This is the same as <code class="code">f</code> nowadays; historically <code class="code">f</code> was for single-precision and <code class="code">d</code> was for double-precision floating point. </p> </dd> <dt><code class="code">v</code></dt> <dd> +<p>An Altivec vector register (VR), <code class="code">v0</code>…<code class="code">v31</code>. </p> </dd> <dt><code class="code">wa</code></dt> <dd> +<p>A VSX register (VSR), <code class="code">vs0</code>…<code class="code">vs63</code>. This is either an FPR (<code class="code">vs0</code>…<code class="code">vs31</code> are <code class="code">f0</code>…<code class="code">f31</code>) or a VR (<code class="code">vs32</code>…<code class="code">vs63</code> are <code class="code">v0</code>…<code class="code">v31</code>). </p> <p>When using <code class="code">wa</code>, you should use the <code class="code">%x</code> output modifier, so that the correct register number is printed. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("xvadddp %x0,%x1,%x2" + : "=wa" (v1) + : "wa" (v2), "wa" (v3));</pre> +</div> <p>You should not use <code class="code">%x</code> for <code class="code">v</code> operands: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("xsaddqp %0,%1,%2" + : "=v" (v1) + : "v" (v2), "v" (v3));</pre> +</div> </dd> <dt><code class="code">c</code></dt> <dd> +<p>The count register, <code class="code">ctr</code>. </p> </dd> <dt><code class="code">l</code></dt> <dd> +<p>The link register, <code class="code">lr</code>. </p> </dd> <dt><code class="code">x</code></dt> <dd> +<p>Condition register field 0, <code class="code">cr0</code>. </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>Any condition register field, <code class="code">cr0</code>…<code class="code">cr7</code>. </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>A signed 16-bit constant. </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>An unsigned 16-bit constant shifted left 16 bits (use <code class="code">L</code> instead for <code class="code">SImode</code> constants). </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>An unsigned 16-bit constant. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>A signed 16-bit constant shifted left 16 bits. </p> </dd> <dt><code class="code">eI</code></dt> <dd> +<p>A signed 34-bit integer constant if prefixed instructions are supported. </p> </dd> <dt><code class="code">eP</code></dt> <dd> +<p>A scalar floating point constant or a vector constant that can be loaded to a VSX register with one prefixed instruction. </p> </dd> <dt><code class="code">eQ</code></dt> <dd> +<p>An IEEE 128-bit constant that can be loaded into a VSX register with the <code class="code">lxvkq</code> instruction. </p> </dd> <dt><code class="code">m</code></dt> <dd> +<p>A memory operand. Normally, <code class="code">m</code> does not allow addresses that update the base register. If the <code class="code"><</code> or <code class="code">></code> constraint is also used, they are allowed and therefore on PowerPC targets in that case it is only safe to use <code class="code">m<></code> in an <code class="code">asm</code> statement if that <code class="code">asm</code> statement accesses the operand exactly once. The <code class="code">asm</code> statement must also use <code class="code">%U<var class="var"><opno></var></code> as a placeholder for the “update” flag in the corresponding load or store instruction. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("st%U0 %1,%0" : "=m<>" (mem) : "r" (val));</pre> +</div> <p>is correct but: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm ("st %1,%0" : "=m<>" (mem) : "r" (val));</pre> +</div> <p>is not. </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>A memory operand addressed by just a base register. </p> </dd> <dt><code class="code">Z</code></dt> <dd> +<p>A memory operand accessed with indexed or indirect addressing. </p> </dd> <dt><code class="code">a</code></dt> <dd> +<p>An indexed or indirect address. </p> </dd> </dl> </dd> <dt>PRU—<samp class="file">config/pru/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">I</code></dt> <dd> +<p>An unsigned 8-bit integer constant. </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>An unsigned 16-bit integer constant. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>An unsigned 5-bit integer constant (for shift counts). </p> </dd> <dt><code class="code">T</code></dt> <dd> +<p>A text segment (program memory) constant label. </p> </dd> <dt><code class="code">Z</code></dt> <dd> +<p>Integer constant zero. </p> </dd> </dl> </dd> <dt>RL78—<samp class="file">config/rl78/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">Int3</code></dt> <dd><p>An integer constant in the range 1 … 7. </p></dd> <dt><code class="code">Int8</code></dt> <dd><p>An integer constant in the range 0 … 255. </p></dd> <dt><code class="code">J</code></dt> <dd><p>An integer constant in the range −255 … 0 </p></dd> <dt><code class="code">K</code></dt> <dd><p>The integer constant 1. </p></dd> <dt><code class="code">L</code></dt> <dd><p>The integer constant -1. </p></dd> <dt><code class="code">M</code></dt> <dd><p>The integer constant 0. </p></dd> <dt><code class="code">N</code></dt> <dd><p>The integer constant 2. </p></dd> <dt><code class="code">O</code></dt> <dd><p>The integer constant -2. </p></dd> <dt><code class="code">P</code></dt> <dd><p>An integer constant in the range 1 … 15. </p></dd> <dt><code class="code">Qbi</code></dt> <dd><p>The built-in compare types–eq, ne, gtu, ltu, geu, and leu. </p></dd> <dt><code class="code">Qsc</code></dt> <dd><p>The synthetic compare types–gt, lt, ge, and le. </p></dd> <dt><code class="code">Wab</code></dt> <dd><p>A memory reference with an absolute address. </p></dd> <dt><code class="code">Wbc</code></dt> <dd><p>A memory reference using <code class="code">BC</code> as a base register, with an optional offset. </p></dd> <dt><code class="code">Wca</code></dt> <dd><p>A memory reference using <code class="code">AX</code>, <code class="code">BC</code>, <code class="code">DE</code>, or <code class="code">HL</code> for the address, for calls. </p></dd> <dt><code class="code">Wcv</code></dt> <dd><p>A memory reference using any 16-bit register pair for the address, for calls. </p></dd> <dt><code class="code">Wd2</code></dt> <dd><p>A memory reference using <code class="code">DE</code> as a base register, with an optional offset. </p></dd> <dt><code class="code">Wde</code></dt> <dd><p>A memory reference using <code class="code">DE</code> as a base register, without any offset. </p></dd> <dt><code class="code">Wfr</code></dt> <dd><p>Any memory reference to an address in the far address space. </p></dd> <dt><code class="code">Wh1</code></dt> <dd><p>A memory reference using <code class="code">HL</code> as a base register, with an optional one-byte offset. </p></dd> <dt><code class="code">Whb</code></dt> <dd><p>A memory reference using <code class="code">HL</code> as a base register, with <code class="code">B</code> or <code class="code">C</code> as the index register. </p></dd> <dt><code class="code">Whl</code></dt> <dd><p>A memory reference using <code class="code">HL</code> as a base register, without any offset. </p></dd> <dt><code class="code">Ws1</code></dt> <dd><p>A memory reference using <code class="code">SP</code> as a base register, with an optional one-byte offset. </p></dd> <dt><code class="code">Y</code></dt> <dd><p>Any memory reference to an address in the near address space. </p></dd> <dt><code class="code">A</code></dt> <dd><p>The <code class="code">AX</code> register. </p></dd> <dt><code class="code">B</code></dt> <dd><p>The <code class="code">BC</code> register. </p></dd> <dt><code class="code">D</code></dt> <dd><p>The <code class="code">DE</code> register. </p></dd> <dt><code class="code">R</code></dt> <dd><p><code class="code">A</code> through <code class="code">L</code> registers. </p></dd> <dt><code class="code">S</code></dt> <dd><p>The <code class="code">SP</code> register. </p></dd> <dt><code class="code">T</code></dt> <dd><p>The <code class="code">HL</code> register. </p></dd> <dt><code class="code">Z08W</code></dt> <dd><p>The 16-bit <code class="code">R8</code> register. </p></dd> <dt><code class="code">Z10W</code></dt> <dd><p>The 16-bit <code class="code">R10</code> register. </p></dd> <dt><code class="code">Zint</code></dt> <dd><p>The registers reserved for interrupts (<code class="code">R24</code> to <code class="code">R31</code>). </p></dd> <dt><code class="code">a</code></dt> <dd><p>The <code class="code">A</code> register. </p></dd> <dt><code class="code">b</code></dt> <dd><p>The <code class="code">B</code> register. </p></dd> <dt><code class="code">c</code></dt> <dd><p>The <code class="code">C</code> register. </p></dd> <dt><code class="code">d</code></dt> <dd><p>The <code class="code">D</code> register. </p></dd> <dt><code class="code">e</code></dt> <dd><p>The <code class="code">E</code> register. </p></dd> <dt><code class="code">h</code></dt> <dd><p>The <code class="code">H</code> register. </p></dd> <dt><code class="code">l</code></dt> <dd><p>The <code class="code">L</code> register. </p></dd> <dt><code class="code">v</code></dt> <dd><p>The virtual registers. </p></dd> <dt><code class="code">w</code></dt> <dd><p>The <code class="code">PSW</code> register. </p></dd> <dt><code class="code">x</code></dt> <dd> +<p>The <code class="code">X</code> register. </p> </dd> </dl> </dd> <dt>RISC-V—<samp class="file">config/riscv/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">f</code></dt> <dd> +<p>A floating-point register (if available). </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>An I-type 12-bit signed immediate. </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Integer zero. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>A 5-bit unsigned immediate for CSR access instructions. </p> </dd> <dt><code class="code">A</code></dt> <dd> +<p>An address that is held in a general-purpose register. </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>A constraint that matches an absolute symbolic address. </p> </dd> </dl> </dd> <dt>RX—<samp class="file">config/rx/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">Q</code></dt> <dd> +<p>An address which does not involve register indirect addressing or pre/post increment/decrement addressing. </p> </dd> <dt><code class="code">Symbol</code></dt> <dd> +<p>A symbol reference. </p> </dd> <dt><code class="code">Int08</code></dt> <dd> +<p>A constant in the range −256 to 255, inclusive. </p> </dd> <dt><code class="code">Sint08</code></dt> <dd> +<p>A constant in the range −128 to 127, inclusive. </p> </dd> <dt><code class="code">Sint16</code></dt> <dd> +<p>A constant in the range −32768 to 32767, inclusive. </p> </dd> <dt><code class="code">Sint24</code></dt> <dd> +<p>A constant in the range −8388608 to 8388607, inclusive. </p> </dd> <dt><code class="code">Uint04</code></dt> <dd> +<p>A constant in the range 0 to 15, inclusive. </p> </dd> </dl> </dd> <dt>S/390 and zSeries—<samp class="file">config/s390/s390.h</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>Address register (general purpose register except r0) </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>Condition code register </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>Data register (arbitrary general purpose register) </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>Floating-point register </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>Unsigned 8-bit constant (0–255) </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Unsigned 12-bit constant (0–4095) </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Signed 16-bit constant (−32768–32767) </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Value appropriate as displacement. </p> +<dl class="table"> <dt><code class="code">(0..4095)</code></dt> <dd><p>for short displacement </p></dd> <dt><code class="code">(−524288..524287)</code></dt> <dd><p>for long displacement </p></dd> </dl> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Constant integer with a value of 0x7fffffff. </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>Multiple letter constraint followed by 4 parameter letters. </p> +<dl class="table"> <dt><code class="code">0..9:</code></dt> <dd><p>number of the part counting from most to least significant </p></dd> <dt><code class="code">H,Q:</code></dt> <dd><p>mode of the part </p></dd> <dt><code class="code">D,S,H:</code></dt> <dd><p>mode of the containing operand </p></dd> <dt><code class="code">0,F:</code></dt> <dd><p>value of the other parts (F—all bits set) </p></dd> </dl> <p>The constraint matches if the specified part of a constant has a value different from its other parts. </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>Memory reference without index register and with short displacement. </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>Memory reference with index register and short displacement. </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>Memory reference without index register but with long displacement. </p> </dd> <dt><code class="code">T</code></dt> <dd> +<p>Memory reference with index register and long displacement. </p> </dd> <dt><code class="code">U</code></dt> <dd> +<p>Pointer with short displacement. </p> </dd> <dt><code class="code">W</code></dt> <dd> +<p>Pointer with long displacement. </p> </dd> <dt><code class="code">Y</code></dt> <dd> +<p>Shift count operand. </p> </dd> </dl> </dd> <dt>SPARC—<samp class="file">config/sparc/sparc.h</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">f</code></dt> <dd> +<p>Floating-point register on the SPARC-V8 architecture and lower floating-point register on the SPARC-V9 architecture. </p> </dd> <dt><code class="code">e</code></dt> <dd> +<p>Floating-point register. It is equivalent to ‘<samp class="samp">f</samp>’ on the SPARC-V8 architecture and contains both lower and upper floating-point registers on the SPARC-V9 architecture. </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>Floating-point condition code register. </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>Lower floating-point register. It is only valid on the SPARC-V9 architecture when the Visual Instruction Set is available. </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>Floating-point register. It is only valid on the SPARC-V9 architecture when the Visual Instruction Set is available. </p> </dd> <dt><code class="code">h</code></dt> <dd> +<p>64-bit global or out register for the SPARC-V8+ architecture. </p> </dd> <dt><code class="code">C</code></dt> <dd> +<p>The constant all-ones, for floating-point. </p> </dd> <dt><code class="code">A</code></dt> <dd> +<p>Signed 5-bit constant </p> </dd> <dt><code class="code">D</code></dt> <dd> +<p>A vector constant </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>Signed 13-bit constant </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Zero </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>32-bit constant with the low 12 bits clear (a constant that can be loaded with the <code class="code">sethi</code> instruction) </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>A constant in the range supported by <code class="code">movcc</code> instructions (11-bit signed immediate) </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>A constant in the range supported by <code class="code">movrcc</code> instructions (10-bit signed immediate) </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>Same as ‘<samp class="samp">K</samp>’, except that it verifies that bits that are not in the lower 32-bit range are all zero. Must be used instead of ‘<samp class="samp">K</samp>’ for modes wider than <code class="code">SImode</code> </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>The constant 4096 </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>Floating-point zero </p> </dd> <dt><code class="code">H</code></dt> <dd> +<p>Signed 13-bit constant, sign-extended to 32 or 64 bits </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>The constant -1 </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>Floating-point constant whose integral representation can be moved into an integer register using a single sethi instruction </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>Floating-point constant whose integral representation can be moved into an integer register using a single mov instruction </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>Floating-point constant whose integral representation can be moved into an integer register using a high/lo_sum instruction sequence </p> </dd> <dt><code class="code">T</code></dt> <dd> +<p>Memory address aligned to an 8-byte boundary </p> </dd> <dt><code class="code">U</code></dt> <dd> +<p>Even register </p> </dd> <dt><code class="code">W</code></dt> <dd> +<p>Memory address for ‘<samp class="samp">e</samp>’ constraint registers </p> </dd> <dt><code class="code">w</code></dt> <dd> +<p>Memory address with only a base register </p> </dd> <dt><code class="code">Y</code></dt> <dd> +<p>Vector zero </p> </dd> </dl> </dd> <dt>TI C6X family—<samp class="file">config/c6x/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>Register file A (A0–A31). </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>Register file B (B0–B31). </p> </dd> <dt><code class="code">A</code></dt> <dd> +<p>Predicate registers in register file A (A0–A2 on C64X and higher, A1 and A2 otherwise). </p> </dd> <dt><code class="code">B</code></dt> <dd> +<p>Predicate registers in register file B (B0–B2). </p> </dd> <dt><code class="code">C</code></dt> <dd> +<p>A call-used register in register file B (B0–B9, B16–B31). </p> </dd> <dt><code class="code">Da</code></dt> <dd> +<p>Register file A, excluding predicate registers (A3–A31, plus A0 if not C64X or higher). </p> </dd> <dt><code class="code">Db</code></dt> <dd> +<p>Register file B, excluding predicate registers (B3–B31). </p> </dd> <dt><code class="code">Iu4</code></dt> <dd> +<p>Integer constant in the range 0 … 15. </p> </dd> <dt><code class="code">Iu5</code></dt> <dd> +<p>Integer constant in the range 0 … 31. </p> </dd> <dt><code class="code">In5</code></dt> <dd> +<p>Integer constant in the range −31 … 0. </p> </dd> <dt><code class="code">Is5</code></dt> <dd> +<p>Integer constant in the range −16 … 15. </p> </dd> <dt><code class="code">I5x</code></dt> <dd> +<p>Integer constant that can be the operand of an ADDA or a SUBA insn. </p> </dd> <dt><code class="code">IuB</code></dt> <dd> +<p>Integer constant in the range 0 … 65535. </p> </dd> <dt><code class="code">IsB</code></dt> <dd> +<p>Integer constant in the range −32768 … 32767. </p> </dd> <dt><code class="code">IsC</code></dt> <dd> +<p>Integer constant in the range <em class="math">-2^{20}</em> … <em class="math">2^{20} - 1</em>. </p> </dd> <dt><code class="code">Jc</code></dt> <dd> +<p>Integer constant that is a valid mask for the clr instruction. </p> </dd> <dt><code class="code">Js</code></dt> <dd> +<p>Integer constant that is a valid mask for the set instruction. </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>Memory location with A base register. </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>Memory location with B base register. </p> </dd> <dt><code class="code">Z</code></dt> <dd> +<p>Register B14 (aka DP). </p> </dd> </dl> </dd> <dt>Visium—<samp class="file">config/visium/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">b</code></dt> <dd> +<p>EAM register <code class="code">mdb</code> </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>EAM register <code class="code">mdc</code> </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>Floating point register </p> </dd> <dt><code class="code">l</code></dt> <dd> +<p>General register, but not <code class="code">r29</code>, <code class="code">r30</code> and <code class="code">r31</code> </p> </dd> <dt><code class="code">t</code></dt> <dd> +<p>Register <code class="code">r1</code> </p> </dd> <dt><code class="code">u</code></dt> <dd> +<p>Register <code class="code">r2</code> </p> </dd> <dt><code class="code">v</code></dt> <dd> +<p>Register <code class="code">r3</code> </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>Floating-point constant 0.0 </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Integer constant in the range 0 .. 65535 (16-bit immediate) </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Integer constant in the range 1 .. 31 (5-bit immediate) </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Integer constant in the range −65535 .. −1 (16-bit negative immediate) </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>Integer constant −1 </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>Integer constant 0 </p> </dd> <dt><code class="code">P</code></dt> <dd><p>Integer constant 32 </p></dd> </dl> </dd> <dt>x86 family—<samp class="file">config/i386/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">R</code></dt> <dd> +<p>Legacy register—the eight integer registers available on all i386 processors (<code class="code">a</code>, <code class="code">b</code>, <code class="code">c</code>, <code class="code">d</code>, <code class="code">si</code>, <code class="code">di</code>, <code class="code">bp</code>, <code class="code">sp</code>). </p> </dd> <dt><code class="code">q</code></dt> <dd> +<p>Any register accessible as <code class="code"><var class="var">r</var>l</code>. In 32-bit mode, <code class="code">a</code>, <code class="code">b</code>, <code class="code">c</code>, and <code class="code">d</code>; in 64-bit mode, any integer register. </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>Any register accessible as <code class="code"><var class="var">r</var>h</code>: <code class="code">a</code>, <code class="code">b</code>, <code class="code">c</code>, and <code class="code">d</code>. </p> </dd> <dt><code class="code">a</code></dt> <dd> +<p>The <code class="code">a</code> register. </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>The <code class="code">b</code> register. </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>The <code class="code">c</code> register. </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>The <code class="code">d</code> register. </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>The <code class="code">si</code> register. </p> </dd> <dt><code class="code">D</code></dt> <dd> +<p>The <code class="code">di</code> register. </p> </dd> <dt><code class="code">A</code></dt> <dd> +<p>The <code class="code">a</code> and <code class="code">d</code> registers. This class is used for instructions that return double word results in the <code class="code">ax:dx</code> register pair. Single word values will be allocated either in <code class="code">ax</code> or <code class="code">dx</code>. For example on i386 the following implements <code class="code">rdtsc</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned long long rdtsc (void) +{ + unsigned long long tick; + __asm__ __volatile__("rdtsc":"=A"(tick)); + return tick; +}</pre> +</div> <p>This is not correct on x86-64 as it would allocate tick in either <code class="code">ax</code> or <code class="code">dx</code>. You have to use the following variant instead: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned long long rdtsc (void) +{ + unsigned int tickl, tickh; + __asm__ __volatile__("rdtsc":"=a"(tickl),"=d"(tickh)); + return ((unsigned long long)tickh << 32)|tickl; +}</pre> +</div> </dd> <dt><code class="code">U</code></dt> <dd> +<p>The call-clobbered integer registers. </p> </dd> <dt><code class="code">f</code></dt> <dd> +<p>Any 80387 floating-point (stack) register. </p> </dd> <dt><code class="code">t</code></dt> <dd> +<p>Top of 80387 floating-point stack (<code class="code">%st(0)</code>). </p> </dd> <dt><code class="code">u</code></dt> <dd> +<p>Second from top of 80387 floating-point stack (<code class="code">%st(1)</code>). </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>Any MMX register. </p> </dd> <dt><code class="code">x</code></dt> <dd> +<p>Any SSE register. </p> </dd> <dt><code class="code">v</code></dt> <dd> +<p>Any EVEX encodable SSE register (<code class="code">%xmm0-%xmm31</code>). </p> </dd> <dt><code class="code">Yz</code></dt> <dd> +<p>First SSE register (<code class="code">%xmm0</code>). </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>Integer constant in the range 0 … 31, for 32-bit shifts. </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Integer constant in the range 0 … 63, for 64-bit shifts. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Signed 8-bit integer constant. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p><code class="code">0xFF</code> or <code class="code">0xFFFF</code>, for andsi as a zero-extending move. </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>0, 1, 2, or 3 (shifts for the <code class="code">lea</code> instruction). </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>Unsigned 8-bit integer constant (for <code class="code">in</code> and <code class="code">out</code> instructions). </p> </dd> <dt><code class="code">G</code></dt> <dd> +<p>Standard 80387 floating point constant. </p> </dd> <dt><code class="code">C</code></dt> <dd> +<p>SSE constant zero operand. </p> </dd> <dt><code class="code">e</code></dt> <dd> +<p>32-bit signed integer constant, or a symbolic reference known to fit that range (for immediate operands in sign-extending x86-64 instructions). </p> </dd> <dt><code class="code">We</code></dt> <dd> +<p>32-bit signed integer constant, or a symbolic reference known to fit that range (for sign-extending conversion operations that require non-<code class="code">VOIDmode</code> immediate operands). </p> </dd> <dt><code class="code">Wz</code></dt> <dd> +<p>32-bit unsigned integer constant, or a symbolic reference known to fit that range (for zero-extending conversion operations that require non-<code class="code">VOIDmode</code> immediate operands). </p> </dd> <dt><code class="code">Wd</code></dt> <dd> +<p>128-bit integer constant where both the high and low 64-bit word satisfy the <code class="code">e</code> constraint. </p> </dd> <dt><code class="code">Z</code></dt> <dd> +<p>32-bit unsigned integer constant, or a symbolic reference known to fit that range (for immediate operands in zero-extending x86-64 instructions). </p> </dd> <dt><code class="code">Tv</code></dt> <dd> +<p>VSIB address operand. </p> </dd> <dt><code class="code">Ts</code></dt> <dd> +<p>Address operand without segment register. </p> </dd> </dl> </dd> <dt>Xstormy16—<samp class="file">config/stormy16/stormy16.h</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>Register r0. </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>Register r1. </p> </dd> <dt><code class="code">c</code></dt> <dd> +<p>Register r2. </p> </dd> <dt><code class="code">d</code></dt> <dd> +<p>Register r8. </p> </dd> <dt><code class="code">e</code></dt> <dd> +<p>Registers r0 through r7. </p> </dd> <dt><code class="code">t</code></dt> <dd> +<p>Registers r0 and r1. </p> </dd> <dt><code class="code">y</code></dt> <dd> +<p>The carry register. </p> </dd> <dt><code class="code">z</code></dt> <dd> +<p>Registers r8 and r9. </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>A constant between 0 and 3 inclusive. </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>A constant that has exactly one bit set. </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>A constant that has exactly one bit clear. </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>A constant between 0 and 255 inclusive. </p> </dd> <dt><code class="code">M</code></dt> <dd> +<p>A constant between −255 and 0 inclusive. </p> </dd> <dt><code class="code">N</code></dt> <dd> +<p>A constant between −3 and 0 inclusive. </p> </dd> <dt><code class="code">O</code></dt> <dd> +<p>A constant between 1 and 4 inclusive. </p> </dd> <dt><code class="code">P</code></dt> <dd> +<p>A constant between −4 and −1 inclusive. </p> </dd> <dt><code class="code">Q</code></dt> <dd> +<p>A memory reference that is a stack push. </p> </dd> <dt><code class="code">R</code></dt> <dd> +<p>A memory reference that is a stack pop. </p> </dd> <dt><code class="code">S</code></dt> <dd> +<p>A memory reference that refers to a constant address of known value. </p> </dd> <dt><code class="code">T</code></dt> <dd> +<p>The register indicated by Rx (not implemented yet). </p> </dd> <dt><code class="code">U</code></dt> <dd> +<p>A constant that is not between 2 and 15 inclusive. </p> </dd> <dt><code class="code">Z</code></dt> <dd> +<p>The constant 0. </p> </dd> </dl> </dd> <dt>Xtensa—<samp class="file">config/xtensa/constraints.md</samp> +</dt> <dd> +<dl class="table"> <dt><code class="code">a</code></dt> <dd> +<p>General-purpose 32-bit register </p> </dd> <dt><code class="code">b</code></dt> <dd> +<p>One-bit boolean register </p> </dd> <dt><code class="code">A</code></dt> <dd> +<p>MAC16 40-bit accumulator register </p> </dd> <dt><code class="code">I</code></dt> <dd> +<p>Signed 12-bit integer constant, for use in MOVI instructions </p> </dd> <dt><code class="code">J</code></dt> <dd> +<p>Signed 8-bit integer constant, for use in ADDI instructions </p> </dd> <dt><code class="code">K</code></dt> <dd> +<p>Integer constant valid for BccI instructions </p> </dd> <dt><code class="code">L</code></dt> <dd> +<p>Unsigned constant valid for BccUI instructions </p> </dd> </dl> </dd> </dl> </div> <div class="nav-panel"> <p> Previous: <a href="modifiers">Constraint Modifier Characters</a>, Up: <a href="constraints">Constraints for <code class="code">asm</code> Operands</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Machine-Constraints.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Machine-Constraints.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mcore-function-attributes.html b/devdocs/gcc~13/mcore-function-attributes.html new file mode 100644 index 00000000..3da457a2 --- /dev/null +++ b/devdocs/gcc~13/mcore-function-attributes.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="MCORE-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="microblaze-function-attributes" accesskey="n" rel="next">MicroBlaze Function Attributes</a>, Previous: <a href="m68k-function-attributes" accesskey="p" rel="prev">m68k Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MCORE-Function-Attributes-1"><span>6.33.16 MCORE Function Attributes<a class="copiable-link" href="#MCORE-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the MCORE back end: </p> <dl class="table"> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-MCORE"> ¶</a></span> +</dt> <dd><p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MCORE-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MCORE-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mcore-options.html b/devdocs/gcc~13/mcore-options.html new file mode 100644 index 00000000..d154f5a3 --- /dev/null +++ b/devdocs/gcc~13/mcore-options.html @@ -0,0 +1,39 @@ +<div class="subsection-level-extent" id="MCore-Options"> <div class="nav-panel"> <p> Next: <a href="microblaze-options" accesskey="n" rel="next">MicroBlaze Options</a>, Previous: <a href="m680x0-options" accesskey="p" rel="prev">M680x0 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MCore-Options-1"><span>3.19.26 MCore Options<a class="copiable-link" href="#MCore-Options-1"> ¶</a></span></h1> <p>These are the ‘<samp class="samp">-m</samp>’ options defined for the Motorola M*Core processors. </p> <dl class="table"> <dt> + <span><code class="code">-mhardlit</code><a class="copiable-link" href="#index-mhardlit"> ¶</a></span> +</dt> <dt><code class="code">-mno-hardlit</code></dt> <dd> +<p>Inline constants into the code stream if it can be done in two instructions or less. </p> </dd> <dt> + <span><code class="code">-mdiv</code><a class="copiable-link" href="#index-mdiv-2"> ¶</a></span> +</dt> <dt><code class="code">-mno-div</code></dt> <dd> +<p>Use the divide instruction. (Enabled by default). </p> </dd> <dt> + <span><code class="code">-mrelax-immediate</code><a class="copiable-link" href="#index-mrelax-immediate"> ¶</a></span> +</dt> <dt><code class="code">-mno-relax-immediate</code></dt> <dd> +<p>Allow arbitrary-sized immediates in bit operations. </p> </dd> <dt> + <span><code class="code">-mwide-bitfields</code><a class="copiable-link" href="#index-mwide-bitfields"> ¶</a></span> +</dt> <dt><code class="code">-mno-wide-bitfields</code></dt> <dd> +<p>Always treat bit-fields as <code class="code">int</code>-sized. </p> </dd> <dt> + <span><code class="code">-m4byte-functions</code><a class="copiable-link" href="#index-m4byte-functions"> ¶</a></span> +</dt> <dt><code class="code">-mno-4byte-functions</code></dt> <dd> +<p>Force all functions to be aligned to a 4-byte boundary. </p> </dd> <dt> + <span><code class="code">-mcallgraph-data</code><a class="copiable-link" href="#index-mcallgraph-data"> ¶</a></span> +</dt> <dt><code class="code">-mno-callgraph-data</code></dt> <dd> +<p>Emit callgraph information. </p> </dd> <dt> + <span><code class="code">-mslow-bytes</code><a class="copiable-link" href="#index-mslow-bytes"> ¶</a></span> +</dt> <dt><code class="code">-mno-slow-bytes</code></dt> <dd> +<p>Prefer word access when reading byte quantities. </p> </dd> <dt> + <span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian-7"> ¶</a></span> +</dt> <dt><code class="code">-mbig-endian</code></dt> <dd> +<p>Generate code for a little-endian target. </p> </dd> <dt> + <span><code class="code">-m210</code><a class="copiable-link" href="#index-m210"> ¶</a></span> +</dt> <dt><code class="code">-m340</code></dt> <dd> +<p>Generate code for the 210 processor. </p> </dd> <dt> +<span><code class="code">-mno-lsim</code><a class="copiable-link" href="#index-mno-lsim-1"> ¶</a></span> +</dt> <dd> +<p>Assume that runtime support has been provided and so omit the simulator library (<samp class="file">libsim.a)</samp> from the linker command line. </p> </dd> <dt> +<span><code class="code">-mstack-increment=<var class="var">size</var></code><a class="copiable-link" href="#index-mstack-increment"> ¶</a></span> +</dt> <dd> +<p>Set the maximum amount for a single stack increment operation. Large values can increase the speed of programs that contain functions that need a large amount of stack space, but they can also trigger a segmentation fault if the stack is extended too much. The default value is 0x1000. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="microblaze-options">MicroBlaze Options</a>, Previous: <a href="m680x0-options">M680x0 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MCore-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MCore-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/messaging-with-the-gnu-objective-c-runtime.html b/devdocs/gcc~13/messaging-with-the-gnu-objective-c-runtime.html new file mode 100644 index 00000000..84f4b828 --- /dev/null +++ b/devdocs/gcc~13/messaging-with-the-gnu-objective-c-runtime.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Messaging-with-the-GNU-Objective-C-runtime"> <div class="nav-panel"> <p> Previous: <a href="fast-enumeration" accesskey="p" rel="prev">Fast Enumeration</a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Messaging-with-the-GNU-Objective-C-Runtime"><span>8.10 Messaging with the GNU Objective-C Runtime<a class="copiable-link" href="#Messaging-with-the-GNU-Objective-C-Runtime"> ¶</a></span></h1> <p>This section is specific for the GNU Objective-C runtime. If you are using a different runtime, you can skip it. </p> <p>The implementation of messaging in the GNU Objective-C runtime is designed to be portable, and so is based on standard C. </p> <p>Sending a message in the GNU Objective-C runtime is composed of two separate steps. First, there is a call to the lookup function, <code class="code">objc_msg_lookup ()</code> (or, in the case of messages to super, <code class="code">objc_msg_lookup_super ()</code>). This runtime function takes as argument the receiver and the selector of the method to be called; it returns the <code class="code">IMP</code>, that is a pointer to the function implementing the method. The second step of method invocation consists of casting this pointer function to the appropriate function pointer type, and calling the function pointed to it with the right arguments. </p> <p>For example, when the compiler encounters a method invocation such as <code class="code">[object init]</code>, it compiles it into a call to <code class="code">objc_msg_lookup (object, @selector(init))</code> followed by a cast of the returned value to the appropriate function pointer type, and then it calls it. </p> <ul class="mini-toc"> <li><a href="dynamically-registering-methods" accesskey="1">Dynamically Registering Methods</a></li> <li><a href="forwarding-hook" accesskey="2">Forwarding Hook</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Messaging-with-the-GNU-Objective-C-runtime.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Messaging-with-the-GNU-Objective-C-runtime.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/metadata b/devdocs/gcc~13/metadata new file mode 100644 index 00000000..1dcc3654 --- /dev/null +++ b/devdocs/gcc~13/metadata @@ -0,0 +1,2 @@ +(1 (name . "GCC") (slug . "gcc~13") (type . "simple") (links (home . "https://gcc.gnu.org/")) (version . "13") (release . "13.1.0") (mtime . 1690397241) (db_size . 4388409) (attribution . "© Free Software Foundation<br> + Licensed under the GNU Free Documentation License, Version 1.3."))
\ No newline at end of file diff --git a/devdocs/gcc~13/method-signatures.html b/devdocs/gcc~13/method-signatures.html new file mode 100644 index 00000000..f9041538 --- /dev/null +++ b/devdocs/gcc~13/method-signatures.html @@ -0,0 +1,9 @@ +<div class="subsection-level-extent" id="Method-signatures"> <div class="nav-panel"> <p> Previous: <a href="_0040encode" accesskey="p" rel="prev"><code class="code">@encode</code></a>, Up: <a href="type-encoding" accesskey="u" rel="up">Type Encoding</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Method-Signatures"><span>8.3.3 Method Signatures<a class="copiable-link" href="#Method-Signatures"> ¶</a></span></h1> <p>This section documents the encoding of method types, which is rarely needed to use Objective-C. You should skip it at a first reading; the runtime provides functions that will work on methods and can walk through the list of parameters and interpret them for you. These functions are part of the public “API” and are the preferred way to interact with method signatures from user code. </p> <p>But if you need to debug a problem with method signatures and need to know how they are implemented (i.e., the “ABI”), read on. </p> <p>Methods have their “signature” encoded and made available to the runtime. The “signature” encodes all the information required to dynamically build invocations of the method at runtime: return type and arguments. </p> <p>The “signature” is a null-terminated string, composed of the following: </p> <ul class="itemize mark-bullet"> <li>The return type, including type qualifiers. For example, a method returning <code class="code">int</code> would have <code class="code">i</code> here. </li> +<li>The total size (in bytes) required to pass all the parameters. This includes the two hidden parameters (the object <code class="code">self</code> and the method selector <code class="code">_cmd</code>). </li> +<li>Each argument, with the type encoding, followed by the offset (in bytes) of the argument in the list of parameters. </li> +</ul> <p>For example, a method with no arguments and returning <code class="code">int</code> would have the signature <code class="code">i8@0:4</code> if the size of a pointer is 4. The signature is interpreted as follows: the <code class="code">i</code> is the return type (an <code class="code">int</code>), the <code class="code">8</code> is the total size of the parameters in bytes (two pointers each of size 4), the <code class="code">@0</code> is the first parameter (an object at byte offset <code class="code">0</code>) and <code class="code">:4</code> is the second parameter (a <code class="code">SEL</code> at byte offset <code class="code">4</code>). </p> <p>You can easily find more examples by running the “strings” program on an Objective-C object file compiled by GCC. You’ll see a lot of strings that look very much like <code class="code">i8@0:4</code>. They are signatures of Objective-C methods. </p> </div> <div class="nav-panel"> <p> Previous: <a href="_0040encode"><code class="code">@encode</code></a>, Up: <a href="type-encoding">Type Encoding</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Method-signatures.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Method-signatures.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/microblaze-function-attributes.html b/devdocs/gcc~13/microblaze-function-attributes.html new file mode 100644 index 00000000..ff2158fe --- /dev/null +++ b/devdocs/gcc~13/microblaze-function-attributes.html @@ -0,0 +1,15 @@ +<div class="subsection-level-extent" id="MicroBlaze-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="microsoft-windows-function-attributes" accesskey="n" rel="next">Microsoft Windows Function Attributes</a>, Previous: <a href="mcore-function-attributes" accesskey="p" rel="prev">MCORE Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MicroBlaze-Function-Attributes-1"><span>6.33.17 MicroBlaze Function Attributes<a class="copiable-link" href="#MicroBlaze-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported on MicroBlaze targets: </p> <dl class="table"> <dt> +<span><code class="code">save_volatiles</code><a class="copiable-link" href="#index-save_005fvolatiles-function-attribute_002c-MicroBlaze"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the function is an interrupt handler. All volatile registers (in addition to non-volatile registers) are saved in the function prologue. If the function is a leaf function, only volatiles used by the function are saved. A normal function return is generated instead of a return from interrupt. </p> </dd> <dt> + <span><code class="code">break_handler</code><a class="copiable-link" href="#index-break_005fhandler-function-attribute_002c-MicroBlaze"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is a break handler. The compiler generates function entry and exit sequences suitable for use in an break handler when this attribute is present. The return from <code class="code">break_handler</code> is done through the <code class="code">rtbd</code> instead of <code class="code">rtsd</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f () __attribute__ ((break_handler));</pre> +</div> </dd> <dt> + <span><code class="code">interrupt_handler</code><a class="copiable-link" href="#index-interrupt_005fhandler-function-attribute_002c-MicroBlaze"> ¶</a></span> +</dt> <dt><code class="code">fast_interrupt</code></dt> <dd><p>These attributes indicate that the specified function is an interrupt handler. Use the <code class="code">fast_interrupt</code> attribute to indicate handlers used in low-latency interrupt mode, and <code class="code">interrupt_handler</code> for interrupts that do not use low-latency handlers. In both cases, GCC emits appropriate prologue code and generates a return from the handler using <code class="code">rtid</code> instead of <code class="code">rtsd</code>. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MicroBlaze-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MicroBlaze-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/microblaze-options.html b/devdocs/gcc~13/microblaze-options.html new file mode 100644 index 00000000..e36049bb --- /dev/null +++ b/devdocs/gcc~13/microblaze-options.html @@ -0,0 +1,68 @@ +<div class="subsection-level-extent" id="MicroBlaze-Options"> <div class="nav-panel"> <p> Next: <a href="mips-options" accesskey="n" rel="next">MIPS Options</a>, Previous: <a href="mcore-options" accesskey="p" rel="prev">MCore Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MicroBlaze-Options-1"><span>3.19.27 MicroBlaze Options<a class="copiable-link" href="#MicroBlaze-Options-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-7"> ¶</a></span> +</dt> <dd> +<p>Use software emulation for floating point (default). </p> </dd> <dt> +<span><code class="code">-mhard-float</code><a class="copiable-link" href="#index-mhard-float-3"> ¶</a></span> +</dt> <dd> +<p>Use hardware floating-point instructions. </p> </dd> <dt> +<span><code class="code">-mmemcpy</code><a class="copiable-link" href="#index-mmemcpy-1"> ¶</a></span> +</dt> <dd> +<p>Do not optimize block moves, use <code class="code">memcpy</code>. </p> </dd> <dt> +<span><code class="code">-mno-clearbss</code><a class="copiable-link" href="#index-mno-clearbss"> ¶</a></span> +</dt> <dd> +<p>This option is deprecated. Use <samp class="option">-fno-zero-initialized-in-bss</samp> instead. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-mcpu_003d-3"> ¶</a></span> +</dt> <dd> +<p>Use features of, and schedule code for, the given CPU. Supported values are in the format ‘<samp class="samp">v<var class="var">X</var>.<var class="var">YY</var>.<var class="var">Z</var></samp>’, where <var class="var">X</var> is a major version, <var class="var">YY</var> is the minor version, and <var class="var">Z</var> is compatibility code. Example values are ‘<samp class="samp">v3.00.a</samp>’, ‘<samp class="samp">v4.00.b</samp>’, ‘<samp class="samp">v5.00.a</samp>’, ‘<samp class="samp">v5.00.b</samp>’, ‘<samp class="samp">v6.00.a</samp>’. </p> </dd> <dt> +<span><code class="code">-mxl-soft-mul</code><a class="copiable-link" href="#index-mxl-soft-mul"> ¶</a></span> +</dt> <dd> +<p>Use software multiply emulation (default). </p> </dd> <dt> +<span><code class="code">-mxl-soft-div</code><a class="copiable-link" href="#index-mxl-soft-div"> ¶</a></span> +</dt> <dd> +<p>Use software emulation for divides (default). </p> </dd> <dt> +<span><code class="code">-mxl-barrel-shift</code><a class="copiable-link" href="#index-mxl-barrel-shift"> ¶</a></span> +</dt> <dd> +<p>Use the hardware barrel shifter. </p> </dd> <dt> +<span><code class="code">-mxl-pattern-compare</code><a class="copiable-link" href="#index-mxl-pattern-compare"> ¶</a></span> +</dt> <dd> +<p>Use pattern compare instructions. </p> </dd> <dt> +<span><code class="code">-msmall-divides</code><a class="copiable-link" href="#index-msmall-divides"> ¶</a></span> +</dt> <dd> +<p>Use table lookup optimization for small signed integer divisions. </p> </dd> <dt> +<span><code class="code">-mxl-stack-check</code><a class="copiable-link" href="#index-mxl-stack-check"> ¶</a></span> +</dt> <dd> +<p>This option is deprecated. Use <samp class="option">-fstack-check</samp> instead. </p> </dd> <dt> +<span><code class="code">-mxl-gp-opt</code><a class="copiable-link" href="#index-mxl-gp-opt"> ¶</a></span> +</dt> <dd> +<p>Use GP-relative <code class="code">.sdata</code>/<code class="code">.sbss</code> sections. </p> </dd> <dt> +<span><code class="code">-mxl-multiply-high</code><a class="copiable-link" href="#index-mxl-multiply-high"> ¶</a></span> +</dt> <dd> +<p>Use multiply high instructions for high part of 32x32 multiply. </p> </dd> <dt> +<span><code class="code">-mxl-float-convert</code><a class="copiable-link" href="#index-mxl-float-convert"> ¶</a></span> +</dt> <dd> +<p>Use hardware floating-point conversion instructions. </p> </dd> <dt> +<span><code class="code">-mxl-float-sqrt</code><a class="copiable-link" href="#index-mxl-float-sqrt"> ¶</a></span> +</dt> <dd> +<p>Use hardware floating-point square root instruction. </p> </dd> <dt> +<span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian-8"> ¶</a></span> +</dt> <dd> +<p>Generate code for a big-endian target. </p> </dd> <dt> +<span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian-8"> ¶</a></span> +</dt> <dd> +<p>Generate code for a little-endian target. </p> </dd> <dt> +<span><code class="code">-mxl-reorder</code><a class="copiable-link" href="#index-mxl-reorder"> ¶</a></span> +</dt> <dd> +<p>Use reorder instructions (swap and byte reversed load/store). </p> </dd> <dt><code class="code">-mxl-mode-<var class="var">app-model</var></code></dt> <dd> +<p>Select application model <var class="var">app-model</var>. Valid models are </p> +<dl class="table"> <dt>‘<samp class="samp">executable</samp>’</dt> <dd> +<p>normal executable (default), uses startup code <samp class="file">crt0.o</samp>. </p> </dd> <dt>‘<samp class="samp">xmdstub</samp>’</dt> <dd> +<p>for use with Xilinx Microprocessor Debugger (XMD) based software intrusive debug agent called xmdstub. This uses startup file <samp class="file">crt1.o</samp> and sets the start address of the program to 0x800. </p> </dd> <dt>‘<samp class="samp">bootstrap</samp>’</dt> <dd> +<p>for applications that are loaded using a bootloader. This model uses startup file <samp class="file">crt2.o</samp> which does not contain a processor reset vector handler. This is suitable for transferring control on a processor reset to the bootloader rather than the application. </p> </dd> <dt>‘<samp class="samp">novectors</samp>’</dt> <dd><p>for applications that do not require any of the MicroBlaze vectors. This option may be useful for applications running within a monitoring application. This model uses <samp class="file">crt3.o</samp> as a startup file. </p></dd> </dl> <p>Option <samp class="option">-xl-mode-<var class="var">app-model</var></samp> is a deprecated alias for <samp class="option">-mxl-mode-<var class="var">app-model</var></samp>. </p> </dd> <dt> +<span><code class="code">-mpic-data-is-text-relative</code><a class="copiable-link" href="#index-mpic-data-is-text-relative-1"> ¶</a></span> +</dt> <dd> +<p>Assume that the displacement between the text and data segments is fixed at static link time. This allows data to be referenced by offset from start of text address instead of GOT since PC-relative addressing is not supported. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="mips-options">MIPS Options</a>, Previous: <a href="mcore-options">MCore Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MicroBlaze-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MicroBlaze-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/microsoft-windows-function-attributes.html b/devdocs/gcc~13/microsoft-windows-function-attributes.html new file mode 100644 index 00000000..5e642153 --- /dev/null +++ b/devdocs/gcc~13/microsoft-windows-function-attributes.html @@ -0,0 +1,13 @@ +<div class="subsection-level-extent" id="Microsoft-Windows-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="mips-function-attributes" accesskey="n" rel="next">MIPS Function Attributes</a>, Previous: <a href="microblaze-function-attributes" accesskey="p" rel="prev">MicroBlaze Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Microsoft-Windows-Function-Attributes-1"><span>6.33.18 Microsoft Windows Function Attributes<a class="copiable-link" href="#Microsoft-Windows-Function-Attributes-1"> ¶</a></span></h1> <p>The following attributes are available on Microsoft Windows and Symbian OS targets. </p> <dl class="table"> <dt> + <span><code class="code">dllexport</code><a class="copiable-link" href="#index-dllexport-function-attribute"> ¶</a></span> +</dt> <dd> +<p>On Microsoft Windows targets and Symbian OS targets the <code class="code">dllexport</code> attribute causes the compiler to provide a global pointer to a pointer in a DLL, so that it can be referenced with the <code class="code">dllimport</code> attribute. On Microsoft Windows targets, the pointer name is formed by combining <code class="code">_imp__</code> and the function or variable name. </p> <p>You can use <code class="code">__declspec(dllexport)</code> as a synonym for <code class="code">__attribute__ ((dllexport))</code> for compatibility with other compilers. </p> <p>On systems that support the <code class="code">visibility</code> attribute, this attribute also implies “default” visibility. It is an error to explicitly specify any other visibility. </p> <p>GCC’s default behavior is to emit all inline functions with the <code class="code">dllexport</code> attribute. Since this can cause object file-size bloat, you can use <samp class="option">-fno-keep-inline-dllexport</samp>, which tells GCC to ignore the attribute for inlined functions unless the <samp class="option">-fkeep-inline-functions</samp> flag is used instead. </p> <p>The attribute is ignored for undefined symbols. </p> <p>When applied to C++ classes, the attribute marks defined non-inlined member functions and static data members as exports. Static consts initialized in-class are not marked unless they are also defined out-of-class. </p> <p>For Microsoft Windows targets there are alternative methods for including the symbol in the DLL’s export table such as using a <samp class="file">.def</samp> file with an <code class="code">EXPORTS</code> section or, with GNU ld, using the <samp class="option">--export-all</samp> linker flag. </p> </dd> <dt> + <span><code class="code">dllimport</code><a class="copiable-link" href="#index-dllimport-function-attribute"> ¶</a></span> +</dt> <dd> +<p>On Microsoft Windows and Symbian OS targets, the <code class="code">dllimport</code> attribute causes the compiler to reference a function or variable via a global pointer to a pointer that is set up by the DLL exporting the symbol. The attribute implies <code class="code">extern</code>. On Microsoft Windows targets, the pointer name is formed by combining <code class="code">_imp__</code> and the function or variable name. </p> <p>You can use <code class="code">__declspec(dllimport)</code> as a synonym for <code class="code">__attribute__ ((dllimport))</code> for compatibility with other compilers. </p> <p>On systems that support the <code class="code">visibility</code> attribute, this attribute also implies “default” visibility. It is an error to explicitly specify any other visibility. </p> <p>Currently, the attribute is ignored for inlined functions. If the attribute is applied to a symbol <em class="emph">definition</em>, an error is reported. If a symbol previously declared <code class="code">dllimport</code> is later defined, the attribute is ignored in subsequent references, and a warning is emitted. The attribute is also overridden by a subsequent declaration as <code class="code">dllexport</code>. </p> <p>When applied to C++ classes, the attribute marks non-inlined member functions and static data members as imports. However, the attribute is ignored for virtual methods to allow creation of vtables using thunks. </p> <p>On the SH Symbian OS target the <code class="code">dllimport</code> attribute also has another affect—it can cause the vtable and run-time type information for a class to be exported. This happens when the class has a dllimported constructor or a non-inline, non-pure virtual function and, for either of those two conditions, the class also has an inline constructor or destructor and has a key function that is defined in the current translation unit. </p> <p>For Microsoft Windows targets the use of the <code class="code">dllimport</code> attribute on functions is not necessary, but provides a small performance benefit by eliminating a thunk in the DLL. The use of the <code class="code">dllimport</code> attribute on imported variables can be avoided by passing the <samp class="option">--enable-auto-import</samp> switch to the GNU linker. As with functions, using the attribute for a variable eliminates a thunk in the DLL. </p> <p>One drawback to using this attribute is that a pointer to a <em class="emph">variable</em> marked as <code class="code">dllimport</code> cannot be used as a constant address. However, a pointer to a <em class="emph">function</em> with the <code class="code">dllimport</code> attribute can be used as a constant initializer; in this case, the address of a stub function in the import lib is referenced. On Microsoft Windows targets, the attribute can be disabled for functions by setting the <samp class="option">-mnop-fun-dllimport</samp> flag. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="mips-function-attributes">MIPS Function Attributes</a>, Previous: <a href="microblaze-function-attributes">MicroBlaze Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Microsoft-Windows-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Microsoft-Windows-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/microsoft-windows-variable-attributes.html b/devdocs/gcc~13/microsoft-windows-variable-attributes.html new file mode 100644 index 00000000..62d65a86 --- /dev/null +++ b/devdocs/gcc~13/microsoft-windows-variable-attributes.html @@ -0,0 +1,24 @@ +<div class="subsection-level-extent" id="Microsoft-Windows-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="msp430-variable-attributes" accesskey="n" rel="next">MSP430 Variable Attributes</a>, Previous: <a href="m32r_002fd-variable-attributes" accesskey="p" rel="prev">M32R/D Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Microsoft-Windows-Variable-Attributes-1"><span>6.34.9 Microsoft Windows Variable Attributes<a class="copiable-link" href="#Microsoft-Windows-Variable-Attributes-1"> ¶</a></span></h1> <p>You can use these attributes on Microsoft Windows targets. <a class="ref" href="variable-attributes">x86 Variable Attributes</a> for additional Windows compatibility attributes available on all x86 targets. </p> <dl class="table"> <dt> + <span><code class="code">dllimport</code><a class="copiable-link" href="#index-dllimport-variable-attribute"> ¶</a></span> +</dt> <dt><code class="code">dllexport</code></dt> <dd> +<p>The <code class="code">dllimport</code> and <code class="code">dllexport</code> attributes are described in <a class="ref" href="microsoft-windows-function-attributes">Microsoft Windows Function Attributes</a>. </p> </dd> <dt> +<span><code class="code">selectany</code><a class="copiable-link" href="#index-selectany-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">selectany</code> attribute causes an initialized global variable to have link-once semantics. When multiple definitions of the variable are encountered by the linker, the first is selected and the remainder are discarded. Following usage by the Microsoft compiler, the linker is told <em class="emph">not</em> to warn about size or content differences of the multiple definitions. </p> <p>Although the primary usage of this attribute is for POD types, the attribute can also be applied to global C++ objects that are initialized by a constructor. In this case, the static initialization and destruction code for the object is emitted in each translation defining the object, but the calls to the constructor and destructor are protected by a link-once guard variable. </p> <p>The <code class="code">selectany</code> attribute is only available on Microsoft Windows targets. You can use <code class="code">__declspec (selectany)</code> as a synonym for <code class="code">__attribute__ ((selectany))</code> for compatibility with other compilers. </p> </dd> <dt> +<span><code class="code">shared</code><a class="copiable-link" href="#index-shared-variable-attribute"> ¶</a></span> +</dt> <dd> +<p>On Microsoft Windows, in addition to putting variable definitions in a named section, the section can also be shared among all running copies of an executable or DLL. For example, this small program defines shared data by putting it in a named section <code class="code">shared</code> and marking the section shareable: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int foo __attribute__((section ("shared"), shared)) = 0; + +int +main() +{ + /* <span class="r">Read and write foo. All running + copies see the same value.</span> */ + return 0; +}</pre> +</div> <p>You may only use the <code class="code">shared</code> attribute along with <code class="code">section</code> attribute with a fully-initialized global definition because of the way linkers work. See <code class="code">section</code> attribute for more information. </p> <p>The <code class="code">shared</code> attribute is only available on Microsoft Windows. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="msp430-variable-attributes">MSP430 Variable Attributes</a>, Previous: <a href="m32r_002fd-variable-attributes">M32R/D Variable Attributes</a>, Up: <a href="variable-attributes">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Microsoft-Windows-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Microsoft-Windows-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mips-3d-built-in-functions.html b/devdocs/gcc~13/mips-3d-built-in-functions.html new file mode 100644 index 00000000..c6fa4527 --- /dev/null +++ b/devdocs/gcc~13/mips-3d-built-in-functions.html @@ -0,0 +1,56 @@ +<div class="subsubsection-level-extent" id="MIPS-3D-Built-in-Functions"> <div class="nav-panel"> <p> Previous: <a href="paired-single-built-in-functions" accesskey="p" rel="prev">Paired-Single Built-in Functions</a>, Up: <a href="mips-loongson-built-in-functions" accesskey="u" rel="up">MIPS Loongson Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="MIPS-3D-Built-in-Functions-1"><span>6.60.17.3 MIPS-3D Built-in Functions<a class="copiable-link" href="#MIPS-3D-Built-in-Functions-1"> ¶</a></span></h1> <p>The MIPS-3D Application-Specific Extension (ASE) includes additional paired-single instructions that are designed to improve the performance of 3D graphics operations. Support for these instructions is controlled by the <samp class="option">-mips3d</samp> command-line option. </p> <p>The functions listed below map directly to a particular MIPS-3D instruction. Please refer to the architecture specification for more details on what each instruction does. </p> <dl class="table"> <dt><code class="code">v2sf __builtin_mips_addr_ps (v2sf, v2sf)</code></dt> <dd> +<p>Reduction add (<code class="code">addr.ps</code>). </p> </dd> <dt><code class="code">v2sf __builtin_mips_mulr_ps (v2sf, v2sf)</code></dt> <dd> +<p>Reduction multiply (<code class="code">mulr.ps</code>). </p> </dd> <dt><code class="code">v2sf __builtin_mips_cvt_pw_ps (v2sf)</code></dt> <dd> +<p>Convert paired single to paired word (<code class="code">cvt.pw.ps</code>). </p> </dd> <dt><code class="code">v2sf __builtin_mips_cvt_ps_pw (v2sf)</code></dt> <dd> +<p>Convert paired word to paired single (<code class="code">cvt.ps.pw</code>). </p> </dd> <dt><code class="code">float __builtin_mips_recip1_s (float)</code></dt> <dt><code class="code">double __builtin_mips_recip1_d (double)</code></dt> <dt><code class="code">v2sf __builtin_mips_recip1_ps (v2sf)</code></dt> <dd> +<p>Reduced-precision reciprocal (sequence step 1) (<code class="code">recip1.<var class="var">fmt</var></code>). </p> </dd> <dt><code class="code">float __builtin_mips_recip2_s (float, float)</code></dt> <dt><code class="code">double __builtin_mips_recip2_d (double, double)</code></dt> <dt><code class="code">v2sf __builtin_mips_recip2_ps (v2sf, v2sf)</code></dt> <dd> +<p>Reduced-precision reciprocal (sequence step 2) (<code class="code">recip2.<var class="var">fmt</var></code>). </p> </dd> <dt><code class="code">float __builtin_mips_rsqrt1_s (float)</code></dt> <dt><code class="code">double __builtin_mips_rsqrt1_d (double)</code></dt> <dt><code class="code">v2sf __builtin_mips_rsqrt1_ps (v2sf)</code></dt> <dd> +<p>Reduced-precision reciprocal square root (sequence step 1) (<code class="code">rsqrt1.<var class="var">fmt</var></code>). </p> </dd> <dt><code class="code">float __builtin_mips_rsqrt2_s (float, float)</code></dt> <dt><code class="code">double __builtin_mips_rsqrt2_d (double, double)</code></dt> <dt><code class="code">v2sf __builtin_mips_rsqrt2_ps (v2sf, v2sf)</code></dt> <dd><p>Reduced-precision reciprocal square root (sequence step 2) (<code class="code">rsqrt2.<var class="var">fmt</var></code>). </p></dd> </dl> <p>The following multi-instruction functions are also available. In each case, <var class="var">cond</var> can be any of the 16 floating-point conditions: <code class="code">f</code>, <code class="code">un</code>, <code class="code">eq</code>, <code class="code">ueq</code>, <code class="code">olt</code>, <code class="code">ult</code>, <code class="code">ole</code>, <code class="code">ule</code>, <code class="code">sf</code>, <code class="code">ngle</code>, <code class="code">seq</code>, <code class="code">ngl</code>, <code class="code">lt</code>, <code class="code">nge</code>, <code class="code">le</code> or <code class="code">ngt</code>. </p> <dl class="table"> <dt><code class="code">int __builtin_mips_cabs_<var class="var">cond</var>_s (float <var class="var">a</var>, float <var class="var">b</var>)</code></dt> <dt><code class="code">int __builtin_mips_cabs_<var class="var">cond</var>_d (double <var class="var">a</var>, double <var class="var">b</var>)</code></dt> <dd> +<p>Absolute comparison of two scalar values (<code class="code">cabs.<var class="var">cond</var>.<var class="var">fmt</var></code>, <code class="code">bc1t</code>/<code class="code">bc1f</code>). </p> <p>These functions compare <var class="var">a</var> and <var class="var">b</var> using <code class="code">cabs.<var class="var">cond</var>.s</code> or <code class="code">cabs.<var class="var">cond</var>.d</code> and return the result as a boolean value. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">float a, b; +if (__builtin_mips_cabs_eq_s (a, b)) + true (); +else + false ();</pre> +</div> </dd> <dt><code class="code">int __builtin_mips_upper_cabs_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>)</code></dt> <dt><code class="code">int __builtin_mips_lower_cabs_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>)</code></dt> <dd> +<p>Absolute comparison of two paired-single values (<code class="code">cabs.<var class="var">cond</var>.ps</code>, <code class="code">bc1t</code>/<code class="code">bc1f</code>). </p> <p>These functions compare <var class="var">a</var> and <var class="var">b</var> using <code class="code">cabs.<var class="var">cond</var>.ps</code> and return either the upper or lower half of the result. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2sf a, b; +if (__builtin_mips_upper_cabs_eq_ps (a, b)) + upper_halves_are_equal (); +else + upper_halves_are_unequal (); + +if (__builtin_mips_lower_cabs_eq_ps (a, b)) + lower_halves_are_equal (); +else + lower_halves_are_unequal ();</pre> +</div> </dd> <dt><code class="code">v2sf __builtin_mips_movt_cabs_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>, v2sf <var class="var">c</var>, v2sf <var class="var">d</var>)</code></dt> <dt><code class="code">v2sf __builtin_mips_movf_cabs_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>, v2sf <var class="var">c</var>, v2sf <var class="var">d</var>)</code></dt> <dd> +<p>Conditional move based on absolute comparison (<code class="code">cabs.<var class="var">cond</var>.ps</code>, <code class="code">movt.ps</code>/<code class="code">movf.ps</code>). </p> <p>The <code class="code">movt</code> functions return the value <var class="var">x</var> computed by: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">cabs.<var class="var">cond</var>.ps <var class="var">cc</var>,<var class="var">a</var>,<var class="var">b</var> +mov.ps <var class="var">x</var>,<var class="var">c</var> +movt.ps <var class="var">x</var>,<var class="var">d</var>,<var class="var">cc</var></pre> +</div> <p>The <code class="code">movf</code> functions are similar but use <code class="code">movf.ps</code> instead of <code class="code">movt.ps</code>. </p> </dd> <dt><code class="code">int __builtin_mips_any_c_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>)</code></dt> <dt><code class="code">int __builtin_mips_all_c_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>)</code></dt> <dt><code class="code">int __builtin_mips_any_cabs_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>)</code></dt> <dt><code class="code">int __builtin_mips_all_cabs_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>)</code></dt> <dd> +<p>Comparison of two paired-single values (<code class="code">c.<var class="var">cond</var>.ps</code>/<code class="code">cabs.<var class="var">cond</var>.ps</code>, <code class="code">bc1any2t</code>/<code class="code">bc1any2f</code>). </p> <p>These functions compare <var class="var">a</var> and <var class="var">b</var> using <code class="code">c.<var class="var">cond</var>.ps</code> or <code class="code">cabs.<var class="var">cond</var>.ps</code>. The <code class="code">any</code> forms return <code class="code">true</code> if either result is <code class="code">true</code> and the <code class="code">all</code> forms return <code class="code">true</code> if both results are <code class="code">true</code>. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2sf a, b; +if (__builtin_mips_any_c_eq_ps (a, b)) + one_is_true (); +else + both_are_false (); + +if (__builtin_mips_all_c_eq_ps (a, b)) + both_are_true (); +else + one_is_false ();</pre> +</div> </dd> <dt><code class="code">int __builtin_mips_any_c_<var class="var">cond</var>_4s (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>, v2sf <var class="var">c</var>, v2sf <var class="var">d</var>)</code></dt> <dt><code class="code">int __builtin_mips_all_c_<var class="var">cond</var>_4s (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>, v2sf <var class="var">c</var>, v2sf <var class="var">d</var>)</code></dt> <dt><code class="code">int __builtin_mips_any_cabs_<var class="var">cond</var>_4s (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>, v2sf <var class="var">c</var>, v2sf <var class="var">d</var>)</code></dt> <dt><code class="code">int __builtin_mips_all_cabs_<var class="var">cond</var>_4s (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>, v2sf <var class="var">c</var>, v2sf <var class="var">d</var>)</code></dt> <dd> +<p>Comparison of four paired-single values (<code class="code">c.<var class="var">cond</var>.ps</code>/<code class="code">cabs.<var class="var">cond</var>.ps</code>, <code class="code">bc1any4t</code>/<code class="code">bc1any4f</code>). </p> <p>These functions use <code class="code">c.<var class="var">cond</var>.ps</code> or <code class="code">cabs.<var class="var">cond</var>.ps</code> to compare <var class="var">a</var> with <var class="var">b</var> and to compare <var class="var">c</var> with <var class="var">d</var>. The <code class="code">any</code> forms return <code class="code">true</code> if any of the four results are <code class="code">true</code> and the <code class="code">all</code> forms return <code class="code">true</code> if all four results are <code class="code">true</code>. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2sf a, b, c, d; +if (__builtin_mips_any_c_eq_4s (a, b, c, d)) + some_are_true (); +else + all_are_false (); + +if (__builtin_mips_all_c_eq_4s (a, b, c, d)) + all_are_true (); +else + some_are_false ();</pre> +</div> </dd> </dl> </div> <div class="nav-panel"> <p> Previous: <a href="paired-single-built-in-functions">Paired-Single Built-in Functions</a>, Up: <a href="mips-loongson-built-in-functions">MIPS Loongson Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-3D-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-3D-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mips-dsp-built-in-functions.html b/devdocs/gcc~13/mips-dsp-built-in-functions.html new file mode 100644 index 00000000..85b73beb --- /dev/null +++ b/devdocs/gcc~13/mips-dsp-built-in-functions.html @@ -0,0 +1,208 @@ +<div class="subsection-level-extent" id="MIPS-DSP-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="mips-paired-single-support" accesskey="n" rel="next">MIPS Paired-Single Support</a>, Previous: <a href="loongarch-base-built-in-functions" accesskey="p" rel="prev">LoongArch Base Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MIPS-DSP-Built-in-Functions-1"><span>6.60.15 MIPS DSP Built-in Functions<a class="copiable-link" href="#MIPS-DSP-Built-in-Functions-1"> ¶</a></span></h1> <p>The MIPS DSP Application-Specific Extension (ASE) includes new instructions that are designed to improve the performance of DSP and media applications. It provides instructions that operate on packed 8-bit/16-bit integer data, Q7, Q15 and Q31 fractional data. </p> <p>GCC supports MIPS DSP operations using both the generic vector extensions (see <a class="pxref" href="vector-extensions">Using Vector Instructions through Built-in Functions</a>) and a collection of MIPS-specific built-in functions. Both kinds of support are enabled by the <samp class="option">-mdsp</samp> command-line option. </p> <p>Revision 2 of the ASE was introduced in the second half of 2006. This revision adds extra instructions to the original ASE, but is otherwise backwards-compatible with it. You can select revision 2 using the command-line option <samp class="option">-mdspr2</samp>; this option implies <samp class="option">-mdsp</samp>. </p> <p>The SCOUNT and POS bits of the DSP control register are global. The WRDSP, EXTPDP, EXTPDPV and MTHLIP instructions modify the SCOUNT and POS bits. During optimization, the compiler does not delete these instructions and it does not delete calls to functions containing these instructions. </p> <p>At present, GCC only provides support for operations on 32-bit vectors. The vector type associated with 8-bit integer data is usually called <code class="code">v4i8</code>, the vector type associated with Q7 is usually called <code class="code">v4q7</code>, the vector type associated with 16-bit integer data is usually called <code class="code">v2i16</code>, and the vector type associated with Q15 is usually called <code class="code">v2q15</code>. They can be defined in C as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef signed char v4i8 __attribute__ ((vector_size(4))); +typedef signed char v4q7 __attribute__ ((vector_size(4))); +typedef short v2i16 __attribute__ ((vector_size(4))); +typedef short v2q15 __attribute__ ((vector_size(4)));</pre> +</div> <p><code class="code">v4i8</code>, <code class="code">v4q7</code>, <code class="code">v2i16</code> and <code class="code">v2q15</code> values are initialized in the same way as aggregates. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v4i8 a = {1, 2, 3, 4}; +v4i8 b; +b = (v4i8) {5, 6, 7, 8}; + +v2q15 c = {0x0fcb, 0x3a75}; +v2q15 d; +d = (v2q15) {0.1234 * 0x1.0p15, 0.4567 * 0x1.0p15};</pre> +</div> <p><em class="emph">Note:</em> The CPU’s endianness determines the order in which values are packed. On little-endian targets, the first value is the least significant and the last value is the most significant. The opposite order applies to big-endian targets. For example, the code above sets the lowest byte of <code class="code">a</code> to <code class="code">1</code> on little-endian targets and <code class="code">4</code> on big-endian targets. </p> <p><em class="emph">Note:</em> Q7, Q15 and Q31 values must be initialized with their integer representation. As shown in this example, the integer representation of a Q7 value can be obtained by multiplying the fractional value by <code class="code">0x1.0p7</code>. The equivalent for Q15 values is to multiply by <code class="code">0x1.0p15</code>. The equivalent for Q31 values is to multiply by <code class="code">0x1.0p31</code>. </p> <p>The table below lists the <code class="code">v4i8</code> and <code class="code">v2q15</code> operations for which hardware support exists. <code class="code">a</code> and <code class="code">b</code> are <code class="code">v4i8</code> values, and <code class="code">c</code> and <code class="code">d</code> are <code class="code">v2q15</code> values. </p> <table class="multitable"> <thead><tr> +<th width="50%">C code</th> +<th width="50%">MIPS instruction</th> +</tr></thead> <tbody> +<tr> +<td width="50%"><code class="code">a + b</code></td> +<td width="50%"><code class="code">addu.qb</code></td> +</tr> <tr> +<td width="50%"><code class="code">c + d</code></td> +<td width="50%"><code class="code">addq.ph</code></td> +</tr> <tr> +<td width="50%"><code class="code">a - b</code></td> +<td width="50%"><code class="code">subu.qb</code></td> +</tr> <tr> +<td width="50%"><code class="code">c - d</code></td> +<td width="50%"><code class="code">subq.ph</code></td> +</tr> </tbody> </table> <p>The table below lists the <code class="code">v2i16</code> operation for which hardware support exists for the DSP ASE REV 2. <code class="code">e</code> and <code class="code">f</code> are <code class="code">v2i16</code> values. </p> <table class="multitable"> <thead><tr> +<th width="50%">C code</th> +<th width="50%">MIPS instruction</th> +</tr></thead> <tbody> +<tr> +<td width="50%"><code class="code">e * f</code></td> +<td width="50%"><code class="code">mul.ph</code></td> +</tr> </tbody> </table> <p>It is easier to describe the DSP built-in functions if we first define the following types: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int q31; +typedef int i32; +typedef unsigned int ui32; +typedef long long a64;</pre> +</div> <p><code class="code">q31</code> and <code class="code">i32</code> are actually the same as <code class="code">int</code>, but we use <code class="code">q31</code> to indicate a Q31 fractional value and <code class="code">i32</code> to indicate a 32-bit integer value. Similarly, <code class="code">a64</code> is the same as <code class="code">long long</code>, but we use <code class="code">a64</code> to indicate values that are placed in one of the four DSP accumulators (<code class="code">$ac0</code>, <code class="code">$ac1</code>, <code class="code">$ac2</code> or <code class="code">$ac3</code>). </p> <p>Also, some built-in functions prefer or require immediate numbers as parameters, because the corresponding DSP instructions accept both immediate numbers and register operands, or accept immediate numbers only. The immediate parameters are listed as follows. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">imm0_3: 0 to 3. +imm0_7: 0 to 7. +imm0_15: 0 to 15. +imm0_31: 0 to 31. +imm0_63: 0 to 63. +imm0_255: 0 to 255. +imm_n32_31: -32 to 31. +imm_n512_511: -512 to 511.</pre> +</div> <p>The following built-in functions map directly to a particular MIPS DSP instruction. Please refer to the architecture specification for details on what each instruction does. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2q15 __builtin_mips_addq_ph (v2q15, v2q15); +v2q15 __builtin_mips_addq_s_ph (v2q15, v2q15); +q31 __builtin_mips_addq_s_w (q31, q31); +v4i8 __builtin_mips_addu_qb (v4i8, v4i8); +v4i8 __builtin_mips_addu_s_qb (v4i8, v4i8); +v2q15 __builtin_mips_subq_ph (v2q15, v2q15); +v2q15 __builtin_mips_subq_s_ph (v2q15, v2q15); +q31 __builtin_mips_subq_s_w (q31, q31); +v4i8 __builtin_mips_subu_qb (v4i8, v4i8); +v4i8 __builtin_mips_subu_s_qb (v4i8, v4i8); +i32 __builtin_mips_addsc (i32, i32); +i32 __builtin_mips_addwc (i32, i32); +i32 __builtin_mips_modsub (i32, i32); +i32 __builtin_mips_raddu_w_qb (v4i8); +v2q15 __builtin_mips_absq_s_ph (v2q15); +q31 __builtin_mips_absq_s_w (q31); +v4i8 __builtin_mips_precrq_qb_ph (v2q15, v2q15); +v2q15 __builtin_mips_precrq_ph_w (q31, q31); +v2q15 __builtin_mips_precrq_rs_ph_w (q31, q31); +v4i8 __builtin_mips_precrqu_s_qb_ph (v2q15, v2q15); +q31 __builtin_mips_preceq_w_phl (v2q15); +q31 __builtin_mips_preceq_w_phr (v2q15); +v2q15 __builtin_mips_precequ_ph_qbl (v4i8); +v2q15 __builtin_mips_precequ_ph_qbr (v4i8); +v2q15 __builtin_mips_precequ_ph_qbla (v4i8); +v2q15 __builtin_mips_precequ_ph_qbra (v4i8); +v2q15 __builtin_mips_preceu_ph_qbl (v4i8); +v2q15 __builtin_mips_preceu_ph_qbr (v4i8); +v2q15 __builtin_mips_preceu_ph_qbla (v4i8); +v2q15 __builtin_mips_preceu_ph_qbra (v4i8); +v4i8 __builtin_mips_shll_qb (v4i8, imm0_7); +v4i8 __builtin_mips_shll_qb (v4i8, i32); +v2q15 __builtin_mips_shll_ph (v2q15, imm0_15); +v2q15 __builtin_mips_shll_ph (v2q15, i32); +v2q15 __builtin_mips_shll_s_ph (v2q15, imm0_15); +v2q15 __builtin_mips_shll_s_ph (v2q15, i32); +q31 __builtin_mips_shll_s_w (q31, imm0_31); +q31 __builtin_mips_shll_s_w (q31, i32); +v4i8 __builtin_mips_shrl_qb (v4i8, imm0_7); +v4i8 __builtin_mips_shrl_qb (v4i8, i32); +v2q15 __builtin_mips_shra_ph (v2q15, imm0_15); +v2q15 __builtin_mips_shra_ph (v2q15, i32); +v2q15 __builtin_mips_shra_r_ph (v2q15, imm0_15); +v2q15 __builtin_mips_shra_r_ph (v2q15, i32); +q31 __builtin_mips_shra_r_w (q31, imm0_31); +q31 __builtin_mips_shra_r_w (q31, i32); +v2q15 __builtin_mips_muleu_s_ph_qbl (v4i8, v2q15); +v2q15 __builtin_mips_muleu_s_ph_qbr (v4i8, v2q15); +v2q15 __builtin_mips_mulq_rs_ph (v2q15, v2q15); +q31 __builtin_mips_muleq_s_w_phl (v2q15, v2q15); +q31 __builtin_mips_muleq_s_w_phr (v2q15, v2q15); +a64 __builtin_mips_dpau_h_qbl (a64, v4i8, v4i8); +a64 __builtin_mips_dpau_h_qbr (a64, v4i8, v4i8); +a64 __builtin_mips_dpsu_h_qbl (a64, v4i8, v4i8); +a64 __builtin_mips_dpsu_h_qbr (a64, v4i8, v4i8); +a64 __builtin_mips_dpaq_s_w_ph (a64, v2q15, v2q15); +a64 __builtin_mips_dpaq_sa_l_w (a64, q31, q31); +a64 __builtin_mips_dpsq_s_w_ph (a64, v2q15, v2q15); +a64 __builtin_mips_dpsq_sa_l_w (a64, q31, q31); +a64 __builtin_mips_mulsaq_s_w_ph (a64, v2q15, v2q15); +a64 __builtin_mips_maq_s_w_phl (a64, v2q15, v2q15); +a64 __builtin_mips_maq_s_w_phr (a64, v2q15, v2q15); +a64 __builtin_mips_maq_sa_w_phl (a64, v2q15, v2q15); +a64 __builtin_mips_maq_sa_w_phr (a64, v2q15, v2q15); +i32 __builtin_mips_bitrev (i32); +i32 __builtin_mips_insv (i32, i32); +v4i8 __builtin_mips_repl_qb (imm0_255); +v4i8 __builtin_mips_repl_qb (i32); +v2q15 __builtin_mips_repl_ph (imm_n512_511); +v2q15 __builtin_mips_repl_ph (i32); +void __builtin_mips_cmpu_eq_qb (v4i8, v4i8); +void __builtin_mips_cmpu_lt_qb (v4i8, v4i8); +void __builtin_mips_cmpu_le_qb (v4i8, v4i8); +i32 __builtin_mips_cmpgu_eq_qb (v4i8, v4i8); +i32 __builtin_mips_cmpgu_lt_qb (v4i8, v4i8); +i32 __builtin_mips_cmpgu_le_qb (v4i8, v4i8); +void __builtin_mips_cmp_eq_ph (v2q15, v2q15); +void __builtin_mips_cmp_lt_ph (v2q15, v2q15); +void __builtin_mips_cmp_le_ph (v2q15, v2q15); +v4i8 __builtin_mips_pick_qb (v4i8, v4i8); +v2q15 __builtin_mips_pick_ph (v2q15, v2q15); +v2q15 __builtin_mips_packrl_ph (v2q15, v2q15); +i32 __builtin_mips_extr_w (a64, imm0_31); +i32 __builtin_mips_extr_w (a64, i32); +i32 __builtin_mips_extr_r_w (a64, imm0_31); +i32 __builtin_mips_extr_s_h (a64, i32); +i32 __builtin_mips_extr_rs_w (a64, imm0_31); +i32 __builtin_mips_extr_rs_w (a64, i32); +i32 __builtin_mips_extr_s_h (a64, imm0_31); +i32 __builtin_mips_extr_r_w (a64, i32); +i32 __builtin_mips_extp (a64, imm0_31); +i32 __builtin_mips_extp (a64, i32); +i32 __builtin_mips_extpdp (a64, imm0_31); +i32 __builtin_mips_extpdp (a64, i32); +a64 __builtin_mips_shilo (a64, imm_n32_31); +a64 __builtin_mips_shilo (a64, i32); +a64 __builtin_mips_mthlip (a64, i32); +void __builtin_mips_wrdsp (i32, imm0_63); +i32 __builtin_mips_rddsp (imm0_63); +i32 __builtin_mips_lbux (void *, i32); +i32 __builtin_mips_lhx (void *, i32); +i32 __builtin_mips_lwx (void *, i32); +a64 __builtin_mips_ldx (void *, i32); /* MIPS64 only */ +i32 __builtin_mips_bposge32 (void); +a64 __builtin_mips_madd (a64, i32, i32); +a64 __builtin_mips_maddu (a64, ui32, ui32); +a64 __builtin_mips_msub (a64, i32, i32); +a64 __builtin_mips_msubu (a64, ui32, ui32); +a64 __builtin_mips_mult (i32, i32); +a64 __builtin_mips_multu (ui32, ui32);</pre> +</div> <p>The following built-in functions map directly to a particular MIPS DSP REV 2 instruction. Please refer to the architecture specification for details on what each instruction does. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v4q7 __builtin_mips_absq_s_qb (v4q7); +v2i16 __builtin_mips_addu_ph (v2i16, v2i16); +v2i16 __builtin_mips_addu_s_ph (v2i16, v2i16); +v4i8 __builtin_mips_adduh_qb (v4i8, v4i8); +v4i8 __builtin_mips_adduh_r_qb (v4i8, v4i8); +i32 __builtin_mips_append (i32, i32, imm0_31); +i32 __builtin_mips_balign (i32, i32, imm0_3); +i32 __builtin_mips_cmpgdu_eq_qb (v4i8, v4i8); +i32 __builtin_mips_cmpgdu_lt_qb (v4i8, v4i8); +i32 __builtin_mips_cmpgdu_le_qb (v4i8, v4i8); +a64 __builtin_mips_dpa_w_ph (a64, v2i16, v2i16); +a64 __builtin_mips_dps_w_ph (a64, v2i16, v2i16); +v2i16 __builtin_mips_mul_ph (v2i16, v2i16); +v2i16 __builtin_mips_mul_s_ph (v2i16, v2i16); +q31 __builtin_mips_mulq_rs_w (q31, q31); +v2q15 __builtin_mips_mulq_s_ph (v2q15, v2q15); +q31 __builtin_mips_mulq_s_w (q31, q31); +a64 __builtin_mips_mulsa_w_ph (a64, v2i16, v2i16); +v4i8 __builtin_mips_precr_qb_ph (v2i16, v2i16); +v2i16 __builtin_mips_precr_sra_ph_w (i32, i32, imm0_31); +v2i16 __builtin_mips_precr_sra_r_ph_w (i32, i32, imm0_31); +i32 __builtin_mips_prepend (i32, i32, imm0_31); +v4i8 __builtin_mips_shra_qb (v4i8, imm0_7); +v4i8 __builtin_mips_shra_r_qb (v4i8, imm0_7); +v4i8 __builtin_mips_shra_qb (v4i8, i32); +v4i8 __builtin_mips_shra_r_qb (v4i8, i32); +v2i16 __builtin_mips_shrl_ph (v2i16, imm0_15); +v2i16 __builtin_mips_shrl_ph (v2i16, i32); +v2i16 __builtin_mips_subu_ph (v2i16, v2i16); +v2i16 __builtin_mips_subu_s_ph (v2i16, v2i16); +v4i8 __builtin_mips_subuh_qb (v4i8, v4i8); +v4i8 __builtin_mips_subuh_r_qb (v4i8, v4i8); +v2q15 __builtin_mips_addqh_ph (v2q15, v2q15); +v2q15 __builtin_mips_addqh_r_ph (v2q15, v2q15); +q31 __builtin_mips_addqh_w (q31, q31); +q31 __builtin_mips_addqh_r_w (q31, q31); +v2q15 __builtin_mips_subqh_ph (v2q15, v2q15); +v2q15 __builtin_mips_subqh_r_ph (v2q15, v2q15); +q31 __builtin_mips_subqh_w (q31, q31); +q31 __builtin_mips_subqh_r_w (q31, q31); +a64 __builtin_mips_dpax_w_ph (a64, v2i16, v2i16); +a64 __builtin_mips_dpsx_w_ph (a64, v2i16, v2i16); +a64 __builtin_mips_dpaqx_s_w_ph (a64, v2q15, v2q15); +a64 __builtin_mips_dpaqx_sa_w_ph (a64, v2q15, v2q15); +a64 __builtin_mips_dpsqx_s_w_ph (a64, v2q15, v2q15); +a64 __builtin_mips_dpsqx_sa_w_ph (a64, v2q15, v2q15);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="mips-paired-single-support">MIPS Paired-Single Support</a>, Previous: <a href="loongarch-base-built-in-functions">LoongArch Base Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-DSP-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-DSP-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mips-function-attributes.html b/devdocs/gcc~13/mips-function-attributes.html new file mode 100644 index 00000000..a6f22e64 --- /dev/null +++ b/devdocs/gcc~13/mips-function-attributes.html @@ -0,0 +1,46 @@ +<div class="subsection-level-extent" id="MIPS-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="msp430-function-attributes" accesskey="n" rel="next">MSP430 Function Attributes</a>, Previous: <a href="microsoft-windows-function-attributes" accesskey="p" rel="prev">Microsoft Windows Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MIPS-Function-Attributes-1"><span>6.33.19 MIPS Function Attributes<a class="copiable-link" href="#MIPS-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the MIPS back end: </p> <dl class="table"> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-MIPS"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. An optional argument is supported for the interrupt attribute which allows the interrupt mode to be described. By default GCC assumes the external interrupt controller (EIC) mode is in use, this can be explicitly set using <code class="code">eic</code>. When interrupts are non-masked then the requested Interrupt Priority Level (IPL) is copied to the current IPL which has the effect of only enabling higher priority interrupts. To use vectored interrupt mode use the argument <code class="code">vector=[sw0|sw1|hw0|hw1|hw2|hw3|hw4|hw5]</code>, this will change the behavior of the non-masked interrupt support and GCC will arrange to mask all interrupts from sw0 up to and including the specified interrupt vector. </p> <p>You can use the following attributes to modify the behavior of an interrupt handler: </p> +<dl class="table"> <dt> +<span><code class="code">use_shadow_register_set</code><a class="copiable-link" href="#index-use_005fshadow_005fregister_005fset-function-attribute_002c-MIPS"> ¶</a></span> +</dt> <dd> +<p>Assume that the handler uses a shadow register set, instead of the main general-purpose registers. An optional argument <code class="code">intstack</code> is supported to indicate that the shadow register set contains a valid stack pointer. </p> </dd> <dt> +<span><code class="code">keep_interrupts_masked</code><a class="copiable-link" href="#index-keep_005finterrupts_005fmasked-function-attribute_002c-MIPS"> ¶</a></span> +</dt> <dd> +<p>Keep interrupts masked for the whole function. Without this attribute, GCC tries to reenable interrupts for as much of the function as it can. </p> </dd> <dt> +<span><code class="code">use_debug_exception_return</code><a class="copiable-link" href="#index-use_005fdebug_005fexception_005freturn-function-attribute_002c-MIPS"> ¶</a></span> +</dt> <dd><p>Return using the <code class="code">deret</code> instruction. Interrupt handlers that don’t have this attribute return using <code class="code">eret</code> instead. </p></dd> </dl> <p>You can use any combination of these attributes, as shown below: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __attribute__ ((interrupt)) v0 (); +void __attribute__ ((interrupt, use_shadow_register_set)) v1 (); +void __attribute__ ((interrupt, keep_interrupts_masked)) v2 (); +void __attribute__ ((interrupt, use_debug_exception_return)) v3 (); +void __attribute__ ((interrupt, use_shadow_register_set, + keep_interrupts_masked)) v4 (); +void __attribute__ ((interrupt, use_shadow_register_set, + use_debug_exception_return)) v5 (); +void __attribute__ ((interrupt, keep_interrupts_masked, + use_debug_exception_return)) v6 (); +void __attribute__ ((interrupt, use_shadow_register_set, + keep_interrupts_masked, + use_debug_exception_return)) v7 (); +void __attribute__ ((interrupt("eic"))) v8 (); +void __attribute__ ((interrupt("vector=hw3"))) v9 ();</pre> +</div> </dd> <dt> + <span><code class="code">long_call</code><a class="copiable-link" href="#index-indirect-calls_002c-MIPS"> ¶</a></span> +</dt> <dt><code class="code">short_call</code></dt> <dt><code class="code">near</code></dt> <dt><code class="code">far</code></dt> <dd> +<p>These attributes specify how a particular function is called on MIPS. The attributes override the <samp class="option">-mlong-calls</samp> (see <a class="pxref" href="mips-options">MIPS Options</a>) command-line switch. The <code class="code">long_call</code> and <code class="code">far</code> attributes are synonyms, and cause the compiler to always call the function by first loading its address into a register, and then using the contents of that register. The <code class="code">short_call</code> and <code class="code">near</code> attributes are synonyms, and have the opposite effect; they specify that non-PIC calls should be made using the more efficient <code class="code">jal</code> instruction. </p> </dd> <dt> + <span><code class="code">mips16</code><a class="copiable-link" href="#index-mips16-function-attribute_002c-MIPS"> ¶</a></span> +</dt> <dt><code class="code">nomips16</code></dt> <dd> <p>On MIPS targets, you can use the <code class="code">mips16</code> and <code class="code">nomips16</code> function attributes to locally select or turn off MIPS16 code generation. A function with the <code class="code">mips16</code> attribute is emitted as MIPS16 code, while MIPS16 code generation is disabled for functions with the <code class="code">nomips16</code> attribute. These attributes override the <samp class="option">-mips16</samp> and <samp class="option">-mno-mips16</samp> options on the command line (see <a class="pxref" href="mips-options">MIPS Options</a>). </p> <p>When compiling files containing mixed MIPS16 and non-MIPS16 code, the preprocessor symbol <code class="code">__mips16</code> reflects the setting on the command line, not that within individual functions. Mixed MIPS16 and non-MIPS16 code may interact badly with some GCC extensions such as <code class="code">__builtin_apply</code> (see <a class="pxref" href="constructing-calls">Constructing Function Calls</a>). </p> </dd> <dt> + <span><code class="code">micromips, MIPS</code><a class="copiable-link" href="#index-micromips-function-attribute"> ¶</a></span> +</dt> <dt><code class="code">nomicromips, MIPS</code></dt> <dd> <p>On MIPS targets, you can use the <code class="code">micromips</code> and <code class="code">nomicromips</code> function attributes to locally select or turn off microMIPS code generation. A function with the <code class="code">micromips</code> attribute is emitted as microMIPS code, while microMIPS code generation is disabled for functions with the <code class="code">nomicromips</code> attribute. These attributes override the <samp class="option">-mmicromips</samp> and <samp class="option">-mno-micromips</samp> options on the command line (see <a class="pxref" href="mips-options">MIPS Options</a>). </p> <p>When compiling files containing mixed microMIPS and non-microMIPS code, the preprocessor symbol <code class="code">__mips_micromips</code> reflects the setting on the command line, not that within individual functions. Mixed microMIPS and non-microMIPS code may interact badly with some GCC extensions such as <code class="code">__builtin_apply</code> (see <a class="pxref" href="constructing-calls">Constructing Function Calls</a>). </p> </dd> <dt> +<span><code class="code">nocompression</code><a class="copiable-link" href="#index-nocompression-function-attribute_002c-MIPS"> ¶</a></span> +</dt> <dd> +<p>On MIPS targets, you can use the <code class="code">nocompression</code> function attribute to locally turn off MIPS16 and microMIPS code generation. This attribute overrides the <samp class="option">-mips16</samp> and <samp class="option">-mmicromips</samp> options on the command line (see <a class="pxref" href="mips-options">MIPS Options</a>). </p> </dd> <dt> +<span><code class="code">use_hazard_barrier_return</code><a class="copiable-link" href="#index-use_005fhazard_005fbarrier_005freturn-function-attribute_002c-MIPS"> ¶</a></span> +</dt> <dd><p>This function attribute instructs the compiler to generate a hazard barrier return that clears all execution and instruction hazards while returning, instead of generating a normal return instruction. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="msp430-function-attributes">MSP430 Function Attributes</a>, Previous: <a href="microsoft-windows-function-attributes">Microsoft Windows Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mips-loongson-built-in-functions.html b/devdocs/gcc~13/mips-loongson-built-in-functions.html new file mode 100644 index 00000000..1df6e54e --- /dev/null +++ b/devdocs/gcc~13/mips-loongson-built-in-functions.html @@ -0,0 +1,117 @@ +<div class="subsection-level-extent" id="MIPS-Loongson-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="mips-simd-architecture-_0028msa_0029-support" accesskey="n" rel="next">MIPS SIMD Architecture (MSA) Support</a>, Previous: <a href="mips-paired-single-support" accesskey="p" rel="prev">MIPS Paired-Single Support</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MIPS-Loongson-Built-in-Functions-1"><span>6.60.17 MIPS Loongson Built-in Functions<a class="copiable-link" href="#MIPS-Loongson-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC provides intrinsics to access the SIMD instructions provided by the ST Microelectronics Loongson-2E and -2F processors. These intrinsics, available after inclusion of the <code class="code">loongson.h</code> header file, operate on the following 64-bit vector types: </p> <ul class="itemize mark-bullet"> <li> +<code class="code">uint8x8_t</code>, a vector of eight unsigned 8-bit integers; </li> +<li> +<code class="code">uint16x4_t</code>, a vector of four unsigned 16-bit integers; </li> +<li> +<code class="code">uint32x2_t</code>, a vector of two unsigned 32-bit integers; </li> +<li> +<code class="code">int8x8_t</code>, a vector of eight signed 8-bit integers; </li> +<li> +<code class="code">int16x4_t</code>, a vector of four signed 16-bit integers; </li> +<li> +<code class="code">int32x2_t</code>, a vector of two signed 32-bit integers. </li> +</ul> <p>The intrinsics provided are listed below; each is named after the machine instruction to which it corresponds, with suffixes added as appropriate to distinguish intrinsics that expand to the same machine instruction yet have different argument types. Refer to the architecture documentation for a description of the functionality of each instruction. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int16x4_t packsswh (int32x2_t s, int32x2_t t); +int8x8_t packsshb (int16x4_t s, int16x4_t t); +uint8x8_t packushb (uint16x4_t s, uint16x4_t t); +uint32x2_t paddw_u (uint32x2_t s, uint32x2_t t); +uint16x4_t paddh_u (uint16x4_t s, uint16x4_t t); +uint8x8_t paddb_u (uint8x8_t s, uint8x8_t t); +int32x2_t paddw_s (int32x2_t s, int32x2_t t); +int16x4_t paddh_s (int16x4_t s, int16x4_t t); +int8x8_t paddb_s (int8x8_t s, int8x8_t t); +uint64_t paddd_u (uint64_t s, uint64_t t); +int64_t paddd_s (int64_t s, int64_t t); +int16x4_t paddsh (int16x4_t s, int16x4_t t); +int8x8_t paddsb (int8x8_t s, int8x8_t t); +uint16x4_t paddush (uint16x4_t s, uint16x4_t t); +uint8x8_t paddusb (uint8x8_t s, uint8x8_t t); +uint64_t pandn_ud (uint64_t s, uint64_t t); +uint32x2_t pandn_uw (uint32x2_t s, uint32x2_t t); +uint16x4_t pandn_uh (uint16x4_t s, uint16x4_t t); +uint8x8_t pandn_ub (uint8x8_t s, uint8x8_t t); +int64_t pandn_sd (int64_t s, int64_t t); +int32x2_t pandn_sw (int32x2_t s, int32x2_t t); +int16x4_t pandn_sh (int16x4_t s, int16x4_t t); +int8x8_t pandn_sb (int8x8_t s, int8x8_t t); +uint16x4_t pavgh (uint16x4_t s, uint16x4_t t); +uint8x8_t pavgb (uint8x8_t s, uint8x8_t t); +uint32x2_t pcmpeqw_u (uint32x2_t s, uint32x2_t t); +uint16x4_t pcmpeqh_u (uint16x4_t s, uint16x4_t t); +uint8x8_t pcmpeqb_u (uint8x8_t s, uint8x8_t t); +int32x2_t pcmpeqw_s (int32x2_t s, int32x2_t t); +int16x4_t pcmpeqh_s (int16x4_t s, int16x4_t t); +int8x8_t pcmpeqb_s (int8x8_t s, int8x8_t t); +uint32x2_t pcmpgtw_u (uint32x2_t s, uint32x2_t t); +uint16x4_t pcmpgth_u (uint16x4_t s, uint16x4_t t); +uint8x8_t pcmpgtb_u (uint8x8_t s, uint8x8_t t); +int32x2_t pcmpgtw_s (int32x2_t s, int32x2_t t); +int16x4_t pcmpgth_s (int16x4_t s, int16x4_t t); +int8x8_t pcmpgtb_s (int8x8_t s, int8x8_t t); +uint16x4_t pextrh_u (uint16x4_t s, int field); +int16x4_t pextrh_s (int16x4_t s, int field); +uint16x4_t pinsrh_0_u (uint16x4_t s, uint16x4_t t); +uint16x4_t pinsrh_1_u (uint16x4_t s, uint16x4_t t); +uint16x4_t pinsrh_2_u (uint16x4_t s, uint16x4_t t); +uint16x4_t pinsrh_3_u (uint16x4_t s, uint16x4_t t); +int16x4_t pinsrh_0_s (int16x4_t s, int16x4_t t); +int16x4_t pinsrh_1_s (int16x4_t s, int16x4_t t); +int16x4_t pinsrh_2_s (int16x4_t s, int16x4_t t); +int16x4_t pinsrh_3_s (int16x4_t s, int16x4_t t); +int32x2_t pmaddhw (int16x4_t s, int16x4_t t); +int16x4_t pmaxsh (int16x4_t s, int16x4_t t); +uint8x8_t pmaxub (uint8x8_t s, uint8x8_t t); +int16x4_t pminsh (int16x4_t s, int16x4_t t); +uint8x8_t pminub (uint8x8_t s, uint8x8_t t); +uint8x8_t pmovmskb_u (uint8x8_t s); +int8x8_t pmovmskb_s (int8x8_t s); +uint16x4_t pmulhuh (uint16x4_t s, uint16x4_t t); +int16x4_t pmulhh (int16x4_t s, int16x4_t t); +int16x4_t pmullh (int16x4_t s, int16x4_t t); +int64_t pmuluw (uint32x2_t s, uint32x2_t t); +uint8x8_t pasubub (uint8x8_t s, uint8x8_t t); +uint16x4_t biadd (uint8x8_t s); +uint16x4_t psadbh (uint8x8_t s, uint8x8_t t); +uint16x4_t pshufh_u (uint16x4_t dest, uint16x4_t s, uint8_t order); +int16x4_t pshufh_s (int16x4_t dest, int16x4_t s, uint8_t order); +uint16x4_t psllh_u (uint16x4_t s, uint8_t amount); +int16x4_t psllh_s (int16x4_t s, uint8_t amount); +uint32x2_t psllw_u (uint32x2_t s, uint8_t amount); +int32x2_t psllw_s (int32x2_t s, uint8_t amount); +uint16x4_t psrlh_u (uint16x4_t s, uint8_t amount); +int16x4_t psrlh_s (int16x4_t s, uint8_t amount); +uint32x2_t psrlw_u (uint32x2_t s, uint8_t amount); +int32x2_t psrlw_s (int32x2_t s, uint8_t amount); +uint16x4_t psrah_u (uint16x4_t s, uint8_t amount); +int16x4_t psrah_s (int16x4_t s, uint8_t amount); +uint32x2_t psraw_u (uint32x2_t s, uint8_t amount); +int32x2_t psraw_s (int32x2_t s, uint8_t amount); +uint32x2_t psubw_u (uint32x2_t s, uint32x2_t t); +uint16x4_t psubh_u (uint16x4_t s, uint16x4_t t); +uint8x8_t psubb_u (uint8x8_t s, uint8x8_t t); +int32x2_t psubw_s (int32x2_t s, int32x2_t t); +int16x4_t psubh_s (int16x4_t s, int16x4_t t); +int8x8_t psubb_s (int8x8_t s, int8x8_t t); +uint64_t psubd_u (uint64_t s, uint64_t t); +int64_t psubd_s (int64_t s, int64_t t); +int16x4_t psubsh (int16x4_t s, int16x4_t t); +int8x8_t psubsb (int8x8_t s, int8x8_t t); +uint16x4_t psubush (uint16x4_t s, uint16x4_t t); +uint8x8_t psubusb (uint8x8_t s, uint8x8_t t); +uint32x2_t punpckhwd_u (uint32x2_t s, uint32x2_t t); +uint16x4_t punpckhhw_u (uint16x4_t s, uint16x4_t t); +uint8x8_t punpckhbh_u (uint8x8_t s, uint8x8_t t); +int32x2_t punpckhwd_s (int32x2_t s, int32x2_t t); +int16x4_t punpckhhw_s (int16x4_t s, int16x4_t t); +int8x8_t punpckhbh_s (int8x8_t s, int8x8_t t); +uint32x2_t punpcklwd_u (uint32x2_t s, uint32x2_t t); +uint16x4_t punpcklhw_u (uint16x4_t s, uint16x4_t t); +uint8x8_t punpcklbh_u (uint8x8_t s, uint8x8_t t); +int32x2_t punpcklwd_s (int32x2_t s, int32x2_t t); +int16x4_t punpcklhw_s (int16x4_t s, int16x4_t t); +int8x8_t punpcklbh_s (int8x8_t s, int8x8_t t);</pre> +</div> <ul class="mini-toc"> <li><a href="paired-single-arithmetic" accesskey="1">Paired-Single Arithmetic</a></li> <li><a href="paired-single-built-in-functions" accesskey="2">Paired-Single Built-in Functions</a></li> <li><a href="mips-3d-built-in-functions" accesskey="3">MIPS-3D Built-in Functions</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="mips-simd-architecture-_0028msa_0029-support">MIPS SIMD Architecture (MSA) Support</a>, Previous: <a href="mips-paired-single-support">MIPS Paired-Single Support</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-Loongson-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-Loongson-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mips-options.html b/devdocs/gcc~13/mips-options.html new file mode 100644 index 00000000..2c2e9140 --- /dev/null +++ b/devdocs/gcc~13/mips-options.html @@ -0,0 +1,333 @@ +<div class="subsection-level-extent" id="MIPS-Options"> <div class="nav-panel"> <p> Next: <a href="mmix-options" accesskey="n" rel="next">MMIX Options</a>, Previous: <a href="microblaze-options" accesskey="p" rel="prev">MicroBlaze Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MIPS-Options-1"><span>3.19.28 MIPS Options<a class="copiable-link" href="#MIPS-Options-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">-EB</code><a class="copiable-link" href="#index-EB-2"> ¶</a></span> +</dt> <dd> +<p>Generate big-endian code. </p> </dd> <dt> +<span><code class="code">-EL</code><a class="copiable-link" href="#index-EL-2"> ¶</a></span> +</dt> <dd> +<p>Generate little-endian code. This is the default for ‘<samp class="samp">mips*el-*-*</samp>’ configurations. </p> </dd> <dt> +<span><code class="code">-march=<var class="var">arch</var></code><a class="copiable-link" href="#index-march-9"> ¶</a></span> +</dt> <dd> +<p>Generate code that runs on <var class="var">arch</var>, which can be the name of a generic MIPS ISA, or the name of a particular processor. The ISA names are: ‘<samp class="samp">mips1</samp>’, ‘<samp class="samp">mips2</samp>’, ‘<samp class="samp">mips3</samp>’, ‘<samp class="samp">mips4</samp>’, ‘<samp class="samp">mips32</samp>’, ‘<samp class="samp">mips32r2</samp>’, ‘<samp class="samp">mips32r3</samp>’, ‘<samp class="samp">mips32r5</samp>’, ‘<samp class="samp">mips32r6</samp>’, ‘<samp class="samp">mips64</samp>’, ‘<samp class="samp">mips64r2</samp>’, ‘<samp class="samp">mips64r3</samp>’, ‘<samp class="samp">mips64r5</samp>’ and ‘<samp class="samp">mips64r6</samp>’. The processor names are: ‘<samp class="samp">4kc</samp>’, ‘<samp class="samp">4km</samp>’, ‘<samp class="samp">4kp</samp>’, ‘<samp class="samp">4ksc</samp>’, ‘<samp class="samp">4kec</samp>’, ‘<samp class="samp">4kem</samp>’, ‘<samp class="samp">4kep</samp>’, ‘<samp class="samp">4ksd</samp>’, ‘<samp class="samp">5kc</samp>’, ‘<samp class="samp">5kf</samp>’, ‘<samp class="samp">20kc</samp>’, ‘<samp class="samp">24kc</samp>’, ‘<samp class="samp">24kf2_1</samp>’, ‘<samp class="samp">24kf1_1</samp>’, ‘<samp class="samp">24kec</samp>’, ‘<samp class="samp">24kef2_1</samp>’, ‘<samp class="samp">24kef1_1</samp>’, ‘<samp class="samp">34kc</samp>’, ‘<samp class="samp">34kf2_1</samp>’, ‘<samp class="samp">34kf1_1</samp>’, ‘<samp class="samp">34kn</samp>’, ‘<samp class="samp">74kc</samp>’, ‘<samp class="samp">74kf2_1</samp>’, ‘<samp class="samp">74kf1_1</samp>’, ‘<samp class="samp">74kf3_2</samp>’, ‘<samp class="samp">1004kc</samp>’, ‘<samp class="samp">1004kf2_1</samp>’, ‘<samp class="samp">1004kf1_1</samp>’, ‘<samp class="samp">i6400</samp>’, ‘<samp class="samp">i6500</samp>’, ‘<samp class="samp">interaptiv</samp>’, ‘<samp class="samp">loongson2e</samp>’, ‘<samp class="samp">loongson2f</samp>’, ‘<samp class="samp">loongson3a</samp>’, ‘<samp class="samp">gs464</samp>’, ‘<samp class="samp">gs464e</samp>’, ‘<samp class="samp">gs264e</samp>’, ‘<samp class="samp">m4k</samp>’, ‘<samp class="samp">m14k</samp>’, ‘<samp class="samp">m14kc</samp>’, ‘<samp class="samp">m14ke</samp>’, ‘<samp class="samp">m14kec</samp>’, ‘<samp class="samp">m5100</samp>’, ‘<samp class="samp">m5101</samp>’, ‘<samp class="samp">octeon</samp>’, ‘<samp class="samp">octeon+</samp>’, ‘<samp class="samp">octeon2</samp>’, ‘<samp class="samp">octeon3</samp>’, ‘<samp class="samp">orion</samp>’, ‘<samp class="samp">p5600</samp>’, ‘<samp class="samp">p6600</samp>’, ‘<samp class="samp">r2000</samp>’, ‘<samp class="samp">r3000</samp>’, ‘<samp class="samp">r3900</samp>’, ‘<samp class="samp">r4000</samp>’, ‘<samp class="samp">r4400</samp>’, ‘<samp class="samp">r4600</samp>’, ‘<samp class="samp">r4650</samp>’, ‘<samp class="samp">r4700</samp>’, ‘<samp class="samp">r5900</samp>’, ‘<samp class="samp">r6000</samp>’, ‘<samp class="samp">r8000</samp>’, ‘<samp class="samp">rm7000</samp>’, ‘<samp class="samp">rm9000</samp>’, ‘<samp class="samp">r10000</samp>’, ‘<samp class="samp">r12000</samp>’, ‘<samp class="samp">r14000</samp>’, ‘<samp class="samp">r16000</samp>’, ‘<samp class="samp">sb1</samp>’, ‘<samp class="samp">sr71000</samp>’, ‘<samp class="samp">vr4100</samp>’, ‘<samp class="samp">vr4111</samp>’, ‘<samp class="samp">vr4120</samp>’, ‘<samp class="samp">vr4130</samp>’, ‘<samp class="samp">vr4300</samp>’, ‘<samp class="samp">vr5000</samp>’, ‘<samp class="samp">vr5400</samp>’, ‘<samp class="samp">vr5500</samp>’, ‘<samp class="samp">xlr</samp>’ and ‘<samp class="samp">xlp</samp>’. The special value ‘<samp class="samp">from-abi</samp>’ selects the most compatible architecture for the selected ABI (that is, ‘<samp class="samp">mips1</samp>’ for 32-bit ABIs and ‘<samp class="samp">mips3</samp>’ for 64-bit ABIs). </p> <p>The native Linux/GNU toolchain also supports the value ‘<samp class="samp">native</samp>’, which selects the best architecture option for the host processor. <samp class="option">-march=native</samp> has no effect if GCC does not recognize the processor. </p> <p>In processor names, a final ‘<samp class="samp">000</samp>’ can be abbreviated as ‘<samp class="samp">k</samp>’ (for example, <samp class="option">-march=r2k</samp>). Prefixes are optional, and ‘<samp class="samp">vr</samp>’ may be written ‘<samp class="samp">r</samp>’. </p> <p>Names of the form ‘<samp class="samp"><var class="var">n</var>f2_1</samp>’ refer to processors with FPUs clocked at half the rate of the core, names of the form ‘<samp class="samp"><var class="var">n</var>f1_1</samp>’ refer to processors with FPUs clocked at the same rate as the core, and names of the form ‘<samp class="samp"><var class="var">n</var>f3_2</samp>’ refer to processors with FPUs clocked a ratio of 3:2 with respect to the core. For compatibility reasons, ‘<samp class="samp"><var class="var">n</var>f</samp>’ is accepted as a synonym for ‘<samp class="samp"><var class="var">n</var>f2_1</samp>’ while ‘<samp class="samp"><var class="var">n</var>x</samp>’ and ‘<samp class="samp"><var class="var">b</var>fx</samp>’ are accepted as synonyms for ‘<samp class="samp"><var class="var">n</var>f1_1</samp>’. </p> <p>GCC defines two macros based on the value of this option. The first is <code class="code">_MIPS_ARCH</code>, which gives the name of target architecture, as a string. The second has the form <code class="code">_MIPS_ARCH_<var class="var">foo</var></code>, where <var class="var">foo</var> is the capitalized value of <code class="code">_MIPS_ARCH</code>. For example, <samp class="option">-march=r2000</samp> sets <code class="code">_MIPS_ARCH</code> to <code class="code">"r2000"</code> and defines the macro <code class="code">_MIPS_ARCH_R2000</code>. </p> <p>Note that the <code class="code">_MIPS_ARCH</code> macro uses the processor names given above. In other words, it has the full prefix and does not abbreviate ‘<samp class="samp">000</samp>’ as ‘<samp class="samp">k</samp>’. In the case of ‘<samp class="samp">from-abi</samp>’, the macro names the resolved architecture (either <code class="code">"mips1"</code> or <code class="code">"mips3"</code>). It names the default architecture when no <samp class="option">-march</samp> option is given. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">arch</var></code><a class="copiable-link" href="#index-mtune-10"> ¶</a></span> +</dt> <dd> +<p>Optimize for <var class="var">arch</var>. Among other things, this option controls the way instructions are scheduled, and the perceived cost of arithmetic operations. The list of <var class="var">arch</var> values is the same as for <samp class="option">-march</samp>. </p> <p>When this option is not used, GCC optimizes for the processor specified by <samp class="option">-march</samp>. By using <samp class="option">-march</samp> and <samp class="option">-mtune</samp> together, it is possible to generate code that runs on a family of processors, but optimize the code for one particular member of that family. </p> <p><samp class="option">-mtune</samp> defines the macros <code class="code">_MIPS_TUNE</code> and <code class="code">_MIPS_TUNE_<var class="var">foo</var></code>, which work in the same way as the <samp class="option">-march</samp> ones described above. </p> </dd> <dt> +<span><code class="code">-mips1</code><a class="copiable-link" href="#index-mips1"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips1</samp>. </p> </dd> <dt> +<span><code class="code">-mips2</code><a class="copiable-link" href="#index-mips2"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips2</samp>. </p> </dd> <dt> +<span><code class="code">-mips3</code><a class="copiable-link" href="#index-mips3"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips3</samp>. </p> </dd> <dt> +<span><code class="code">-mips4</code><a class="copiable-link" href="#index-mips4"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips4</samp>. </p> </dd> <dt> +<span><code class="code">-mips32</code><a class="copiable-link" href="#index-mips32"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips32</samp>. </p> </dd> <dt> +<span><code class="code">-mips32r3</code><a class="copiable-link" href="#index-mips32r3"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips32r3</samp>. </p> </dd> <dt> +<span><code class="code">-mips32r5</code><a class="copiable-link" href="#index-mips32r5"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips32r5</samp>. </p> </dd> <dt> +<span><code class="code">-mips32r6</code><a class="copiable-link" href="#index-mips32r6"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips32r6</samp>. </p> </dd> <dt> +<span><code class="code">-mips64</code><a class="copiable-link" href="#index-mips64"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips64</samp>. </p> </dd> <dt> +<span><code class="code">-mips64r2</code><a class="copiable-link" href="#index-mips64r2"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips64r2</samp>. </p> </dd> <dt> +<span><code class="code">-mips64r3</code><a class="copiable-link" href="#index-mips64r3"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips64r3</samp>. </p> </dd> <dt> +<span><code class="code">-mips64r5</code><a class="copiable-link" href="#index-mips64r5"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips64r5</samp>. </p> </dd> <dt> +<span><code class="code">-mips64r6</code><a class="copiable-link" href="#index-mips64r6"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-march=mips64r6</samp>. </p> </dd> <dt> + <span><code class="code">-mips16</code><a class="copiable-link" href="#index-mips16"> ¶</a></span> +</dt> <dt><code class="code">-mno-mips16</code></dt> <dd> +<p>Generate (do not generate) MIPS16 code. If GCC is targeting a MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE. </p> <p>MIPS16 code generation can also be controlled on a per-function basis by means of <code class="code">mips16</code> and <code class="code">nomips16</code> attributes. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>, for more information. </p> </dd> <dt> +<span><code class="code">-mflip-mips16</code><a class="copiable-link" href="#index-mflip-mips16"> ¶</a></span> +</dt> <dd> +<p>Generate MIPS16 code on alternating functions. This option is provided for regression testing of mixed MIPS16/non-MIPS16 code generation, and is not intended for ordinary use in compiling user code. </p> </dd> <dt> + <span><code class="code">-minterlink-compressed</code><a class="copiable-link" href="#index-minterlink-compressed"> ¶</a></span> +</dt> <dt><code class="code">-mno-interlink-compressed</code></dt> <dd> +<p>Require (do not require) that code using the standard (uncompressed) MIPS ISA be link-compatible with MIPS16 and microMIPS code, and vice versa. </p> <p>For example, code using the standard ISA encoding cannot jump directly to MIPS16 or microMIPS code; it must either use a call or an indirect jump. <samp class="option">-minterlink-compressed</samp> therefore disables direct jumps unless GCC knows that the target of the jump is not compressed. </p> </dd> <dt> + <span><code class="code">-minterlink-mips16</code><a class="copiable-link" href="#index-minterlink-mips16"> ¶</a></span> +</dt> <dt><code class="code">-mno-interlink-mips16</code></dt> <dd> +<p>Aliases of <samp class="option">-minterlink-compressed</samp> and <samp class="option">-mno-interlink-compressed</samp>. These options predate the microMIPS ASE and are retained for backwards compatibility. </p> </dd> <dt> + <span><code class="code">-mabi=32</code><a class="copiable-link" href="#index-mabi_003d32"> ¶</a></span> +</dt> <dt><code class="code">-mabi=o64</code></dt> <dt><code class="code">-mabi=n32</code></dt> <dt><code class="code">-mabi=64</code></dt> <dt><code class="code">-mabi=eabi</code></dt> <dd> +<p>Generate code for the given ABI. </p> <p>Note that the EABI has a 32-bit and a 64-bit variant. GCC normally generates 64-bit code when you select a 64-bit architecture, but you can use <samp class="option">-mgp32</samp> to get 32-bit code instead. </p> <p>For information about the O64 ABI, see <a class="uref" href="https://gcc.gnu.org/projects/mipso64-abi.html">https://gcc.gnu.org/projects/mipso64-abi.html</a>. </p> <p>GCC supports a variant of the o32 ABI in which floating-point registers are 64 rather than 32 bits wide. You can select this combination with <samp class="option">-mabi=32</samp> <samp class="option">-mfp64</samp>. This ABI relies on the <code class="code">mthc1</code> and <code class="code">mfhc1</code> instructions and is therefore only supported for MIPS32R2, MIPS32R3 and MIPS32R5 processors. </p> <p>The register assignments for arguments and return values remain the same, but each scalar value is passed in a single 64-bit register rather than a pair of 32-bit registers. For example, scalar floating-point values are returned in ‘<samp class="samp">$f0</samp>’ only, not a ‘<samp class="samp">$f0</samp>’/‘<samp class="samp">$f1</samp>’ pair. The set of call-saved registers also remains the same in that the even-numbered double-precision registers are saved. </p> <p>Two additional variants of the o32 ABI are supported to enable a transition from 32-bit to 64-bit registers. These are FPXX (<samp class="option">-mfpxx</samp>) and FP64A (<samp class="option">-mfp64</samp> <samp class="option">-mno-odd-spreg</samp>). The FPXX extension mandates that all code must execute correctly when run using 32-bit or 64-bit registers. The code can be interlinked with either FP32 or FP64, but not both. The FP64A extension is similar to the FP64 extension but forbids the use of odd-numbered single-precision registers. This can be used in conjunction with the <code class="code">FRE</code> mode of FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to interlink and run in the same process without changing FPU modes. </p> </dd> <dt> + <span><code class="code">-mabicalls</code><a class="copiable-link" href="#index-mabicalls"> ¶</a></span> +</dt> <dt><code class="code">-mno-abicalls</code></dt> <dd> +<p>Generate (do not generate) code that is suitable for SVR4-style dynamic objects. <samp class="option">-mabicalls</samp> is the default for SVR4-based systems. </p> </dd> <dt><code class="code">-mshared</code></dt> <dt><code class="code">-mno-shared</code></dt> <dd> +<p>Generate (do not generate) code that is fully position-independent, and that can therefore be linked into shared libraries. This option only affects <samp class="option">-mabicalls</samp>. </p> <p>All <samp class="option">-mabicalls</samp> code has traditionally been position-independent, regardless of options like <samp class="option">-fPIC</samp> and <samp class="option">-fpic</samp>. However, as an extension, the GNU toolchain allows executables to use absolute accesses for locally-binding symbols. It can also use shorter GP initialization sequences and generate direct calls to locally-defined functions. This mode is selected by <samp class="option">-mno-shared</samp>. </p> <p><samp class="option">-mno-shared</samp> depends on binutils 2.16 or higher and generates objects that can only be linked by the GNU linker. However, the option does not affect the ABI of the final executable; it only affects the ABI of relocatable objects. Using <samp class="option">-mno-shared</samp> generally makes executables both smaller and quicker. </p> <p><samp class="option">-mshared</samp> is the default. </p> </dd> <dt> + <span><code class="code">-mplt</code><a class="copiable-link" href="#index-mplt"> ¶</a></span> +</dt> <dt><code class="code">-mno-plt</code></dt> <dd> +<p>Assume (do not assume) that the static and dynamic linkers support PLTs and copy relocations. This option only affects <samp class="option">-mno-shared -mabicalls</samp>. For the n64 ABI, this option has no effect without <samp class="option">-msym32</samp>. </p> <p>You can make <samp class="option">-mplt</samp> the default by configuring GCC with <samp class="option">--with-mips-plt</samp>. The default is <samp class="option">-mno-plt</samp> otherwise. </p> </dd> <dt> + <span><code class="code">-mxgot</code><a class="copiable-link" href="#index-mxgot-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-xgot</code></dt> <dd> +<p>Lift (do not lift) the usual restrictions on the size of the global offset table. </p> <p>GCC normally uses a single instruction to load values from the GOT. While this is relatively efficient, it only works if the GOT is smaller than about 64k. Anything larger causes the linker to report an error such as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">relocation truncated to fit: R_MIPS_GOT16 foobar</pre> +</div> <p>If this happens, you should recompile your code with <samp class="option">-mxgot</samp>. This works with very large GOTs, although the code is also less efficient, since it takes three instructions to fetch the value of a global symbol. </p> <p>Note that some linkers can create multiple GOTs. If you have such a linker, you should only need to use <samp class="option">-mxgot</samp> when a single object file accesses more than 64k’s worth of GOT entries. Very few do. </p> <p>These options have no effect unless GCC is generating position independent code. </p> </dd> <dt> +<span><code class="code">-mgp32</code><a class="copiable-link" href="#index-mgp32"> ¶</a></span> +</dt> <dd> +<p>Assume that general-purpose registers are 32 bits wide. </p> </dd> <dt> +<span><code class="code">-mgp64</code><a class="copiable-link" href="#index-mgp64"> ¶</a></span> +</dt> <dd> +<p>Assume that general-purpose registers are 64 bits wide. </p> </dd> <dt> +<span><code class="code">-mfp32</code><a class="copiable-link" href="#index-mfp32"> ¶</a></span> +</dt> <dd> +<p>Assume that floating-point registers are 32 bits wide. </p> </dd> <dt> +<span><code class="code">-mfp64</code><a class="copiable-link" href="#index-mfp64"> ¶</a></span> +</dt> <dd> +<p>Assume that floating-point registers are 64 bits wide. </p> </dd> <dt> +<span><code class="code">-mfpxx</code><a class="copiable-link" href="#index-mfpxx"> ¶</a></span> +</dt> <dd> +<p>Do not assume the width of floating-point registers. </p> </dd> <dt> +<span><code class="code">-mhard-float</code><a class="copiable-link" href="#index-mhard-float-4"> ¶</a></span> +</dt> <dd> +<p>Use floating-point coprocessor instructions. </p> </dd> <dt> +<span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-8"> ¶</a></span> +</dt> <dd> +<p>Do not use floating-point coprocessor instructions. Implement floating-point calculations using library calls instead. </p> </dd> <dt> +<span><code class="code">-mno-float</code><a class="copiable-link" href="#index-mno-float"> ¶</a></span> +</dt> <dd> +<p>Equivalent to <samp class="option">-msoft-float</samp>, but additionally asserts that the program being compiled does not perform any floating-point operations. This option is presently supported only by some bare-metal MIPS configurations, where it may select a special set of libraries that lack all floating-point support (including, for example, the floating-point <code class="code">printf</code> formats). If code compiled with <samp class="option">-mno-float</samp> accidentally contains floating-point operations, it is likely to suffer a link-time or run-time failure. </p> </dd> <dt> +<span><code class="code">-msingle-float</code><a class="copiable-link" href="#index-msingle-float-1"> ¶</a></span> +</dt> <dd> +<p>Assume that the floating-point coprocessor only supports single-precision operations. </p> </dd> <dt> +<span><code class="code">-mdouble-float</code><a class="copiable-link" href="#index-mdouble-float-2"> ¶</a></span> +</dt> <dd> +<p>Assume that the floating-point coprocessor supports double-precision operations. This is the default. </p> </dd> <dt> + <span><code class="code">-modd-spreg</code><a class="copiable-link" href="#index-modd-spreg"> ¶</a></span> +</dt> <dt><code class="code">-mno-odd-spreg</code></dt> <dd> +<p>Enable the use of odd-numbered single-precision floating-point registers for the o32 ABI. This is the default for processors that are known to support these registers. When using the o32 FPXX ABI, <samp class="option">-mno-odd-spreg</samp> is set by default. </p> </dd> <dt> + <span><code class="code">-mabs=2008</code><a class="copiable-link" href="#index-mabs_003d2008"> ¶</a></span> +</dt> <dt><code class="code">-mabs=legacy</code></dt> <dd> +<p>These options control the treatment of the special not-a-number (NaN) IEEE 754 floating-point data with the <code class="code">abs.<i class="i">fmt</i></code> and <code class="code">neg.<i class="i">fmt</i></code> machine instructions. </p> <p>By default or when <samp class="option">-mabs=legacy</samp> is used the legacy treatment is selected. In this case these instructions are considered arithmetic and avoided where correct operation is required and the input operand might be a NaN. A longer sequence of instructions that manipulate the sign bit of floating-point datum manually is used instead unless the <samp class="option">-ffinite-math-only</samp> option has also been specified. </p> <p>The <samp class="option">-mabs=2008</samp> option selects the IEEE 754-2008 treatment. In this case these instructions are considered non-arithmetic and therefore operating correctly in all cases, including in particular where the input operand is a NaN. These instructions are therefore always used for the respective operations. </p> </dd> <dt> + <span><code class="code">-mnan=2008</code><a class="copiable-link" href="#index-mnan_003d2008"> ¶</a></span> +</dt> <dt><code class="code">-mnan=legacy</code></dt> <dd> +<p>These options control the encoding of the special not-a-number (NaN) IEEE 754 floating-point data. </p> <p>The <samp class="option">-mnan=legacy</samp> option selects the legacy encoding. In this case quiet NaNs (qNaNs) are denoted by the first bit of their trailing significand field being 0, whereas signaling NaNs (sNaNs) are denoted by the first bit of their trailing significand field being 1. </p> <p>The <samp class="option">-mnan=2008</samp> option selects the IEEE 754-2008 encoding. In this case qNaNs are denoted by the first bit of their trailing significand field being 1, whereas sNaNs are denoted by the first bit of their trailing significand field being 0. </p> <p>The default is <samp class="option">-mnan=legacy</samp> unless GCC has been configured with <samp class="option">--with-nan=2008</samp>. </p> </dd> <dt> + <span><code class="code">-mllsc</code><a class="copiable-link" href="#index-mllsc"> ¶</a></span> +</dt> <dt><code class="code">-mno-llsc</code></dt> <dd> +<p>Use (do not use) ‘<samp class="samp">ll</samp>’, ‘<samp class="samp">sc</samp>’, and ‘<samp class="samp">sync</samp>’ instructions to implement atomic memory built-in functions. When neither option is specified, GCC uses the instructions if the target architecture supports them. </p> <p><samp class="option">-mllsc</samp> is useful if the runtime environment can emulate the instructions and <samp class="option">-mno-llsc</samp> can be useful when compiling for nonstandard ISAs. You can make either option the default by configuring GCC with <samp class="option">--with-llsc</samp> and <samp class="option">--without-llsc</samp> respectively. <samp class="option">--with-llsc</samp> is the default for some configurations; see the installation documentation for details. </p> </dd> <dt> + <span><code class="code">-mdsp</code><a class="copiable-link" href="#index-mdsp-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-dsp</code></dt> <dd> +<p>Use (do not use) revision 1 of the MIPS DSP ASE. See <a class="xref" href="mips-dsp-built-in-functions">MIPS DSP Built-in Functions</a>. This option defines the preprocessor macro <code class="code">__mips_dsp</code>. It also defines <code class="code">__mips_dsp_rev</code> to 1. </p> </dd> <dt> + <span><code class="code">-mdspr2</code><a class="copiable-link" href="#index-mdspr2"> ¶</a></span> +</dt> <dt><code class="code">-mno-dspr2</code></dt> <dd> +<p>Use (do not use) revision 2 of the MIPS DSP ASE. See <a class="xref" href="mips-dsp-built-in-functions">MIPS DSP Built-in Functions</a>. This option defines the preprocessor macros <code class="code">__mips_dsp</code> and <code class="code">__mips_dspr2</code>. It also defines <code class="code">__mips_dsp_rev</code> to 2. </p> </dd> <dt> + <span><code class="code">-msmartmips</code><a class="copiable-link" href="#index-msmartmips"> ¶</a></span> +</dt> <dt><code class="code">-mno-smartmips</code></dt> <dd> +<p>Use (do not use) the MIPS SmartMIPS ASE. </p> </dd> <dt> + <span><code class="code">-mpaired-single</code><a class="copiable-link" href="#index-mpaired-single"> ¶</a></span> +</dt> <dt><code class="code">-mno-paired-single</code></dt> <dd> +<p>Use (do not use) paired-single floating-point instructions. See <a class="xref" href="mips-paired-single-support">MIPS Paired-Single Support</a>. This option requires hardware floating-point support to be enabled. </p> </dd> <dt> + <span><code class="code">-mdmx</code><a class="copiable-link" href="#index-mdmx"> ¶</a></span> +</dt> <dt><code class="code">-mno-mdmx</code></dt> <dd> +<p>Use (do not use) MIPS Digital Media Extension instructions. This option can only be used when generating 64-bit code and requires hardware floating-point support to be enabled. </p> </dd> <dt> + <span><code class="code">-mips3d</code><a class="copiable-link" href="#index-mips3d"> ¶</a></span> +</dt> <dt><code class="code">-mno-mips3d</code></dt> <dd> +<p>Use (do not use) the MIPS-3D ASE. See <a class="xref" href="mips-3d-built-in-functions">MIPS-3D Built-in Functions</a>. The option <samp class="option">-mips3d</samp> implies <samp class="option">-mpaired-single</samp>. </p> </dd> <dt> + <span><code class="code">-mmicromips</code><a class="copiable-link" href="#index-mmicromips"> ¶</a></span> +</dt> <dt><code class="code">-mno-micromips</code></dt> <dd> +<p>Generate (do not generate) microMIPS code. </p> <p>MicroMIPS code generation can also be controlled on a per-function basis by means of <code class="code">micromips</code> and <code class="code">nomicromips</code> attributes. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>, for more information. </p> </dd> <dt> + <span><code class="code">-mmt</code><a class="copiable-link" href="#index-mmt"> ¶</a></span> +</dt> <dt><code class="code">-mno-mt</code></dt> <dd> +<p>Use (do not use) MT Multithreading instructions. </p> </dd> <dt> + <span><code class="code">-mmcu</code><a class="copiable-link" href="#index-mmcu-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-mcu</code></dt> <dd> +<p>Use (do not use) the MIPS MCU ASE instructions. </p> </dd> <dt> + <span><code class="code">-meva</code><a class="copiable-link" href="#index-meva"> ¶</a></span> +</dt> <dt><code class="code">-mno-eva</code></dt> <dd> +<p>Use (do not use) the MIPS Enhanced Virtual Addressing instructions. </p> </dd> <dt> + <span><code class="code">-mvirt</code><a class="copiable-link" href="#index-mvirt"> ¶</a></span> +</dt> <dt><code class="code">-mno-virt</code></dt> <dd> +<p>Use (do not use) the MIPS Virtualization (VZ) instructions. </p> </dd> <dt> + <span><code class="code">-mxpa</code><a class="copiable-link" href="#index-mxpa"> ¶</a></span> +</dt> <dt><code class="code">-mno-xpa</code></dt> <dd> +<p>Use (do not use) the MIPS eXtended Physical Address (XPA) instructions. </p> </dd> <dt> + <span><code class="code">-mcrc</code><a class="copiable-link" href="#index-mcrc"> ¶</a></span> +</dt> <dt><code class="code">-mno-crc</code></dt> <dd> +<p>Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions. </p> </dd> <dt> + <span><code class="code">-mginv</code><a class="copiable-link" href="#index-mginv"> ¶</a></span> +</dt> <dt><code class="code">-mno-ginv</code></dt> <dd> +<p>Use (do not use) the MIPS Global INValidate (GINV) instructions. </p> </dd> <dt> + <span><code class="code">-mloongson-mmi</code><a class="copiable-link" href="#index-mloongson-mmi"> ¶</a></span> +</dt> <dt><code class="code">-mno-loongson-mmi</code></dt> <dd> +<p>Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI). </p> </dd> <dt> + <span><code class="code">-mloongson-ext</code><a class="copiable-link" href="#index-mloongson-ext"> ¶</a></span> +</dt> <dt><code class="code">-mno-loongson-ext</code></dt> <dd> +<p>Use (do not use) the MIPS Loongson EXTensions (EXT) instructions. </p> </dd> <dt> + <span><code class="code">-mloongson-ext2</code><a class="copiable-link" href="#index-mloongson-ext2"> ¶</a></span> +</dt> <dt><code class="code">-mno-loongson-ext2</code></dt> <dd> +<p>Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions. </p> </dd> <dt> +<span><code class="code">-mlong64</code><a class="copiable-link" href="#index-mlong64"> ¶</a></span> +</dt> <dd> +<p>Force <code class="code">long</code> types to be 64 bits wide. See <samp class="option">-mlong32</samp> for an explanation of the default and the way that the pointer size is determined. </p> </dd> <dt> +<span><code class="code">-mlong32</code><a class="copiable-link" href="#index-mlong32"> ¶</a></span> +</dt> <dd> +<p>Force <code class="code">long</code>, <code class="code">int</code>, and pointer types to be 32 bits wide. </p> <p>The default size of <code class="code">int</code>s, <code class="code">long</code>s and pointers depends on the ABI. All the supported ABIs use 32-bit <code class="code">int</code>s. The n64 ABI uses 64-bit <code class="code">long</code>s, as does the 64-bit EABI; the others use 32-bit <code class="code">long</code>s. Pointers are the same size as <code class="code">long</code>s, or the same size as integer registers, whichever is smaller. </p> </dd> <dt> + <span><code class="code">-msym32</code><a class="copiable-link" href="#index-msym32"> ¶</a></span> +</dt> <dt><code class="code">-mno-sym32</code></dt> <dd> +<p>Assume (do not assume) that all symbols have 32-bit values, regardless of the selected ABI. This option is useful in combination with <samp class="option">-mabi=64</samp> and <samp class="option">-mno-abicalls</samp> because it allows GCC to generate shorter and faster references to symbolic addresses. </p> </dd> <dt> +<span><code class="code">-G <var class="var">num</var></code><a class="copiable-link" href="#index-G-2"> ¶</a></span> +</dt> <dd> +<p>Put definitions of externally-visible data in a small data section if that data is no bigger than <var class="var">num</var> bytes. GCC can then generate more efficient accesses to the data; see <samp class="option">-mgpopt</samp> for details. </p> <p>The default <samp class="option">-G</samp> option depends on the configuration. </p> </dd> <dt> + <span><code class="code">-mlocal-sdata</code><a class="copiable-link" href="#index-mlocal-sdata"> ¶</a></span> +</dt> <dt><code class="code">-mno-local-sdata</code></dt> <dd> +<p>Extend (do not extend) the <samp class="option">-G</samp> behavior to local data too, such as to static variables in C. <samp class="option">-mlocal-sdata</samp> is the default for all configurations. </p> <p>If the linker complains that an application is using too much small data, you might want to try rebuilding the less performance-critical parts with <samp class="option">-mno-local-sdata</samp>. You might also want to build large libraries with <samp class="option">-mno-local-sdata</samp>, so that the libraries leave more room for the main program. </p> </dd> <dt> + <span><code class="code">-mextern-sdata</code><a class="copiable-link" href="#index-mextern-sdata"> ¶</a></span> +</dt> <dt><code class="code">-mno-extern-sdata</code></dt> <dd> +<p>Assume (do not assume) that externally-defined data is in a small data section if the size of that data is within the <samp class="option">-G</samp> limit. <samp class="option">-mextern-sdata</samp> is the default for all configurations. </p> <p>If you compile a module <var class="var">Mod</var> with <samp class="option">-mextern-sdata</samp> <samp class="option">-G <var class="var">num</var></samp> <samp class="option">-mgpopt</samp>, and <var class="var">Mod</var> references a variable <var class="var">Var</var> that is no bigger than <var class="var">num</var> bytes, you must make sure that <var class="var">Var</var> is placed in a small data section. If <var class="var">Var</var> is defined by another module, you must either compile that module with a high-enough <samp class="option">-G</samp> setting or attach a <code class="code">section</code> attribute to <var class="var">Var</var>’s definition. If <var class="var">Var</var> is common, you must link the application with a high-enough <samp class="option">-G</samp> setting. </p> <p>The easiest way of satisfying these restrictions is to compile and link every module with the same <samp class="option">-G</samp> option. However, you may wish to build a library that supports several different small data limits. You can do this by compiling the library with the highest supported <samp class="option">-G</samp> setting and additionally using <samp class="option">-mno-extern-sdata</samp> to stop the library from making assumptions about externally-defined data. </p> </dd> <dt> + <span><code class="code">-mgpopt</code><a class="copiable-link" href="#index-mgpopt"> ¶</a></span> +</dt> <dt><code class="code">-mno-gpopt</code></dt> <dd> +<p>Use (do not use) GP-relative accesses for symbols that are known to be in a small data section; see <samp class="option">-G</samp>, <samp class="option">-mlocal-sdata</samp> and <samp class="option">-mextern-sdata</samp>. <samp class="option">-mgpopt</samp> is the default for all configurations. </p> <p><samp class="option">-mno-gpopt</samp> is useful for cases where the <code class="code">$gp</code> register might not hold the value of <code class="code">_gp</code>. For example, if the code is part of a library that might be used in a boot monitor, programs that call boot monitor routines pass an unknown value in <code class="code">$gp</code>. (In such situations, the boot monitor itself is usually compiled with <samp class="option">-G0</samp>.) </p> <p><samp class="option">-mno-gpopt</samp> implies <samp class="option">-mno-local-sdata</samp> and <samp class="option">-mno-extern-sdata</samp>. </p> </dd> <dt> + <span><code class="code">-membedded-data</code><a class="copiable-link" href="#index-membedded-data"> ¶</a></span> +</dt> <dt><code class="code">-mno-embedded-data</code></dt> <dd> +<p>Allocate variables to the read-only data section first if possible, then next in the small data section if possible, otherwise in data. This gives slightly slower code than the default, but reduces the amount of RAM required when executing, and thus may be preferred for some embedded systems. </p> </dd> <dt> + <span><code class="code">-muninit-const-in-rodata</code><a class="copiable-link" href="#index-muninit-const-in-rodata"> ¶</a></span> +</dt> <dt><code class="code">-mno-uninit-const-in-rodata</code></dt> <dd> +<p>Put uninitialized <code class="code">const</code> variables in the read-only data section. This option is only meaningful in conjunction with <samp class="option">-membedded-data</samp>. </p> </dd> <dt> +<span><code class="code">-mcode-readable=<var class="var">setting</var></code><a class="copiable-link" href="#index-mcode-readable"> ¶</a></span> +</dt> <dd> +<p>Specify whether GCC may generate code that reads from executable sections. There are three possible settings: </p> <dl class="table"> <dt><code class="code">-mcode-readable=yes</code></dt> <dd> +<p>Instructions may freely access executable sections. This is the default setting. </p> </dd> <dt><code class="code">-mcode-readable=pcrel</code></dt> <dd> +<p>MIPS16 PC-relative load instructions can access executable sections, but other instructions must not do so. This option is useful on 4KSc and 4KSd processors when the code TLBs have the Read Inhibit bit set. It is also useful on processors that can be configured to have a dual instruction/data SRAM interface and that, like the M4K, automatically redirect PC-relative loads to the instruction RAM. </p> </dd> <dt><code class="code">-mcode-readable=no</code></dt> <dd><p>Instructions must not access executable sections. This option can be useful on targets that are configured to have a dual instruction/data SRAM interface but that (unlike the M4K) do not automatically redirect PC-relative loads to the instruction RAM. </p></dd> </dl> </dd> <dt> + <span><code class="code">-msplit-addresses</code><a class="copiable-link" href="#index-msplit-addresses"> ¶</a></span> +</dt> <dt><code class="code">-mno-split-addresses</code></dt> <dd> +<p>Enable (disable) use of the <code class="code">%hi()</code> and <code class="code">%lo()</code> assembler relocation operators. This option has been superseded by <samp class="option">-mexplicit-relocs</samp> but is retained for backwards compatibility. </p> </dd> <dt> + <span><code class="code">-mexplicit-relocs</code><a class="copiable-link" href="#index-mexplicit-relocs-2"> ¶</a></span> +</dt> <dt><code class="code">-mno-explicit-relocs</code></dt> <dd> +<p>Use (do not use) assembler relocation operators when dealing with symbolic addresses. The alternative, selected by <samp class="option">-mno-explicit-relocs</samp>, is to use assembler macros instead. </p> <p><samp class="option">-mexplicit-relocs</samp> is the default if GCC was configured to use an assembler that supports relocation operators. </p> </dd> <dt> + <span><code class="code">-mcheck-zero-division</code><a class="copiable-link" href="#index-mcheck-zero-division-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-check-zero-division</code></dt> <dd> +<p>Trap (do not trap) on integer division by zero. </p> <p>The default is <samp class="option">-mcheck-zero-division</samp>. </p> </dd> <dt> + <span><code class="code">-mdivide-traps</code><a class="copiable-link" href="#index-mdivide-traps"> ¶</a></span> +</dt> <dt><code class="code">-mdivide-breaks</code></dt> <dd> +<p>MIPS systems check for division by zero by generating either a conditional trap or a break instruction. Using traps results in smaller code, but is only supported on MIPS II and later. Also, some versions of the Linux kernel have a bug that prevents trap from generating the proper signal (<code class="code">SIGFPE</code>). Use <samp class="option">-mdivide-traps</samp> to allow conditional traps on architectures that support them and <samp class="option">-mdivide-breaks</samp> to force the use of breaks. </p> <p>The default is usually <samp class="option">-mdivide-traps</samp>, but this can be overridden at configure time using <samp class="option">--with-divide=breaks</samp>. Divide-by-zero checks can be completely disabled using <samp class="option">-mno-check-zero-division</samp>. </p> </dd> <dt> + <span><code class="code">-mload-store-pairs</code><a class="copiable-link" href="#index-mload-store-pairs"> ¶</a></span> +</dt> <dt><code class="code">-mno-load-store-pairs</code></dt> <dd> +<p>Enable (disable) an optimization that pairs consecutive load or store instructions to enable load/store bonding. This option is enabled by default but only takes effect when the selected architecture is known to support bonding. </p> </dd> <dt> + <span><code class="code">-munaligned-access</code><a class="copiable-link" href="#index-munaligned-access-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-unaligned-access</code></dt> <dd> +<p>Enable (disable) direct unaligned access for MIPS Release 6. MIPSr6 requires load/store unaligned-access support, by hardware or trap&emulate. So <samp class="option">-mno-unaligned-access</samp> may be needed by kernel. </p> </dd> <dt> + <span><code class="code">-mmemcpy</code><a class="copiable-link" href="#index-mmemcpy-2"> ¶</a></span> +</dt> <dt><code class="code">-mno-memcpy</code></dt> <dd> +<p>Force (do not force) the use of <code class="code">memcpy</code> for non-trivial block moves. The default is <samp class="option">-mno-memcpy</samp>, which allows GCC to inline most constant-sized copies. </p> </dd> <dt> + <span><code class="code">-mlong-calls</code><a class="copiable-link" href="#index-mlong-calls-6"> ¶</a></span> +</dt> <dt><code class="code">-mno-long-calls</code></dt> <dd> +<p>Disable (do not disable) use of the <code class="code">jal</code> instruction. Calling functions using <code class="code">jal</code> is more efficient but requires the caller and callee to be in the same 256 megabyte segment. </p> <p>This option has no effect on abicalls code. The default is <samp class="option">-mno-long-calls</samp>. </p> </dd> <dt> + <span><code class="code">-mmad</code><a class="copiable-link" href="#index-mmad"> ¶</a></span> +</dt> <dt><code class="code">-mno-mad</code></dt> <dd> +<p>Enable (disable) use of the <code class="code">mad</code>, <code class="code">madu</code> and <code class="code">mul</code> instructions, as provided by the R4650 ISA. </p> </dd> <dt> + <span><code class="code">-mimadd</code><a class="copiable-link" href="#index-mimadd"> ¶</a></span> +</dt> <dt><code class="code">-mno-imadd</code></dt> <dd> +<p>Enable (disable) use of the <code class="code">madd</code> and <code class="code">msub</code> integer instructions. The default is <samp class="option">-mimadd</samp> on architectures that support <code class="code">madd</code> and <code class="code">msub</code> except for the 74k architecture where it was found to generate slower code. </p> </dd> <dt> + <span><code class="code">-mfused-madd</code><a class="copiable-link" href="#index-mfused-madd-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-fused-madd</code></dt> <dd> +<p>Enable (disable) use of the floating-point multiply-accumulate instructions, when they are available. The default is <samp class="option">-mfused-madd</samp>. </p> <p>On the R8000 CPU when multiply-accumulate instructions are used, the intermediate product is calculated to infinite precision and is not subject to the FCSR Flush to Zero bit. This may be undesirable in some circumstances. On other processors the result is numerically identical to the equivalent computation using separate multiply, add, subtract and negate instructions. </p> </dd> <dt> +<span><code class="code">-nocpp</code><a class="copiable-link" href="#index-nocpp"> ¶</a></span> +</dt> <dd> +<p>Tell the MIPS assembler to not run its preprocessor over user assembler files (with a ‘<samp class="samp">.s</samp>’ suffix) when assembling them. </p> </dd> <dt> + <span><code class="code">-mfix-24k</code><a class="copiable-link" href="#index-mfix-24k"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-24k</code></dt> <dd> +<p>Work around the 24K E48 (lost data on stores during refill) errata. The workarounds are implemented by the assembler rather than by GCC. </p> </dd> <dt> + <span><code class="code">-mfix-r4000</code><a class="copiable-link" href="#index-mfix-r4000"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-r4000</code></dt> <dd> +<p>Work around certain R4000 CPU errata: </p> +<ul class="itemize mark-minus"> <li>A double-word or a variable shift may give an incorrect result if executed immediately after starting an integer division. </li> +<li>A double-word or a variable shift may give an incorrect result if executed while an integer multiplication is in progress. </li> +<li>An integer division may give an incorrect result if started in a delay slot of a taken branch or a jump. </li> +</ul> </dd> <dt> + <span><code class="code">-mfix-r4400</code><a class="copiable-link" href="#index-mfix-r4400"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-r4400</code></dt> <dd> +<p>Work around certain R4400 CPU errata: </p> +<ul class="itemize mark-minus"> <li>A double-word or a variable shift may give an incorrect result if executed immediately after starting an integer division. </li> +</ul> </dd> <dt> + <span><code class="code">-mfix-r10000</code><a class="copiable-link" href="#index-mfix-r10000"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-r10000</code></dt> <dd> +<p>Work around certain R10000 errata: </p> +<ul class="itemize mark-minus"> <li> +<code class="code">ll</code>/<code class="code">sc</code> sequences may not behave atomically on revisions prior to 3.0. They may deadlock on revisions 2.6 and earlier. </li> +</ul> <p>This option can only be used if the target architecture supports branch-likely instructions. <samp class="option">-mfix-r10000</samp> is the default when <samp class="option">-march=r10000</samp> is used; <samp class="option">-mno-fix-r10000</samp> is the default otherwise. </p> </dd> <dt> +<span><code class="code">-mfix-r5900</code><a class="copiable-link" href="#index-mfix-r5900"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-r5900</code></dt> <dd> +<p>Do not attempt to schedule the preceding instruction into the delay slot of a branch instruction placed at the end of a short loop of six instructions or fewer and always schedule a <code class="code">nop</code> instruction there instead. The short loop bug under certain conditions causes loops to execute only once or twice, due to a hardware bug in the R5900 chip. The workaround is implemented by the assembler rather than by GCC. </p> </dd> <dt> +<span><code class="code">-mfix-rm7000</code><a class="copiable-link" href="#index-mfix-rm7000"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-rm7000</code></dt> <dd> +<p>Work around the RM7000 <code class="code">dmult</code>/<code class="code">dmultu</code> errata. The workarounds are implemented by the assembler rather than by GCC. </p> </dd> <dt> +<span><code class="code">-mfix-vr4120</code><a class="copiable-link" href="#index-mfix-vr4120"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-vr4120</code></dt> <dd> +<p>Work around certain VR4120 errata: </p> +<ul class="itemize mark-minus"> <li> +<code class="code">dmultu</code> does not always produce the correct result. </li> +<li> +<code class="code">div</code> and <code class="code">ddiv</code> do not always produce the correct result if one of the operands is negative. </li> +</ul> <p>The workarounds for the division errata rely on special functions in <samp class="file">libgcc.a</samp>. At present, these functions are only provided by the <code class="code">mips64vr*-elf</code> configurations. </p> <p>Other VR4120 errata require a NOP to be inserted between certain pairs of instructions. These errata are handled by the assembler, not by GCC itself. </p> </dd> <dt> +<span><code class="code">-mfix-vr4130</code><a class="copiable-link" href="#index-mfix-vr4130"> ¶</a></span> +</dt> <dd> +<p>Work around the VR4130 <code class="code">mflo</code>/<code class="code">mfhi</code> errata. The workarounds are implemented by the assembler rather than by GCC, although GCC avoids using <code class="code">mflo</code> and <code class="code">mfhi</code> if the VR4130 <code class="code">macc</code>, <code class="code">macchi</code>, <code class="code">dmacc</code> and <code class="code">dmacchi</code> instructions are available instead. </p> </dd> <dt> +<span><code class="code">-mfix-sb1</code><a class="copiable-link" href="#index-mfix-sb1"> ¶</a></span> +</dt> <dt><code class="code">-mno-fix-sb1</code></dt> <dd> +<p>Work around certain SB-1 CPU core errata. (This flag currently works around the SB-1 revision 2 “F1” and “F2” floating-point errata.) </p> </dd> <dt> +<span><code class="code">-mr10k-cache-barrier=<var class="var">setting</var></code><a class="copiable-link" href="#index-mr10k-cache-barrier"> ¶</a></span> +</dt> <dd> +<p>Specify whether GCC should insert cache barriers to avoid the side effects of speculation on R10K processors. </p> <p>In common with many processors, the R10K tries to predict the outcome of a conditional branch and speculatively executes instructions from the “taken” branch. It later aborts these instructions if the predicted outcome is wrong. However, on the R10K, even aborted instructions can have side effects. </p> <p>This problem only affects kernel stores and, depending on the system, kernel loads. As an example, a speculatively-executed store may load the target memory into cache and mark the cache line as dirty, even if the store itself is later aborted. If a DMA operation writes to the same area of memory before the “dirty” line is flushed, the cached data overwrites the DMA-ed data. See the R10K processor manual for a full description, including other potential problems. </p> <p>One workaround is to insert cache barrier instructions before every memory access that might be speculatively executed and that might have side effects even if aborted. <samp class="option">-mr10k-cache-barrier=<var class="var">setting</var></samp> controls GCC’s implementation of this workaround. It assumes that aborted accesses to any byte in the following regions does not have side effects: </p> <ol class="enumerate"> <li> the memory occupied by the current function’s stack frame; </li> +<li> the memory occupied by an incoming stack argument; </li> +<li> the memory occupied by an object with a link-time-constant address. </li> +</ol> <p>It is the kernel’s responsibility to ensure that speculative accesses to these regions are indeed safe. </p> <p>If the input program contains a function declaration such as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void foo (void);</pre> +</div> <p>then the implementation of <code class="code">foo</code> must allow <code class="code">j foo</code> and <code class="code">jal foo</code> to be executed speculatively. GCC honors this restriction for functions it compiles itself. It expects non-GCC functions (such as hand-written assembly code) to do the same. </p> <p>The option has three forms: </p> <dl class="table"> <dt><code class="code">-mr10k-cache-barrier=load-store</code></dt> <dd> +<p>Insert a cache barrier before a load or store that might be speculatively executed and that might have side effects even if aborted. </p> </dd> <dt><code class="code">-mr10k-cache-barrier=store</code></dt> <dd> +<p>Insert a cache barrier before a store that might be speculatively executed and that might have side effects even if aborted. </p> </dd> <dt><code class="code">-mr10k-cache-barrier=none</code></dt> <dd><p>Disable the insertion of cache barriers. This is the default setting. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mflush-func=<var class="var">func</var></code><a class="copiable-link" href="#index-mflush-func"> ¶</a></span> +</dt> <dt><code class="code">-mno-flush-func</code></dt> <dd> +<p>Specifies the function to call to flush the I and D caches, or to not call any such function. If called, the function must take the same arguments as the common <code class="code">_flush_func</code>, that is, the address of the memory range for which the cache is being flushed, the size of the memory range, and the number 3 (to flush both caches). The default depends on the target GCC was configured for, but commonly is either <code class="code">_flush_func</code> or <code class="code">__cpu_flush</code>. </p> </dd> <dt> +<span><code class="code">mbranch-cost=<var class="var">num</var></code><a class="copiable-link" href="#index-mbranch-cost-3"> ¶</a></span> +</dt> <dd> +<p>Set the cost of branches to roughly <var class="var">num</var> “simple” instructions. This cost is only a heuristic and is not guaranteed to produce consistent results across releases. A zero cost redundantly selects the default, which is based on the <samp class="option">-mtune</samp> setting. </p> </dd> <dt> + <span><code class="code">-mbranch-likely</code><a class="copiable-link" href="#index-mbranch-likely"> ¶</a></span> +</dt> <dt><code class="code">-mno-branch-likely</code></dt> <dd> +<p>Enable or disable use of Branch Likely instructions, regardless of the default for the selected architecture. By default, Branch Likely instructions may be generated if they are supported by the selected architecture. An exception is for the MIPS32 and MIPS64 architectures and processors that implement those architectures; for those, Branch Likely instructions are not be generated by default because the MIPS32 and MIPS64 architectures specifically deprecate their use. </p> </dd> <dt> + <span><code class="code">-mcompact-branches=never</code><a class="copiable-link" href="#index-mcompact-branches_003dnever"> ¶</a></span> +</dt> <dt><code class="code">-mcompact-branches=optimal</code></dt> <dt><code class="code">-mcompact-branches=always</code></dt> <dd> +<p>These options control which form of branches will be generated. The default is <samp class="option">-mcompact-branches=optimal</samp>. </p> <p>The <samp class="option">-mcompact-branches=never</samp> option ensures that compact branch instructions will never be generated. </p> <p>The <samp class="option">-mcompact-branches=always</samp> option ensures that a compact branch instruction will be generated if available for MIPS Release 6 onwards. If a compact branch instruction is not available (or pre-R6), a delay slot form of the branch will be used instead. </p> <p>If it is used for MIPS16/microMIPS targets, it will be just ignored now. The behaviour for MIPS16/microMIPS may change in future, since they do have some compact branch instructions. </p> <p>The <samp class="option">-mcompact-branches=optimal</samp> option will cause a delay slot branch to be used if one is available in the current ISA and the delay slot is successfully filled. If the delay slot is not filled, a compact branch will be chosen if one is available. </p> </dd> <dt> +<span><code class="code">-mfp-exceptions</code><a class="copiable-link" href="#index-mfp-exceptions"> ¶</a></span> +</dt> <dt><code class="code">-mno-fp-exceptions</code></dt> <dd> +<p>Specifies whether FP exceptions are enabled. This affects how FP instructions are scheduled for some processors. The default is that FP exceptions are enabled. </p> <p>For instance, on the SB-1, if FP exceptions are disabled, and we are emitting 64-bit code, then we can use both FP pipes. Otherwise, we can only use one FP pipe. </p> </dd> <dt> +<span><code class="code">-mvr4130-align</code><a class="copiable-link" href="#index-mvr4130-align"> ¶</a></span> +</dt> <dt><code class="code">-mno-vr4130-align</code></dt> <dd> +<p>The VR4130 pipeline is two-way superscalar, but can only issue two instructions together if the first one is 8-byte aligned. When this option is enabled, GCC aligns pairs of instructions that it thinks should execute in parallel. </p> <p>This option only has an effect when optimizing for the VR4130. It normally makes code faster, but at the expense of making it bigger. It is enabled by default at optimization level <samp class="option">-O3</samp>. </p> </dd> <dt> +<span><code class="code">-msynci</code><a class="copiable-link" href="#index-msynci"> ¶</a></span> +</dt> <dt><code class="code">-mno-synci</code></dt> <dd> +<p>Enable (disable) generation of <code class="code">synci</code> instructions on architectures that support it. The <code class="code">synci</code> instructions (if enabled) are generated when <code class="code">__builtin___clear_cache</code> is compiled. </p> <p>This option defaults to <samp class="option">-mno-synci</samp>, but the default can be overridden by configuring GCC with <samp class="option">--with-synci</samp>. </p> <p>When compiling code for single processor systems, it is generally safe to use <code class="code">synci</code>. However, on many multi-core (SMP) systems, it does not invalidate the instruction caches on all cores and may lead to undefined behavior. </p> </dd> <dt> +<span><code class="code">-mrelax-pic-calls</code><a class="copiable-link" href="#index-mrelax-pic-calls"> ¶</a></span> +</dt> <dt><code class="code">-mno-relax-pic-calls</code></dt> <dd> +<p>Try to turn PIC calls that are normally dispatched via register <code class="code">$25</code> into direct calls. This is only possible if the linker can resolve the destination at link time and if the destination is within range for a direct call. </p> <p><samp class="option">-mrelax-pic-calls</samp> is the default if GCC was configured to use an assembler and a linker that support the <code class="code">.reloc</code> assembly directive and <samp class="option">-mexplicit-relocs</samp> is in effect. With <samp class="option">-mno-explicit-relocs</samp>, this optimization can be performed by the assembler and the linker alone without help from the compiler. </p> </dd> <dt> + <span><code class="code">-mmcount-ra-address</code><a class="copiable-link" href="#index-mmcount-ra-address"> ¶</a></span> +</dt> <dt><code class="code">-mno-mcount-ra-address</code></dt> <dd> +<p>Emit (do not emit) code that allows <code class="code">_mcount</code> to modify the calling function’s return address. When enabled, this option extends the usual <code class="code">_mcount</code> interface with a new <var class="var">ra-address</var> parameter, which has type <code class="code">intptr_t *</code> and is passed in register <code class="code">$12</code>. <code class="code">_mcount</code> can then modify the return address by doing both of the following: </p> +<ul class="itemize mark-bullet"> <li>Returning the new address in register <code class="code">$31</code>. </li> +<li>Storing the new address in <code class="code">*<var class="var">ra-address</var></code>, if <var class="var">ra-address</var> is nonnull. </li> +</ul> <p>The default is <samp class="option">-mno-mcount-ra-address</samp>. </p> </dd> <dt> +<span><code class="code">-mframe-header-opt</code><a class="copiable-link" href="#index-mframe-header-opt"> ¶</a></span> +</dt> <dt><code class="code">-mno-frame-header-opt</code></dt> <dd> +<p>Enable (disable) frame header optimization in the o32 ABI. When using the o32 ABI, calling functions will allocate 16 bytes on the stack for the called function to write out register arguments. When enabled, this optimization will suppress the allocation of the frame header if it can be determined that it is unused. </p> <p>This optimization is off by default at all optimization levels. </p> </dd> <dt> +<span><code class="code">-mlxc1-sxc1</code><a class="copiable-link" href="#index-mlxc1-sxc1"> ¶</a></span> +</dt> <dt><code class="code">-mno-lxc1-sxc1</code></dt> <dd> +<p>When applicable, enable (disable) the generation of <code class="code">lwxc1</code>, <code class="code">swxc1</code>, <code class="code">ldxc1</code>, <code class="code">sdxc1</code> instructions. Enabled by default. </p> </dd> <dt> +<span><code class="code">-mmadd4</code><a class="copiable-link" href="#index-mmadd4"> ¶</a></span> +</dt> <dt><code class="code">-mno-madd4</code></dt> <dd> +<p>When applicable, enable (disable) the generation of 4-operand <code class="code">madd.s</code>, <code class="code">madd.d</code> and related instructions. Enabled by default. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="mmix-options">MMIX Options</a>, Previous: <a href="microblaze-options">MicroBlaze Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mips-paired-single-support.html b/devdocs/gcc~13/mips-paired-single-support.html new file mode 100644 index 00000000..cba9dda2 --- /dev/null +++ b/devdocs/gcc~13/mips-paired-single-support.html @@ -0,0 +1,11 @@ +<div class="subsection-level-extent" id="MIPS-Paired-Single-Support"> <div class="nav-panel"> <p> Next: <a href="mips-loongson-built-in-functions" accesskey="n" rel="next">MIPS Loongson Built-in Functions</a>, Previous: <a href="mips-dsp-built-in-functions" accesskey="p" rel="prev">MIPS DSP Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MIPS-Paired-Single-Support-1"><span>6.60.16 MIPS Paired-Single Support<a class="copiable-link" href="#MIPS-Paired-Single-Support-1"> ¶</a></span></h1> <p>The MIPS64 architecture includes a number of instructions that operate on pairs of single-precision floating-point values. Each pair is packed into a 64-bit floating-point register, with one element being designated the “upper half” and the other being designated the “lower half”. </p> <p>GCC supports paired-single operations using both the generic vector extensions (see <a class="pxref" href="vector-extensions">Using Vector Instructions through Built-in Functions</a>) and a collection of MIPS-specific built-in functions. Both kinds of support are enabled by the <samp class="option">-mpaired-single</samp> command-line option. </p> <p>The vector type associated with paired-single values is usually called <code class="code">v2sf</code>. It can be defined in C as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef float v2sf __attribute__ ((vector_size (8)));</pre> +</div> <p><code class="code">v2sf</code> values are initialized in the same way as aggregates. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2sf a = {1.5, 9.1}; +v2sf b; +float e, f; +b = (v2sf) {e, f};</pre> +</div> <p><em class="emph">Note:</em> The CPU’s endianness determines which value is stored in the upper half of a register and which value is stored in the lower half. On little-endian targets, the first value is the lower one and the second value is the upper one. The opposite order applies to big-endian targets. For example, the code above sets the lower half of <code class="code">a</code> to <code class="code">1.5</code> on little-endian targets and <code class="code">9.1</code> on big-endian targets. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-Paired-Single-Support.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-Paired-Single-Support.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mips-simd-architecture-_0028msa_0029-support.html b/devdocs/gcc~13/mips-simd-architecture-_0028msa_0029-support.html new file mode 100644 index 00000000..19fbede6 --- /dev/null +++ b/devdocs/gcc~13/mips-simd-architecture-_0028msa_0029-support.html @@ -0,0 +1,74 @@ +<div class="subsection-level-extent" id="MIPS-SIMD-Architecture-_0028MSA_0029-Support"> <div class="nav-panel"> <p> Next: <a href="other-mips-built-in-functions" accesskey="n" rel="next">Other MIPS Built-in Functions</a>, Previous: <a href="mips-loongson-built-in-functions" accesskey="p" rel="prev">MIPS Loongson Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MIPS-SIMD-Architecture-_0028MSA_0029-Support-1"><span>6.60.18 MIPS SIMD Architecture (MSA) Support<a class="copiable-link" href="#MIPS-SIMD-Architecture-_0028MSA_0029-Support-1"> ¶</a></span></h1> <p>GCC provides intrinsics to access the SIMD instructions provided by the MSA MIPS SIMD Architecture. The interface is made available by including <code class="code"><msa.h></code> and using <samp class="option">-mmsa -mhard-float -mfp64 -mnan=2008</samp>. For each <code class="code">__builtin_msa_*</code>, there is a shortened name of the intrinsic, <code class="code">__msa_*</code>. </p> <p>MSA implements 128-bit wide vector registers, operating on 8-, 16-, 32- and 64-bit integer, 16- and 32-bit fixed-point, or 32- and 64-bit floating point data elements. The following vectors typedefs are included in <code class="code">msa.h</code>: </p> +<ul class="itemize mark-bullet"> <li> +<code class="code">v16i8</code>, a vector of sixteen signed 8-bit integers; </li> +<li> +<code class="code">v16u8</code>, a vector of sixteen unsigned 8-bit integers; </li> +<li> +<code class="code">v8i16</code>, a vector of eight signed 16-bit integers; </li> +<li> +<code class="code">v8u16</code>, a vector of eight unsigned 16-bit integers; </li> +<li> +<code class="code">v4i32</code>, a vector of four signed 32-bit integers; </li> +<li> +<code class="code">v4u32</code>, a vector of four unsigned 32-bit integers; </li> +<li> +<code class="code">v2i64</code>, a vector of two signed 64-bit integers; </li> +<li> +<code class="code">v2u64</code>, a vector of two unsigned 64-bit integers; </li> +<li> +<code class="code">v4f32</code>, a vector of four 32-bit floats; </li> +<li> +<code class="code">v2f64</code>, a vector of two 64-bit doubles. </li> +</ul> <p>Instructions and corresponding built-ins may have additional restrictions and/or input/output values manipulated: </p> +<ul class="itemize mark-bullet"> <li> +<code class="code">imm0_1</code>, an integer literal in range 0 to 1; </li> +<li> +<code class="code">imm0_3</code>, an integer literal in range 0 to 3; </li> +<li> +<code class="code">imm0_7</code>, an integer literal in range 0 to 7; </li> +<li> +<code class="code">imm0_15</code>, an integer literal in range 0 to 15; </li> +<li> +<code class="code">imm0_31</code>, an integer literal in range 0 to 31; </li> +<li> +<code class="code">imm0_63</code>, an integer literal in range 0 to 63; </li> +<li> +<code class="code">imm0_255</code>, an integer literal in range 0 to 255; </li> +<li> +<code class="code">imm_n16_15</code>, an integer literal in range -16 to 15; </li> +<li> +<code class="code">imm_n512_511</code>, an integer literal in range -512 to 511; </li> +<li> +<code class="code">imm_n1024_1022</code>, an integer literal in range -512 to 511 left shifted by 1 bit, i.e., -1024, -1022, …, 1020, 1022; </li> +<li> +<code class="code">imm_n2048_2044</code>, an integer literal in range -512 to 511 left shifted by 2 bits, i.e., -2048, -2044, …, 2040, 2044; </li> +<li> +<code class="code">imm_n4096_4088</code>, an integer literal in range -512 to 511 left shifted by 3 bits, i.e., -4096, -4088, …, 4080, 4088; </li> +<li> +<code class="code">imm1_4</code>, an integer literal in range 1 to 4; </li> +<li> +<code class="code">i32, i64, u32, u64, f32, f64</code>, defined as follows: </li> +</ul> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ +typedef int i32; +#if __LONG_MAX__ == __LONG_LONG_MAX__ +typedef long i64; +#else +typedef long long i64; +#endif + +typedef unsigned int u32; +#if __LONG_MAX__ == __LONG_LONG_MAX__ +typedef unsigned long u64; +#else +typedef unsigned long long u64; +#endif + +typedef double f64; +typedef float f32; +}</pre> +</div> <ul class="mini-toc"> <li><a href="mips-simd-architecture-built-in-functions" accesskey="1">MIPS SIMD Architecture Built-in Functions</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="other-mips-built-in-functions">Other MIPS Built-in Functions</a>, Previous: <a href="mips-loongson-built-in-functions">MIPS Loongson Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-SIMD-Architecture-_0028MSA_0029-Support.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-SIMD-Architecture-_0028MSA_0029-Support.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mips-simd-architecture-built-in-functions.html b/devdocs/gcc~13/mips-simd-architecture-built-in-functions.html new file mode 100644 index 00000000..ad67e1c4 --- /dev/null +++ b/devdocs/gcc~13/mips-simd-architecture-built-in-functions.html @@ -0,0 +1,713 @@ +<div class="subsubsection-level-extent" id="MIPS-SIMD-Architecture-Built-in-Functions"> <div class="nav-panel"> <p> Up: <a href="mips-simd-architecture-_0028msa_0029-support" accesskey="u" rel="up">MIPS SIMD Architecture (MSA) Support</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="MIPS-SIMD-Architecture-Built-in-Functions-1"><span>6.60.18.1 MIPS SIMD Architecture Built-in Functions<a class="copiable-link" href="#MIPS-SIMD-Architecture-Built-in-Functions-1"> ¶</a></span></h1> <p>The intrinsics provided are listed below; each is named after the machine instruction. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v16i8 __builtin_msa_add_a_b (v16i8, v16i8); +v8i16 __builtin_msa_add_a_h (v8i16, v8i16); +v4i32 __builtin_msa_add_a_w (v4i32, v4i32); +v2i64 __builtin_msa_add_a_d (v2i64, v2i64); + +v16i8 __builtin_msa_adds_a_b (v16i8, v16i8); +v8i16 __builtin_msa_adds_a_h (v8i16, v8i16); +v4i32 __builtin_msa_adds_a_w (v4i32, v4i32); +v2i64 __builtin_msa_adds_a_d (v2i64, v2i64); + +v16i8 __builtin_msa_adds_s_b (v16i8, v16i8); +v8i16 __builtin_msa_adds_s_h (v8i16, v8i16); +v4i32 __builtin_msa_adds_s_w (v4i32, v4i32); +v2i64 __builtin_msa_adds_s_d (v2i64, v2i64); + +v16u8 __builtin_msa_adds_u_b (v16u8, v16u8); +v8u16 __builtin_msa_adds_u_h (v8u16, v8u16); +v4u32 __builtin_msa_adds_u_w (v4u32, v4u32); +v2u64 __builtin_msa_adds_u_d (v2u64, v2u64); + +v16i8 __builtin_msa_addv_b (v16i8, v16i8); +v8i16 __builtin_msa_addv_h (v8i16, v8i16); +v4i32 __builtin_msa_addv_w (v4i32, v4i32); +v2i64 __builtin_msa_addv_d (v2i64, v2i64); + +v16i8 __builtin_msa_addvi_b (v16i8, imm0_31); +v8i16 __builtin_msa_addvi_h (v8i16, imm0_31); +v4i32 __builtin_msa_addvi_w (v4i32, imm0_31); +v2i64 __builtin_msa_addvi_d (v2i64, imm0_31); + +v16u8 __builtin_msa_and_v (v16u8, v16u8); + +v16u8 __builtin_msa_andi_b (v16u8, imm0_255); + +v16i8 __builtin_msa_asub_s_b (v16i8, v16i8); +v8i16 __builtin_msa_asub_s_h (v8i16, v8i16); +v4i32 __builtin_msa_asub_s_w (v4i32, v4i32); +v2i64 __builtin_msa_asub_s_d (v2i64, v2i64); + +v16u8 __builtin_msa_asub_u_b (v16u8, v16u8); +v8u16 __builtin_msa_asub_u_h (v8u16, v8u16); +v4u32 __builtin_msa_asub_u_w (v4u32, v4u32); +v2u64 __builtin_msa_asub_u_d (v2u64, v2u64); + +v16i8 __builtin_msa_ave_s_b (v16i8, v16i8); +v8i16 __builtin_msa_ave_s_h (v8i16, v8i16); +v4i32 __builtin_msa_ave_s_w (v4i32, v4i32); +v2i64 __builtin_msa_ave_s_d (v2i64, v2i64); + +v16u8 __builtin_msa_ave_u_b (v16u8, v16u8); +v8u16 __builtin_msa_ave_u_h (v8u16, v8u16); +v4u32 __builtin_msa_ave_u_w (v4u32, v4u32); +v2u64 __builtin_msa_ave_u_d (v2u64, v2u64); + +v16i8 __builtin_msa_aver_s_b (v16i8, v16i8); +v8i16 __builtin_msa_aver_s_h (v8i16, v8i16); +v4i32 __builtin_msa_aver_s_w (v4i32, v4i32); +v2i64 __builtin_msa_aver_s_d (v2i64, v2i64); + +v16u8 __builtin_msa_aver_u_b (v16u8, v16u8); +v8u16 __builtin_msa_aver_u_h (v8u16, v8u16); +v4u32 __builtin_msa_aver_u_w (v4u32, v4u32); +v2u64 __builtin_msa_aver_u_d (v2u64, v2u64); + +v16u8 __builtin_msa_bclr_b (v16u8, v16u8); +v8u16 __builtin_msa_bclr_h (v8u16, v8u16); +v4u32 __builtin_msa_bclr_w (v4u32, v4u32); +v2u64 __builtin_msa_bclr_d (v2u64, v2u64); + +v16u8 __builtin_msa_bclri_b (v16u8, imm0_7); +v8u16 __builtin_msa_bclri_h (v8u16, imm0_15); +v4u32 __builtin_msa_bclri_w (v4u32, imm0_31); +v2u64 __builtin_msa_bclri_d (v2u64, imm0_63); + +v16u8 __builtin_msa_binsl_b (v16u8, v16u8, v16u8); +v8u16 __builtin_msa_binsl_h (v8u16, v8u16, v8u16); +v4u32 __builtin_msa_binsl_w (v4u32, v4u32, v4u32); +v2u64 __builtin_msa_binsl_d (v2u64, v2u64, v2u64); + +v16u8 __builtin_msa_binsli_b (v16u8, v16u8, imm0_7); +v8u16 __builtin_msa_binsli_h (v8u16, v8u16, imm0_15); +v4u32 __builtin_msa_binsli_w (v4u32, v4u32, imm0_31); +v2u64 __builtin_msa_binsli_d (v2u64, v2u64, imm0_63); + +v16u8 __builtin_msa_binsr_b (v16u8, v16u8, v16u8); +v8u16 __builtin_msa_binsr_h (v8u16, v8u16, v8u16); +v4u32 __builtin_msa_binsr_w (v4u32, v4u32, v4u32); +v2u64 __builtin_msa_binsr_d (v2u64, v2u64, v2u64); + +v16u8 __builtin_msa_binsri_b (v16u8, v16u8, imm0_7); +v8u16 __builtin_msa_binsri_h (v8u16, v8u16, imm0_15); +v4u32 __builtin_msa_binsri_w (v4u32, v4u32, imm0_31); +v2u64 __builtin_msa_binsri_d (v2u64, v2u64, imm0_63); + +v16u8 __builtin_msa_bmnz_v (v16u8, v16u8, v16u8); + +v16u8 __builtin_msa_bmnzi_b (v16u8, v16u8, imm0_255); + +v16u8 __builtin_msa_bmz_v (v16u8, v16u8, v16u8); + +v16u8 __builtin_msa_bmzi_b (v16u8, v16u8, imm0_255); + +v16u8 __builtin_msa_bneg_b (v16u8, v16u8); +v8u16 __builtin_msa_bneg_h (v8u16, v8u16); +v4u32 __builtin_msa_bneg_w (v4u32, v4u32); +v2u64 __builtin_msa_bneg_d (v2u64, v2u64); + +v16u8 __builtin_msa_bnegi_b (v16u8, imm0_7); +v8u16 __builtin_msa_bnegi_h (v8u16, imm0_15); +v4u32 __builtin_msa_bnegi_w (v4u32, imm0_31); +v2u64 __builtin_msa_bnegi_d (v2u64, imm0_63); + +i32 __builtin_msa_bnz_b (v16u8); +i32 __builtin_msa_bnz_h (v8u16); +i32 __builtin_msa_bnz_w (v4u32); +i32 __builtin_msa_bnz_d (v2u64); + +i32 __builtin_msa_bnz_v (v16u8); + +v16u8 __builtin_msa_bsel_v (v16u8, v16u8, v16u8); + +v16u8 __builtin_msa_bseli_b (v16u8, v16u8, imm0_255); + +v16u8 __builtin_msa_bset_b (v16u8, v16u8); +v8u16 __builtin_msa_bset_h (v8u16, v8u16); +v4u32 __builtin_msa_bset_w (v4u32, v4u32); +v2u64 __builtin_msa_bset_d (v2u64, v2u64); + +v16u8 __builtin_msa_bseti_b (v16u8, imm0_7); +v8u16 __builtin_msa_bseti_h (v8u16, imm0_15); +v4u32 __builtin_msa_bseti_w (v4u32, imm0_31); +v2u64 __builtin_msa_bseti_d (v2u64, imm0_63); + +i32 __builtin_msa_bz_b (v16u8); +i32 __builtin_msa_bz_h (v8u16); +i32 __builtin_msa_bz_w (v4u32); +i32 __builtin_msa_bz_d (v2u64); + +i32 __builtin_msa_bz_v (v16u8); + +v16i8 __builtin_msa_ceq_b (v16i8, v16i8); +v8i16 __builtin_msa_ceq_h (v8i16, v8i16); +v4i32 __builtin_msa_ceq_w (v4i32, v4i32); +v2i64 __builtin_msa_ceq_d (v2i64, v2i64); + +v16i8 __builtin_msa_ceqi_b (v16i8, imm_n16_15); +v8i16 __builtin_msa_ceqi_h (v8i16, imm_n16_15); +v4i32 __builtin_msa_ceqi_w (v4i32, imm_n16_15); +v2i64 __builtin_msa_ceqi_d (v2i64, imm_n16_15); + +i32 __builtin_msa_cfcmsa (imm0_31); + +v16i8 __builtin_msa_cle_s_b (v16i8, v16i8); +v8i16 __builtin_msa_cle_s_h (v8i16, v8i16); +v4i32 __builtin_msa_cle_s_w (v4i32, v4i32); +v2i64 __builtin_msa_cle_s_d (v2i64, v2i64); + +v16i8 __builtin_msa_cle_u_b (v16u8, v16u8); +v8i16 __builtin_msa_cle_u_h (v8u16, v8u16); +v4i32 __builtin_msa_cle_u_w (v4u32, v4u32); +v2i64 __builtin_msa_cle_u_d (v2u64, v2u64); + +v16i8 __builtin_msa_clei_s_b (v16i8, imm_n16_15); +v8i16 __builtin_msa_clei_s_h (v8i16, imm_n16_15); +v4i32 __builtin_msa_clei_s_w (v4i32, imm_n16_15); +v2i64 __builtin_msa_clei_s_d (v2i64, imm_n16_15); + +v16i8 __builtin_msa_clei_u_b (v16u8, imm0_31); +v8i16 __builtin_msa_clei_u_h (v8u16, imm0_31); +v4i32 __builtin_msa_clei_u_w (v4u32, imm0_31); +v2i64 __builtin_msa_clei_u_d (v2u64, imm0_31); + +v16i8 __builtin_msa_clt_s_b (v16i8, v16i8); +v8i16 __builtin_msa_clt_s_h (v8i16, v8i16); +v4i32 __builtin_msa_clt_s_w (v4i32, v4i32); +v2i64 __builtin_msa_clt_s_d (v2i64, v2i64); + +v16i8 __builtin_msa_clt_u_b (v16u8, v16u8); +v8i16 __builtin_msa_clt_u_h (v8u16, v8u16); +v4i32 __builtin_msa_clt_u_w (v4u32, v4u32); +v2i64 __builtin_msa_clt_u_d (v2u64, v2u64); + +v16i8 __builtin_msa_clti_s_b (v16i8, imm_n16_15); +v8i16 __builtin_msa_clti_s_h (v8i16, imm_n16_15); +v4i32 __builtin_msa_clti_s_w (v4i32, imm_n16_15); +v2i64 __builtin_msa_clti_s_d (v2i64, imm_n16_15); + +v16i8 __builtin_msa_clti_u_b (v16u8, imm0_31); +v8i16 __builtin_msa_clti_u_h (v8u16, imm0_31); +v4i32 __builtin_msa_clti_u_w (v4u32, imm0_31); +v2i64 __builtin_msa_clti_u_d (v2u64, imm0_31); + +i32 __builtin_msa_copy_s_b (v16i8, imm0_15); +i32 __builtin_msa_copy_s_h (v8i16, imm0_7); +i32 __builtin_msa_copy_s_w (v4i32, imm0_3); +i64 __builtin_msa_copy_s_d (v2i64, imm0_1); + +u32 __builtin_msa_copy_u_b (v16i8, imm0_15); +u32 __builtin_msa_copy_u_h (v8i16, imm0_7); +u32 __builtin_msa_copy_u_w (v4i32, imm0_3); +u64 __builtin_msa_copy_u_d (v2i64, imm0_1); + +void __builtin_msa_ctcmsa (imm0_31, i32); + +v16i8 __builtin_msa_div_s_b (v16i8, v16i8); +v8i16 __builtin_msa_div_s_h (v8i16, v8i16); +v4i32 __builtin_msa_div_s_w (v4i32, v4i32); +v2i64 __builtin_msa_div_s_d (v2i64, v2i64); + +v16u8 __builtin_msa_div_u_b (v16u8, v16u8); +v8u16 __builtin_msa_div_u_h (v8u16, v8u16); +v4u32 __builtin_msa_div_u_w (v4u32, v4u32); +v2u64 __builtin_msa_div_u_d (v2u64, v2u64); + +v8i16 __builtin_msa_dotp_s_h (v16i8, v16i8); +v4i32 __builtin_msa_dotp_s_w (v8i16, v8i16); +v2i64 __builtin_msa_dotp_s_d (v4i32, v4i32); + +v8u16 __builtin_msa_dotp_u_h (v16u8, v16u8); +v4u32 __builtin_msa_dotp_u_w (v8u16, v8u16); +v2u64 __builtin_msa_dotp_u_d (v4u32, v4u32); + +v8i16 __builtin_msa_dpadd_s_h (v8i16, v16i8, v16i8); +v4i32 __builtin_msa_dpadd_s_w (v4i32, v8i16, v8i16); +v2i64 __builtin_msa_dpadd_s_d (v2i64, v4i32, v4i32); + +v8u16 __builtin_msa_dpadd_u_h (v8u16, v16u8, v16u8); +v4u32 __builtin_msa_dpadd_u_w (v4u32, v8u16, v8u16); +v2u64 __builtin_msa_dpadd_u_d (v2u64, v4u32, v4u32); + +v8i16 __builtin_msa_dpsub_s_h (v8i16, v16i8, v16i8); +v4i32 __builtin_msa_dpsub_s_w (v4i32, v8i16, v8i16); +v2i64 __builtin_msa_dpsub_s_d (v2i64, v4i32, v4i32); + +v8i16 __builtin_msa_dpsub_u_h (v8i16, v16u8, v16u8); +v4i32 __builtin_msa_dpsub_u_w (v4i32, v8u16, v8u16); +v2i64 __builtin_msa_dpsub_u_d (v2i64, v4u32, v4u32); + +v4f32 __builtin_msa_fadd_w (v4f32, v4f32); +v2f64 __builtin_msa_fadd_d (v2f64, v2f64); + +v4i32 __builtin_msa_fcaf_w (v4f32, v4f32); +v2i64 __builtin_msa_fcaf_d (v2f64, v2f64); + +v4i32 __builtin_msa_fceq_w (v4f32, v4f32); +v2i64 __builtin_msa_fceq_d (v2f64, v2f64); + +v4i32 __builtin_msa_fclass_w (v4f32); +v2i64 __builtin_msa_fclass_d (v2f64); + +v4i32 __builtin_msa_fcle_w (v4f32, v4f32); +v2i64 __builtin_msa_fcle_d (v2f64, v2f64); + +v4i32 __builtin_msa_fclt_w (v4f32, v4f32); +v2i64 __builtin_msa_fclt_d (v2f64, v2f64); + +v4i32 __builtin_msa_fcne_w (v4f32, v4f32); +v2i64 __builtin_msa_fcne_d (v2f64, v2f64); + +v4i32 __builtin_msa_fcor_w (v4f32, v4f32); +v2i64 __builtin_msa_fcor_d (v2f64, v2f64); + +v4i32 __builtin_msa_fcueq_w (v4f32, v4f32); +v2i64 __builtin_msa_fcueq_d (v2f64, v2f64); + +v4i32 __builtin_msa_fcule_w (v4f32, v4f32); +v2i64 __builtin_msa_fcule_d (v2f64, v2f64); + +v4i32 __builtin_msa_fcult_w (v4f32, v4f32); +v2i64 __builtin_msa_fcult_d (v2f64, v2f64); + +v4i32 __builtin_msa_fcun_w (v4f32, v4f32); +v2i64 __builtin_msa_fcun_d (v2f64, v2f64); + +v4i32 __builtin_msa_fcune_w (v4f32, v4f32); +v2i64 __builtin_msa_fcune_d (v2f64, v2f64); + +v4f32 __builtin_msa_fdiv_w (v4f32, v4f32); +v2f64 __builtin_msa_fdiv_d (v2f64, v2f64); + +v8i16 __builtin_msa_fexdo_h (v4f32, v4f32); +v4f32 __builtin_msa_fexdo_w (v2f64, v2f64); + +v4f32 __builtin_msa_fexp2_w (v4f32, v4i32); +v2f64 __builtin_msa_fexp2_d (v2f64, v2i64); + +v4f32 __builtin_msa_fexupl_w (v8i16); +v2f64 __builtin_msa_fexupl_d (v4f32); + +v4f32 __builtin_msa_fexupr_w (v8i16); +v2f64 __builtin_msa_fexupr_d (v4f32); + +v4f32 __builtin_msa_ffint_s_w (v4i32); +v2f64 __builtin_msa_ffint_s_d (v2i64); + +v4f32 __builtin_msa_ffint_u_w (v4u32); +v2f64 __builtin_msa_ffint_u_d (v2u64); + +v4f32 __builtin_msa_ffql_w (v8i16); +v2f64 __builtin_msa_ffql_d (v4i32); + +v4f32 __builtin_msa_ffqr_w (v8i16); +v2f64 __builtin_msa_ffqr_d (v4i32); + +v16i8 __builtin_msa_fill_b (i32); +v8i16 __builtin_msa_fill_h (i32); +v4i32 __builtin_msa_fill_w (i32); +v2i64 __builtin_msa_fill_d (i64); + +v4f32 __builtin_msa_flog2_w (v4f32); +v2f64 __builtin_msa_flog2_d (v2f64); + +v4f32 __builtin_msa_fmadd_w (v4f32, v4f32, v4f32); +v2f64 __builtin_msa_fmadd_d (v2f64, v2f64, v2f64); + +v4f32 __builtin_msa_fmax_w (v4f32, v4f32); +v2f64 __builtin_msa_fmax_d (v2f64, v2f64); + +v4f32 __builtin_msa_fmax_a_w (v4f32, v4f32); +v2f64 __builtin_msa_fmax_a_d (v2f64, v2f64); + +v4f32 __builtin_msa_fmin_w (v4f32, v4f32); +v2f64 __builtin_msa_fmin_d (v2f64, v2f64); + +v4f32 __builtin_msa_fmin_a_w (v4f32, v4f32); +v2f64 __builtin_msa_fmin_a_d (v2f64, v2f64); + +v4f32 __builtin_msa_fmsub_w (v4f32, v4f32, v4f32); +v2f64 __builtin_msa_fmsub_d (v2f64, v2f64, v2f64); + +v4f32 __builtin_msa_fmul_w (v4f32, v4f32); +v2f64 __builtin_msa_fmul_d (v2f64, v2f64); + +v4f32 __builtin_msa_frint_w (v4f32); +v2f64 __builtin_msa_frint_d (v2f64); + +v4f32 __builtin_msa_frcp_w (v4f32); +v2f64 __builtin_msa_frcp_d (v2f64); + +v4f32 __builtin_msa_frsqrt_w (v4f32); +v2f64 __builtin_msa_frsqrt_d (v2f64); + +v4i32 __builtin_msa_fsaf_w (v4f32, v4f32); +v2i64 __builtin_msa_fsaf_d (v2f64, v2f64); + +v4i32 __builtin_msa_fseq_w (v4f32, v4f32); +v2i64 __builtin_msa_fseq_d (v2f64, v2f64); + +v4i32 __builtin_msa_fsle_w (v4f32, v4f32); +v2i64 __builtin_msa_fsle_d (v2f64, v2f64); + +v4i32 __builtin_msa_fslt_w (v4f32, v4f32); +v2i64 __builtin_msa_fslt_d (v2f64, v2f64); + +v4i32 __builtin_msa_fsne_w (v4f32, v4f32); +v2i64 __builtin_msa_fsne_d (v2f64, v2f64); + +v4i32 __builtin_msa_fsor_w (v4f32, v4f32); +v2i64 __builtin_msa_fsor_d (v2f64, v2f64); + +v4f32 __builtin_msa_fsqrt_w (v4f32); +v2f64 __builtin_msa_fsqrt_d (v2f64); + +v4f32 __builtin_msa_fsub_w (v4f32, v4f32); +v2f64 __builtin_msa_fsub_d (v2f64, v2f64); + +v4i32 __builtin_msa_fsueq_w (v4f32, v4f32); +v2i64 __builtin_msa_fsueq_d (v2f64, v2f64); + +v4i32 __builtin_msa_fsule_w (v4f32, v4f32); +v2i64 __builtin_msa_fsule_d (v2f64, v2f64); + +v4i32 __builtin_msa_fsult_w (v4f32, v4f32); +v2i64 __builtin_msa_fsult_d (v2f64, v2f64); + +v4i32 __builtin_msa_fsun_w (v4f32, v4f32); +v2i64 __builtin_msa_fsun_d (v2f64, v2f64); + +v4i32 __builtin_msa_fsune_w (v4f32, v4f32); +v2i64 __builtin_msa_fsune_d (v2f64, v2f64); + +v4i32 __builtin_msa_ftint_s_w (v4f32); +v2i64 __builtin_msa_ftint_s_d (v2f64); + +v4u32 __builtin_msa_ftint_u_w (v4f32); +v2u64 __builtin_msa_ftint_u_d (v2f64); + +v8i16 __builtin_msa_ftq_h (v4f32, v4f32); +v4i32 __builtin_msa_ftq_w (v2f64, v2f64); + +v4i32 __builtin_msa_ftrunc_s_w (v4f32); +v2i64 __builtin_msa_ftrunc_s_d (v2f64); + +v4u32 __builtin_msa_ftrunc_u_w (v4f32); +v2u64 __builtin_msa_ftrunc_u_d (v2f64); + +v8i16 __builtin_msa_hadd_s_h (v16i8, v16i8); +v4i32 __builtin_msa_hadd_s_w (v8i16, v8i16); +v2i64 __builtin_msa_hadd_s_d (v4i32, v4i32); + +v8u16 __builtin_msa_hadd_u_h (v16u8, v16u8); +v4u32 __builtin_msa_hadd_u_w (v8u16, v8u16); +v2u64 __builtin_msa_hadd_u_d (v4u32, v4u32); + +v8i16 __builtin_msa_hsub_s_h (v16i8, v16i8); +v4i32 __builtin_msa_hsub_s_w (v8i16, v8i16); +v2i64 __builtin_msa_hsub_s_d (v4i32, v4i32); + +v8i16 __builtin_msa_hsub_u_h (v16u8, v16u8); +v4i32 __builtin_msa_hsub_u_w (v8u16, v8u16); +v2i64 __builtin_msa_hsub_u_d (v4u32, v4u32); + +v16i8 __builtin_msa_ilvev_b (v16i8, v16i8); +v8i16 __builtin_msa_ilvev_h (v8i16, v8i16); +v4i32 __builtin_msa_ilvev_w (v4i32, v4i32); +v2i64 __builtin_msa_ilvev_d (v2i64, v2i64); + +v16i8 __builtin_msa_ilvl_b (v16i8, v16i8); +v8i16 __builtin_msa_ilvl_h (v8i16, v8i16); +v4i32 __builtin_msa_ilvl_w (v4i32, v4i32); +v2i64 __builtin_msa_ilvl_d (v2i64, v2i64); + +v16i8 __builtin_msa_ilvod_b (v16i8, v16i8); +v8i16 __builtin_msa_ilvod_h (v8i16, v8i16); +v4i32 __builtin_msa_ilvod_w (v4i32, v4i32); +v2i64 __builtin_msa_ilvod_d (v2i64, v2i64); + +v16i8 __builtin_msa_ilvr_b (v16i8, v16i8); +v8i16 __builtin_msa_ilvr_h (v8i16, v8i16); +v4i32 __builtin_msa_ilvr_w (v4i32, v4i32); +v2i64 __builtin_msa_ilvr_d (v2i64, v2i64); + +v16i8 __builtin_msa_insert_b (v16i8, imm0_15, i32); +v8i16 __builtin_msa_insert_h (v8i16, imm0_7, i32); +v4i32 __builtin_msa_insert_w (v4i32, imm0_3, i32); +v2i64 __builtin_msa_insert_d (v2i64, imm0_1, i64); + +v16i8 __builtin_msa_insve_b (v16i8, imm0_15, v16i8); +v8i16 __builtin_msa_insve_h (v8i16, imm0_7, v8i16); +v4i32 __builtin_msa_insve_w (v4i32, imm0_3, v4i32); +v2i64 __builtin_msa_insve_d (v2i64, imm0_1, v2i64); + +v16i8 __builtin_msa_ld_b (const void *, imm_n512_511); +v8i16 __builtin_msa_ld_h (const void *, imm_n1024_1022); +v4i32 __builtin_msa_ld_w (const void *, imm_n2048_2044); +v2i64 __builtin_msa_ld_d (const void *, imm_n4096_4088); + +v16i8 __builtin_msa_ldi_b (imm_n512_511); +v8i16 __builtin_msa_ldi_h (imm_n512_511); +v4i32 __builtin_msa_ldi_w (imm_n512_511); +v2i64 __builtin_msa_ldi_d (imm_n512_511); + +v8i16 __builtin_msa_madd_q_h (v8i16, v8i16, v8i16); +v4i32 __builtin_msa_madd_q_w (v4i32, v4i32, v4i32); + +v8i16 __builtin_msa_maddr_q_h (v8i16, v8i16, v8i16); +v4i32 __builtin_msa_maddr_q_w (v4i32, v4i32, v4i32); + +v16i8 __builtin_msa_maddv_b (v16i8, v16i8, v16i8); +v8i16 __builtin_msa_maddv_h (v8i16, v8i16, v8i16); +v4i32 __builtin_msa_maddv_w (v4i32, v4i32, v4i32); +v2i64 __builtin_msa_maddv_d (v2i64, v2i64, v2i64); + +v16i8 __builtin_msa_max_a_b (v16i8, v16i8); +v8i16 __builtin_msa_max_a_h (v8i16, v8i16); +v4i32 __builtin_msa_max_a_w (v4i32, v4i32); +v2i64 __builtin_msa_max_a_d (v2i64, v2i64); + +v16i8 __builtin_msa_max_s_b (v16i8, v16i8); +v8i16 __builtin_msa_max_s_h (v8i16, v8i16); +v4i32 __builtin_msa_max_s_w (v4i32, v4i32); +v2i64 __builtin_msa_max_s_d (v2i64, v2i64); + +v16u8 __builtin_msa_max_u_b (v16u8, v16u8); +v8u16 __builtin_msa_max_u_h (v8u16, v8u16); +v4u32 __builtin_msa_max_u_w (v4u32, v4u32); +v2u64 __builtin_msa_max_u_d (v2u64, v2u64); + +v16i8 __builtin_msa_maxi_s_b (v16i8, imm_n16_15); +v8i16 __builtin_msa_maxi_s_h (v8i16, imm_n16_15); +v4i32 __builtin_msa_maxi_s_w (v4i32, imm_n16_15); +v2i64 __builtin_msa_maxi_s_d (v2i64, imm_n16_15); + +v16u8 __builtin_msa_maxi_u_b (v16u8, imm0_31); +v8u16 __builtin_msa_maxi_u_h (v8u16, imm0_31); +v4u32 __builtin_msa_maxi_u_w (v4u32, imm0_31); +v2u64 __builtin_msa_maxi_u_d (v2u64, imm0_31); + +v16i8 __builtin_msa_min_a_b (v16i8, v16i8); +v8i16 __builtin_msa_min_a_h (v8i16, v8i16); +v4i32 __builtin_msa_min_a_w (v4i32, v4i32); +v2i64 __builtin_msa_min_a_d (v2i64, v2i64); + +v16i8 __builtin_msa_min_s_b (v16i8, v16i8); +v8i16 __builtin_msa_min_s_h (v8i16, v8i16); +v4i32 __builtin_msa_min_s_w (v4i32, v4i32); +v2i64 __builtin_msa_min_s_d (v2i64, v2i64); + +v16u8 __builtin_msa_min_u_b (v16u8, v16u8); +v8u16 __builtin_msa_min_u_h (v8u16, v8u16); +v4u32 __builtin_msa_min_u_w (v4u32, v4u32); +v2u64 __builtin_msa_min_u_d (v2u64, v2u64); + +v16i8 __builtin_msa_mini_s_b (v16i8, imm_n16_15); +v8i16 __builtin_msa_mini_s_h (v8i16, imm_n16_15); +v4i32 __builtin_msa_mini_s_w (v4i32, imm_n16_15); +v2i64 __builtin_msa_mini_s_d (v2i64, imm_n16_15); + +v16u8 __builtin_msa_mini_u_b (v16u8, imm0_31); +v8u16 __builtin_msa_mini_u_h (v8u16, imm0_31); +v4u32 __builtin_msa_mini_u_w (v4u32, imm0_31); +v2u64 __builtin_msa_mini_u_d (v2u64, imm0_31); + +v16i8 __builtin_msa_mod_s_b (v16i8, v16i8); +v8i16 __builtin_msa_mod_s_h (v8i16, v8i16); +v4i32 __builtin_msa_mod_s_w (v4i32, v4i32); +v2i64 __builtin_msa_mod_s_d (v2i64, v2i64); + +v16u8 __builtin_msa_mod_u_b (v16u8, v16u8); +v8u16 __builtin_msa_mod_u_h (v8u16, v8u16); +v4u32 __builtin_msa_mod_u_w (v4u32, v4u32); +v2u64 __builtin_msa_mod_u_d (v2u64, v2u64); + +v16i8 __builtin_msa_move_v (v16i8); + +v8i16 __builtin_msa_msub_q_h (v8i16, v8i16, v8i16); +v4i32 __builtin_msa_msub_q_w (v4i32, v4i32, v4i32); + +v8i16 __builtin_msa_msubr_q_h (v8i16, v8i16, v8i16); +v4i32 __builtin_msa_msubr_q_w (v4i32, v4i32, v4i32); + +v16i8 __builtin_msa_msubv_b (v16i8, v16i8, v16i8); +v8i16 __builtin_msa_msubv_h (v8i16, v8i16, v8i16); +v4i32 __builtin_msa_msubv_w (v4i32, v4i32, v4i32); +v2i64 __builtin_msa_msubv_d (v2i64, v2i64, v2i64); + +v8i16 __builtin_msa_mul_q_h (v8i16, v8i16); +v4i32 __builtin_msa_mul_q_w (v4i32, v4i32); + +v8i16 __builtin_msa_mulr_q_h (v8i16, v8i16); +v4i32 __builtin_msa_mulr_q_w (v4i32, v4i32); + +v16i8 __builtin_msa_mulv_b (v16i8, v16i8); +v8i16 __builtin_msa_mulv_h (v8i16, v8i16); +v4i32 __builtin_msa_mulv_w (v4i32, v4i32); +v2i64 __builtin_msa_mulv_d (v2i64, v2i64); + +v16i8 __builtin_msa_nloc_b (v16i8); +v8i16 __builtin_msa_nloc_h (v8i16); +v4i32 __builtin_msa_nloc_w (v4i32); +v2i64 __builtin_msa_nloc_d (v2i64); + +v16i8 __builtin_msa_nlzc_b (v16i8); +v8i16 __builtin_msa_nlzc_h (v8i16); +v4i32 __builtin_msa_nlzc_w (v4i32); +v2i64 __builtin_msa_nlzc_d (v2i64); + +v16u8 __builtin_msa_nor_v (v16u8, v16u8); + +v16u8 __builtin_msa_nori_b (v16u8, imm0_255); + +v16u8 __builtin_msa_or_v (v16u8, v16u8); + +v16u8 __builtin_msa_ori_b (v16u8, imm0_255); + +v16i8 __builtin_msa_pckev_b (v16i8, v16i8); +v8i16 __builtin_msa_pckev_h (v8i16, v8i16); +v4i32 __builtin_msa_pckev_w (v4i32, v4i32); +v2i64 __builtin_msa_pckev_d (v2i64, v2i64); + +v16i8 __builtin_msa_pckod_b (v16i8, v16i8); +v8i16 __builtin_msa_pckod_h (v8i16, v8i16); +v4i32 __builtin_msa_pckod_w (v4i32, v4i32); +v2i64 __builtin_msa_pckod_d (v2i64, v2i64); + +v16i8 __builtin_msa_pcnt_b (v16i8); +v8i16 __builtin_msa_pcnt_h (v8i16); +v4i32 __builtin_msa_pcnt_w (v4i32); +v2i64 __builtin_msa_pcnt_d (v2i64); + +v16i8 __builtin_msa_sat_s_b (v16i8, imm0_7); +v8i16 __builtin_msa_sat_s_h (v8i16, imm0_15); +v4i32 __builtin_msa_sat_s_w (v4i32, imm0_31); +v2i64 __builtin_msa_sat_s_d (v2i64, imm0_63); + +v16u8 __builtin_msa_sat_u_b (v16u8, imm0_7); +v8u16 __builtin_msa_sat_u_h (v8u16, imm0_15); +v4u32 __builtin_msa_sat_u_w (v4u32, imm0_31); +v2u64 __builtin_msa_sat_u_d (v2u64, imm0_63); + +v16i8 __builtin_msa_shf_b (v16i8, imm0_255); +v8i16 __builtin_msa_shf_h (v8i16, imm0_255); +v4i32 __builtin_msa_shf_w (v4i32, imm0_255); + +v16i8 __builtin_msa_sld_b (v16i8, v16i8, i32); +v8i16 __builtin_msa_sld_h (v8i16, v8i16, i32); +v4i32 __builtin_msa_sld_w (v4i32, v4i32, i32); +v2i64 __builtin_msa_sld_d (v2i64, v2i64, i32); + +v16i8 __builtin_msa_sldi_b (v16i8, v16i8, imm0_15); +v8i16 __builtin_msa_sldi_h (v8i16, v8i16, imm0_7); +v4i32 __builtin_msa_sldi_w (v4i32, v4i32, imm0_3); +v2i64 __builtin_msa_sldi_d (v2i64, v2i64, imm0_1); + +v16i8 __builtin_msa_sll_b (v16i8, v16i8); +v8i16 __builtin_msa_sll_h (v8i16, v8i16); +v4i32 __builtin_msa_sll_w (v4i32, v4i32); +v2i64 __builtin_msa_sll_d (v2i64, v2i64); + +v16i8 __builtin_msa_slli_b (v16i8, imm0_7); +v8i16 __builtin_msa_slli_h (v8i16, imm0_15); +v4i32 __builtin_msa_slli_w (v4i32, imm0_31); +v2i64 __builtin_msa_slli_d (v2i64, imm0_63); + +v16i8 __builtin_msa_splat_b (v16i8, i32); +v8i16 __builtin_msa_splat_h (v8i16, i32); +v4i32 __builtin_msa_splat_w (v4i32, i32); +v2i64 __builtin_msa_splat_d (v2i64, i32); + +v16i8 __builtin_msa_splati_b (v16i8, imm0_15); +v8i16 __builtin_msa_splati_h (v8i16, imm0_7); +v4i32 __builtin_msa_splati_w (v4i32, imm0_3); +v2i64 __builtin_msa_splati_d (v2i64, imm0_1); + +v16i8 __builtin_msa_sra_b (v16i8, v16i8); +v8i16 __builtin_msa_sra_h (v8i16, v8i16); +v4i32 __builtin_msa_sra_w (v4i32, v4i32); +v2i64 __builtin_msa_sra_d (v2i64, v2i64); + +v16i8 __builtin_msa_srai_b (v16i8, imm0_7); +v8i16 __builtin_msa_srai_h (v8i16, imm0_15); +v4i32 __builtin_msa_srai_w (v4i32, imm0_31); +v2i64 __builtin_msa_srai_d (v2i64, imm0_63); + +v16i8 __builtin_msa_srar_b (v16i8, v16i8); +v8i16 __builtin_msa_srar_h (v8i16, v8i16); +v4i32 __builtin_msa_srar_w (v4i32, v4i32); +v2i64 __builtin_msa_srar_d (v2i64, v2i64); + +v16i8 __builtin_msa_srari_b (v16i8, imm0_7); +v8i16 __builtin_msa_srari_h (v8i16, imm0_15); +v4i32 __builtin_msa_srari_w (v4i32, imm0_31); +v2i64 __builtin_msa_srari_d (v2i64, imm0_63); + +v16i8 __builtin_msa_srl_b (v16i8, v16i8); +v8i16 __builtin_msa_srl_h (v8i16, v8i16); +v4i32 __builtin_msa_srl_w (v4i32, v4i32); +v2i64 __builtin_msa_srl_d (v2i64, v2i64); + +v16i8 __builtin_msa_srli_b (v16i8, imm0_7); +v8i16 __builtin_msa_srli_h (v8i16, imm0_15); +v4i32 __builtin_msa_srli_w (v4i32, imm0_31); +v2i64 __builtin_msa_srli_d (v2i64, imm0_63); + +v16i8 __builtin_msa_srlr_b (v16i8, v16i8); +v8i16 __builtin_msa_srlr_h (v8i16, v8i16); +v4i32 __builtin_msa_srlr_w (v4i32, v4i32); +v2i64 __builtin_msa_srlr_d (v2i64, v2i64); + +v16i8 __builtin_msa_srlri_b (v16i8, imm0_7); +v8i16 __builtin_msa_srlri_h (v8i16, imm0_15); +v4i32 __builtin_msa_srlri_w (v4i32, imm0_31); +v2i64 __builtin_msa_srlri_d (v2i64, imm0_63); + +void __builtin_msa_st_b (v16i8, void *, imm_n512_511); +void __builtin_msa_st_h (v8i16, void *, imm_n1024_1022); +void __builtin_msa_st_w (v4i32, void *, imm_n2048_2044); +void __builtin_msa_st_d (v2i64, void *, imm_n4096_4088); + +v16i8 __builtin_msa_subs_s_b (v16i8, v16i8); +v8i16 __builtin_msa_subs_s_h (v8i16, v8i16); +v4i32 __builtin_msa_subs_s_w (v4i32, v4i32); +v2i64 __builtin_msa_subs_s_d (v2i64, v2i64); + +v16u8 __builtin_msa_subs_u_b (v16u8, v16u8); +v8u16 __builtin_msa_subs_u_h (v8u16, v8u16); +v4u32 __builtin_msa_subs_u_w (v4u32, v4u32); +v2u64 __builtin_msa_subs_u_d (v2u64, v2u64); + +v16u8 __builtin_msa_subsus_u_b (v16u8, v16i8); +v8u16 __builtin_msa_subsus_u_h (v8u16, v8i16); +v4u32 __builtin_msa_subsus_u_w (v4u32, v4i32); +v2u64 __builtin_msa_subsus_u_d (v2u64, v2i64); + +v16i8 __builtin_msa_subsuu_s_b (v16u8, v16u8); +v8i16 __builtin_msa_subsuu_s_h (v8u16, v8u16); +v4i32 __builtin_msa_subsuu_s_w (v4u32, v4u32); +v2i64 __builtin_msa_subsuu_s_d (v2u64, v2u64); + +v16i8 __builtin_msa_subv_b (v16i8, v16i8); +v8i16 __builtin_msa_subv_h (v8i16, v8i16); +v4i32 __builtin_msa_subv_w (v4i32, v4i32); +v2i64 __builtin_msa_subv_d (v2i64, v2i64); + +v16i8 __builtin_msa_subvi_b (v16i8, imm0_31); +v8i16 __builtin_msa_subvi_h (v8i16, imm0_31); +v4i32 __builtin_msa_subvi_w (v4i32, imm0_31); +v2i64 __builtin_msa_subvi_d (v2i64, imm0_31); + +v16i8 __builtin_msa_vshf_b (v16i8, v16i8, v16i8); +v8i16 __builtin_msa_vshf_h (v8i16, v8i16, v8i16); +v4i32 __builtin_msa_vshf_w (v4i32, v4i32, v4i32); +v2i64 __builtin_msa_vshf_d (v2i64, v2i64, v2i64); + +v16u8 __builtin_msa_xor_v (v16u8, v16u8); + +v16u8 __builtin_msa_xori_b (v16u8, imm0_255);</pre> +</div> </div> <div class="nav-panel"> <p> Up: <a href="mips-simd-architecture-_0028msa_0029-support">MIPS SIMD Architecture (MSA) Support</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-SIMD-Architecture-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MIPS-SIMD-Architecture-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mixed-labels-and-declarations.html b/devdocs/gcc~13/mixed-labels-and-declarations.html new file mode 100644 index 00000000..14875f09 --- /dev/null +++ b/devdocs/gcc~13/mixed-labels-and-declarations.html @@ -0,0 +1,10 @@ +<div class="section-level-extent" id="Mixed-Labels-and-Declarations"> <div class="nav-panel"> <p> Next: <a href="function-attributes" accesskey="n" rel="next">Declaring Attributes of Functions</a>, Previous: <a href="cast-to-union" accesskey="p" rel="prev">Cast to a Union Type</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Mixed-Declarations_002c-Labels-and-Code"><span>6.32 Mixed Declarations, Labels and Code<a class="copiable-link" href="#Mixed-Declarations_002c-Labels-and-Code"> ¶</a></span></h1> <p>ISO C99 and ISO C++ allow declarations and code to be freely mixed within compound statements. ISO C2X allows labels to be placed before declarations and at the end of a compound statement. As an extension, GNU C also allows all this in C90 mode. For example, you could do: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int i; +/* <span class="r">…</span> */ +i++; +int j = i + 2;</pre> +</div> <p>Each identifier is visible from where it is declared until the end of the enclosing block. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Mixed-Labels-and-Declarations.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Mixed-Labels-and-Declarations.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mmix-options.html b/devdocs/gcc~13/mmix-options.html new file mode 100644 index 00000000..31b3e606 --- /dev/null +++ b/devdocs/gcc~13/mmix-options.html @@ -0,0 +1,35 @@ +<div class="subsection-level-extent" id="MMIX-Options"> <div class="nav-panel"> <p> Next: <a href="mn10300-options" accesskey="n" rel="next">MN10300 Options</a>, Previous: <a href="mips-options" accesskey="p" rel="prev">MIPS Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MMIX-Options-1"><span>3.19.29 MMIX Options<a class="copiable-link" href="#MMIX-Options-1"> ¶</a></span></h1> <p>These options are defined for the MMIX: </p> <dl class="table"> <dt> + <span><code class="code">-mlibfuncs</code><a class="copiable-link" href="#index-mlibfuncs"> ¶</a></span> +</dt> <dt><code class="code">-mno-libfuncs</code></dt> <dd> +<p>Specify that intrinsic library functions are being compiled, passing all values in registers, no matter the size. </p> </dd> <dt> + <span><code class="code">-mepsilon</code><a class="copiable-link" href="#index-mepsilon"> ¶</a></span> +</dt> <dt><code class="code">-mno-epsilon</code></dt> <dd> +<p>Generate floating-point comparison instructions that compare with respect to the <code class="code">rE</code> epsilon register. </p> </dd> <dt> + <span><code class="code">-mabi=mmixware</code><a class="copiable-link" href="#index-mabi_003dmmixware"> ¶</a></span> +</dt> <dt><code class="code">-mabi=gnu</code></dt> <dd> +<p>Generate code that passes function parameters and return values that (in the called function) are seen as registers <code class="code">$0</code> and up, as opposed to the GNU ABI which uses global registers <code class="code">$231</code> and up. </p> </dd> <dt> + <span><code class="code">-mzero-extend</code><a class="copiable-link" href="#index-mzero-extend"> ¶</a></span> +</dt> <dt><code class="code">-mno-zero-extend</code></dt> <dd> +<p>When reading data from memory in sizes shorter than 64 bits, use (do not use) zero-extending load instructions by default, rather than sign-extending ones. </p> </dd> <dt> + <span><code class="code">-mknuthdiv</code><a class="copiable-link" href="#index-mknuthdiv"> ¶</a></span> +</dt> <dt><code class="code">-mno-knuthdiv</code></dt> <dd> +<p>Make the result of a division yielding a remainder have the same sign as the divisor. With the default, <samp class="option">-mno-knuthdiv</samp>, the sign of the remainder follows the sign of the dividend. Both methods are arithmetically valid, the latter being almost exclusively used. </p> </dd> <dt> + <span><code class="code">-mtoplevel-symbols</code><a class="copiable-link" href="#index-mtoplevel-symbols"> ¶</a></span> +</dt> <dt><code class="code">-mno-toplevel-symbols</code></dt> <dd> +<p>Prepend (do not prepend) a ‘<samp class="samp">:</samp>’ to all global symbols, so the assembly code can be used with the <code class="code">PREFIX</code> assembly directive. </p> </dd> <dt> +<span><code class="code">-melf</code><a class="copiable-link" href="#index-melf-1"> ¶</a></span> +</dt> <dd> +<p>Generate an executable in the ELF format, rather than the default ‘<samp class="samp">mmo</samp>’ format used by the <code class="command">mmix</code> simulator. </p> </dd> <dt> + <span><code class="code">-mbranch-predict</code><a class="copiable-link" href="#index-mbranch-predict"> ¶</a></span> +</dt> <dt><code class="code">-mno-branch-predict</code></dt> <dd> +<p>Use (do not use) the probable-branch instructions, when static branch prediction indicates a probable branch. </p> </dd> <dt> + <span><code class="code">-mbase-addresses</code><a class="copiable-link" href="#index-mbase-addresses"> ¶</a></span> +</dt> <dt><code class="code">-mno-base-addresses</code></dt> <dd> +<p>Generate (do not generate) code that uses <em class="emph">base addresses</em>. Using a base address automatically generates a request (handled by the assembler and the linker) for a constant to be set up in a global register. The register is used for one or more base address requests within the range 0 to 255 from the value held in the register. The generally leads to short and fast code, but the number of different data items that can be addressed is limited. This means that a program that uses lots of static data may require <samp class="option">-mno-base-addresses</samp>. </p> </dd> <dt> + <span><code class="code">-msingle-exit</code><a class="copiable-link" href="#index-msingle-exit"> ¶</a></span> +</dt> <dt><code class="code">-mno-single-exit</code></dt> <dd><p>Force (do not force) generated code to have a single exit point in each function. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="mn10300-options">MN10300 Options</a>, Previous: <a href="mips-options">MIPS Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MMIX-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MMIX-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/mn10300-options.html b/devdocs/gcc~13/mn10300-options.html new file mode 100644 index 00000000..4c8d239e --- /dev/null +++ b/devdocs/gcc~13/mn10300-options.html @@ -0,0 +1,48 @@ +<div class="subsection-level-extent" id="MN10300-Options"> <div class="nav-panel"> <p> Next: <a href="moxie-options" accesskey="n" rel="next">Moxie Options</a>, Previous: <a href="mmix-options" accesskey="p" rel="prev">MMIX Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MN10300-Options-1"><span>3.19.30 MN10300 Options<a class="copiable-link" href="#MN10300-Options-1"> ¶</a></span></h1> <p>These <samp class="option">-m</samp> options are defined for Matsushita MN10300 architectures: </p> <dl class="table"> <dt> +<span><code class="code">-mmult-bug</code><a class="copiable-link" href="#index-mmult-bug"> ¶</a></span> +</dt> <dd> +<p>Generate code to avoid bugs in the multiply instructions for the MN10300 processors. This is the default. </p> </dd> <dt> +<span><code class="code">-mno-mult-bug</code><a class="copiable-link" href="#index-mno-mult-bug"> ¶</a></span> +</dt> <dd> +<p>Do not generate code to avoid bugs in the multiply instructions for the MN10300 processors. </p> </dd> <dt> +<span><code class="code">-mam33</code><a class="copiable-link" href="#index-mam33"> ¶</a></span> +</dt> <dd> +<p>Generate code using features specific to the AM33 processor. </p> </dd> <dt> +<span><code class="code">-mno-am33</code><a class="copiable-link" href="#index-mno-am33"> ¶</a></span> +</dt> <dd> +<p>Do not generate code using features specific to the AM33 processor. This is the default. </p> </dd> <dt> +<span><code class="code">-mam33-2</code><a class="copiable-link" href="#index-mam33-2"> ¶</a></span> +</dt> <dd> +<p>Generate code using features specific to the AM33/2.0 processor. </p> </dd> <dt> +<span><code class="code">-mam34</code><a class="copiable-link" href="#index-mam34"> ¶</a></span> +</dt> <dd> +<p>Generate code using features specific to the AM34 processor. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-mtune-11"> ¶</a></span> +</dt> <dd> +<p>Use the timing characteristics of the indicated CPU type when scheduling instructions. This does not change the targeted processor type. The CPU type must be one of ‘<samp class="samp">mn10300</samp>’, ‘<samp class="samp">am33</samp>’, ‘<samp class="samp">am33-2</samp>’ or ‘<samp class="samp">am34</samp>’. </p> </dd> <dt> +<span><code class="code">-mreturn-pointer-on-d0</code><a class="copiable-link" href="#index-mreturn-pointer-on-d0"> ¶</a></span> +</dt> <dd> +<p>When generating a function that returns a pointer, return the pointer in both <code class="code">a0</code> and <code class="code">d0</code>. Otherwise, the pointer is returned only in <code class="code">a0</code>, and attempts to call such functions without a prototype result in errors. Note that this option is on by default; use <samp class="option">-mno-return-pointer-on-d0</samp> to disable it. </p> </dd> <dt> +<span><code class="code">-mno-crt0</code><a class="copiable-link" href="#index-mno-crt0"> ¶</a></span> +</dt> <dd> +<p>Do not link in the C run-time initialization object file. </p> </dd> <dt> +<span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax-2"> ¶</a></span> +</dt> <dd> +<p>Indicate to the linker that it should perform a relaxation optimization pass to shorten branches, calls and absolute memory addresses. This option only has an effect when used on the command line for the final link step. </p> <p>This option makes symbolic debugging impossible. </p> </dd> <dt> +<span><code class="code">-mliw</code><a class="copiable-link" href="#index-mliw"> ¶</a></span> +</dt> <dd> +<p>Allow the compiler to generate <em class="emph">Long Instruction Word</em> instructions if the target is the ‘<samp class="samp">AM33</samp>’ or later. This is the default. This option defines the preprocessor macro <code class="code">__LIW__</code>. </p> </dd> <dt> +<span><code class="code">-mno-liw</code><a class="copiable-link" href="#index-mno-liw"> ¶</a></span> +</dt> <dd> +<p>Do not allow the compiler to generate <em class="emph">Long Instruction Word</em> instructions. This option defines the preprocessor macro <code class="code">__NO_LIW__</code>. </p> </dd> <dt> +<span><code class="code">-msetlb</code><a class="copiable-link" href="#index-msetlb"> ¶</a></span> +</dt> <dd> +<p>Allow the compiler to generate the <em class="emph">SETLB</em> and <em class="emph">Lcc</em> instructions if the target is the ‘<samp class="samp">AM33</samp>’ or later. This is the default. This option defines the preprocessor macro <code class="code">__SETLB__</code>. </p> </dd> <dt> +<span><code class="code">-mno-setlb</code><a class="copiable-link" href="#index-mno-setlb"> ¶</a></span> +</dt> <dd> +<p>Do not allow the compiler to generate <em class="emph">SETLB</em> or <em class="emph">Lcc</em> instructions. This option defines the preprocessor macro <code class="code">__NO_SETLB__</code>. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="moxie-options">Moxie Options</a>, Previous: <a href="mmix-options">MMIX Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MN10300-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MN10300-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/modern-gnu-objective-c-runtime-api.html b/devdocs/gcc~13/modern-gnu-objective-c-runtime-api.html new file mode 100644 index 00000000..48114515 --- /dev/null +++ b/devdocs/gcc~13/modern-gnu-objective-c-runtime-api.html @@ -0,0 +1,18 @@ +<div class="subsection-level-extent" id="Modern-GNU-Objective-C-runtime-API"> <div class="nav-panel"> <p> Next: <a href="traditional-gnu-objective-c-runtime-api" accesskey="n" rel="next">Traditional GNU Objective-C Runtime API</a>, Up: <a href="gnu-objective-c-runtime-api" accesskey="u" rel="up">GNU Objective-C Runtime API</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Modern-GNU-Objective-C-Runtime-API"><span>8.1.1 Modern GNU Objective-C Runtime API<a class="copiable-link" href="#Modern-GNU-Objective-C-Runtime-API"> ¶</a></span></h1> <p>The GNU Objective-C runtime provides an API which is similar to the one provided by the “Objective-C 2.0” Apple/NeXT Objective-C runtime. The API is documented in the public header files of the GNU Objective-C runtime: </p> <ul class="itemize mark-bullet"> <li> +<samp class="file">objc/objc.h</samp>: this is the basic Objective-C header file, defining the basic Objective-C types such as <code class="code">id</code>, <code class="code">Class</code> and <code class="code">BOOL</code>. You have to include this header to do almost anything with Objective-C. </li> +<li> +<samp class="file">objc/runtime.h</samp>: this header declares most of the public runtime API functions allowing you to inspect and manipulate the Objective-C runtime data structures. These functions are fairly standardized across Objective-C runtimes and are almost identical to the Apple/NeXT Objective-C runtime ones. It does not declare functions in some specialized areas (constructing and forwarding message invocations, threading) which are in the other headers below. You have to include <samp class="file">objc/objc.h</samp> and <samp class="file">objc/runtime.h</samp> to use any of the functions, such as <code class="code">class_getName()</code>, declared in <samp class="file">objc/runtime.h</samp>. </li> +<li> +<samp class="file">objc/message.h</samp>: this header declares public functions used to construct, deconstruct and forward message invocations. Because messaging is done in quite a different way on different runtimes, functions in this header are specific to the GNU Objective-C runtime implementation. </li> +<li> +<samp class="file">objc/objc-exception.h</samp>: this header declares some public functions related to Objective-C exceptions. For example functions in this header allow you to throw an Objective-C exception from plain C/C++ code. </li> +<li> +<samp class="file">objc/objc-sync.h</samp>: this header declares some public functions related to the Objective-C <code class="code">@synchronized()</code> syntax, allowing you to emulate an Objective-C <code class="code">@synchronized()</code> block in plain C/C++ code. </li> +<li> +<samp class="file">objc/thr.h</samp>: this header declares a public runtime API threading layer that is only provided by the GNU Objective-C runtime. It declares functions such as <code class="code">objc_mutex_lock()</code>, which provide a platform-independent set of threading functions. </li> +</ul> <p>The header files contain detailed documentation for each function in the GNU Objective-C runtime API. </p> </div> <div class="nav-panel"> <p> Next: <a href="traditional-gnu-objective-c-runtime-api">Traditional GNU Objective-C Runtime API</a>, Up: <a href="gnu-objective-c-runtime-api">GNU Objective-C Runtime API</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Modern-GNU-Objective-C-runtime-API.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Modern-GNU-Objective-C-runtime-API.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/modifiers.html b/devdocs/gcc~13/modifiers.html new file mode 100644 index 00000000..de43cf4a --- /dev/null +++ b/devdocs/gcc~13/modifiers.html @@ -0,0 +1,19 @@ +<div class="subsubsection-level-extent" id="Modifiers"> <div class="nav-panel"> <p> Next: <a href="machine-constraints" accesskey="n" rel="next">Constraints for Particular Machines</a>, Previous: <a href="multi-alternative" accesskey="p" rel="prev">Multiple Alternative Constraints</a>, Up: <a href="constraints" accesskey="u" rel="up">Constraints for <code class="code">asm</code> Operands</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection subsection-level-set-subsubsection" id="Constraint-Modifier-Characters"><span>6.47.3.3 Constraint Modifier Characters<a class="copiable-link" href="#Constraint-Modifier-Characters"> ¶</a></span></h1> <p>Here are constraint modifier characters. </p> <dl class="table"> <dt> +<span>‘<samp class="samp">=</samp>’<a class="copiable-link" href="#index-_003d-in-constraint"> ¶</a></span> +</dt> <dd> +<p>Means that this operand is written to by this instruction: the previous value is discarded and replaced by new data. </p> </dd> <dt> +<span>‘<samp class="samp">+</samp>’<a class="copiable-link" href="#index-_002b-in-constraint"> ¶</a></span> +</dt> <dd> +<p>Means that this operand is both read and written by the instruction. </p> <p>When the compiler fixes up the operands to satisfy the constraints, it needs to know which operands are read by the instruction and which are written by it. ‘<samp class="samp">=</samp>’ identifies an operand which is only written; ‘<samp class="samp">+</samp>’ identifies an operand that is both read and written; all other operands are assumed to only be read. </p> <p>If you specify ‘<samp class="samp">=</samp>’ or ‘<samp class="samp">+</samp>’ in a constraint, you put it in the first character of the constraint string. </p> </dd> <dt> + <span>‘<samp class="samp">&</samp>’<a class="copiable-link" href="#index-_0026-in-constraint"> ¶</a></span> +</dt> <dd> +<p>Means (in a particular alternative) that this operand is an <em class="dfn">earlyclobber</em> operand, which is written before the instruction is finished using the input operands. Therefore, this operand may not lie in a register that is read by the instruction or as part of any memory address. </p> <p>‘<samp class="samp">&</samp>’ applies only to the alternative in which it is written. In constraints with multiple alternatives, sometimes one alternative requires ‘<samp class="samp">&</samp>’ while others do not. See, for example, the ‘<samp class="samp">movdf</samp>’ insn of the 68000. </p> <p>An operand which is read by the instruction can be tied to an earlyclobber operand if its only use as an input occurs before the early result is written. Adding alternatives of this form often allows GCC to produce better code when only some of the read operands can be affected by the earlyclobber. See, for example, the ‘<samp class="samp">mulsi3</samp>’ insn of the ARM. </p> <p>Furthermore, if the <em class="dfn">earlyclobber</em> operand is also a read/write operand, then that operand is written only after it’s used. </p> <p>‘<samp class="samp">&</samp>’ does not obviate the need to write ‘<samp class="samp">=</samp>’ or ‘<samp class="samp">+</samp>’. As <em class="dfn">earlyclobber</em> operands are always written, a read-only <em class="dfn">earlyclobber</em> operand is ill-formed and will be rejected by the compiler. </p> </dd> <dt> +<span>‘<samp class="samp">%</samp>’<a class="copiable-link" href="#index-_0025-in-constraint"> ¶</a></span> +</dt> <dd> +<p>Declares the instruction to be commutative for this operand and the following operand. This means that the compiler may interchange the two operands if that is the cheapest way to make all operands fit the constraints. ‘<samp class="samp">%</samp>’ applies to all alternatives and must appear as the first character in the constraint. Only read-only operands can use ‘<samp class="samp">%</samp>’. </p> <p>GCC can only handle one commutative pair in an asm; if you use more, the compiler may fail. Note that you need not use the modifier if the two alternatives are strictly identical; this would only waste time in the reload pass. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="machine-constraints">Constraints for Particular Machines</a>, Previous: <a href="multi-alternative">Multiple Alternative Constraints</a>, Up: <a href="constraints">Constraints for <code class="code">asm</code> Operands</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Modifiers.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Modifiers.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/moxie-options.html b/devdocs/gcc~13/moxie-options.html new file mode 100644 index 00000000..d5152b1b --- /dev/null +++ b/devdocs/gcc~13/moxie-options.html @@ -0,0 +1,18 @@ +<div class="subsection-level-extent" id="Moxie-Options"> <div class="nav-panel"> <p> Next: <a href="msp430-options" accesskey="n" rel="next">MSP430 Options</a>, Previous: <a href="mn10300-options" accesskey="p" rel="prev">MN10300 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Moxie-Options-1"><span>3.19.31 Moxie Options<a class="copiable-link" href="#Moxie-Options-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">-meb</code><a class="copiable-link" href="#index-meb"> ¶</a></span> +</dt> <dd> +<p>Generate big-endian code. This is the default for ‘<samp class="samp">moxie-*-*</samp>’ configurations. </p> </dd> <dt> +<span><code class="code">-mel</code><a class="copiable-link" href="#index-mel"> ¶</a></span> +</dt> <dd> +<p>Generate little-endian code. </p> </dd> <dt> +<span><code class="code">-mmul.x</code><a class="copiable-link" href="#index-mmul_002ex"> ¶</a></span> +</dt> <dd> +<p>Generate mul.x and umul.x instructions. This is the default for ‘<samp class="samp">moxiebox-*-*</samp>’ configurations. </p> </dd> <dt> +<span><code class="code">-mno-crt0</code><a class="copiable-link" href="#index-mno-crt0-1"> ¶</a></span> +</dt> <dd> +<p>Do not link in the C run-time initialization object file. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Moxie-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Moxie-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/msp430-built-in-functions.html b/devdocs/gcc~13/msp430-built-in-functions.html new file mode 100644 index 00000000..b130f221 --- /dev/null +++ b/devdocs/gcc~13/msp430-built-in-functions.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="MSP430-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="nds32-built-in-functions" accesskey="n" rel="next">NDS32 Built-in Functions</a>, Previous: <a href="other-mips-built-in-functions" accesskey="p" rel="prev">Other MIPS Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MSP430-Built-in-Functions-1"><span>6.60.20 MSP430 Built-in Functions<a class="copiable-link" href="#MSP430-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC provides a couple of special builtin functions to aid in the writing of interrupt handlers in C. </p> <dl class="table"> <dt><code class="code">__bic_SR_register_on_exit (int <var class="var">mask</var>)</code></dt> <dd> +<p>This clears the indicated bits in the saved copy of the status register currently residing on the stack. This only works inside interrupt handlers and the changes to the status register will only take affect once the handler returns. </p> </dd> <dt><code class="code">__bis_SR_register_on_exit (int <var class="var">mask</var>)</code></dt> <dd> +<p>This sets the indicated bits in the saved copy of the status register currently residing on the stack. This only works inside interrupt handlers and the changes to the status register will only take affect once the handler returns. </p> </dd> <dt><code class="code">__delay_cycles (long long <var class="var">cycles</var>)</code></dt> <dd><p>This inserts an instruction sequence that takes exactly <var class="var">cycles</var> cycles (between 0 and about 17E9) to complete. The inserted sequence may use jumps, loops, or no-ops, and does not interfere with any other instructions. Note that <var class="var">cycles</var> must be a compile-time constant integer - that is, you must pass a number, not a variable that may be optimized to a constant later. The number of cycles delayed by this builtin is exact. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/msp430-function-attributes.html b/devdocs/gcc~13/msp430-function-attributes.html new file mode 100644 index 00000000..3d6a66c6 --- /dev/null +++ b/devdocs/gcc~13/msp430-function-attributes.html @@ -0,0 +1,25 @@ +<div class="subsection-level-extent" id="MSP430-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="nds32-function-attributes" accesskey="n" rel="next">NDS32 Function Attributes</a>, Previous: <a href="mips-function-attributes" accesskey="p" rel="prev">MIPS Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MSP430-Function-Attributes-1"><span>6.33.20 MSP430 Function Attributes<a class="copiable-link" href="#MSP430-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the MSP430 back end: </p> <dl class="table"> <dt> +<span><code class="code">critical</code><a class="copiable-link" href="#index-critical-function-attribute_002c-MSP430"> ¶</a></span> +</dt> <dd> +<p>Critical functions disable interrupts upon entry and restore the previous interrupt state upon exit. Critical functions cannot also have the <code class="code">naked</code>, <code class="code">reentrant</code> or <code class="code">interrupt</code> attributes. </p> <p>The MSP430 hardware ensures that interrupts are disabled on entry to <code class="code">interrupt</code> functions, and restores the previous interrupt state on exit. The <code class="code">critical</code> attribute is therefore redundant on <code class="code">interrupt</code> functions. </p> </dd> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-MSP430"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> <p>You can provide an argument to the interrupt attribute which specifies a name or number. If the argument is a number it indicates the slot in the interrupt vector table (0 - 31) to which this handler should be assigned. If the argument is a name it is treated as a symbolic name for the vector slot. These names should match up with appropriate entries in the linker script. By default the names <code class="code">watchdog</code> for vector 26, <code class="code">nmi</code> for vector 30 and <code class="code">reset</code> for vector 31 are recognized. </p> </dd> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-MSP430"> ¶</a></span> +</dt> <dd> +<p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p> </dd> <dt> +<span><code class="code">reentrant</code><a class="copiable-link" href="#index-reentrant-function-attribute_002c-MSP430"> ¶</a></span> +</dt> <dd> +<p>Reentrant functions disable interrupts upon entry and enable them upon exit. Reentrant functions cannot also have the <code class="code">naked</code> or <code class="code">critical</code> attributes. They can have the <code class="code">interrupt</code> attribute. </p> </dd> <dt> +<span><code class="code">wakeup</code><a class="copiable-link" href="#index-wakeup-function-attribute_002c-MSP430"> ¶</a></span> +</dt> <dd> +<p>This attribute only applies to interrupt functions. It is silently ignored if applied to a non-interrupt function. A wakeup interrupt function will rouse the processor from any low-power state that it might be in when the function exits. </p> </dd> <dt> + <span><code class="code">lower</code><a class="copiable-link" href="#index-lower-function-attribute_002c-MSP430"> ¶</a></span> +</dt> <dt><code class="code">upper</code></dt> <dt><code class="code">either</code></dt> <dd> +<p>On the MSP430 target these attributes can be used to specify whether the function or variable should be placed into low memory, high memory, or the placement should be left to the linker to decide. The attributes are only significant if compiling for the MSP430X architecture in the large memory model. </p> <p>The attributes work in conjunction with a linker script that has been augmented to specify where to place sections with a <code class="code">.lower</code> and a <code class="code">.upper</code> prefix. So, for example, as well as placing the <code class="code">.data</code> section, the script also specifies the placement of a <code class="code">.lower.data</code> and a <code class="code">.upper.data</code> section. The intention is that <code class="code">lower</code> sections are placed into a small but easier to access memory region and the upper sections are placed into a larger, but slower to access, region. </p> <p>The <code class="code">either</code> attribute is special. It tells the linker to place the object into the corresponding <code class="code">lower</code> section if there is room for it. If there is insufficient room then the object is placed into the corresponding <code class="code">upper</code> section instead. Note that the placement algorithm is not very sophisticated. It does not attempt to find an optimal packing of the <code class="code">lower</code> sections. It just makes one pass over the objects and does the best that it can. Using the <samp class="option">-ffunction-sections</samp> and <samp class="option">-fdata-sections</samp> command-line options can help the packing, however, since they produce smaller, easier to pack regions. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="nds32-function-attributes">NDS32 Function Attributes</a>, Previous: <a href="mips-function-attributes">MIPS Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/msp430-options.html b/devdocs/gcc~13/msp430-options.html new file mode 100644 index 00000000..a785d60a --- /dev/null +++ b/devdocs/gcc~13/msp430-options.html @@ -0,0 +1,56 @@ +<div class="subsection-level-extent" id="MSP430-Options"> <div class="nav-panel"> <p> Next: <a href="nds32-options" accesskey="n" rel="next">NDS32 Options</a>, Previous: <a href="moxie-options" accesskey="p" rel="prev">Moxie Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MSP430-Options-1"><span>3.19.32 MSP430 Options<a class="copiable-link" href="#MSP430-Options-1"> ¶</a></span></h1> <p>These options are defined for the MSP430: </p> <dl class="table"> <dt> +<span><code class="code">-masm-hex</code><a class="copiable-link" href="#index-masm-hex"> ¶</a></span> +</dt> <dd> +<p>Force assembly output to always use hex constants. Normally such constants are signed decimals, but this option is available for testsuite and/or aesthetic purposes. </p> </dd> <dt> +<span><code class="code">-mmcu=</code><a class="copiable-link" href="#index-mmcu_003d"> ¶</a></span> +</dt> <dd> +<p>Select the MCU to target. This is used to create a C preprocessor symbol based upon the MCU name, converted to upper case and pre- and post-fixed with ‘<samp class="samp">__</samp>’. This in turn is used by the <samp class="file">msp430.h</samp> header file to select an MCU-specific supplementary header file. </p> <p>The option also sets the ISA to use. If the MCU name is one that is known to only support the 430 ISA then that is selected, otherwise the 430X ISA is selected. A generic MCU name of ‘<samp class="samp">msp430</samp>’ can also be used to select the 430 ISA. Similarly the generic ‘<samp class="samp">msp430x</samp>’ MCU name selects the 430X ISA. </p> <p>In addition an MCU-specific linker script is added to the linker command line. The script’s name is the name of the MCU with <samp class="file">.ld</samp> appended. Thus specifying <samp class="option">-mmcu=xxx</samp> on the <code class="command">gcc</code> command line defines the C preprocessor symbol <code class="code">__XXX__</code> and cause the linker to search for a script called <samp class="file">xxx.ld</samp>. </p> <p>The ISA and hardware multiply supported for the different MCUs is hard-coded into GCC. However, an external ‘<samp class="samp">devices.csv</samp>’ file can be used to extend device support beyond those that have been hard-coded. </p> <p>GCC searches for the ‘<samp class="samp">devices.csv</samp>’ file using the following methods in the given precedence order, where the first method takes precendence over the second which takes precedence over the third. </p> <dl class="table"> <dt>Include path specified with <code class="code">-I</code> and <code class="code">-L</code> +</dt> <dd><p>‘<samp class="samp">devices.csv</samp>’ will be searched for in each of the directories specified by include paths and linker library search paths. </p></dd> <dt>Path specified by the environment variable ‘<samp class="samp">MSP430_GCC_INCLUDE_DIR</samp>’</dt> <dd><p>Define the value of the global environment variable ‘<samp class="samp">MSP430_GCC_INCLUDE_DIR</samp>’ to the full path to the directory containing devices.csv, and GCC will search this directory for devices.csv. If devices.csv is found, this directory will also be registered as an include path, and linker library path. Header files and linker scripts in this directory can therefore be used without manually specifying <code class="code">-I</code> and <code class="code">-L</code> on the command line. </p></dd> <dt>The ‘<samp class="samp">msp430-elf{,bare}/include/devices</samp>’ directory</dt> <dd> +<p>Finally, GCC will examine ‘<samp class="samp">msp430-elf{,bare}/include/devices</samp>’ from the toolchain root directory. This directory does not exist in a default installation, but if the user has created it and copied ‘<samp class="samp">devices.csv</samp>’ there, then the MCU data will be read. As above, this directory will also be registered as an include path, and linker library path. </p> </dd> </dl> <p>If none of the above search methods find ‘<samp class="samp">devices.csv</samp>’, then the hard-coded MCU data is used. </p> </dd> <dt> + <span><code class="code">-mwarn-mcu</code><a class="copiable-link" href="#index-mwarn-mcu"> ¶</a></span> +</dt> <dt><code class="code">-mno-warn-mcu</code></dt> <dd> +<p>This option enables or disables warnings about conflicts between the MCU name specified by the <samp class="option">-mmcu</samp> option and the ISA set by the <samp class="option">-mcpu</samp> option and/or the hardware multiply support set by the <samp class="option">-mhwmult</samp> option. It also toggles warnings about unrecognized MCU names. This option is on by default. </p> </dd> <dt> +<span><code class="code">-mcpu=</code><a class="copiable-link" href="#index-mcpu_003d-4"> ¶</a></span> +</dt> <dd> +<p>Specifies the ISA to use. Accepted values are ‘<samp class="samp">msp430</samp>’, ‘<samp class="samp">msp430x</samp>’ and ‘<samp class="samp">msp430xv2</samp>’. This option is deprecated. The <samp class="option">-mmcu=</samp> option should be used to select the ISA. </p> </dd> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-5"> ¶</a></span> +</dt> <dd> +<p>Link to the simulator runtime libraries and linker script. Overrides any scripts that would be selected by the <samp class="option">-mmcu=</samp> option. </p> </dd> <dt> +<span><code class="code">-mlarge</code><a class="copiable-link" href="#index-mlarge"> ¶</a></span> +</dt> <dd> +<p>Use large-model addressing (20-bit pointers, 20-bit <code class="code">size_t</code>). </p> </dd> <dt> +<span><code class="code">-msmall</code><a class="copiable-link" href="#index-msmall"> ¶</a></span> +</dt> <dd> +<p>Use small-model addressing (16-bit pointers, 16-bit <code class="code">size_t</code>). </p> </dd> <dt> +<span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax-3"> ¶</a></span> +</dt> <dd> +<p>This option is passed to the assembler and linker, and allows the linker to perform certain optimizations that cannot be done until the final link. </p> </dd> <dt> +<span><code class="code">mhwmult=</code><a class="copiable-link" href="#index-mhwmult_003d"> ¶</a></span> +</dt> <dd> +<p>Describes the type of hardware multiply supported by the target. Accepted values are ‘<samp class="samp">none</samp>’ for no hardware multiply, ‘<samp class="samp">16bit</samp>’ for the original 16-bit-only multiply supported by early MCUs. ‘<samp class="samp">32bit</samp>’ for the 16/32-bit multiply supported by later MCUs and ‘<samp class="samp">f5series</samp>’ for the 16/32-bit multiply supported by F5-series MCUs. A value of ‘<samp class="samp">auto</samp>’ can also be given. This tells GCC to deduce the hardware multiply support based upon the MCU name provided by the <samp class="option">-mmcu</samp> option. If no <samp class="option">-mmcu</samp> option is specified or if the MCU name is not recognized then no hardware multiply support is assumed. <code class="code">auto</code> is the default setting. </p> <p>Hardware multiplies are normally performed by calling a library routine. This saves space in the generated code. When compiling at <samp class="option">-O3</samp> or higher however the hardware multiplier is invoked inline. This makes for bigger, but faster code. </p> <p>The hardware multiply routines disable interrupts whilst running and restore the previous interrupt state when they finish. This makes them safe to use inside interrupt handlers as well as in normal code. </p> </dd> <dt> +<span><code class="code">-minrt</code><a class="copiable-link" href="#index-minrt"> ¶</a></span> +</dt> <dd> +<p>Enable the use of a minimum runtime environment - no static initializers or constructors. This is intended for memory-constrained devices. The compiler includes special symbols in some objects that tell the linker and runtime which code fragments are required. </p> </dd> <dt> +<span><code class="code">-mtiny-printf</code><a class="copiable-link" href="#index-mtiny-printf"> ¶</a></span> +</dt> <dd> +<p>Enable reduced code size <code class="code">printf</code> and <code class="code">puts</code> library functions. The ‘<samp class="samp">tiny</samp>’ implementations of these functions are not reentrant, so must be used with caution in multi-threaded applications. </p> <p>Support for streams has been removed and the string to be printed will always be sent to stdout via the <code class="code">write</code> syscall. The string is not buffered before it is sent to write. </p> <p>This option requires Newlib Nano IO, so GCC must be configured with ‘<samp class="samp">--enable-newlib-nano-formatted-io</samp>’. </p> </dd> <dt> +<span><code class="code">-mmax-inline-shift=</code><a class="copiable-link" href="#index-mmax-inline-shift_003d"> ¶</a></span> +</dt> <dd> +<p>This option takes an integer between 0 and 64 inclusive, and sets the maximum number of inline shift instructions which should be emitted to perform a shift operation by a constant amount. When this value needs to be exceeded, an mspabi helper function is used instead. The default value is 4. </p> <p>This only affects cases where a shift by multiple positions cannot be completed with a single instruction (e.g. all shifts >1 on the 430 ISA). </p> <p>Shifts of a 32-bit value are at least twice as costly, so the value passed for this option is divided by 2 and the resulting value used instead. </p> </dd> <dt> + <span><code class="code">-mcode-region=</code><a class="copiable-link" href="#index-mcode-region"> ¶</a></span> +</dt> <dt><code class="code">-mdata-region=</code></dt> <dd> +<p>These options tell the compiler where to place functions and data that do not have one of the <code class="code">lower</code>, <code class="code">upper</code>, <code class="code">either</code> or <code class="code">section</code> attributes. Possible values are <code class="code">lower</code>, <code class="code">upper</code>, <code class="code">either</code> or <code class="code">any</code>. The first three behave like the corresponding attribute. The fourth possible value - <code class="code">any</code> - is the default. It leaves placement entirely up to the linker script and how it assigns the standard sections (<code class="code">.text</code>, <code class="code">.data</code>, etc) to the memory regions. </p> </dd> <dt> +<span><code class="code">-msilicon-errata=</code><a class="copiable-link" href="#index-msilicon-errata"> ¶</a></span> +</dt> <dd> +<p>This option passes on a request to assembler to enable the fixes for the named silicon errata. </p> </dd> <dt> +<span><code class="code">-msilicon-errata-warn=</code><a class="copiable-link" href="#index-msilicon-errata-warn"> ¶</a></span> +</dt> <dd> +<p>This option passes on a request to the assembler to enable warning messages when a silicon errata might need to be applied. </p> </dd> <dt> + <span><code class="code">-mwarn-devices-csv</code><a class="copiable-link" href="#index-mwarn-devices-csv"> ¶</a></span> +</dt> <dt><code class="code">-mno-warn-devices-csv</code></dt> <dd> +<p>Warn if ‘<samp class="samp">devices.csv</samp>’ is not found or there are problem parsing it (default: on). </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="nds32-options">NDS32 Options</a>, Previous: <a href="moxie-options">Moxie Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/msp430-variable-attributes.html b/devdocs/gcc~13/msp430-variable-attributes.html new file mode 100644 index 00000000..961aa08f --- /dev/null +++ b/devdocs/gcc~13/msp430-variable-attributes.html @@ -0,0 +1,12 @@ +<div class="subsection-level-extent" id="MSP430-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="nvidia-ptx-variable-attributes" accesskey="n" rel="next">Nvidia PTX Variable Attributes</a>, Previous: <a href="microsoft-windows-variable-attributes" accesskey="p" rel="prev">Microsoft Windows Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="MSP430-Variable-Attributes-1"><span>6.34.10 MSP430 Variable Attributes<a class="copiable-link" href="#MSP430-Variable-Attributes-1"> ¶</a></span></h1> <dl class="table"> <dt> + <span><code class="code">upper</code><a class="copiable-link" href="#index-upper-variable-attribute_002c-MSP430"> ¶</a></span> +</dt> <dt><code class="code">either</code></dt> <dd> +<p>These attributes are the same as the MSP430 function attributes of the same name (see <a class="pxref" href="msp430-function-attributes">MSP430 Function Attributes</a>). </p> </dd> <dt> +<span><code class="code">lower</code><a class="copiable-link" href="#index-lower-variable-attribute_002c-MSP430"> ¶</a></span> +</dt> <dd> +<p>This option behaves mostly the same as the MSP430 function attribute of the same name (see <a class="pxref" href="msp430-function-attributes">MSP430 Function Attributes</a>), but it has some additional functionality. </p> <p>If <samp class="option">-mdata-region=</samp>{<code class="code">upper,either,none</code>} has been passed, or the <code class="code">section</code> attribute is applied to a variable, the compiler will generate 430X instructions to handle it. This is because the compiler has to assume that the variable could get placed in the upper memory region (above address 0xFFFF). Marking the variable with the <code class="code">lower</code> attribute informs the compiler that the variable will be placed in lower memory so it is safe to use 430 instructions to handle it. </p> <p>In the case of the <code class="code">section</code> attribute, the section name given will be used, and the <code class="code">.lower</code> prefix will not be added. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/MSP430-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/multi-alternative.html b/devdocs/gcc~13/multi-alternative.html new file mode 100644 index 00000000..77a7f39d --- /dev/null +++ b/devdocs/gcc~13/multi-alternative.html @@ -0,0 +1,8 @@ +<div class="subsubsection-level-extent" id="Multi-Alternative"> <div class="nav-panel"> <p> Next: <a href="modifiers" accesskey="n" rel="next">Constraint Modifier Characters</a>, Previous: <a href="simple-constraints" accesskey="p" rel="prev">Simple Constraints</a>, Up: <a href="constraints" accesskey="u" rel="up">Constraints for <code class="code">asm</code> Operands</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection subsection-level-set-subsubsection" id="Multiple-Alternative-Constraints"><span>6.47.3.2 Multiple Alternative Constraints<a class="copiable-link" href="#Multiple-Alternative-Constraints"> ¶</a></span></h1> <p>Sometimes a single instruction has multiple alternative sets of possible operands. For example, on the 68000, a logical-or instruction can combine register or an immediate value into memory, or it can combine any kind of operand into a register; but it cannot combine one memory location into another. </p> <p>These constraints are represented as multiple alternatives. An alternative can be described by a series of letters for each operand. The overall constraint for an operand is made from the letters for this operand from the first alternative, a comma, the letters for this operand from the second alternative, a comma, and so on until the last alternative. All operands for a single instruction must have the same number of alternatives. </p> <p>So the first alternative for the 68000’s logical-or could be written as <code class="code">"+m" (output) : "ir" (input)</code>. The second could be <code class="code">"+r" +(output): "irm" (input)</code>. However, the fact that two memory locations cannot be used in a single instruction prevents simply using <code class="code">"+rm" +(output) : "irm" (input)</code>. Using multi-alternatives, this might be written as <code class="code">"+m,r" (output) : "ir,irm" (input)</code>. This describes all the available alternatives to the compiler, allowing it to choose the most efficient one for the current conditions. </p> <p>There is no way within the template to determine which alternative was chosen. However you may be able to wrap your <code class="code">asm</code> statements with builtins such as <code class="code">__builtin_constant_p</code> to achieve the desired results. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Multi-Alternative.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Multi-Alternative.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/name-lookup.html b/devdocs/gcc~13/name-lookup.html new file mode 100644 index 00000000..ab74435c --- /dev/null +++ b/devdocs/gcc~13/name-lookup.html @@ -0,0 +1,39 @@ +<div class="subsection-level-extent" id="Name-lookup"> <div class="nav-panel"> <p> Next: <a href="temporaries" accesskey="n" rel="next">Temporaries May Vanish Before You Expect</a>, Previous: <a href="static-definitions" accesskey="p" rel="prev">Declare <em class="emph">and</em> Define Static Members</a>, Up: <a href="c_002b_002b-misunderstandings" accesskey="u" rel="up">Common Misunderstandings with GNU C++</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Name-Lookup_002c-Templates_002c-and-Accessing-Members-of-Base-Classes"><span>14.7.2 Name Lookup, Templates, and Accessing Members of Base Classes<a class="copiable-link" href="#Name-Lookup_002c-Templates_002c-and-Accessing-Members-of-Base-Classes"> ¶</a></span></h1> <p>The C++ standard prescribes that all names that are not dependent on template parameters are bound to their present definitions when parsing a template function or class.<a class="footnote" id="DOCF9" href="#FOOT9"><sup>9</sup></a> Only names that are dependent are looked up at the point of instantiation. For example, consider </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void foo(double); + +struct A { + template <typename T> + void f () { + foo (1); // <span class="r">1</span> + int i = N; // <span class="r">2</span> + T t; + t.bar(); // <span class="r">3</span> + foo (t); // <span class="r">4</span> + } + + static const int N; +};</pre> +</div> <p>Here, the names <code class="code">foo</code> and <code class="code">N</code> appear in a context that does not depend on the type of <code class="code">T</code>. The compiler will thus require that they are defined in the context of use in the template, not only before the point of instantiation, and will here use <code class="code">::foo(double)</code> and <code class="code">A::N</code>, respectively. In particular, it will convert the integer value to a <code class="code">double</code> when passing it to <code class="code">::foo(double)</code>. </p> <p>Conversely, <code class="code">bar</code> and the call to <code class="code">foo</code> in the fourth marked line are used in contexts that do depend on the type of <code class="code">T</code>, so they are only looked up at the point of instantiation, and you can provide declarations for them after declaring the template, but before instantiating it. In particular, if you instantiate <code class="code">A::f<int></code>, the last line will call an overloaded <code class="code">::foo(int)</code> if one was provided, even if after the declaration of <code class="code">struct A</code>. </p> <p>This distinction between lookup of dependent and non-dependent names is called two-stage (or dependent) name lookup. G++ implements it since version 3.4. </p> <p>Two-stage name lookup sometimes leads to situations with behavior different from non-template codes. The most common is probably this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">template <typename T> struct Base { + int i; +}; + +template <typename T> struct Derived : public Base<T> { + int get_i() { return i; } +};</pre> +</div> <p>In <code class="code">get_i()</code>, <code class="code">i</code> is not used in a dependent context, so the compiler will look for a name declared at the enclosing namespace scope (which is the global scope here). It will not look into the base class, since that is dependent and you may declare specializations of <code class="code">Base</code> even after declaring <code class="code">Derived</code>, so the compiler cannot really know what <code class="code">i</code> would refer to. If there is no global variable <code class="code">i</code>, then you will get an error message. </p> <p>In order to make it clear that you want the member of the base class, you need to defer lookup until instantiation time, at which the base class is known. For this, you need to access <code class="code">i</code> in a dependent context, by either using <code class="code">this->i</code> (remember that <code class="code">this</code> is of type <code class="code">Derived<T>*</code>, so is obviously dependent), or using <code class="code">Base<T>::i</code>. Alternatively, <code class="code">Base<T>::i</code> might be brought into scope by a <code class="code">using</code>-declaration. </p> <p>Another, similar example involves calling member functions of a base class: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">template <typename T> struct Base { + int f(); +}; + +template <typename T> struct Derived : Base<T> { + int g() { return f(); }; +};</pre> +</div> <p>Again, the call to <code class="code">f()</code> is not dependent on template arguments (there are no arguments that depend on the type <code class="code">T</code>, and it is also not otherwise specified that the call should be in a dependent context). Thus a global declaration of such a function must be available, since the one in the base class is not visible until instantiation time. The compiler will consequently produce the following error message: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">x.cc: In member function `int Derived<T>::g()': +x.cc:6: error: there are no arguments to `f' that depend on a template + parameter, so a declaration of `f' must be available +x.cc:6: error: (if you use `-fpermissive', G++ will accept your code, but + allowing the use of an undeclared name is deprecated)</pre> +</div> <p>To make the code valid either use <code class="code">this->f()</code>, or <code class="code">Base<T>::f()</code>. Using the <samp class="option">-fpermissive</samp> flag will also let the compiler accept the code, by marking all function calls for which no declaration is visible at the time of definition of the template for later lookup at instantiation time, as if it were a dependent call. We do not recommend using <samp class="option">-fpermissive</samp> to work around invalid code, and it will also only catch cases where functions in base classes are called, not where variables in base classes are used (as in the example above). </p> <p>Note that some compilers (including G++ versions prior to 3.4) get these examples wrong and accept above code without an error. Those compilers do not implement two-stage name lookup correctly. </p> </div> <div class="footnotes-segment"> <h1 class="footnotes-heading">Footnotes</h1> <h2 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(9)</a></h2> <p>The C++ standard just uses the term “dependent” for names that depend on the type or value of template parameters. This shorter term will also be used in the rest of this section.</p> </div> <div class="nav-panel"> <p> Next: <a href="temporaries">Temporaries May Vanish Before You Expect</a>, Previous: <a href="static-definitions">Declare <em class="emph">and</em> Define Static Members</a>, Up: <a href="c_002b_002b-misunderstandings">Common Misunderstandings with GNU C++</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Name-lookup.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Name-lookup.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/named-address-spaces.html b/devdocs/gcc~13/named-address-spaces.html new file mode 100644 index 00000000..59906126 --- /dev/null +++ b/devdocs/gcc~13/named-address-spaces.html @@ -0,0 +1,66 @@ +<div class="section-level-extent" id="Named-Address-Spaces"> <div class="nav-panel"> <p> Next: <a href="zero-length" accesskey="n" rel="next">Arrays of Length Zero</a>, Previous: <a href="fixed-point" accesskey="p" rel="prev">Fixed-Point Types</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Named-Address-Spaces-1"><span>6.17 Named Address Spaces<a class="copiable-link" href="#Named-Address-Spaces-1"> ¶</a></span></h1> <p>As an extension, GNU C supports named address spaces as defined in the N1275 draft of ISO/IEC DTR 18037. Support for named address spaces in GCC will evolve as the draft technical report changes. Calling conventions for any target might also change. At present, only the AVR, M32C, PRU, RL78, and x86 targets support address spaces other than the generic address space. </p> <p>Address space identifiers may be used exactly like any other C type qualifier (e.g., <code class="code">const</code> or <code class="code">volatile</code>). See the N1275 document for more details. </p> <ul class="mini-toc"> <li><a href="#AVR-Named-Address-Spaces-1" accesskey="1">AVR Named Address Spaces</a></li> <li><a href="#M32C-Named-Address-Spaces" accesskey="2">M32C Named Address Spaces</a></li> <li><a href="#PRU-Named-Address-Spaces" accesskey="3">PRU Named Address Spaces</a></li> <li><a href="#RL78-Named-Address-Spaces" accesskey="4">RL78 Named Address Spaces</a></li> <li><a href="#x86-Named-Address-Spaces" accesskey="5">x86 Named Address Spaces</a></li> </ul> <div class="subsection-level-extent" id="AVR-Named-Address-Spaces-1"> <h2 class="subsection"><span>6.17.1 AVR Named Address Spaces<a class="copiable-link" href="#AVR-Named-Address-Spaces-1"> ¶</a></span></h2> <p>On the AVR target, there are several address spaces that can be used in order to put read-only data into the flash memory and access that data by means of the special instructions <code class="code">LPM</code> or <code class="code">ELPM</code> needed to read from flash. </p> <p>Devices belonging to <code class="code">avrtiny</code> and <code class="code">avrxmega3</code> can access flash memory by means of <code class="code">LD*</code> instructions because the flash memory is mapped into the RAM address space. There is <em class="emph">no need</em> for language extensions like <code class="code">__flash</code> or attribute <a class="ref" href="variable-attributes"><code class="code">progmem</code></a>. The default linker description files for these devices cater for that feature and <code class="code">.rodata</code> stays in flash: The compiler just generates <code class="code">LD*</code> instructions, and the linker script adds core specific offsets to all <code class="code">.rodata</code> symbols: <code class="code">0x4000</code> in the case of <code class="code">avrtiny</code> and <code class="code">0x8000</code> in the case of <code class="code">avrxmega3</code>. See <a class="ref" href="avr-options">AVR Options</a> for a list of respective devices. </p> <p>For devices not in <code class="code">avrtiny</code> or <code class="code">avrxmega3</code>, any data including read-only data is located in RAM (the generic address space) because flash memory is not visible in the RAM address space. In order to locate read-only data in flash memory <em class="emph">and</em> to generate the right instructions to access this data without using (inline) assembler code, special address spaces are needed. </p> <dl class="table"> <dt> +<span><code class="code">__flash</code><a class="copiable-link" href="#index-_005f_005fflash-AVR-Named-Address-Spaces"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">__flash</code> qualifier locates data in the <code class="code">.progmem.data</code> section. Data is read using the <code class="code">LPM</code> instruction. Pointers to this address space are 16 bits wide. </p> </dd> <dt> + <span><code class="code">__flash1</code><a class="copiable-link" href="#index-_005f_005fflash1-AVR-Named-Address-Spaces"> ¶</a></span> +</dt> <dt><code class="code">__flash2</code></dt> <dt><code class="code">__flash3</code></dt> <dt><code class="code">__flash4</code></dt> <dt><code class="code">__flash5</code></dt> <dd> +<p>These are 16-bit address spaces locating data in section <code class="code">.progmem<var class="var">N</var>.data</code> where <var class="var">N</var> refers to address space <code class="code">__flash<var class="var">N</var></code>. The compiler sets the <code class="code">RAMPZ</code> segment register appropriately before reading data by means of the <code class="code">ELPM</code> instruction. </p> </dd> <dt> +<span><code class="code">__memx</code><a class="copiable-link" href="#index-_005f_005fmemx-AVR-Named-Address-Spaces"> ¶</a></span> +</dt> <dd> +<p>This is a 24-bit address space that linearizes flash and RAM: If the high bit of the address is set, data is read from RAM using the lower two bytes as RAM address. If the high bit of the address is clear, data is read from flash with <code class="code">RAMPZ</code> set according to the high byte of the address. See <a class="xref" href="avr-built-in-functions"><code class="code">__builtin_avr_flash_segment</code></a>. </p> <p>Objects in this address space are located in <code class="code">.progmemx.data</code>. </p> +</dd> </dl> <p><b class="b">Example</b> </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">char my_read (const __flash char ** p) +{ + /* p is a pointer to RAM that points to a pointer to flash. + The first indirection of p reads that flash pointer + from RAM and the second indirection reads a char from this + flash address. */ + + return **p; +} + +/* Locate array[] in flash memory */ +const __flash int array[] = { 3, 5, 7, 11, 13, 17, 19 }; + +int i = 1; + +int main (void) +{ + /* Return 17 by reading from flash memory */ + return array[array[i]]; +}</pre> +</div> <p>For each named address space supported by avr-gcc there is an equally named but uppercase built-in macro defined. The purpose is to facilitate testing if respective address space support is available or not: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#ifdef __FLASH +const __flash int var = 1; + +int read_var (void) +{ + return var; +} +#else +#include <avr/pgmspace.h> /* From AVR-LibC */ + +const int var PROGMEM = 1; + +int read_var (void) +{ + return (int) pgm_read_word (&var); +} +#endif /* __FLASH */</pre> +</div> <p>Notice that attribute <a class="ref" href="variable-attributes"><code class="code">progmem</code></a> locates data in flash but accesses to these data read from generic address space, i.e. from RAM, so that you need special accessors like <code class="code">pgm_read_byte</code> from <a class="uref" href="https://www.nongnu.org/avr-libc/user-manual/">AVR-LibC</a> together with attribute <code class="code">progmem</code>. </p> <p><b class="b">Limitations and caveats</b> </p> <ul class="itemize mark-bullet"> <li>Reading across the 64 KiB section boundary of the <code class="code">__flash</code> or <code class="code">__flash<var class="var">N</var></code> address spaces shows undefined behavior. The only address space that supports reading across the 64 KiB flash segment boundaries is <code class="code">__memx</code>. </li> +<li>If you use one of the <code class="code">__flash<var class="var">N</var></code> address spaces you must arrange your linker script to locate the <code class="code">.progmem<var class="var">N</var>.data</code> sections according to your needs. </li> +<li>Any data or pointers to the non-generic address spaces must be qualified as <code class="code">const</code>, i.e. as read-only data. This still applies if the data in one of these address spaces like software version number or calibration lookup table are intended to be changed after load time by, say, a boot loader. In this case the right qualification is <code class="code">const</code> <code class="code">volatile</code> so that the compiler must not optimize away known values or insert them as immediates into operands of instructions. </li> +<li>The following code initializes a variable <code class="code">pfoo</code> located in static storage with a 24-bit address: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern const __memx char foo; +const __memx void *pfoo = &foo;</pre> +</div> </li> +<li>On the reduced Tiny devices like ATtiny40, no address spaces are supported. Just use vanilla C / C++ code without overhead as outlined above. Attribute <code class="code">progmem</code> is supported but works differently, see <a class="ref" href="variable-attributes">AVR Variable Attributes</a>. </li> +</ul> </div> <div class="subsection-level-extent" id="M32C-Named-Address-Spaces"> <h2 class="subsection"><span>6.17.2 M32C Named Address Spaces<a class="copiable-link" href="#M32C-Named-Address-Spaces"> ¶</a></span></h2> <p>On the M32C target, with the R8C and M16C CPU variants, variables qualified with <code class="code">__far</code> are accessed using 32-bit addresses in order to access memory beyond the first 64 Ki bytes. If <code class="code">__far</code> is used with the M32CM or M32C CPU variants, it has no effect. </p> </div> <div class="subsection-level-extent" id="PRU-Named-Address-Spaces"> <h2 class="subsection"><span>6.17.3 PRU Named Address Spaces<a class="copiable-link" href="#PRU-Named-Address-Spaces"> ¶</a></span></h2> <p>On the PRU target, variables qualified with <code class="code">__regio_symbol</code> are aliases used to access the special I/O CPU registers. They must be declared as <code class="code">extern</code> because such variables will not be allocated in any data memory. They must also be marked as <code class="code">volatile</code>, and can only be 32-bit integer types. The only names those variables can have are <code class="code">__R30</code> and <code class="code">__R31</code>, representing respectively the <code class="code">R30</code> and <code class="code">R31</code> special I/O CPU registers. Hence the following example is the only valid usage of <code class="code">__regio_symbol</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern volatile __regio_symbol uint32_t __R30; +extern volatile __regio_symbol uint32_t __R31;</pre> +</div> </div> <div class="subsection-level-extent" id="RL78-Named-Address-Spaces"> <h2 class="subsection"><span>6.17.4 RL78 Named Address Spaces<a class="copiable-link" href="#RL78-Named-Address-Spaces"> ¶</a></span></h2> <p>On the RL78 target, variables qualified with <code class="code">__far</code> are accessed with 32-bit pointers (20-bit addresses) rather than the default 16-bit addresses. Non-far variables are assumed to appear in the topmost 64 KiB of the address space. </p> </div> <div class="subsection-level-extent" id="x86-Named-Address-Spaces"> <h2 class="subsection"><span>6.17.5 x86 Named Address Spaces<a class="copiable-link" href="#x86-Named-Address-Spaces"> ¶</a></span></h2> <p>On the x86 target, variables may be declared as being relative to the <code class="code">%fs</code> or <code class="code">%gs</code> segments. </p> <dl class="table"> <dt> + <span><code class="code">__seg_fs</code><a class="copiable-link" href="#index-_005f_005fseg_005ffs-x86-named-address-space"> ¶</a></span> +</dt> <dt><code class="code">__seg_gs</code></dt> <dd> +<p>The object is accessed with the respective segment override prefix. </p> <p>The respective segment base must be set via some method specific to the operating system. Rather than require an expensive system call to retrieve the segment base, these address spaces are not considered to be subspaces of the generic (flat) address space. This means that explicit casts are required to convert pointers between these address spaces and the generic address space. In practice the application should cast to <code class="code">uintptr_t</code> and apply the segment base offset that it installed previously. </p> <p>The preprocessor symbols <code class="code">__SEG_FS</code> and <code class="code">__SEG_GS</code> are defined when these address spaces are supported. </p> +</dd> </dl> </div> </div> <div class="nav-panel"> <p> Next: <a href="zero-length">Arrays of Length Zero</a>, Previous: <a href="fixed-point">Fixed-Point Types</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Named-Address-Spaces.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Named-Address-Spaces.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nds32-built-in-functions.html b/devdocs/gcc~13/nds32-built-in-functions.html new file mode 100644 index 00000000..ae1b3bf0 --- /dev/null +++ b/devdocs/gcc~13/nds32-built-in-functions.html @@ -0,0 +1,30 @@ +<div class="subsection-level-extent" id="NDS32-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions" accesskey="n" rel="next">Basic PowerPC Built-in Functions</a>, Previous: <a href="msp430-built-in-functions" accesskey="p" rel="prev">MSP430 Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="NDS32-Built-in-Functions-1"><span>6.60.21 NDS32 Built-in Functions<a class="copiable-link" href="#NDS32-Built-in-Functions-1"> ¶</a></span></h1> <p>These built-in functions are available for the NDS32 target: </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnds32_005fisync"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_nds32_isync</strong> <code class="def-code-arguments">(int *<var class="var">addr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnds32_005fisync"> ¶</a></span> +</dt> <dd><p>Insert an ISYNC instruction into the instruction stream where <var class="var">addr</var> is an instruction address for serialization. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnds32_005fisb"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_nds32_isb</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnds32_005fisb"> ¶</a></span> +</dt> <dd><p>Insert an ISB instruction into the instruction stream. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnds32_005fmfsr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_nds32_mfsr</strong> <code class="def-code-arguments">(int <var class="var">sr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnds32_005fmfsr"> ¶</a></span> +</dt> <dd><p>Return the content of a system register which is mapped by <var class="var">sr</var>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnds32_005fmfusr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_nds32_mfusr</strong> <code class="def-code-arguments">(int <var class="var">usr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnds32_005fmfusr"> ¶</a></span> +</dt> <dd><p>Return the content of a user space register which is mapped by <var class="var">usr</var>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnds32_005fmtsr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_nds32_mtsr</strong> <code class="def-code-arguments">(int <var class="var">value</var>, int <var class="var">sr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnds32_005fmtsr"> ¶</a></span> +</dt> <dd><p>Move the <var class="var">value</var> to a system register which is mapped by <var class="var">sr</var>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnds32_005fmtusr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_nds32_mtusr</strong> <code class="def-code-arguments">(int <var class="var">value</var>, int <var class="var">usr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnds32_005fmtusr"> ¶</a></span> +</dt> <dd><p>Move the <var class="var">value</var> to a user space register which is mapped by <var class="var">usr</var>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnds32_005fsetgie_005fen"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_nds32_setgie_en</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnds32_005fsetgie_005fen"> ¶</a></span> +</dt> <dd><p>Enable global interrupt. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnds32_005fsetgie_005fdis"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_nds32_setgie_dis</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnds32_005fsetgie_005fdis"> ¶</a></span> +</dt> <dd><p>Disable global interrupt. </p></dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="basic-powerpc-built-in-functions">Basic PowerPC Built-in Functions</a>, Previous: <a href="msp430-built-in-functions">MSP430 Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/NDS32-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/NDS32-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nds32-function-attributes.html b/devdocs/gcc~13/nds32-function-attributes.html new file mode 100644 index 00000000..9af4ee7f --- /dev/null +++ b/devdocs/gcc~13/nds32-function-attributes.html @@ -0,0 +1,24 @@ +<div class="subsection-level-extent" id="NDS32-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="nios-ii-function-attributes" accesskey="n" rel="next">Nios II Function Attributes</a>, Previous: <a href="msp430-function-attributes" accesskey="p" rel="prev">MSP430 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="NDS32-Function-Attributes-1"><span>6.33.21 NDS32 Function Attributes<a class="copiable-link" href="#NDS32-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the NDS32 back end: </p> <dl class="table"> <dt> + <span><code class="code">exception</code><a class="copiable-link" href="#index-exception-function-attribute"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the NDS32 target to indicate that the specified function is an exception handler. The compiler will generate corresponding sections for use in an exception handler. </p> </dd> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-NDS32"> ¶</a></span> +</dt> <dd> +<p>On NDS32 target, this attribute indicates that the specified function is an interrupt handler. The compiler generates corresponding sections for use in an interrupt handler. You can use the following attributes to modify the behavior: </p> +<dl class="table"> <dt> +<span><code class="code">nested</code><a class="copiable-link" href="#index-nested-function-attribute_002c-NDS32"> ¶</a></span> +</dt> <dd><p>This interrupt service routine is interruptible. </p></dd> <dt><code class="code">not_nested</code></dt> <dd><p>This interrupt service routine is not interruptible. </p></dd> <dt><code class="code">nested_ready</code></dt> <dd><p>This interrupt service routine is interruptible after <code class="code">PSW.GIE</code> (global interrupt enable) is set. This allows interrupt service routine to finish some short critical code before enabling interrupts. </p></dd> <dt><code class="code">save_all</code></dt> <dd><p>The system will help save all registers into stack before entering interrupt handler. </p></dd> <dt><code class="code">partial_save</code></dt> <dd><p>The system will help save caller registers into stack before entering interrupt handler. </p></dd> </dl> </dd> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-NDS32"> ¶</a></span> +</dt> <dd> +<p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p> </dd> <dt> + <span><code class="code">reset</code><a class="copiable-link" href="#index-reset-function-attribute_002c-NDS32"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the NDS32 target to indicate that the specified function is a reset handler. The compiler will generate corresponding sections for use in a reset handler. You can use the following attributes to provide extra exception handling: </p> +<dl class="table"> <dt> +<span><code class="code">nmi</code><a class="copiable-link" href="#index-nmi-function-attribute_002c-NDS32"> ¶</a></span> +</dt> <dd><p>Provide a user-defined function to handle NMI exception. </p></dd> <dt><code class="code">warm</code></dt> <dd><p>Provide a user-defined function to handle warm reset exception. </p></dd> </dl> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="nios-ii-function-attributes">Nios II Function Attributes</a>, Previous: <a href="msp430-function-attributes">MSP430 Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/NDS32-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/NDS32-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nds32-options.html b/devdocs/gcc~13/nds32-options.html new file mode 100644 index 00000000..ec536695 --- /dev/null +++ b/devdocs/gcc~13/nds32-options.html @@ -0,0 +1,73 @@ +<div class="subsection-level-extent" id="NDS32-Options"> <div class="nav-panel"> <p> Next: <a href="nios-ii-options" accesskey="n" rel="next">Nios II Options</a>, Previous: <a href="msp430-options" accesskey="p" rel="prev">MSP430 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="NDS32-Options-1"><span>3.19.33 NDS32 Options<a class="copiable-link" href="#NDS32-Options-1"> ¶</a></span></h1> <p>These options are defined for NDS32 implementations: </p> <dl class="table"> <dt> +<span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian-9"> ¶</a></span> +</dt> <dd> +<p>Generate code in big-endian mode. </p> </dd> <dt> +<span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian-9"> ¶</a></span> +</dt> <dd> +<p>Generate code in little-endian mode. </p> </dd> <dt> +<span><code class="code">-mreduced-regs</code><a class="copiable-link" href="#index-mreduced-regs"> ¶</a></span> +</dt> <dd> +<p>Use reduced-set registers for register allocation. </p> </dd> <dt> +<span><code class="code">-mfull-regs</code><a class="copiable-link" href="#index-mfull-regs"> ¶</a></span> +</dt> <dd> +<p>Use full-set registers for register allocation. </p> </dd> <dt> +<span><code class="code">-mcmov</code><a class="copiable-link" href="#index-mcmov"> ¶</a></span> +</dt> <dd> +<p>Generate conditional move instructions. </p> </dd> <dt> +<span><code class="code">-mno-cmov</code><a class="copiable-link" href="#index-mno-cmov"> ¶</a></span> +</dt> <dd> +<p>Do not generate conditional move instructions. </p> </dd> <dt> +<span><code class="code">-mext-perf</code><a class="copiable-link" href="#index-mext-perf"> ¶</a></span> +</dt> <dd> +<p>Generate performance extension instructions. </p> </dd> <dt> +<span><code class="code">-mno-ext-perf</code><a class="copiable-link" href="#index-mno-ext-perf"> ¶</a></span> +</dt> <dd> +<p>Do not generate performance extension instructions. </p> </dd> <dt> +<span><code class="code">-mext-perf2</code><a class="copiable-link" href="#index-mext-perf2"> ¶</a></span> +</dt> <dd> +<p>Generate performance extension 2 instructions. </p> </dd> <dt> +<span><code class="code">-mno-ext-perf2</code><a class="copiable-link" href="#index-mno-ext-perf2"> ¶</a></span> +</dt> <dd> +<p>Do not generate performance extension 2 instructions. </p> </dd> <dt> +<span><code class="code">-mext-string</code><a class="copiable-link" href="#index-mext-string"> ¶</a></span> +</dt> <dd> +<p>Generate string extension instructions. </p> </dd> <dt> +<span><code class="code">-mno-ext-string</code><a class="copiable-link" href="#index-mno-ext-string"> ¶</a></span> +</dt> <dd> +<p>Do not generate string extension instructions. </p> </dd> <dt> +<span><code class="code">-mv3push</code><a class="copiable-link" href="#index-mv3push"> ¶</a></span> +</dt> <dd> +<p>Generate v3 push25/pop25 instructions. </p> </dd> <dt> +<span><code class="code">-mno-v3push</code><a class="copiable-link" href="#index-mno-v3push"> ¶</a></span> +</dt> <dd> +<p>Do not generate v3 push25/pop25 instructions. </p> </dd> <dt> +<span><code class="code">-m16-bit</code><a class="copiable-link" href="#index-m16-bit-1"> ¶</a></span> +</dt> <dd> +<p>Generate 16-bit instructions. </p> </dd> <dt> +<span><code class="code">-mno-16-bit</code><a class="copiable-link" href="#index-mno-16-bit"> ¶</a></span> +</dt> <dd> +<p>Do not generate 16-bit instructions. </p> </dd> <dt> +<span><code class="code">-misr-vector-size=<var class="var">num</var></code><a class="copiable-link" href="#index-misr-vector-size"> ¶</a></span> +</dt> <dd> +<p>Specify the size of each interrupt vector, which must be 4 or 16. </p> </dd> <dt> +<span><code class="code">-mcache-block-size=<var class="var">num</var></code><a class="copiable-link" href="#index-mcache-block-size"> ¶</a></span> +</dt> <dd> +<p>Specify the size of each cache block, which must be a power of 2 between 4 and 512. </p> </dd> <dt> +<span><code class="code">-march=<var class="var">arch</var></code><a class="copiable-link" href="#index-march-10"> ¶</a></span> +</dt> <dd> +<p>Specify the name of the target architecture. </p> </dd> <dt> +<span><code class="code">-mcmodel=<var class="var">code-model</var></code><a class="copiable-link" href="#index-mcmodel"> ¶</a></span> +</dt> <dd> +<p>Set the code model to one of </p> +<dl class="table"> <dt>‘<samp class="samp">small</samp>’</dt> <dd><p>All the data and read-only data segments must be within 512KB addressing space. The text segment must be within 16MB addressing space. </p></dd> <dt>‘<samp class="samp">medium</samp>’</dt> <dd><p>The data segment must be within 512KB while the read-only data segment can be within 4GB addressing space. The text segment should be still within 16MB addressing space. </p></dd> <dt>‘<samp class="samp">large</samp>’</dt> <dd><p>All the text and data segments can be within 4GB addressing space. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mctor-dtor</code><a class="copiable-link" href="#index-mctor-dtor"> ¶</a></span> +</dt> <dd> +<p>Enable constructor/destructor feature. </p> </dd> <dt> +<span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax-4"> ¶</a></span> +</dt> <dd> +<p>Guide linker to relax instructions. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="nios-ii-options">Nios II Options</a>, Previous: <a href="msp430-options">MSP430 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/NDS32-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/NDS32-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nested-functions.html b/devdocs/gcc~13/nested-functions.html new file mode 100644 index 00000000..e3336969 --- /dev/null +++ b/devdocs/gcc~13/nested-functions.html @@ -0,0 +1,62 @@ +<div class="section-level-extent" id="Nested-Functions"> <div class="nav-panel"> <p> Next: <a href="nonlocal-gotos" accesskey="n" rel="next">Nonlocal Gotos</a>, Previous: <a href="labels-as-values" accesskey="p" rel="prev">Labels as Values</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Nested-Functions-1"><span>6.4 Nested Functions<a class="copiable-link" href="#Nested-Functions-1"> ¶</a></span></h1> <p>A <em class="dfn">nested function</em> is a function defined inside another function. Nested functions are supported as an extension in GNU C, but are not supported by GNU C++. </p> <p>The nested function’s name is local to the block where it is defined. For example, here we define a nested function named <code class="code">square</code>, and call it twice: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">foo (double a, double b) +{ + double square (double z) { return z * z; } + + return square (a) + square (b); +}</pre></div> +</div> <p>The nested function can access all the variables of the containing function that are visible at the point of its definition. This is called <em class="dfn">lexical scoping</em>. For example, here we show a nested function which uses an inherited variable named <code class="code">offset</code>: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">bar (int *array, int offset, int size) +{ + int access (int *array, int index) + { return array[index + offset]; } + int i; + /* <span class="r">…</span> */ + for (i = 0; i < size; i++) + /* <span class="r">…</span> */ access (array, i) /* <span class="r">…</span> */ +}</pre></div> +</div> <p>Nested function definitions are permitted within functions in the places where variable definitions are allowed; that is, in any block, mixed with the other declarations and statements in the block. </p> <p>It is possible to call the nested function from outside the scope of its name by storing its address or passing the address to another function: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">hack (int *array, int size) +{ + void store (int index, int value) + { array[index] = value; } + + intermediate (store, size); +}</pre> +</div> <p>Here, the function <code class="code">intermediate</code> receives the address of <code class="code">store</code> as an argument. If <code class="code">intermediate</code> calls <code class="code">store</code>, the arguments given to <code class="code">store</code> are used to store into <code class="code">array</code>. But this technique works only so long as the containing function (<code class="code">hack</code>, in this example) does not exit. </p> <p>If you try to call the nested function through its address after the containing function exits, all hell breaks loose. If you try to call it after a containing scope level exits, and if it refers to some of the variables that are no longer in scope, you may be lucky, but it’s not wise to take the risk. If, however, the nested function does not refer to anything that has gone out of scope, you should be safe. </p> <p>GCC implements taking the address of a nested function using a technique called <em class="dfn">trampolines</em>. This technique was described in Lexical Closures for C++ (Thomas M. Breuel, USENIX C++ Conference Proceedings, October 17-21, 1988). </p> <p>A nested function can jump to a label inherited from a containing function, provided the label is explicitly declared in the containing function (see <a class="pxref" href="local-labels">Locally Declared Labels</a>). Such a jump returns instantly to the containing function, exiting the nested function that did the <code class="code">goto</code> and any intermediate functions as well. Here is an example: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">bar (int *array, int offset, int size) +{ + __label__ failure; + int access (int *array, int index) + { + if (index > size) + goto failure; + return array[index + offset]; + } + int i; + /* <span class="r">…</span> */ + for (i = 0; i < size; i++) + /* <span class="r">…</span> */ access (array, i) /* <span class="r">…</span> */ + /* <span class="r">…</span> */ + return 0; + + /* <span class="r">Control comes here from <code class="code">access</code> + if it detects an error.</span> */ + failure: + return -1; +}</pre></div> +</div> <p>A nested function always has no linkage. Declaring one with <code class="code">extern</code> or <code class="code">static</code> is erroneous. If you need to declare the nested function before its definition, use <code class="code">auto</code> (which is otherwise meaningless for function declarations). </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">bar (int *array, int offset, int size) +{ + __label__ failure; + auto int access (int *, int); + /* <span class="r">…</span> */ + int access (int *array, int index) + { + if (index > size) + goto failure; + return array[index + offset]; + } + /* <span class="r">…</span> */ +}</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="nonlocal-gotos">Nonlocal Gotos</a>, Previous: <a href="labels-as-values">Labels as Values</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nested-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nested-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nios-ii-function-attributes.html b/devdocs/gcc~13/nios-ii-function-attributes.html new file mode 100644 index 00000000..76a38d76 --- /dev/null +++ b/devdocs/gcc~13/nios-ii-function-attributes.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="Nios-II-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="nvidia-ptx-function-attributes" accesskey="n" rel="next">Nvidia PTX Function Attributes</a>, Previous: <a href="nds32-function-attributes" accesskey="p" rel="prev">NDS32 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Nios-II-Function-Attributes-1"><span>6.33.22 Nios II Function Attributes<a class="copiable-link" href="#Nios-II-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the Nios II back end: </p> <dl class="table"> <dt> +<span><code class="code">target (<var class="var">options</var>)</code><a class="copiable-link" href="#index-target-function-attribute-2"> ¶</a></span> +</dt> <dd> +<p>As discussed in <a class="ref" href="common-function-attributes">Common Function Attributes</a>, this attribute allows specification of target-specific compilation options. </p> <p>When compiling for Nios II, the following options are allowed: </p> <dl class="table"> <dt> + <span>‘<samp class="samp">custom-<var class="var">insn</var>=<var class="var">N</var></samp>’<a class="copiable-link" href="#index-target_0028_0022custom-insn_003dN_0022_0029-function-attribute_002c-Nios-II"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-custom-<var class="var">insn</var></samp>’</dt> <dd> +<p>Each ‘<samp class="samp">custom-<var class="var">insn</var>=<var class="var">N</var></samp>’ attribute locally enables use of a custom instruction with encoding <var class="var">N</var> when generating code that uses <var class="var">insn</var>. Similarly, ‘<samp class="samp">no-custom-<var class="var">insn</var></samp>’ locally inhibits use of the custom instruction <var class="var">insn</var>. These target attributes correspond to the <samp class="option">-mcustom-<var class="var">insn</var>=<var class="var">N</var></samp> and <samp class="option">-mno-custom-<var class="var">insn</var></samp> command-line options, and support the same set of <var class="var">insn</var> keywords. See <a class="xref" href="nios-ii-options">Nios II Options</a>, for more information. </p> </dd> <dt> +<span>‘<samp class="samp">custom-fpu-cfg=<var class="var">name</var></samp>’<a class="copiable-link" href="#index-target_0028_0022custom-fpu-cfg_003dname_0022_0029-function-attribute_002c-Nios-II"> ¶</a></span> +</dt> <dd><p>This attribute corresponds to the <samp class="option">-mcustom-fpu-cfg=<var class="var">name</var></samp> command-line option, to select a predefined set of custom instructions named <var class="var">name</var>. See <a class="xref" href="nios-ii-options">Nios II Options</a>, for more information. </p></dd> </dl> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nios-II-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nios-II-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nios-ii-options.html b/devdocs/gcc~13/nios-ii-options.html new file mode 100644 index 00000000..18e0cc87 --- /dev/null +++ b/devdocs/gcc~13/nios-ii-options.html @@ -0,0 +1,127 @@ +<div class="subsection-level-extent" id="Nios-II-Options"> <div class="nav-panel"> <p> Next: <a href="nvidia-ptx-options" accesskey="n" rel="next">Nvidia PTX Options</a>, Previous: <a href="nds32-options" accesskey="p" rel="prev">NDS32 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Nios-II-Options-1"><span>3.19.34 Nios II Options<a class="copiable-link" href="#Nios-II-Options-1"> ¶</a></span></h1> <p>These are the options defined for the Altera Nios II processor. </p> <dl class="table"> <dt> + <span><code class="code">-G <var class="var">num</var></code><a class="copiable-link" href="#index-G-3"> ¶</a></span> +</dt> <dd> +<p>Put global and static objects less than or equal to <var class="var">num</var> bytes into the small data or BSS sections instead of the normal data or BSS sections. The default value of <var class="var">num</var> is 8. </p> </dd> <dt> + <span><code class="code">-mgpopt=<var class="var">option</var></code><a class="copiable-link" href="#index-mgpopt-1"> ¶</a></span> +</dt> <dt><code class="code">-mgpopt</code></dt> <dt><code class="code">-mno-gpopt</code></dt> <dd> +<p>Generate (do not generate) GP-relative accesses. The following <var class="var">option</var> names are recognized: </p> <dl class="table"> <dt>‘<samp class="samp">none</samp>’</dt> <dd> +<p>Do not generate GP-relative accesses. </p> </dd> <dt>‘<samp class="samp">local</samp>’</dt> <dd> +<p>Generate GP-relative accesses for small data objects that are not external, weak, or uninitialized common symbols. Also use GP-relative addressing for objects that have been explicitly placed in a small data section via a <code class="code">section</code> attribute. </p> </dd> <dt>‘<samp class="samp">global</samp>’</dt> <dd> +<p>As for ‘<samp class="samp">local</samp>’, but also generate GP-relative accesses for small data objects that are external, weak, or common. If you use this option, you must ensure that all parts of your program (including libraries) are compiled with the same <samp class="option">-G</samp> setting. </p> </dd> <dt>‘<samp class="samp">data</samp>’</dt> <dd> +<p>Generate GP-relative accesses for all data objects in the program. If you use this option, the entire data and BSS segments of your program must fit in 64K of memory and you must use an appropriate linker script to allocate them within the addressable range of the global pointer. </p> </dd> <dt>‘<samp class="samp">all</samp>’</dt> <dd> +<p>Generate GP-relative addresses for function pointers as well as data pointers. If you use this option, the entire text, data, and BSS segments of your program must fit in 64K of memory and you must use an appropriate linker script to allocate them within the addressable range of the global pointer. </p> </dd> </dl> <p><samp class="option">-mgpopt</samp> is equivalent to <samp class="option">-mgpopt=local</samp>, and <samp class="option">-mno-gpopt</samp> is equivalent to <samp class="option">-mgpopt=none</samp>. </p> <p>The default is <samp class="option">-mgpopt</samp> except when <samp class="option">-fpic</samp> or <samp class="option">-fPIC</samp> is specified to generate position-independent code. Note that the Nios II ABI does not permit GP-relative accesses from shared libraries. </p> <p>You may need to specify <samp class="option">-mno-gpopt</samp> explicitly when building programs that include large amounts of small data, including large GOT data sections. In this case, the 16-bit offset for GP-relative addressing may not be large enough to allow access to the entire small data section. </p> </dd> <dt> +<span><code class="code">-mgprel-sec=<var class="var">regexp</var></code><a class="copiable-link" href="#index-mgprel-sec"> ¶</a></span> +</dt> <dd> +<p>This option specifies additional section names that can be accessed via GP-relative addressing. It is most useful in conjunction with <code class="code">section</code> attributes on variable declarations (see <a class="pxref" href="common-variable-attributes">Common Variable Attributes</a>) and a custom linker script. The <var class="var">regexp</var> is a POSIX Extended Regular Expression. </p> <p>This option does not affect the behavior of the <samp class="option">-G</samp> option, and the specified sections are in addition to the standard <code class="code">.sdata</code> and <code class="code">.sbss</code> small-data sections that are recognized by <samp class="option">-mgpopt</samp>. </p> </dd> <dt> +<span><code class="code">-mr0rel-sec=<var class="var">regexp</var></code><a class="copiable-link" href="#index-mr0rel-sec"> ¶</a></span> +</dt> <dd> +<p>This option specifies names of sections that can be accessed via a 16-bit offset from <code class="code">r0</code>; that is, in the low 32K or high 32K of the 32-bit address space. It is most useful in conjunction with <code class="code">section</code> attributes on variable declarations (see <a class="pxref" href="common-variable-attributes">Common Variable Attributes</a>) and a custom linker script. The <var class="var">regexp</var> is a POSIX Extended Regular Expression. </p> <p>In contrast to the use of GP-relative addressing for small data, zero-based addressing is never generated by default and there are no conventional section names used in standard linker scripts for sections in the low or high areas of memory. </p> </dd> <dt> + <span><code class="code">-mel</code><a class="copiable-link" href="#index-mel-1"> ¶</a></span> +</dt> <dt><code class="code">-meb</code></dt> <dd> +<p>Generate little-endian (default) or big-endian (experimental) code, respectively. </p> </dd> <dt> +<span><code class="code">-march=<var class="var">arch</var></code><a class="copiable-link" href="#index-march-11"> ¶</a></span> +</dt> <dd> +<p>This specifies the name of the target Nios II architecture. GCC uses this name to determine what kind of instructions it can emit when generating assembly code. Permissible names are: ‘<samp class="samp">r1</samp>’, ‘<samp class="samp">r2</samp>’. </p> <p>The preprocessor macro <code class="code">__nios2_arch__</code> is available to programs, with value 1 or 2, indicating the targeted ISA level. </p> </dd> <dt> + <span><code class="code">-mbypass-cache</code><a class="copiable-link" href="#index-mno-bypass-cache"> ¶</a></span> +</dt> <dt><code class="code">-mno-bypass-cache</code></dt> <dd> +<p>Force all load and store instructions to always bypass cache by using I/O variants of the instructions. The default is not to bypass the cache. </p> </dd> <dt> + <span><code class="code">-mno-cache-volatile</code><a class="copiable-link" href="#index-mcache-volatile"> ¶</a></span> +</dt> <dt><code class="code">-mcache-volatile</code></dt> <dd> +<p>Volatile memory access bypass the cache using the I/O variants of the load and store instructions. The default is not to bypass the cache. </p> </dd> <dt> + <span><code class="code">-mno-fast-sw-div</code><a class="copiable-link" href="#index-mno-fast-sw-div"> ¶</a></span> +</dt> <dt><code class="code">-mfast-sw-div</code></dt> <dd> +<p>Do not use table-based fast divide for small numbers. The default is to use the fast divide at <samp class="option">-O3</samp> and above. </p> </dd> <dt> + <span><code class="code">-mno-hw-mul</code><a class="copiable-link" href="#index-mno-hw-mul"> ¶</a></span> +</dt> <dt><code class="code">-mhw-mul</code></dt> <dt><code class="code">-mno-hw-mulx</code></dt> <dt><code class="code">-mhw-mulx</code></dt> <dt><code class="code">-mno-hw-div</code></dt> <dt><code class="code">-mhw-div</code></dt> <dd> +<p>Enable or disable emitting <code class="code">mul</code>, <code class="code">mulx</code> and <code class="code">div</code> family of instructions by the compiler. The default is to emit <code class="code">mul</code> and not emit <code class="code">div</code> and <code class="code">mulx</code>. </p> </dd> <dt><code class="code">-mbmx</code></dt> <dt><code class="code">-mno-bmx</code></dt> <dt><code class="code">-mcdx</code></dt> <dt><code class="code">-mno-cdx</code></dt> <dd> +<p>Enable or disable generation of Nios II R2 BMX (bit manipulation) and CDX (code density) instructions. Enabling these instructions also requires <samp class="option">-march=r2</samp>. Since these instructions are optional extensions to the R2 architecture, the default is not to emit them. </p> </dd> <dt> + <span><code class="code">-mcustom-<var class="var">insn</var>=<var class="var">N</var></code><a class="copiable-link" href="#index-mcustom-insn"> ¶</a></span> +</dt> <dt><code class="code">-mno-custom-<var class="var">insn</var></code></dt> <dd> +<p>Each <samp class="option">-mcustom-<var class="var">insn</var>=<var class="var">N</var></samp> option enables use of a custom instruction with encoding <var class="var">N</var> when generating code that uses <var class="var">insn</var>. For example, <samp class="option">-mcustom-fadds=253</samp> generates custom instruction 253 for single-precision floating-point add operations instead of the default behavior of using a library call. </p> <p>The following values of <var class="var">insn</var> are supported. Except as otherwise noted, floating-point operations are expected to be implemented with normal IEEE 754 semantics and correspond directly to the C operators or the equivalent GCC built-in functions (see <a class="pxref" href="other-builtins">Other Built-in Functions Provided by GCC</a>). </p> <p>Single-precision floating point: </p> +<dl class="table"> <dt>‘<samp class="samp">fadds</samp>’, ‘<samp class="samp">fsubs</samp>’, ‘<samp class="samp">fdivs</samp>’, ‘<samp class="samp">fmuls</samp>’</dt> <dd> +<p>Binary arithmetic operations. </p> </dd> <dt>‘<samp class="samp">fnegs</samp>’</dt> <dd> +<p>Unary negation. </p> </dd> <dt>‘<samp class="samp">fabss</samp>’</dt> <dd> +<p>Unary absolute value. </p> </dd> <dt>‘<samp class="samp">fcmpeqs</samp>’, ‘<samp class="samp">fcmpges</samp>’, ‘<samp class="samp">fcmpgts</samp>’, ‘<samp class="samp">fcmples</samp>’, ‘<samp class="samp">fcmplts</samp>’, ‘<samp class="samp">fcmpnes</samp>’</dt> <dd> +<p>Comparison operations. </p> </dd> <dt>‘<samp class="samp">fmins</samp>’, ‘<samp class="samp">fmaxs</samp>’</dt> <dd> +<p>Floating-point minimum and maximum. These instructions are only generated if <samp class="option">-ffinite-math-only</samp> is specified. </p> </dd> <dt>‘<samp class="samp">fsqrts</samp>’</dt> <dd> +<p>Unary square root operation. </p> </dd> <dt>‘<samp class="samp">fcoss</samp>’, ‘<samp class="samp">fsins</samp>’, ‘<samp class="samp">ftans</samp>’, ‘<samp class="samp">fatans</samp>’, ‘<samp class="samp">fexps</samp>’, ‘<samp class="samp">flogs</samp>’</dt> <dd> +<p>Floating-point trigonometric and exponential functions. These instructions are only generated if <samp class="option">-funsafe-math-optimizations</samp> is also specified. </p> </dd> </dl> <p>Double-precision floating point: </p> +<dl class="table"> <dt>‘<samp class="samp">faddd</samp>’, ‘<samp class="samp">fsubd</samp>’, ‘<samp class="samp">fdivd</samp>’, ‘<samp class="samp">fmuld</samp>’</dt> <dd> +<p>Binary arithmetic operations. </p> </dd> <dt>‘<samp class="samp">fnegd</samp>’</dt> <dd> +<p>Unary negation. </p> </dd> <dt>‘<samp class="samp">fabsd</samp>’</dt> <dd> +<p>Unary absolute value. </p> </dd> <dt>‘<samp class="samp">fcmpeqd</samp>’, ‘<samp class="samp">fcmpged</samp>’, ‘<samp class="samp">fcmpgtd</samp>’, ‘<samp class="samp">fcmpled</samp>’, ‘<samp class="samp">fcmpltd</samp>’, ‘<samp class="samp">fcmpned</samp>’</dt> <dd> +<p>Comparison operations. </p> </dd> <dt>‘<samp class="samp">fmind</samp>’, ‘<samp class="samp">fmaxd</samp>’</dt> <dd> +<p>Double-precision minimum and maximum. These instructions are only generated if <samp class="option">-ffinite-math-only</samp> is specified. </p> </dd> <dt>‘<samp class="samp">fsqrtd</samp>’</dt> <dd> +<p>Unary square root operation. </p> </dd> <dt>‘<samp class="samp">fcosd</samp>’, ‘<samp class="samp">fsind</samp>’, ‘<samp class="samp">ftand</samp>’, ‘<samp class="samp">fatand</samp>’, ‘<samp class="samp">fexpd</samp>’, ‘<samp class="samp">flogd</samp>’</dt> <dd> +<p>Double-precision trigonometric and exponential functions. These instructions are only generated if <samp class="option">-funsafe-math-optimizations</samp> is also specified. </p> </dd> </dl> <p>Conversions: </p> +<dl class="table"> <dt>‘<samp class="samp">fextsd</samp>’</dt> <dd> +<p>Conversion from single precision to double precision. </p> </dd> <dt>‘<samp class="samp">ftruncds</samp>’</dt> <dd> +<p>Conversion from double precision to single precision. </p> </dd> <dt>‘<samp class="samp">fixsi</samp>’, ‘<samp class="samp">fixsu</samp>’, ‘<samp class="samp">fixdi</samp>’, ‘<samp class="samp">fixdu</samp>’</dt> <dd> +<p>Conversion from floating point to signed or unsigned integer types, with truncation towards zero. </p> </dd> <dt>‘<samp class="samp">round</samp>’</dt> <dd> +<p>Conversion from single-precision floating point to signed integer, rounding to the nearest integer and ties away from zero. This corresponds to the <code class="code">__builtin_lroundf</code> function when <samp class="option">-fno-math-errno</samp> is used. </p> </dd> <dt>‘<samp class="samp">floatis</samp>’, ‘<samp class="samp">floatus</samp>’, ‘<samp class="samp">floatid</samp>’, ‘<samp class="samp">floatud</samp>’</dt> <dd> +<p>Conversion from signed or unsigned integer types to floating-point types. </p> </dd> </dl> <p>In addition, all of the following transfer instructions for internal registers X and Y must be provided to use any of the double-precision floating-point instructions. Custom instructions taking two double-precision source operands expect the first operand in the 64-bit register X. The other operand (or only operand of a unary operation) is given to the custom arithmetic instruction with the least significant half in source register <var class="var">src1</var> and the most significant half in <var class="var">src2</var>. A custom instruction that returns a double-precision result returns the most significant 32 bits in the destination register and the other half in 32-bit register Y. GCC automatically generates the necessary code sequences to write register X and/or read register Y when double-precision floating-point instructions are used. </p> <dl class="table"> <dt>‘<samp class="samp">fwrx</samp>’</dt> <dd> +<p>Write <var class="var">src1</var> into the least significant half of X and <var class="var">src2</var> into the most significant half of X. </p> </dd> <dt>‘<samp class="samp">fwry</samp>’</dt> <dd> +<p>Write <var class="var">src1</var> into Y. </p> </dd> <dt>‘<samp class="samp">frdxhi</samp>’, ‘<samp class="samp">frdxlo</samp>’</dt> <dd> +<p>Read the most or least (respectively) significant half of X and store it in <var class="var">dest</var>. </p> </dd> <dt>‘<samp class="samp">frdy</samp>’</dt> <dd><p>Read the value of Y and store it into <var class="var">dest</var>. </p></dd> </dl> <p>Note that you can gain more local control over generation of Nios II custom instructions by using the <code class="code">target("custom-<var class="var">insn</var>=<var class="var">N</var>")</code> and <code class="code">target("no-custom-<var class="var">insn</var>")</code> function attributes (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>) or pragmas (see <a class="pxref" href="function-specific-option-pragmas">Function Specific Option Pragmas</a>). </p> </dd> <dt> +<span><code class="code">-mcustom-fpu-cfg=<var class="var">name</var></code><a class="copiable-link" href="#index-mcustom-fpu-cfg"> ¶</a></span> +</dt> <dd> <p>This option enables a predefined, named set of custom instruction encodings (see <samp class="option">-mcustom-<var class="var">insn</var></samp> above). Currently, the following sets are defined: </p> <p><samp class="option">-mcustom-fpu-cfg=60-1</samp> is equivalent to: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mcustom-fmuls=252 +-mcustom-fadds=253 +-mcustom-fsubs=254 +-fsingle-precision-constant</pre> +</div> <p><samp class="option">-mcustom-fpu-cfg=60-2</samp> is equivalent to: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mcustom-fmuls=252 +-mcustom-fadds=253 +-mcustom-fsubs=254 +-mcustom-fdivs=255 +-fsingle-precision-constant</pre> +</div> <p><samp class="option">-mcustom-fpu-cfg=72-3</samp> is equivalent to: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mcustom-floatus=243 +-mcustom-fixsi=244 +-mcustom-floatis=245 +-mcustom-fcmpgts=246 +-mcustom-fcmples=249 +-mcustom-fcmpeqs=250 +-mcustom-fcmpnes=251 +-mcustom-fmuls=252 +-mcustom-fadds=253 +-mcustom-fsubs=254 +-mcustom-fdivs=255 +-fsingle-precision-constant</pre> +</div> <p><samp class="option">-mcustom-fpu-cfg=fph2</samp> is equivalent to: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mcustom-fabss=224 +-mcustom-fnegs=225 +-mcustom-fcmpnes=226 +-mcustom-fcmpeqs=227 +-mcustom-fcmpges=228 +-mcustom-fcmpgts=229 +-mcustom-fcmples=230 +-mcustom-fcmplts=231 +-mcustom-fmaxs=232 +-mcustom-fmins=233 +-mcustom-round=248 +-mcustom-fixsi=249 +-mcustom-floatis=250 +-mcustom-fsqrts=251 +-mcustom-fmuls=252 +-mcustom-fadds=253 +-mcustom-fsubs=254 +-mcustom-fdivs=255</pre> +</div> <p>Custom instruction assignments given by individual <samp class="option">-mcustom-<var class="var">insn</var>=</samp> options override those given by <samp class="option">-mcustom-fpu-cfg=</samp>, regardless of the order of the options on the command line. </p> <p>Note that you can gain more local control over selection of a FPU configuration by using the <code class="code">target("custom-fpu-cfg=<var class="var">name</var>")</code> function attribute (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>) or pragma (see <a class="pxref" href="function-specific-option-pragmas">Function Specific Option Pragmas</a>). </p> <p>The name <var class="var">fph2</var> is an abbreviation for <em class="emph">Nios II Floating Point Hardware 2 Component</em>. Please note that the custom instructions enabled by <samp class="option">-mcustom-fmins=233</samp> and <samp class="option">-mcustom-fmaxs=234</samp> are only generated if <samp class="option">-ffinite-math-only</samp> is specified. The custom instruction enabled by <samp class="option">-mcustom-round=248</samp> is only generated if <samp class="option">-fno-math-errno</samp> is specified. In contrast to the other configurations, <samp class="option">-fsingle-precision-constant</samp> is not set. </p> </dd> </dl> <p>These additional ‘<samp class="samp">-m</samp>’ options are available for the Altera Nios II ELF (bare-metal) target: </p> <dl class="table"> <dt> +<span><code class="code">-mhal</code><a class="copiable-link" href="#index-mhal"> ¶</a></span> +</dt> <dd> +<p>Link with HAL BSP. This suppresses linking with the GCC-provided C runtime startup and termination code, and is typically used in conjunction with <samp class="option">-msys-crt0=</samp> to specify the location of the alternate startup code provided by the HAL BSP. </p> </dd> <dt> +<span><code class="code">-msmallc</code><a class="copiable-link" href="#index-msmallc"> ¶</a></span> +</dt> <dd> +<p>Link with a limited version of the C library, <samp class="option">-lsmallc</samp>, rather than Newlib. </p> </dd> <dt> +<span><code class="code">-msys-crt0=<var class="var">startfile</var></code><a class="copiable-link" href="#index-msys-crt0"> ¶</a></span> +</dt> <dd> +<p><var class="var">startfile</var> is the file name of the startfile (crt0) to use when linking. This option is only useful in conjunction with <samp class="option">-mhal</samp>. </p> </dd> <dt> +<span><code class="code">-msys-lib=<var class="var">systemlib</var></code><a class="copiable-link" href="#index-msys-lib"> ¶</a></span> +</dt> <dd> +<p><var class="var">systemlib</var> is the library name of the library that provides low-level system calls required by the C library, e.g. <code class="code">read</code> and <code class="code">write</code>. This option is typically used to link with a library provided by a HAL BSP. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="nvidia-ptx-options">Nvidia PTX Options</a>, Previous: <a href="nds32-options">NDS32 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nios-II-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nios-II-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/non-bugs.html b/devdocs/gcc~13/non-bugs.html new file mode 100644 index 00000000..02b45973 --- /dev/null +++ b/devdocs/gcc~13/non-bugs.html @@ -0,0 +1,30 @@ +<div class="section-level-extent" id="Non-bugs"> <div class="nav-panel"> <p> Next: <a href="warnings-and-errors" accesskey="n" rel="next">Warning Messages and Error Messages</a>, Previous: <a href="c_002b_002b-misunderstandings" accesskey="p" rel="prev">Common Misunderstandings with GNU C++</a>, Up: <a href="trouble" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Certain-Changes-We-Don_0027t-Want-to-Make"><span>14.8 Certain Changes We Don’t Want to Make<a class="copiable-link" href="#Certain-Changes-We-Don_0027t-Want-to-Make"> ¶</a></span></h1> <p>This section lists changes that people frequently request, but which we do not make because we think GCC is better without them. </p> <ul class="itemize mark-bullet"> <li>Checking the number and type of arguments to a function which has an old-fashioned definition and no prototype. <p>Such a feature would work only occasionally—only for calls that appear in the same file as the called function, following the definition. The only way to check all calls reliably is to add a prototype for the function. But adding a prototype eliminates the motivation for this feature. So the feature is not worthwhile. </p> </li> +<li>Warning about using an expression whose type is signed as a shift count. <p>Shift count operands are probably signed more often than unsigned. Warning about this would cause far more annoyance than good. </p> </li> +<li>Warning about assigning a signed value to an unsigned variable. <p>Such assignments must be very common; warning about them would cause more annoyance than good. </p> </li> +<li>Warning when a non-void function value is ignored. <p>C contains many standard functions that return a value that most programs choose to ignore. One obvious example is <code class="code">printf</code>. Warning about this practice only leads the defensive programmer to clutter programs with dozens of casts to <code class="code">void</code>. Such casts are required so frequently that they become visual noise. Writing those casts becomes so automatic that they no longer convey useful information about the intentions of the programmer. For functions where the return value should never be ignored, use the <code class="code">warn_unused_result</code> function attribute (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> </li> +<li> + Making <samp class="option">-fshort-enums</samp> the default. <p>This would cause storage layout to be incompatible with most other C compilers. And it doesn’t seem very important, given that you can get the same result in other ways. The case where it matters most is when the enumeration-valued object is inside a structure, and in that case you can specify a field width explicitly. </p> </li> +<li>Making bit-fields unsigned by default on particular machines where “the ABI standard” says to do so. <p>The ISO C standard leaves it up to the implementation whether a bit-field declared plain <code class="code">int</code> is signed or not. This in effect creates two alternative dialects of C. </p> <p>The GNU C compiler supports both dialects; you can specify the signed dialect with <samp class="option">-fsigned-bitfields</samp> and the unsigned dialect with <samp class="option">-funsigned-bitfields</samp>. However, this leaves open the question of which dialect to use by default. </p> <p>Currently, the preferred dialect makes plain bit-fields signed, because this is simplest. Since <code class="code">int</code> is the same as <code class="code">signed int</code> in every other context, it is cleanest for them to be the same in bit-fields as well. </p> <p>Some computer manufacturers have published Application Binary Interface standards which specify that plain bit-fields should be unsigned. It is a mistake, however, to say anything about this issue in an ABI. This is because the handling of plain bit-fields distinguishes two dialects of C. Both dialects are meaningful on every type of machine. Whether a particular object file was compiled using signed bit-fields or unsigned is of no concern to other object files, even if they access the same bit-fields in the same data structures. </p> <p>A given program is written in one or the other of these two dialects. The program stands a chance to work on most any machine if it is compiled with the proper dialect. It is unlikely to work at all if compiled with the wrong dialect. </p> <p>Many users appreciate the GNU C compiler because it provides an environment that is uniform across machines. These users would be inconvenienced if the compiler treated plain bit-fields differently on certain machines. </p> <p>Occasionally users write programs intended only for a particular machine type. On these occasions, the users would benefit if the GNU C compiler were to support by default the same dialect as the other compilers on that machine. But such applications are rare. And users writing a program to run on more than one type of machine cannot possibly benefit from this kind of compatibility. </p> <p>This is why GCC does and will treat plain bit-fields in the same fashion on all types of machines (by default). </p> <p>There are some arguments for making bit-fields unsigned by default on all machines. If, for example, this becomes a universal de facto standard, it would make sense for GCC to go along with it. This is something to be considered in the future. </p> <p>(Of course, users strongly concerned about portability should indicate explicitly in each bit-field whether it is signed or not. In this way, they write programs which have the same meaning in both C dialects.) </p> </li> +<li> + Undefining <code class="code">__STDC__</code> when <samp class="option">-ansi</samp> is not used. <p>Currently, GCC defines <code class="code">__STDC__</code> unconditionally. This provides good results in practice. </p> <p>Programmers normally use conditionals on <code class="code">__STDC__</code> to ask whether it is safe to use certain features of ISO C, such as function prototypes or ISO token concatenation. Since plain <code class="command">gcc</code> supports all the features of ISO C, the correct answer to these questions is “yes”. </p> <p>Some users try to use <code class="code">__STDC__</code> to check for the availability of certain library facilities. This is actually incorrect usage in an ISO C program, because the ISO C standard says that a conforming freestanding implementation should define <code class="code">__STDC__</code> even though it does not have the library facilities. ‘<samp class="samp">gcc -ansi -pedantic</samp>’ is a conforming freestanding implementation, and it is therefore required to define <code class="code">__STDC__</code>, even though it does not come with an ISO C library. </p> <p>Sometimes people say that defining <code class="code">__STDC__</code> in a compiler that does not completely conform to the ISO C standard somehow violates the standard. This is illogical. The standard is a standard for compilers that claim to support ISO C, such as ‘<samp class="samp">gcc -ansi</samp>’—not for other compilers such as plain <code class="command">gcc</code>. Whatever the ISO C standard says is relevant to the design of plain <code class="command">gcc</code> without <samp class="option">-ansi</samp> only for pragmatic reasons, not as a requirement. </p> <p>GCC normally defines <code class="code">__STDC__</code> to be 1, and in addition defines <code class="code">__STRICT_ANSI__</code> if you specify the <samp class="option">-ansi</samp> option, or a <samp class="option">-std</samp> option for strict conformance to some version of ISO C. On some hosts, system include files use a different convention, where <code class="code">__STDC__</code> is normally 0, but is 1 if the user specifies strict conformance to the C Standard. GCC follows the host convention when processing system include files, but when processing user files it follows the usual GNU C convention. </p> </li> +<li>Undefining <code class="code">__STDC__</code> in C++. <p>Programs written to compile with C++-to-C translators get the value of <code class="code">__STDC__</code> that goes with the C compiler that is subsequently used. These programs must test <code class="code">__STDC__</code> to determine what kind of C preprocessor that compiler uses: whether they should concatenate tokens in the ISO C fashion or in the traditional fashion. </p> <p>These programs work properly with GNU C++ if <code class="code">__STDC__</code> is defined. They would not work otherwise. </p> <p>In addition, many header files are written to provide prototypes in ISO C but not in traditional C. Many of these header files can work without change in C++ provided <code class="code">__STDC__</code> is defined. If <code class="code">__STDC__</code> is not defined, they will all fail, and will all need to be changed to test explicitly for C++ as well. </p> </li> +<li>Deleting “empty” loops. <p>Historically, GCC has not deleted “empty” loops under the assumption that the most likely reason you would put one in a program is to have a delay, so deleting them will not make real programs run any faster. </p> <p>However, the rationale here is that optimization of a nonempty loop cannot produce an empty one. This held for carefully written C compiled with less powerful optimizers but is not always the case for carefully written C++ or with more powerful optimizers. Thus GCC will remove operations from loops whenever it can determine those operations are not externally visible (apart from the time taken to execute them, of course). In case the loop can be proved to be finite, GCC will also remove the loop itself. </p> <p>Be aware of this when performing timing tests, for instance the following loop can be completely removed, provided <code class="code">some_expression</code> can provably not change any global state. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + int sum = 0; + int ix; + + for (ix = 0; ix != 10000; ix++) + sum += some_expression; +}</pre> +</div> <p>Even though <code class="code">sum</code> is accumulated in the loop, no use is made of that summation, so the accumulation can be removed. </p> </li> +<li>Making side effects happen in the same order as in some other compiler. <p>It is never safe to depend on the order of evaluation of side effects. For example, a function call like this may very well behave differently from one compiler to another: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void func (int, int); + +int i = 2; +func (i++, i++);</pre> +</div> <p>There is no guarantee (in either the C or the C++ standard language definitions) that the increments will be evaluated in any particular order. Either increment might happen first. <code class="code">func</code> might get the arguments ‘<samp class="samp">2, 3</samp>’, or it might get ‘<samp class="samp">3, 2</samp>’, or even ‘<samp class="samp">2, 2</samp>’. </p> </li> +<li>Making certain warnings into errors by default. <p>Some ISO C testsuites report failure when the compiler does not produce an error message for a certain program. </p> <p>ISO C requires a “diagnostic” message for certain kinds of invalid programs, but a warning is defined by GCC to count as a diagnostic. If GCC produces a warning but not an error, that is correct ISO C support. If testsuites call this “failure”, they should be run with the GCC option <samp class="option">-pedantic-errors</samp>, which will turn these warnings into errors. </p> </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="warnings-and-errors">Warning Messages and Error Messages</a>, Previous: <a href="c_002b_002b-misunderstandings">Common Misunderstandings with GNU C++</a>, Up: <a href="trouble">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Non-bugs.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Non-bugs.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nonlocal-gotos.html b/devdocs/gcc~13/nonlocal-gotos.html new file mode 100644 index 00000000..d526f282 --- /dev/null +++ b/devdocs/gcc~13/nonlocal-gotos.html @@ -0,0 +1,16 @@ +<div class="section-level-extent" id="Nonlocal-Gotos"> <div class="nav-panel"> <p> Next: <a href="constructing-calls" accesskey="n" rel="next">Constructing Function Calls</a>, Previous: <a href="nested-functions" accesskey="p" rel="prev">Nested Functions</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Nonlocal-Gotos-1"><span>6.5 Nonlocal Gotos<a class="copiable-link" href="#Nonlocal-Gotos-1"> ¶</a></span></h1> <p>GCC provides the built-in functions <code class="code">__builtin_setjmp</code> and <code class="code">__builtin_longjmp</code> which are similar to, but not interchangeable with, the C library functions <code class="code">setjmp</code> and <code class="code">longjmp</code>. The built-in versions are used internally by GCC’s libraries to implement exception handling on some targets. You should use the standard C library functions declared in <code class="code"><setjmp.h></code> in user code instead of the builtins. </p> <p>The built-in versions of these functions use GCC’s normal mechanisms to save and restore registers using the stack on function entry and exit. The jump buffer argument <var class="var">buf</var> holds only the information needed to restore the stack frame, rather than the entire set of saved register values. </p> <p>An important caveat is that GCC arranges to save and restore only those registers known to the specific architecture variant being compiled for. This can make <code class="code">__builtin_setjmp</code> and <code class="code">__builtin_longjmp</code> more efficient than their library counterparts in some cases, but it can also cause incorrect and mysterious behavior when mixing with code that uses the full register set. </p> <p>You should declare the jump buffer argument <var class="var">buf</var> to the built-in functions as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <stdint.h> +intptr_t <var class="var">buf</var>[5];</pre> +</div> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fsetjmp"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_setjmp</strong> <code class="def-code-arguments">(intptr_t *<var class="var">buf</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsetjmp"> ¶</a></span> +</dt> <dd><p>This function saves the current stack context in <var class="var">buf</var>. <code class="code">__builtin_setjmp</code> returns 0 when returning directly, and 1 when returning from <code class="code">__builtin_longjmp</code> using the same <var class="var">buf</var>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005flongjmp"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_longjmp</strong> <code class="def-code-arguments">(intptr_t *<var class="var">buf</var>, int <var class="var">val</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005flongjmp"> ¶</a></span> +</dt> <dd> +<p>This function restores the stack context in <var class="var">buf</var>, saved by a previous call to <code class="code">__builtin_setjmp</code>. After <code class="code">__builtin_longjmp</code> is finished, the program resumes execution as if the matching <code class="code">__builtin_setjmp</code> returns the value <var class="var">val</var>, which must be 1. </p> <p>Because <code class="code">__builtin_longjmp</code> depends on the function return mechanism to restore the stack context, it cannot be called from the same function calling <code class="code">__builtin_setjmp</code> to initialize <var class="var">buf</var>. It can only be called from a function called (directly or indirectly) from the function calling <code class="code">__builtin_setjmp</code>. </p> +</dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="constructing-calls">Constructing Function Calls</a>, Previous: <a href="nested-functions">Nested Functions</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nonlocal-Gotos.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nonlocal-Gotos.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nvidia-ptx-function-attributes.html b/devdocs/gcc~13/nvidia-ptx-function-attributes.html new file mode 100644 index 00000000..c9f09ebf --- /dev/null +++ b/devdocs/gcc~13/nvidia-ptx-function-attributes.html @@ -0,0 +1,10 @@ +<div class="subsection-level-extent" id="Nvidia-PTX-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="powerpc-function-attributes" accesskey="n" rel="next">PowerPC Function Attributes</a>, Previous: <a href="nios-ii-function-attributes" accesskey="p" rel="prev">Nios II Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Nvidia-PTX-Function-Attributes-1"><span>6.33.23 Nvidia PTX Function Attributes<a class="copiable-link" href="#Nvidia-PTX-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the Nvidia PTX back end: </p> <dl class="table"> <dt> +<span><code class="code">kernel</code><a class="copiable-link" href="#index-kernel-attribute_002c-Nvidia-PTX"> ¶</a></span> +</dt> <dd> +<p>This attribute indicates that the corresponding function should be compiled as a kernel function, which can be invoked from the host via the CUDA RT library. By default functions are only callable only from other PTX functions. </p> <p>Kernel functions must have <code class="code">void</code> return type. </p> +</dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nvidia-PTX-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nvidia-PTX-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nvidia-ptx-options.html b/devdocs/gcc~13/nvidia-ptx-options.html new file mode 100644 index 00000000..fd8d5da0 --- /dev/null +++ b/devdocs/gcc~13/nvidia-ptx-options.html @@ -0,0 +1,36 @@ +<div class="subsection-level-extent" id="Nvidia-PTX-Options"> <div class="nav-panel"> <p> Next: <a href="openrisc-options" accesskey="n" rel="next">OpenRISC Options</a>, Previous: <a href="nios-ii-options" accesskey="p" rel="prev">Nios II Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Nvidia-PTX-Options-1"><span>3.19.35 Nvidia PTX Options<a class="copiable-link" href="#Nvidia-PTX-Options-1"> ¶</a></span></h1> <p>These options are defined for Nvidia PTX: </p> <dl class="table"> <dt> +<span><code class="code">-m64</code><a class="copiable-link" href="#index-m64"> ¶</a></span> +</dt> <dd> +<p>Ignored, but preserved for backward compatibility. Only 64-bit ABI is supported. </p> </dd> <dt> +<span><code class="code">-march=<var class="var">architecture-string</var></code><a class="copiable-link" href="#index-march-12"> ¶</a></span> +</dt> <dd> +<p>Generate code for the specified PTX ISA target architecture (e.g. ‘<samp class="samp">sm_35</samp>’). Valid architecture strings are ‘<samp class="samp">sm_30</samp>’, ‘<samp class="samp">sm_35</samp>’, ‘<samp class="samp">sm_53</samp>’, ‘<samp class="samp">sm_70</samp>’, ‘<samp class="samp">sm_75</samp>’ and ‘<samp class="samp">sm_80</samp>’. The default depends on how the compiler has been configured, see <samp class="option">--with-arch</samp>. </p> <p>This option sets the value of the preprocessor macro <code class="code">__PTX_SM__</code>; for instance, for ‘<samp class="samp">sm_35</samp>’, it has the value ‘<samp class="samp">350</samp>’. </p> </dd> <dt> +<span><code class="code">-misa=<var class="var">architecture-string</var></code><a class="copiable-link" href="#index-misa"> ¶</a></span> +</dt> <dd> +<p>Alias of <samp class="option">-march=</samp>. </p> </dd> <dt> +<span><code class="code">-march-map=<var class="var">architecture-string</var></code><a class="copiable-link" href="#index-march-13"> ¶</a></span> +</dt> <dd> +<p>Select the closest available <samp class="option">-march=</samp> value that is not more capable. For instance, for <samp class="option">-march-map=sm_50</samp> select <samp class="option">-march=sm_35</samp>, and for <samp class="option">-march-map=sm_53</samp> select <samp class="option">-march=sm_53</samp>. </p> </dd> <dt> +<span><code class="code">-mptx=<var class="var">version-string</var></code><a class="copiable-link" href="#index-mptx"> ¶</a></span> +</dt> <dd> +<p>Generate code for the specified PTX ISA version (e.g. ‘<samp class="samp">7.0</samp>’). Valid version strings include ‘<samp class="samp">3.1</samp>’, ‘<samp class="samp">6.0</samp>’, ‘<samp class="samp">6.3</samp>’, and ‘<samp class="samp">7.0</samp>’. The default PTX ISA version is 6.0, unless a higher version is required for specified PTX ISA target architecture via option <samp class="option">-march=</samp>. </p> <p>This option sets the values of the preprocessor macros <code class="code">__PTX_ISA_VERSION_MAJOR__</code> and <code class="code">__PTX_ISA_VERSION_MINOR__</code>; for instance, for ‘<samp class="samp">3.1</samp>’ the macros have the values ‘<samp class="samp">3</samp>’ and ‘<samp class="samp">1</samp>’, respectively. </p> </dd> <dt> +<span><code class="code">-mmainkernel</code><a class="copiable-link" href="#index-mmainkernel"> ¶</a></span> +</dt> <dd> +<p>Link in code for a __main kernel. This is for stand-alone instead of offloading execution. </p> </dd> <dt> +<span><code class="code">-moptimize</code><a class="copiable-link" href="#index-moptimize"> ¶</a></span> +</dt> <dd> +<p>Apply partitioned execution optimizations. This is the default when any level of optimization is selected. </p> </dd> <dt> +<span><code class="code">-msoft-stack</code><a class="copiable-link" href="#index-msoft-stack"> ¶</a></span> +</dt> <dd> +<p>Generate code that does not use <code class="code">.local</code> memory directly for stack storage. Instead, a per-warp stack pointer is maintained explicitly. This enables variable-length stack allocation (with variable-length arrays or <code class="code">alloca</code>), and when global memory is used for underlying storage, makes it possible to access automatic variables from other threads, or with atomic instructions. This code generation variant is used for OpenMP offloading, but the option is exposed on its own for the purpose of testing the compiler; to generate code suitable for linking into programs using OpenMP offloading, use option <samp class="option">-mgomp</samp>. </p> </dd> <dt> +<span><code class="code">-muniform-simt</code><a class="copiable-link" href="#index-muniform-simt"> ¶</a></span> +</dt> <dd> +<p>Switch to code generation variant that allows to execute all threads in each warp, while maintaining memory state and side effects as if only one thread in each warp was active outside of OpenMP SIMD regions. All atomic operations and calls to runtime (malloc, free, vprintf) are conditionally executed (iff current lane index equals the master lane index), and the register being assigned is copied via a shuffle instruction from the master lane. Outside of SIMD regions lane 0 is the master; inside, each thread sees itself as the master. Shared memory array <code class="code">int __nvptx_uni[]</code> stores all-zeros or all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD regions). Each thread can bitwise-and the bitmask at position <code class="code">tid.y</code> with current lane index to compute the master lane index. </p> </dd> <dt> +<span><code class="code">-mgomp</code><a class="copiable-link" href="#index-mgomp"> ¶</a></span> +</dt> <dd> +<p>Generate code for use in OpenMP offloading: enables <samp class="option">-msoft-stack</samp> and <samp class="option">-muniform-simt</samp> options, and selects corresponding multilib variant. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="openrisc-options">OpenRISC Options</a>, Previous: <a href="nios-ii-options">Nios II Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nvidia-PTX-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nvidia-PTX-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/nvidia-ptx-variable-attributes.html b/devdocs/gcc~13/nvidia-ptx-variable-attributes.html new file mode 100644 index 00000000..fcde0cdd --- /dev/null +++ b/devdocs/gcc~13/nvidia-ptx-variable-attributes.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="Nvidia-PTX-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="powerpc-variable-attributes" accesskey="n" rel="next">PowerPC Variable Attributes</a>, Previous: <a href="msp430-variable-attributes" accesskey="p" rel="prev">MSP430 Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Nvidia-PTX-Variable-Attributes-1"><span>6.34.11 Nvidia PTX Variable Attributes<a class="copiable-link" href="#Nvidia-PTX-Variable-Attributes-1"> ¶</a></span></h1> <p>These variable attributes are supported by the Nvidia PTX back end: </p> <dl class="table"> <dt> +<span><code class="code">shared</code><a class="copiable-link" href="#index-shared-attribute_002c-Nvidia-PTX"> ¶</a></span> +</dt> <dd><p>Use this attribute to place a variable in the <code class="code">.shared</code> memory space. This memory space is private to each cooperative thread array; only threads within one thread block refer to the same instance of the variable. The runtime does not initialize variables in this memory space. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nvidia-PTX-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Nvidia-PTX-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/object-size-checking.html b/devdocs/gcc~13/object-size-checking.html new file mode 100644 index 00000000..ada8daa9 --- /dev/null +++ b/devdocs/gcc~13/object-size-checking.html @@ -0,0 +1,56 @@ +<div class="section-level-extent" id="Object-Size-Checking"> <div class="nav-panel"> <p> Next: <a href="other-builtins" accesskey="n" rel="next">Other Built-in Functions Provided by GCC</a>, Previous: <a href="x86-specific-memory-model-extensions-for-transactional-memory" accesskey="p" rel="prev">x86-Specific Memory Model Extensions for Transactional Memory</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Object-Size-Checking-1"><span>6.58 Object Size Checking<a class="copiable-link" href="#Object-Size-Checking-1"> ¶</a></span></h1> <ul class="mini-toc"> <li><a href="#Object-Size-Checking-Built-in-Functions" accesskey="1">Object Size Checking Built-in Functions</a></li> <li><a href="#Object-Size-Checking-and-Source-Fortification" accesskey="2">Object Size Checking and Source Fortification</a></li> </ul> <div class="subsection-level-extent" id="Object-Size-Checking-Built-in-Functions"> <h2 class="subsection"><span>6.58.1 Object Size Checking Built-in Functions<a class="copiable-link" href="#Object-Size-Checking-Built-in-Functions"> ¶</a></span></h2> <p>GCC implements a limited buffer overflow protection mechanism that can prevent some buffer overflow attacks by determining the sizes of objects into which data is about to be written and preventing the writes when the size isn’t sufficient. The built-in functions described below yield the best results when used together and when optimization is enabled. For example, to detect object sizes across function boundaries or to follow pointer assignments through non-trivial control flow they rely on various optimization passes enabled with <samp class="option">-O2</samp>. However, to a limited extent, they can be used without optimization as well. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fobject_005fsize"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">__builtin_object_size</strong> <code class="def-code-arguments">(const void * <var class="var">ptr</var>, int <var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fobject_005fsize"> ¶</a></span> +</dt> <dd> +<p>is a built-in construct that returns a constant number of bytes from <var class="var">ptr</var> to the end of the object <var class="var">ptr</var> pointer points to (if known at compile time). To determine the sizes of dynamically allocated objects the function relies on the allocation functions called to obtain the storage to be declared with the <code class="code">alloc_size</code> attribute (see <a class="pxref" href="common-function-attributes">Common Function Attributes</a>). <code class="code">__builtin_object_size</code> never evaluates its arguments for side effects. If there are any side effects in them, it returns <code class="code">(size_t) -1</code> for <var class="var">type</var> 0 or 1 and <code class="code">(size_t) 0</code> for <var class="var">type</var> 2 or 3. If there are multiple objects <var class="var">ptr</var> can point to and all of them are known at compile time, the returned number is the maximum of remaining byte counts in those objects if <var class="var">type</var> & 2 is 0 and minimum if nonzero. If it is not possible to determine which objects <var class="var">ptr</var> points to at compile time, <code class="code">__builtin_object_size</code> should return <code class="code">(size_t) -1</code> for <var class="var">type</var> 0 or 1 and <code class="code">(size_t) 0</code> for <var class="var">type</var> 2 or 3. </p> <p><var class="var">type</var> is an integer constant from 0 to 3. If the least significant bit is clear, objects are whole variables, if it is set, a closest surrounding subobject is considered the object a pointer points to. The second bit determines if maximum or minimum of remaining bytes is computed. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct V { char buf1[10]; int b; char buf2[10]; } var; +char *p = &var.buf1[1], *q = &var.b; + +/* Here the object p points to is var. */ +assert (__builtin_object_size (p, 0) == sizeof (var) - 1); +/* The subobject p points to is var.buf1. */ +assert (__builtin_object_size (p, 1) == sizeof (var.buf1) - 1); +/* The object q points to is var. */ +assert (__builtin_object_size (q, 0) + == (char *) (&var + 1) - (char *) &var.b); +/* The subobject q points to is var.b. */ +assert (__builtin_object_size (q, 1) == sizeof (var.b));</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fdynamic_005fobject_005fsize"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">__builtin_dynamic_object_size</strong> <code class="def-code-arguments">(const void * <var class="var">ptr</var>, int <var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fdynamic_005fobject_005fsize"> ¶</a></span> +</dt> <dd><p>is similar to <code class="code">__builtin_object_size</code> in that it returns a number of bytes from <var class="var">ptr</var> to the end of the object <var class="var">ptr</var> pointer points to, except that the size returned may not be a constant. This results in successful evaluation of object size estimates in a wider range of use cases and can be more precise than <code class="code">__builtin_object_size</code>, but it incurs a performance penalty since it may add a runtime overhead on size computation. Semantics of <var class="var">type</var> as well as return values in case it is not possible to determine which objects <var class="var">ptr</var> points to at compile time are the same as in the case of <code class="code">__builtin_object_size</code>. </p></dd> +</dl> </div> <div class="subsection-level-extent" id="Object-Size-Checking-and-Source-Fortification"> <h2 class="subsection"><span>6.58.2 Object Size Checking and Source Fortification<a class="copiable-link" href="#Object-Size-Checking-and-Source-Fortification"> ¶</a></span></h2> <p>Hardening of function calls using the <code class="code">_FORTIFY_SOURCE</code> macro is one of the key uses of the object size checking built-in functions. To make implementation of these features more convenient and improve optimization and diagnostics, there are built-in functions added for many common string operation functions, e.g., for <code class="code">memcpy</code> <code class="code">__builtin___memcpy_chk</code> built-in is provided. This built-in has an additional last argument, which is the number of bytes remaining in the object the <var class="var">dest</var> argument points to or <code class="code">(size_t) -1</code> if the size is not known. </p> <p>The built-in functions are optimized into the normal string functions like <code class="code">memcpy</code> if the last argument is <code class="code">(size_t) -1</code> or if it is known at compile time that the destination object will not be overflowed. If the compiler can determine at compile time that the object will always be overflowed, it issues a warning. </p> <p>The intended use can be e.g. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#undef memcpy +#define bos0(dest) __builtin_object_size (dest, 0) +#define memcpy(dest, src, n) \ + __builtin___memcpy_chk (dest, src, n, bos0 (dest)) + +char *volatile p; +char buf[10]; +/* It is unknown what object p points to, so this is optimized + into plain memcpy - no checking is possible. */ +memcpy (p, "abcde", n); +/* Destination is known and length too. It is known at compile + time there will be no overflow. */ +memcpy (&buf[5], "abcde", 5); +/* Destination is known, but the length is not known at compile time. + This will result in __memcpy_chk call that can check for overflow + at run time. */ +memcpy (&buf[5], "abcde", n); +/* Destination is known and it is known at compile time there will + be overflow. There will be a warning and __memcpy_chk call that + will abort the program at run time. */ +memcpy (&buf[6], "abcde", 5);</pre> +</div> <p>Such built-in functions are provided for <code class="code">memcpy</code>, <code class="code">mempcpy</code>, <code class="code">memmove</code>, <code class="code">memset</code>, <code class="code">strcpy</code>, <code class="code">stpcpy</code>, <code class="code">strncpy</code>, <code class="code">strcat</code> and <code class="code">strncat</code>. </p> <ul class="mini-toc"> <li><a href="#Formatted-Output-Function-Checking" accesskey="1">Formatted Output Function Checking</a></li> </ul> <div class="subsubsection-level-extent" id="Formatted-Output-Function-Checking"> <h2 class="subsubsection"><span>6.58.2.1 Formatted Output Function Checking<a class="copiable-link" href="#Formatted-Output-Function-Checking"> ¶</a></span></h2> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005f_005f_005fsprintf_005fchk"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin___sprintf_chk</strong> <code class="def-code-arguments">(char *<var class="var">s</var>, int <var class="var">flag</var>, size_t <var class="var">os</var>, const char *<var class="var">fmt</var>, ...)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005f_005f_005fsprintf_005fchk"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005f_005f_005fsnprintf_005fchk"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin___snprintf_chk</strong> <code class="def-code-arguments">(char *<var class="var">s</var>, size_t <var class="var">maxlen</var>, int <var class="var">flag</var>, size_t <var class="var">os</var>, const char *<var class="var">fmt</var>, ...)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005f_005f_005fsnprintf_005fchk"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005f_005f_005fvsprintf_005fchk"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin___vsprintf_chk</strong> <code class="def-code-arguments">(char *<var class="var">s</var>, int <var class="var">flag</var>, size_t <var class="var">os</var>, const char *<var class="var">fmt</var>, va_list <var class="var">ap</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005f_005f_005fvsprintf_005fchk"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005f_005f_005fvsnprintf_005fchk"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin___vsnprintf_chk</strong> <code class="def-code-arguments">(char *<var class="var">s</var>, size_t <var class="var">maxlen</var>, int <var class="var">flag</var>, size_t <var class="var">os</var>, const char *<var class="var">fmt</var>, va_list <var class="var">ap</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005f_005f_005fvsnprintf_005fchk"> ¶</a></span> +</dt> <dd> <p>The added <var class="var">flag</var> argument is passed unchanged to <code class="code">__sprintf_chk</code> etc. functions and can contain implementation specific flags on what additional security measures the checking function might take, such as handling <code class="code">%n</code> differently. </p> <p>The <var class="var">os</var> argument is the object size <var class="var">s</var> points to, like in the other built-in functions. There is a small difference in the behavior though, if <var class="var">os</var> is <code class="code">(size_t) -1</code>, the built-in functions are optimized into the non-checking functions only if <var class="var">flag</var> is 0, otherwise the checking function is called with <var class="var">os</var> argument set to <code class="code">(size_t) -1</code>. </p> <p>In addition to this, there are checking built-in functions <code class="code">__builtin___printf_chk</code>, <code class="code">__builtin___vprintf_chk</code>, <code class="code">__builtin___fprintf_chk</code> and <code class="code">__builtin___vfprintf_chk</code>. These have just one additional argument, <var class="var">flag</var>, right before format string <var class="var">fmt</var>. If the compiler is able to optimize them to <code class="code">fputc</code> etc. functions, it does, otherwise the checking function is called and the <var class="var">flag</var> argument passed to it. </p> +</dd> +</dl> </div> </div> </div> <div class="nav-panel"> <p> Next: <a href="other-builtins">Other Built-in Functions Provided by GCC</a>, Previous: <a href="x86-specific-memory-model-extensions-for-transactional-memory">x86-Specific Memory Model Extensions for Transactional Memory</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Object-Size-Checking.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Object-Size-Checking.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/objective-c-and-objective-c_002b_002b-dialect-options.html b/devdocs/gcc~13/objective-c-and-objective-c_002b_002b-dialect-options.html new file mode 100644 index 00000000..9bb55358 --- /dev/null +++ b/devdocs/gcc~13/objective-c-and-objective-c_002b_002b-dialect-options.html @@ -0,0 +1,80 @@ +<div class="section-level-extent" id="Objective-C-and-Objective-C_002b_002b-Dialect-Options"> <div class="nav-panel"> <p> Next: <a href="diagnostic-message-formatting-options" accesskey="n" rel="next">Options to Control Diagnostic Messages Formatting</a>, Previous: <a href="c_002b_002b-dialect-options" accesskey="p" rel="prev">Options Controlling C++ Dialect</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-Controlling-Objective-C-and-Objective-C_002b_002b-Dialects"><span>3.6 Options Controlling Objective-C and Objective-C++ Dialects<a class="copiable-link" href="#Options-Controlling-Objective-C-and-Objective-C_002b_002b-Dialects"> ¶</a></span></h1> <p>(NOTE: This manual does not describe the Objective-C and Objective-C++ languages themselves. See <a class="xref" href="standards">Language Standards Supported by GCC</a>, for references.) </p> <p>This section describes the command-line options that are only meaningful for Objective-C and Objective-C++ programs. You can also use most of the language-independent GNU compiler options. For example, you might compile a file <samp class="file">some_class.m</samp> like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -g -fgnu-runtime -O -c some_class.m</pre> +</div> <p>In this example, <samp class="option">-fgnu-runtime</samp> is an option meant only for Objective-C and Objective-C++ programs; you can use the other options with any language supported by GCC. </p> <p>Note that since Objective-C is an extension of the C language, Objective-C compilations may also use options specific to the C front-end (e.g., <samp class="option">-Wtraditional</samp>). Similarly, Objective-C++ compilations may use C++-specific options (e.g., <samp class="option">-Wabi</samp>). </p> <p>Here is a list of options that are <em class="emph">only</em> for compiling Objective-C and Objective-C++ programs: </p> <dl class="table"> <dt> +<span><code class="code">-fconstant-string-class=<var class="var">class-name</var></code><a class="copiable-link" href="#index-fconstant-string-class"> ¶</a></span> +</dt> <dd> +<p>Use <var class="var">class-name</var> as the name of the class to instantiate for each literal string specified with the syntax <code class="code">@"…"</code>. The default class name is <code class="code">NXConstantString</code> if the GNU runtime is being used, and <code class="code">NSConstantString</code> if the NeXT runtime is being used (see below). The <samp class="option">-fconstant-cfstrings</samp> option, if also present, overrides the <samp class="option">-fconstant-string-class</samp> setting and cause <code class="code">@"…"</code> literals to be laid out as constant CoreFoundation strings. </p> </dd> <dt> +<span><code class="code">-fgnu-runtime</code><a class="copiable-link" href="#index-fgnu-runtime"> ¶</a></span> +</dt> <dd> +<p>Generate object code compatible with the standard GNU Objective-C runtime. This is the default for most types of systems. </p> </dd> <dt> +<span><code class="code">-fnext-runtime</code><a class="copiable-link" href="#index-fnext-runtime"> ¶</a></span> +</dt> <dd> +<p>Generate output compatible with the NeXT runtime. This is the default for NeXT-based systems, including Darwin and Mac OS X. The macro <code class="code">__NEXT_RUNTIME__</code> is predefined if (and only if) this option is used. </p> </dd> <dt> + <span><code class="code">-fno-nil-receivers</code><a class="copiable-link" href="#index-fno-nil-receivers"> ¶</a></span> +</dt> <dd> +<p>Assume that all Objective-C message dispatches (<code class="code">[receiver +message:arg]</code>) in this translation unit ensure that the receiver is not <code class="code">nil</code>. This allows for more efficient entry points in the runtime to be used. This option is only available in conjunction with the NeXT runtime and ABI version 0 or 1. </p> </dd> <dt> +<span><code class="code">-fobjc-abi-version=<var class="var">n</var></code><a class="copiable-link" href="#index-fobjc-abi-version"> ¶</a></span> +</dt> <dd> +<p>Use version <var class="var">n</var> of the Objective-C ABI for the selected runtime. This option is currently supported only for the NeXT runtime. In that case, Version 0 is the traditional (32-bit) ABI without support for properties and other Objective-C 2.0 additions. Version 1 is the traditional (32-bit) ABI with support for properties and other Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If nothing is specified, the default is Version 0 on 32-bit target machines, and Version 2 on 64-bit target machines. </p> </dd> <dt> +<span><code class="code">-fobjc-call-cxx-cdtors</code><a class="copiable-link" href="#index-fobjc-call-cxx-cdtors"> ¶</a></span> +</dt> <dd> +<p>For each Objective-C class, check if any of its instance variables is a C++ object with a non-trivial default constructor. If so, synthesize a special <code class="code">- (id) .cxx_construct</code> instance method which runs non-trivial default constructors on any such instance variables, in order, and then return <code class="code">self</code>. Similarly, check if any instance variable is a C++ object with a non-trivial destructor, and if so, synthesize a special <code class="code">- (void) .cxx_destruct</code> method which runs all such default destructors, in reverse order. </p> <p>The <code class="code">- (id) .cxx_construct</code> and <code class="code">- (void) .cxx_destruct</code> methods thusly generated only operate on instance variables declared in the current Objective-C class, and not those inherited from superclasses. It is the responsibility of the Objective-C runtime to invoke all such methods in an object’s inheritance hierarchy. The <code class="code">- (id) .cxx_construct</code> methods are invoked by the runtime immediately after a new object instance is allocated; the <code class="code">- (void) .cxx_destruct</code> methods are invoked immediately before the runtime deallocates an object instance. </p> <p>As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has support for invoking the <code class="code">- (id) .cxx_construct</code> and <code class="code">- (void) .cxx_destruct</code> methods. </p> </dd> <dt> +<span><code class="code">-fobjc-direct-dispatch</code><a class="copiable-link" href="#index-fobjc-direct-dispatch"> ¶</a></span> +</dt> <dd> +<p>Allow fast jumps to the message dispatcher. On Darwin this is accomplished via the comm page. </p> </dd> <dt> +<span><code class="code">-fobjc-exceptions</code><a class="copiable-link" href="#index-fobjc-exceptions"> ¶</a></span> +</dt> <dd> +<p>Enable syntactic support for structured exception handling in Objective-C, similar to what is offered by C++. This option is required to use the Objective-C keywords <code class="code">@try</code>, <code class="code">@throw</code>, <code class="code">@catch</code>, <code class="code">@finally</code> and <code class="code">@synchronized</code>. This option is available with both the GNU runtime and the NeXT runtime (but not available in conjunction with the NeXT runtime on Mac OS X 10.2 and earlier). </p> </dd> <dt> +<span><code class="code">-fobjc-gc</code><a class="copiable-link" href="#index-fobjc-gc"> ¶</a></span> +</dt> <dd> +<p>Enable garbage collection (GC) in Objective-C and Objective-C++ programs. This option is only available with the NeXT runtime; the GNU runtime has a different garbage collection implementation that does not require special compiler flags. </p> </dd> <dt> +<span><code class="code">-fobjc-nilcheck</code><a class="copiable-link" href="#index-fobjc-nilcheck"> ¶</a></span> +</dt> <dd> +<p>For the NeXT runtime with version 2 of the ABI, check for a nil receiver in method invocations before doing the actual method call. This is the default and can be disabled using <samp class="option">-fno-objc-nilcheck</samp>. Class methods and super calls are never checked for nil in this way no matter what this flag is set to. Currently this flag does nothing when the GNU runtime, or an older version of the NeXT runtime ABI, is used. </p> </dd> <dt> +<span><code class="code">-fobjc-std=objc1</code><a class="copiable-link" href="#index-fobjc-std"> ¶</a></span> +</dt> <dd> +<p>Conform to the language syntax of Objective-C 1.0, the language recognized by GCC 4.0. This only affects the Objective-C additions to the C/C++ language; it does not affect conformance to C/C++ standards, which is controlled by the separate C/C++ dialect option flags. When this option is used with the Objective-C or Objective-C++ compiler, any Objective-C syntax that is not recognized by GCC 4.0 is rejected. This is useful if you need to make sure that your Objective-C code can be compiled with older versions of GCC. </p> </dd> <dt> +<span><code class="code">-freplace-objc-classes</code><a class="copiable-link" href="#index-freplace-objc-classes"> ¶</a></span> +</dt> <dd> +<p>Emit a special marker instructing <code class="command">ld(1)</code> not to statically link in the resulting object file, and allow <code class="command">dyld(1)</code> to load it in at run time instead. This is used in conjunction with the Fix-and-Continue debugging mode, where the object file in question may be recompiled and dynamically reloaded in the course of program execution, without the need to restart the program itself. Currently, Fix-and-Continue functionality is only available in conjunction with the NeXT runtime on Mac OS X 10.3 and later. </p> </dd> <dt> +<span><code class="code">-fzero-link</code><a class="copiable-link" href="#index-fzero-link"> ¶</a></span> +</dt> <dd> +<p>When compiling for the NeXT runtime, the compiler ordinarily replaces calls to <code class="code">objc_getClass("…")</code> (when the name of the class is known at compile time) with static class references that get initialized at load time, which improves run-time performance. Specifying the <samp class="option">-fzero-link</samp> flag suppresses this behavior and causes calls to <code class="code">objc_getClass("…")</code> to be retained. This is useful in Zero-Link debugging mode, since it allows for individual class implementations to be modified during program execution. The GNU runtime currently always retains calls to <code class="code">objc_get_class("…")</code> regardless of command-line options. </p> </dd> <dt> + <span><code class="code">-fno-local-ivars</code><a class="copiable-link" href="#index-fno-local-ivars"> ¶</a></span> +</dt> <dd> +<p>By default instance variables in Objective-C can be accessed as if they were local variables from within the methods of the class they’re declared in. This can lead to shadowing between instance variables and other variables declared either locally inside a class method or globally with the same name. Specifying the <samp class="option">-fno-local-ivars</samp> flag disables this behavior thus avoiding variable shadowing issues. </p> </dd> <dt> +<span><code class="code">-fivar-visibility=<span class="r">[</span>public<span class="r">|</span>protected<span class="r">|</span>private<span class="r">|</span>package<span class="r">]</span></code><a class="copiable-link" href="#index-fivar-visibility"> ¶</a></span> +</dt> <dd> +<p>Set the default instance variable visibility to the specified option so that instance variables declared outside the scope of any access modifier directives default to the specified visibility. </p> </dd> <dt> +<span><code class="code">-gen-decls</code><a class="copiable-link" href="#index-gen-decls"> ¶</a></span> +</dt> <dd> +<p>Dump interface declarations for all classes seen in the source file to a file named <samp class="file"><var class="var">sourcename</var>.decl</samp>. </p> </dd> <dt> + <span><code class="code">-Wassign-intercept <span class="r">(Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wassign-intercept"> ¶</a></span> +</dt> <dd> +<p>Warn whenever an Objective-C assignment is being intercepted by the garbage collector. </p> </dd> <dt> + <span><code class="code">-Wno-property-assign-default <span class="r">(Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wproperty-assign-default"> ¶</a></span> +</dt> <dd> +<p>Do not warn if a property for an Objective-C object has no assign semantics specified. </p> </dd> <dt> + <span><code class="code">-Wno-protocol <span class="r">(Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wno-protocol"> ¶</a></span> +</dt> <dd> +<p>If a class is declared to implement a protocol, a warning is issued for every method in the protocol that is not implemented by the class. The default behavior is to issue a warning for every method not explicitly implemented in the class, even if a method implementation is inherited from the superclass. If you use the <samp class="option">-Wno-protocol</samp> option, then methods inherited from the superclass are considered to be implemented, and no warning is issued for them. </p> </dd> <dt> +<span><code class="code">-Wobjc-root-class <span class="r">(Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wobjc-root-class"> ¶</a></span> +</dt> <dd> +<p>Warn if a class interface lacks a superclass. Most classes will inherit from <code class="code">NSObject</code> (or <code class="code">Object</code>) for example. When declaring classes intended to be root classes, the warning can be suppressed by marking their interfaces with <code class="code">__attribute__((objc_root_class))</code>. </p> </dd> <dt> + <span><code class="code">-Wselector <span class="r">(Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wselector"> ¶</a></span> +</dt> <dd> +<p>Warn if multiple methods of different types for the same selector are found during compilation. The check is performed on the list of methods in the final stage of compilation. Additionally, a check is performed for each selector appearing in a <code class="code">@selector(…)</code> expression, and a corresponding method for that selector has been found during compilation. Because these checks scan the method table only at the end of compilation, these warnings are not produced if the final stage of compilation is not reached, for example because an error is found during compilation, or because the <samp class="option">-fsyntax-only</samp> option is being used. </p> </dd> <dt> + <span><code class="code">-Wstrict-selector-match <span class="r">(Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wstrict-selector-match"> ¶</a></span> +</dt> <dd> +<p>Warn if multiple methods with differing argument and/or return types are found for a given selector when attempting to send a message using this selector to a receiver of type <code class="code">id</code> or <code class="code">Class</code>. When this flag is off (which is the default behavior), the compiler omits such warnings if any differences found are confined to types that share the same size and alignment. </p> </dd> <dt> + <span><code class="code">-Wundeclared-selector <span class="r">(Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wundeclared-selector"> ¶</a></span> +</dt> <dd> +<p>Warn if a <code class="code">@selector(…)</code> expression referring to an undeclared selector is found. A selector is considered undeclared if no method with that name has been declared before the <code class="code">@selector(…)</code> expression, either explicitly in an <code class="code">@interface</code> or <code class="code">@protocol</code> declaration, or implicitly in an <code class="code">@implementation</code> section. This option always performs its checks as soon as a <code class="code">@selector(…)</code> expression is found, while <samp class="option">-Wselector</samp> only performs its checks in the final stage of compilation. This also enforces the coding style convention that methods and selectors must be declared before being used. </p> </dd> <dt> +<span><code class="code">-print-objc-runtime-info</code><a class="copiable-link" href="#index-print-objc-runtime-info"> ¶</a></span> +</dt> <dd> +<p>Generate C header describing the largest structure that is passed by value, if any. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="diagnostic-message-formatting-options">Options to Control Diagnostic Messages Formatting</a>, Previous: <a href="c_002b_002b-dialect-options">Options Controlling C++ Dialect</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Objective-C-and-Objective-C_002b_002b-Dialect-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Objective-C-and-Objective-C_002b_002b-Dialect-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/objective-c.html b/devdocs/gcc~13/objective-c.html new file mode 100644 index 00000000..f7aea77b --- /dev/null +++ b/devdocs/gcc~13/objective-c.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="Objective-C"> <div class="nav-panel"> <p> Next: <a href="compatibility" accesskey="n" rel="next">Binary Compatibility</a>, Previous: <a href="c_002b_002b-extensions" accesskey="p" rel="prev">Extensions to the C++ Language</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="GNU-Objective-C-Features"><span>8 GNU Objective-C Features<a class="copiable-link" href="#GNU-Objective-C-Features"> ¶</a></span></h1> <p>This document is meant to describe some of the GNU Objective-C features. It is not intended to teach you Objective-C. There are several resources on the Internet that present the language. </p> <ul class="mini-toc"> <li><a href="gnu-objective-c-runtime-api" accesskey="1">GNU Objective-C Runtime API</a></li> <li><a href="executing-code-before-main" accesskey="2"><code class="code">+load</code>: Executing Code before <code class="code">main</code></a></li> <li><a href="type-encoding" accesskey="3">Type Encoding</a></li> <li><a href="garbage-collection" accesskey="4">Garbage Collection</a></li> <li><a href="constant-string-objects" accesskey="5">Constant String Objects</a></li> <li><a href="compatibility_005falias" accesskey="6"><code class="code">compatibility_alias</code></a></li> <li><a href="exceptions" accesskey="7">Exceptions</a></li> <li><a href="synchronization" accesskey="8">Synchronization</a></li> <li><a href="fast-enumeration" accesskey="9">Fast Enumeration</a></li> <li><a href="messaging-with-the-gnu-objective-c-runtime">Messaging with the GNU Objective-C Runtime</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Objective-C.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Objective-C.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/offsetof.html b/devdocs/gcc~13/offsetof.html new file mode 100644 index 00000000..110e909e --- /dev/null +++ b/devdocs/gcc~13/offsetof.html @@ -0,0 +1,14 @@ +<div class="section-level-extent" id="Offsetof"> <div class="nav-panel"> <p> Next: <a href="_005f_005fsync-builtins" accesskey="n" rel="next">Legacy <code class="code">__sync</code> Built-in Functions for Atomic Memory Access</a>, Previous: <a href="vector-extensions" accesskey="p" rel="prev">Using Vector Instructions through Built-in Functions</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Support-for-offsetof"><span>6.53 Support for offsetof<a class="copiable-link" href="#Support-for-offsetof"> ¶</a></span></h1> <p>GCC implements for both C and C++ a syntactic extension to implement the <code class="code">offsetof</code> macro. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">primary: + "__builtin_offsetof" "(" <code class="code">typename</code> "," offsetof_member_designator ")" + +offsetof_member_designator: + <code class="code">identifier</code> + | offsetof_member_designator "." <code class="code">identifier</code> + | offsetof_member_designator "[" <code class="code">expr</code> "]"</pre> +</div> <p>This extension is sufficient such that </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define offsetof(<var class="var">type</var>, <var class="var">member</var>) __builtin_offsetof (<var class="var">type</var>, <var class="var">member</var>)</pre> +</div> <p>is a suitable definition of the <code class="code">offsetof</code> macro. In C++, <var class="var">type</var> may be dependent. In either case, <var class="var">member</var> may consist of a single identifier, or a sequence of member accesses and array references. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Offsetof.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Offsetof.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/openrisc-options.html b/devdocs/gcc~13/openrisc-options.html new file mode 100644 index 00000000..7ef7efc8 --- /dev/null +++ b/devdocs/gcc~13/openrisc-options.html @@ -0,0 +1,51 @@ +<div class="subsection-level-extent" id="OpenRISC-Options"> <div class="nav-panel"> <p> Next: <a href="pdp-11-options" accesskey="n" rel="next">PDP-11 Options</a>, Previous: <a href="nvidia-ptx-options" accesskey="p" rel="prev">Nvidia PTX Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="OpenRISC-Options-1"><span>3.19.36 OpenRISC Options<a class="copiable-link" href="#OpenRISC-Options-1"> ¶</a></span></h1> <p>These options are defined for OpenRISC: </p> <dl class="table"> <dt> +<span><code class="code">-mboard=<var class="var">name</var></code><a class="copiable-link" href="#index-mboard"> ¶</a></span> +</dt> <dd> +<p>Configure a board specific runtime. This will be passed to the linker for newlib board library linking. The default is <code class="code">or1ksim</code>. </p> </dd> <dt> +<span><code class="code">-mnewlib</code><a class="copiable-link" href="#index-mnewlib"> ¶</a></span> +</dt> <dd> +<p>This option is ignored; it is for compatibility purposes only. This used to select linker and preprocessor options for use with newlib. </p> </dd> <dt> + <span><code class="code">-msoft-div</code><a class="copiable-link" href="#index-msoft-div"> ¶</a></span> +</dt> <dt><code class="code">-mhard-div</code></dt> <dd> +<p>Select software or hardware divide (<code class="code">l.div</code>, <code class="code">l.divu</code>) instructions. This default is hardware divide. </p> </dd> <dt> + <span><code class="code">-msoft-mul</code><a class="copiable-link" href="#index-msoft-mul"> ¶</a></span> +</dt> <dt><code class="code">-mhard-mul</code></dt> <dd> +<p>Select software or hardware multiply (<code class="code">l.mul</code>, <code class="code">l.muli</code>) instructions. This default is hardware multiply. </p> </dd> <dt> + <span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-9"> ¶</a></span> +</dt> <dt><code class="code">-mhard-float</code></dt> <dd> +<p>Select software or hardware for floating point operations. The default is software. </p> </dd> <dt> +<span><code class="code">-mdouble-float</code><a class="copiable-link" href="#index-mdouble-float-3"> ¶</a></span> +</dt> <dd> +<p>When <samp class="option">-mhard-float</samp> is selected, enables generation of double-precision floating point instructions. By default functions from <samp class="file">libgcc</samp> are used to perform double-precision floating point operations. </p> </dd> <dt> +<span><code class="code">-munordered-float</code><a class="copiable-link" href="#index-munordered-float"> ¶</a></span> +</dt> <dd> +<p>When <samp class="option">-mhard-float</samp> is selected, enables generation of unordered floating point compare and set flag (<code class="code">lf.sfun*</code>) instructions. By default functions from <samp class="file">libgcc</samp> are used to perform unordered floating point compare and set flag operations. </p> </dd> <dt> +<span><code class="code">-mcmov</code><a class="copiable-link" href="#index-mcmov-1"> ¶</a></span> +</dt> <dd> +<p>Enable generation of conditional move (<code class="code">l.cmov</code>) instructions. By default the equivalent will be generated using set and branch. </p> </dd> <dt> +<span><code class="code">-mror</code><a class="copiable-link" href="#index-mror"> ¶</a></span> +</dt> <dd> +<p>Enable generation of rotate right (<code class="code">l.ror</code>) instructions. By default functions from <samp class="file">libgcc</samp> are used to perform rotate right operations. </p> </dd> <dt> +<span><code class="code">-mrori</code><a class="copiable-link" href="#index-mrori"> ¶</a></span> +</dt> <dd> +<p>Enable generation of rotate right with immediate (<code class="code">l.rori</code>) instructions. By default functions from <samp class="file">libgcc</samp> are used to perform rotate right with immediate operations. </p> </dd> <dt> +<span><code class="code">-msext</code><a class="copiable-link" href="#index-msext"> ¶</a></span> +</dt> <dd> +<p>Enable generation of sign extension (<code class="code">l.ext*</code>) instructions. By default memory loads are used to perform sign extension. </p> </dd> <dt> +<span><code class="code">-msfimm</code><a class="copiable-link" href="#index-msfimm"> ¶</a></span> +</dt> <dd> +<p>Enable generation of compare and set flag with immediate (<code class="code">l.sf*i</code>) instructions. By default extra instructions will be generated to store the immediate to a register first. </p> </dd> <dt> +<span><code class="code">-mshftimm</code><a class="copiable-link" href="#index-mshftimm"> ¶</a></span> +</dt> <dd> +<p>Enable generation of shift with immediate (<code class="code">l.srai</code>, <code class="code">l.srli</code>, <code class="code">l.slli</code>) instructions. By default extra instructions will be generated to store the immediate to a register first. </p> </dd> <dt> +<span><code class="code">-mcmodel=small</code><a class="copiable-link" href="#index-mcmodel_003dsmall-1"> ¶</a></span> +</dt> <dd> +<p>Generate OpenRISC code for the small model: The GOT is limited to 64k. This is the default model. </p> </dd> <dt> +<span><code class="code">-mcmodel=large</code><a class="copiable-link" href="#index-mcmodel_003dlarge-1"> ¶</a></span> +</dt> <dd> +<p>Generate OpenRISC code for the large model: The GOT may grow up to 4G in size. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="pdp-11-options">PDP-11 Options</a>, Previous: <a href="nvidia-ptx-options">Nvidia PTX Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/OpenRISC-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/OpenRISC-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/optimize-options.html b/devdocs/gcc~13/optimize-options.html new file mode 100644 index 00000000..8130cabb --- /dev/null +++ b/devdocs/gcc~13/optimize-options.html @@ -0,0 +1,1214 @@ +<div class="section-level-extent" id="Optimize-Options"> <div class="nav-panel"> <p> Next: <a href="instrumentation-options" accesskey="n" rel="next">Program Instrumentation Options</a>, Previous: <a href="debugging-options" accesskey="p" rel="prev">Options for Debugging Your Program</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-That-Control-Optimization"><span>3.11 Options That Control Optimization<a class="copiable-link" href="#Options-That-Control-Optimization"> ¶</a></span></h1> <p>These options control various sorts of optimizations. </p> <p>Without any optimization option, the compiler’s goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you expect from the source code. </p> <p>Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program. </p> <p>The compiler performs optimization based on the knowledge it has of the program. Compiling multiple files at once to a single output file mode allows the compiler to use information gained from all of the files when compiling each of them. </p> <p>Not all optimizations are controlled directly by a flag. Only optimizations that have a flag are listed in this section. </p> <p>Most optimizations are completely disabled at <samp class="option">-O0</samp> or if an <samp class="option">-O</samp> level is not set on the command line, even if individual optimization flags are specified. Similarly, <samp class="option">-Og</samp> suppresses many optimization passes. </p> <p>Depending on the target and how GCC was configured, a slightly different set of optimizations may be enabled at each <samp class="option">-O</samp> level than those listed here. You can invoke GCC with <samp class="option">-Q --help=optimizers</samp> to find out the exact set of optimizations that are enabled at each level. See <a class="xref" href="overall-options">Options Controlling the Kind of Output</a>, for examples. </p> <dl class="table"> <dt> + <span><code class="code">-O</code><a class="copiable-link" href="#index-O"> ¶</a></span> +</dt> <dt><code class="code">-O1</code></dt> <dd> +<p>Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. </p> <p>With <samp class="option">-O</samp>, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time. </p> <p><samp class="option">-O</samp> turns on the following optimization flags: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fauto-inc-dec +-fbranch-count-reg +-fcombine-stack-adjustments +-fcompare-elim +-fcprop-registers +-fdce +-fdefer-pop +-fdelayed-branch +-fdse +-fforward-propagate +-fguess-branch-probability +-fif-conversion +-fif-conversion2 +-finline-functions-called-once +-fipa-modref +-fipa-profile +-fipa-pure-const +-fipa-reference +-fipa-reference-addressable +-fmerge-constants +-fmove-loop-invariants +-fmove-loop-stores +-fomit-frame-pointer +-freorder-blocks +-fshrink-wrap +-fshrink-wrap-separate +-fsplit-wide-types +-fssa-backprop +-fssa-phiopt +-ftree-bit-ccp +-ftree-ccp +-ftree-ch +-ftree-coalesce-vars +-ftree-copy-prop +-ftree-dce +-ftree-dominator-opts +-ftree-dse +-ftree-forwprop +-ftree-fre +-ftree-phiprop +-ftree-pta +-ftree-scev-cprop +-ftree-sink +-ftree-slsr +-ftree-sra +-ftree-ter +-funit-at-a-time</pre> +</div> </dd> <dt> +<span><code class="code">-O2</code><a class="copiable-link" href="#index-O2"> ¶</a></span> +</dt> <dd> +<p>Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. As compared to <samp class="option">-O</samp>, this option increases both compilation time and the performance of the generated code. </p> <p><samp class="option">-O2</samp> turns on all optimization flags specified by <samp class="option">-O1</samp>. It also turns on the following optimization flags: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-falign-functions -falign-jumps +-falign-labels -falign-loops +-fcaller-saves +-fcode-hoisting +-fcrossjumping +-fcse-follow-jumps -fcse-skip-blocks +-fdelete-null-pointer-checks +-fdevirtualize -fdevirtualize-speculatively +-fexpensive-optimizations +-ffinite-loops +-fgcse -fgcse-lm +-fhoist-adjacent-loads +-finline-functions +-finline-small-functions +-findirect-inlining +-fipa-bit-cp -fipa-cp -fipa-icf +-fipa-ra -fipa-sra -fipa-vrp +-fisolate-erroneous-paths-dereference +-flra-remat +-foptimize-sibling-calls +-foptimize-strlen +-fpartial-inlining +-fpeephole2 +-freorder-blocks-algorithm=stc +-freorder-blocks-and-partition -freorder-functions +-frerun-cse-after-loop +-fschedule-insns -fschedule-insns2 +-fsched-interblock -fsched-spec +-fstore-merging +-fstrict-aliasing +-fthread-jumps +-ftree-builtin-call-dce +-ftree-loop-vectorize +-ftree-pre +-ftree-slp-vectorize +-ftree-switch-conversion -ftree-tail-merge +-ftree-vrp +-fvect-cost-model=very-cheap</pre> +</div> <p>Please note the warning under <samp class="option">-fgcse</samp> about invoking <samp class="option">-O2</samp> on programs that use computed gotos. </p> </dd> <dt> +<span><code class="code">-O3</code><a class="copiable-link" href="#index-O3"> ¶</a></span> +</dt> <dd> +<p>Optimize yet more. <samp class="option">-O3</samp> turns on all optimizations specified by <samp class="option">-O2</samp> and also turns on the following optimization flags: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fgcse-after-reload +-fipa-cp-clone +-floop-interchange +-floop-unroll-and-jam +-fpeel-loops +-fpredictive-commoning +-fsplit-loops +-fsplit-paths +-ftree-loop-distribution +-ftree-partial-pre +-funswitch-loops +-fvect-cost-model=dynamic +-fversion-loops-for-strides</pre> +</div> </dd> <dt> +<span><code class="code">-O0</code><a class="copiable-link" href="#index-O0"> ¶</a></span> +</dt> <dd> +<p>Reduce compilation time and make debugging produce the expected results. This is the default. </p> </dd> <dt> +<span><code class="code">-Os</code><a class="copiable-link" href="#index-Os"> ¶</a></span> +</dt> <dd> +<p>Optimize for size. <samp class="option">-Os</samp> enables all <samp class="option">-O2</samp> optimizations except those that often increase code size: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-falign-functions -falign-jumps +-falign-labels -falign-loops +-fprefetch-loop-arrays -freorder-blocks-algorithm=stc</pre> +</div> <p>It also enables <samp class="option">-finline-functions</samp>, causes the compiler to tune for code size rather than execution speed, and performs further optimizations designed to reduce code size. </p> </dd> <dt> +<span><code class="code">-Ofast</code><a class="copiable-link" href="#index-Ofast"> ¶</a></span> +</dt> <dd> +<p>Disregard strict standards compliance. <samp class="option">-Ofast</samp> enables all <samp class="option">-O3</samp> optimizations. It also enables optimizations that are not valid for all standard-compliant programs. It turns on <samp class="option">-ffast-math</samp>, <samp class="option">-fallow-store-data-races</samp> and the Fortran-specific <samp class="option">-fstack-arrays</samp>, unless <samp class="option">-fmax-stack-var-size</samp> is specified, and <samp class="option">-fno-protect-parens</samp>. It turns off <samp class="option">-fsemantic-interposition</samp>. </p> </dd> <dt> +<span><code class="code">-Og</code><a class="copiable-link" href="#index-Og"> ¶</a></span> +</dt> <dd> +<p>Optimize debugging experience. <samp class="option">-Og</samp> should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience. It is a better choice than <samp class="option">-O0</samp> for producing debuggable code because some compiler passes that collect debug information are disabled at <samp class="option">-O0</samp>. </p> <p>Like <samp class="option">-O0</samp>, <samp class="option">-Og</samp> completely disables a number of optimization passes so that individual options controlling them have no effect. Otherwise <samp class="option">-Og</samp> enables all <samp class="option">-O1</samp> optimization flags except for those that may interfere with debugging: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fbranch-count-reg -fdelayed-branch +-fdse -fif-conversion -fif-conversion2 +-finline-functions-called-once +-fmove-loop-invariants -fmove-loop-stores -fssa-phiopt +-ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra</pre> +</div> </dd> <dt> +<span><code class="code">-Oz</code><a class="copiable-link" href="#index-Oz"> ¶</a></span> +</dt> <dd> +<p>Optimize aggressively for size rather than speed. This may increase the number of instructions executed if those instructions require fewer bytes to encode. <samp class="option">-Oz</samp> behaves similarly to <samp class="option">-Os</samp> including enabling most <samp class="option">-O2</samp> optimizations. </p> </dd> </dl> <p>If you use multiple <samp class="option">-O</samp> options, with or without level numbers, the last such option is the one that is effective. </p> <p>Options of the form <samp class="option">-f<var class="var">flag</var></samp> specify machine-independent flags. Most flags have both positive and negative forms; the negative form of <samp class="option">-ffoo</samp> is <samp class="option">-fno-foo</samp>. In the table below, only one of the forms is listed—the one you typically use. You can figure out the other form by either removing ‘<samp class="samp">no-</samp>’ or adding it. </p> <p>The following options control specific optimizations. They are either activated by <samp class="option">-O</samp> options or are related to ones that are. You can use the following flags in the rare cases when “fine-tuning” of optimizations to be performed is desired. </p> <dl class="table"> <dt> + <span><code class="code">-fno-defer-pop</code><a class="copiable-link" href="#index-fno-defer-pop"> ¶</a></span> +</dt> <dd> +<p>For machines that must pop arguments after a function call, always pop the arguments as soon as each function returns. At levels <samp class="option">-O1</samp> and higher, <samp class="option">-fdefer-pop</samp> is the default; this allows the compiler to let arguments accumulate on the stack for several function calls and pop them all at once. </p> </dd> <dt> +<span><code class="code">-fforward-propagate</code><a class="copiable-link" href="#index-fforward-propagate"> ¶</a></span> +</dt> <dd> +<p>Perform a forward propagation pass on RTL. The pass tries to combine two instructions and checks if the result can be simplified. If loop unrolling is active, two passes are performed and the second is scheduled after loop unrolling. </p> <p>This option is enabled by default at optimization levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-ffp-contract=<var class="var">style</var></code><a class="copiable-link" href="#index-ffp-contract"> ¶</a></span> +</dt> <dd> +<p><samp class="option">-ffp-contract=off</samp> disables floating-point expression contraction. <samp class="option">-ffp-contract=fast</samp> enables floating-point expression contraction such as forming of fused multiply-add operations if the target has native support for them. <samp class="option">-ffp-contract=on</samp> enables floating-point expression contraction if allowed by the language standard. This is currently not implemented and treated equal to <samp class="option">-ffp-contract=off</samp>. </p> <p>The default is <samp class="option">-ffp-contract=fast</samp>. </p> </dd> <dt> +<span><code class="code">-fomit-frame-pointer</code><a class="copiable-link" href="#index-fomit-frame-pointer"> ¶</a></span> +</dt> <dd> +<p>Omit the frame pointer in functions that don’t need one. This avoids the instructions to save, set up and restore the frame pointer; on many targets it also makes an extra register available. </p> <p>On some targets this flag has no effect because the standard calling sequence always uses a frame pointer, so it cannot be omitted. </p> <p>Note that <samp class="option">-fno-omit-frame-pointer</samp> doesn’t guarantee the frame pointer is used in all functions. Several targets always omit the frame pointer in leaf functions. </p> <p>Enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-foptimize-sibling-calls</code><a class="copiable-link" href="#index-foptimize-sibling-calls"> ¶</a></span> +</dt> <dd> +<p>Optimize sibling and tail recursive calls. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-foptimize-strlen</code><a class="copiable-link" href="#index-foptimize-strlen"> ¶</a></span> +</dt> <dd> +<p>Optimize various standard C string functions (e.g. <code class="code">strlen</code>, <code class="code">strchr</code> or <code class="code">strcpy</code>) and their <code class="code">_FORTIFY_SOURCE</code> counterparts into faster alternatives. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>. </p> </dd> <dt> + <span><code class="code">-fno-inline</code><a class="copiable-link" href="#index-fno-inline"> ¶</a></span> +</dt> <dd> +<p>Do not expand any functions inline apart from those marked with the <code class="code">always_inline</code> attribute. This is the default when not optimizing. </p> <p>Single functions can be exempted from inlining by marking them with the <code class="code">noinline</code> attribute. </p> </dd> <dt> +<span><code class="code">-finline-small-functions</code><a class="copiable-link" href="#index-finline-small-functions"> ¶</a></span> +</dt> <dd> +<p>Integrate functions into their callers when their body is smaller than expected function call code (so overall size of program gets smaller). The compiler heuristically decides which functions are simple enough to be worth integrating in this way. This inlining applies to all functions, even those not declared inline. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-findirect-inlining</code><a class="copiable-link" href="#index-findirect-inlining"> ¶</a></span> +</dt> <dd> +<p>Inline also indirect calls that are discovered to be known at compile time thanks to previous inlining. This option has any effect only when inlining itself is turned on by the <samp class="option">-finline-functions</samp> or <samp class="option">-finline-small-functions</samp> options. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-finline-functions</code><a class="copiable-link" href="#index-finline-functions"> ¶</a></span> +</dt> <dd> +<p>Consider all functions for inlining, even if they are not declared inline. The compiler heuristically decides which functions are worth integrating in this way. </p> <p>If all calls to a given function are integrated, and the function is declared <code class="code">static</code>, then the function is normally not output as assembler code in its own right. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. Also enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-finline-functions-called-once</code><a class="copiable-link" href="#index-finline-functions-called-once"> ¶</a></span> +</dt> <dd> +<p>Consider all <code class="code">static</code> functions called once for inlining into their caller even if they are not marked <code class="code">inline</code>. If a call to a given function is integrated, then the function is not output as assembler code in its own right. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp> and <samp class="option">-Os</samp>, but not <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-fearly-inlining</code><a class="copiable-link" href="#index-fearly-inlining"> ¶</a></span> +</dt> <dd> +<p>Inline functions marked by <code class="code">always_inline</code> and functions whose body seems smaller than the function call overhead early before doing <samp class="option">-fprofile-generate</samp> instrumentation and real inlining pass. Doing so makes profiling significantly cheaper and usually inlining faster on programs having large chains of nested wrapper functions. </p> <p>Enabled by default. </p> </dd> <dt> +<span><code class="code">-fipa-sra</code><a class="copiable-link" href="#index-fipa-sra"> ¶</a></span> +</dt> <dd> +<p>Perform interprocedural scalar replacement of aggregates, removal of unused parameters and replacement of parameters passed by reference by parameters passed by value. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp> and <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-finline-limit=<var class="var">n</var></code><a class="copiable-link" href="#index-finline-limit"> ¶</a></span> +</dt> <dd> +<p>By default, GCC limits the size of functions that can be inlined. This flag allows coarse control of this limit. <var class="var">n</var> is the size of functions that can be inlined in number of pseudo instructions. </p> <p>Inlining is actually controlled by a number of parameters, which may be specified individually by using <samp class="option">--param <var class="var">name</var>=<var class="var">value</var></samp>. The <samp class="option">-finline-limit=<var class="var">n</var></samp> option sets some of these parameters as follows: </p> <dl class="table"> <dt><code class="code">max-inline-insns-single</code></dt> <dd><p>is set to <var class="var">n</var>/2. </p></dd> <dt><code class="code">max-inline-insns-auto</code></dt> <dd><p>is set to <var class="var">n</var>/2. </p></dd> </dl> <p>See below for a documentation of the individual parameters controlling inlining and for the defaults of these parameters. </p> <p><em class="emph">Note:</em> there may be no value to <samp class="option">-finline-limit</samp> that results in default behavior. </p> <p><em class="emph">Note:</em> pseudo instruction represents, in this particular context, an abstract measurement of function’s size. In no way does it represent a count of assembly instructions and as such its exact meaning might change from one release to an another. </p> </dd> <dt> + <span><code class="code">-fno-keep-inline-dllexport</code><a class="copiable-link" href="#index-fno-keep-inline-dllexport"> ¶</a></span> +</dt> <dd> +<p>This is a more fine-grained version of <samp class="option">-fkeep-inline-functions</samp>, which applies only to functions that are declared using the <code class="code">dllexport</code> attribute or declspec. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> </dd> <dt> +<span><code class="code">-fkeep-inline-functions</code><a class="copiable-link" href="#index-fkeep-inline-functions"> ¶</a></span> +</dt> <dd> +<p>In C, emit <code class="code">static</code> functions that are declared <code class="code">inline</code> into the object file, even if the function has been inlined into all of its callers. This switch does not affect functions using the <code class="code">extern inline</code> extension in GNU C90. In C++, emit any and all inline functions into the object file. </p> </dd> <dt> +<span><code class="code">-fkeep-static-functions</code><a class="copiable-link" href="#index-fkeep-static-functions"> ¶</a></span> +</dt> <dd> +<p>Emit <code class="code">static</code> functions into the object file, even if the function is never used. </p> </dd> <dt> +<span><code class="code">-fkeep-static-consts</code><a class="copiable-link" href="#index-fkeep-static-consts"> ¶</a></span> +</dt> <dd> +<p>Emit variables declared <code class="code">static const</code> when optimization isn’t turned on, even if the variables aren’t referenced. </p> <p>GCC enables this option by default. If you want to force the compiler to check if a variable is referenced, regardless of whether or not optimization is turned on, use the <samp class="option">-fno-keep-static-consts</samp> option. </p> </dd> <dt> +<span><code class="code">-fmerge-constants</code><a class="copiable-link" href="#index-fmerge-constants"> ¶</a></span> +</dt> <dd> +<p>Attempt to merge identical constants (string constants and floating-point constants) across compilation units. </p> <p>This option is the default for optimized compilation if the assembler and linker support it. Use <samp class="option">-fno-merge-constants</samp> to inhibit this behavior. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fmerge-all-constants</code><a class="copiable-link" href="#index-fmerge-all-constants"> ¶</a></span> +</dt> <dd> +<p>Attempt to merge identical constants and identical variables. </p> <p>This option implies <samp class="option">-fmerge-constants</samp>. In addition to <samp class="option">-fmerge-constants</samp> this considers e.g. even constant initialized arrays or initialized constant variables with integral or floating-point types. Languages like C or C++ require each variable, including multiple instances of the same variable in recursive calls, to have distinct locations, so using this option results in non-conforming behavior. </p> </dd> <dt> +<span><code class="code">-fmodulo-sched</code><a class="copiable-link" href="#index-fmodulo-sched"> ¶</a></span> +</dt> <dd> +<p>Perform swing modulo scheduling immediately before the first scheduling pass. This pass looks at innermost loops and reorders their instructions by overlapping different iterations. </p> </dd> <dt> +<span><code class="code">-fmodulo-sched-allow-regmoves</code><a class="copiable-link" href="#index-fmodulo-sched-allow-regmoves"> ¶</a></span> +</dt> <dd> +<p>Perform more aggressive SMS-based modulo scheduling with register moves allowed. By setting this flag certain anti-dependences edges are deleted, which triggers the generation of reg-moves based on the life-range analysis. This option is effective only with <samp class="option">-fmodulo-sched</samp> enabled. </p> </dd> <dt> + <span><code class="code">-fno-branch-count-reg</code><a class="copiable-link" href="#index-fno-branch-count-reg"> ¶</a></span> +</dt> <dd> +<p>Disable the optimization pass that scans for opportunities to use “decrement and branch” instructions on a count register instead of instruction sequences that decrement a register, compare it against zero, and then branch based upon the result. This option is only meaningful on architectures that support such instructions, which include x86, PowerPC, IA-64 and S/390. Note that the <samp class="option">-fno-branch-count-reg</samp> option doesn’t remove the decrement and branch instructions from the generated instruction stream introduced by other optimization passes. </p> <p>The default is <samp class="option">-fbranch-count-reg</samp> at <samp class="option">-O1</samp> and higher, except for <samp class="option">-Og</samp>. </p> </dd> <dt> + <span><code class="code">-fno-function-cse</code><a class="copiable-link" href="#index-fno-function-cse"> ¶</a></span> +</dt> <dd> +<p>Do not put function addresses in registers; make each instruction that calls a constant function contain the function’s address explicitly. </p> <p>This option results in less efficient code, but some strange hacks that alter the assembler output may be confused by the optimizations performed when this option is not used. </p> <p>The default is <samp class="option">-ffunction-cse</samp> </p> </dd> <dt> + <span><code class="code">-fno-zero-initialized-in-bss</code><a class="copiable-link" href="#index-fno-zero-initialized-in-bss"> ¶</a></span> +</dt> <dd> +<p>If the target supports a BSS section, GCC by default puts variables that are initialized to zero into BSS. This can save space in the resulting code. </p> <p>This option turns off this behavior because some programs explicitly rely on variables going to the data section—e.g., so that the resulting executable can find the beginning of that section and/or make assumptions based on that. </p> <p>The default is <samp class="option">-fzero-initialized-in-bss</samp>. </p> </dd> <dt> +<span><code class="code">-fthread-jumps</code><a class="copiable-link" href="#index-fthread-jumps"> ¶</a></span> +</dt> <dd> +<p>Perform optimizations that check to see if a jump branches to a location where another comparison subsumed by the first is found. If so, the first branch is redirected to either the destination of the second branch or a point immediately following it, depending on whether the condition is known to be true or false. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fsplit-wide-types</code><a class="copiable-link" href="#index-fsplit-wide-types"> ¶</a></span> +</dt> <dd> +<p>When using a type that occupies multiple registers, such as <code class="code">long +long</code> on a 32-bit system, split the registers apart and allocate them independently. This normally generates better code for those types, but may make debugging more difficult. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fsplit-wide-types-early</code><a class="copiable-link" href="#index-fsplit-wide-types-early"> ¶</a></span> +</dt> <dd> +<p>Fully split wide types early, instead of very late. This option has no effect unless <samp class="option">-fsplit-wide-types</samp> is turned on. </p> <p>This is the default on some targets. </p> </dd> <dt> +<span><code class="code">-fcse-follow-jumps</code><a class="copiable-link" href="#index-fcse-follow-jumps"> ¶</a></span> +</dt> <dd> +<p>In common subexpression elimination (CSE), scan through jump instructions when the target of the jump is not reached by any other path. For example, when CSE encounters an <code class="code">if</code> statement with an <code class="code">else</code> clause, CSE follows the jump when the condition tested is false. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fcse-skip-blocks</code><a class="copiable-link" href="#index-fcse-skip-blocks"> ¶</a></span> +</dt> <dd> +<p>This is similar to <samp class="option">-fcse-follow-jumps</samp>, but causes CSE to follow jumps that conditionally skip over blocks. When CSE encounters a simple <code class="code">if</code> statement with no else clause, <samp class="option">-fcse-skip-blocks</samp> causes CSE to follow the jump around the body of the <code class="code">if</code>. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-frerun-cse-after-loop</code><a class="copiable-link" href="#index-frerun-cse-after-loop"> ¶</a></span> +</dt> <dd> +<p>Re-run common subexpression elimination after loop optimizations are performed. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fgcse</code><a class="copiable-link" href="#index-fgcse"> ¶</a></span> +</dt> <dd> +<p>Perform a global common subexpression elimination pass. This pass also performs global constant and copy propagation. </p> <p><em class="emph">Note:</em> When compiling a program using computed gotos, a GCC extension, you may get better run-time performance if you disable the global common subexpression elimination pass by adding <samp class="option">-fno-gcse</samp> to the command line. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fgcse-lm</code><a class="copiable-link" href="#index-fgcse-lm"> ¶</a></span> +</dt> <dd> +<p>When <samp class="option">-fgcse-lm</samp> is enabled, global common subexpression elimination attempts to move loads that are only killed by stores into themselves. This allows a loop containing a load/store sequence to be changed to a load outside the loop, and a copy/store within the loop. </p> <p>Enabled by default when <samp class="option">-fgcse</samp> is enabled. </p> </dd> <dt> +<span><code class="code">-fgcse-sm</code><a class="copiable-link" href="#index-fgcse-sm"> ¶</a></span> +</dt> <dd> +<p>When <samp class="option">-fgcse-sm</samp> is enabled, a store motion pass is run after global common subexpression elimination. This pass attempts to move stores out of loops. When used in conjunction with <samp class="option">-fgcse-lm</samp>, loops containing a load/store sequence can be changed to a load before the loop and a store after the loop. </p> <p>Not enabled at any optimization level. </p> </dd> <dt> +<span><code class="code">-fgcse-las</code><a class="copiable-link" href="#index-fgcse-las"> ¶</a></span> +</dt> <dd> +<p>When <samp class="option">-fgcse-las</samp> is enabled, the global common subexpression elimination pass eliminates redundant loads that come after stores to the same memory location (both partial and full redundancies). </p> <p>Not enabled at any optimization level. </p> </dd> <dt> +<span><code class="code">-fgcse-after-reload</code><a class="copiable-link" href="#index-fgcse-after-reload"> ¶</a></span> +</dt> <dd> +<p>When <samp class="option">-fgcse-after-reload</samp> is enabled, a redundant load elimination pass is performed after reload. The purpose of this pass is to clean up redundant spilling. </p> <p>Enabled by <samp class="option">-O3</samp>, <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-faggressive-loop-optimizations</code><a class="copiable-link" href="#index-faggressive-loop-optimizations"> ¶</a></span> +</dt> <dd> +<p>This option tells the loop optimizer to use language constraints to derive bounds for the number of iterations of a loop. This assumes that loop code does not invoke undefined behavior by for example causing signed integer overflows or out-of-bound array accesses. The bounds for the number of iterations of a loop are used to guide loop unrolling and peeling and loop exit test optimizations. This option is enabled by default. </p> </dd> <dt> +<span><code class="code">-funconstrained-commons</code><a class="copiable-link" href="#index-funconstrained-commons"> ¶</a></span> +</dt> <dd> +<p>This option tells the compiler that variables declared in common blocks (e.g. Fortran) may later be overridden with longer trailing arrays. This prevents certain optimizations that depend on knowing the array bounds. </p> </dd> <dt> +<span><code class="code">-fcrossjumping</code><a class="copiable-link" href="#index-fcrossjumping"> ¶</a></span> +</dt> <dd> +<p>Perform cross-jumping transformation. This transformation unifies equivalent code and saves code size. The resulting code may or may not perform better than without cross-jumping. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fauto-inc-dec</code><a class="copiable-link" href="#index-fauto-inc-dec"> ¶</a></span> +</dt> <dd> +<p>Combine increments or decrements of addresses with memory accesses. This pass is always skipped on architectures that do not have instructions to support this. Enabled by default at <samp class="option">-O1</samp> and higher on architectures that support this. </p> </dd> <dt> +<span><code class="code">-fdce</code><a class="copiable-link" href="#index-fdce"> ¶</a></span> +</dt> <dd> +<p>Perform dead code elimination (DCE) on RTL. Enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fdse</code><a class="copiable-link" href="#index-fdse"> ¶</a></span> +</dt> <dd> +<p>Perform dead store elimination (DSE) on RTL. Enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fif-conversion</code><a class="copiable-link" href="#index-fif-conversion"> ¶</a></span> +</dt> <dd> +<p>Attempt to transform conditional jumps into branch-less equivalents. This includes use of conditional moves, min, max, set flags and abs instructions, and some tricks doable by standard arithmetics. The use of conditional execution on chips where it is available is controlled by <samp class="option">-fif-conversion2</samp>. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>, but not with <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-fif-conversion2</code><a class="copiable-link" href="#index-fif-conversion2"> ¶</a></span> +</dt> <dd> +<p>Use conditional execution (where available) to transform conditional jumps into branch-less equivalents. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>, but not with <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-fdeclone-ctor-dtor</code><a class="copiable-link" href="#index-fdeclone-ctor-dtor"> ¶</a></span> +</dt> <dd> +<p>The C++ ABI requires multiple entry points for constructors and destructors: one for a base subobject, one for a complete object, and one for a virtual destructor that calls operator delete afterwards. For a hierarchy with virtual bases, the base and complete variants are clones, which means two copies of the function. With this option, the base and complete variants are changed to be thunks that call a common implementation. </p> <p>Enabled by <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fdelete-null-pointer-checks</code><a class="copiable-link" href="#index-fdelete-null-pointer-checks"> ¶</a></span> +</dt> <dd> +<p>Assume that programs cannot safely dereference null pointers, and that no code or data element resides at address zero. This option enables simple constant folding optimizations at all optimization levels. In addition, other optimization passes in GCC use this flag to control global dataflow analyses that eliminate useless checks for null pointers; these assume that a memory access to address zero always results in a trap, so that if a pointer is checked after it has already been dereferenced, it cannot be null. </p> <p>Note however that in some environments this assumption is not true. Use <samp class="option">-fno-delete-null-pointer-checks</samp> to disable this optimization for programs that depend on that behavior. </p> <p>This option is enabled by default on most targets. On Nios II ELF, it defaults to off. On AVR and MSP430, this option is completely disabled. </p> <p>Passes that use the dataflow information are enabled independently at different optimization levels. </p> </dd> <dt> +<span><code class="code">-fdevirtualize</code><a class="copiable-link" href="#index-fdevirtualize"> ¶</a></span> +</dt> <dd> +<p>Attempt to convert calls to virtual functions to direct calls. This is done both within a procedure and interprocedurally as part of indirect inlining (<samp class="option">-findirect-inlining</samp>) and interprocedural constant propagation (<samp class="option">-fipa-cp</samp>). Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fdevirtualize-speculatively</code><a class="copiable-link" href="#index-fdevirtualize-speculatively"> ¶</a></span> +</dt> <dd> +<p>Attempt to convert calls to virtual functions to speculative direct calls. Based on the analysis of the type inheritance graph, determine for a given call the set of likely targets. If the set is small, preferably of size 1, change the call into a conditional deciding between direct and indirect calls. The speculative calls enable more optimizations, such as inlining. When they seem useless after further optimization, they are converted back into original form. </p> </dd> <dt> +<span><code class="code">-fdevirtualize-at-ltrans</code><a class="copiable-link" href="#index-fdevirtualize-at-ltrans"> ¶</a></span> +</dt> <dd> +<p>Stream extra information needed for aggressive devirtualization when running the link-time optimizer in local transformation mode. This option enables more devirtualization but significantly increases the size of streamed data. For this reason it is disabled by default. </p> </dd> <dt> +<span><code class="code">-fexpensive-optimizations</code><a class="copiable-link" href="#index-fexpensive-optimizations"> ¶</a></span> +</dt> <dd> +<p>Perform a number of minor optimizations that are relatively expensive. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-free</code><a class="copiable-link" href="#index-free-1"> ¶</a></span> +</dt> <dd> +<p>Attempt to remove redundant extension instructions. This is especially helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit registers after writing to their lower 32-bit half. </p> <p>Enabled for Alpha, AArch64 and x86 at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> + <span><code class="code">-fno-lifetime-dse</code><a class="copiable-link" href="#index-fno-lifetime-dse"> ¶</a></span> +</dt> <dd> +<p>In C++ the value of an object is only affected by changes within its lifetime: when the constructor begins, the object has an indeterminate value, and any changes during the lifetime of the object are dead when the object is destroyed. Normally dead store elimination will take advantage of this; if your code relies on the value of the object storage persisting beyond the lifetime of the object, you can use this flag to disable this optimization. To preserve stores before the constructor starts (e.g. because your operator new clears the object storage) but still treat the object as dead after the destructor, you can use <samp class="option">-flifetime-dse=1</samp>. The default behavior can be explicitly selected with <samp class="option">-flifetime-dse=2</samp>. <samp class="option">-flifetime-dse=0</samp> is equivalent to <samp class="option">-fno-lifetime-dse</samp>. </p> </dd> <dt> +<span><code class="code">-flive-range-shrinkage</code><a class="copiable-link" href="#index-flive-range-shrinkage"> ¶</a></span> +</dt> <dd> +<p>Attempt to decrease register pressure through register live range shrinkage. This is helpful for fast processors with small or moderate size register sets. </p> </dd> <dt> +<span><code class="code">-fira-algorithm=<var class="var">algorithm</var></code><a class="copiable-link" href="#index-fira-algorithm"> ¶</a></span> +</dt> <dd> +<p>Use the specified coloring algorithm for the integrated register allocator. The <var class="var">algorithm</var> argument can be ‘<samp class="samp">priority</samp>’, which specifies Chow’s priority coloring, or ‘<samp class="samp">CB</samp>’, which specifies Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented for all architectures, but for those targets that do support it, it is the default because it generates better code. </p> </dd> <dt> +<span><code class="code">-fira-region=<var class="var">region</var></code><a class="copiable-link" href="#index-fira-region"> ¶</a></span> +</dt> <dd> +<p>Use specified regions for the integrated register allocator. The <var class="var">region</var> argument should be one of the following: </p> <dl class="table"> <dt>‘<samp class="samp">all</samp>’</dt> <dd> +<p>Use all loops as register allocation regions. This can give the best results for machines with a small and/or irregular register set. </p> </dd> <dt>‘<samp class="samp">mixed</samp>’</dt> <dd> +<p>Use all loops except for loops with small register pressure as the regions. This value usually gives the best results in most cases and for most architectures, and is enabled by default when compiling with optimization for speed (<samp class="option">-O</samp>, <samp class="option">-O2</samp>, …). </p> </dd> <dt>‘<samp class="samp">one</samp>’</dt> <dd> +<p>Use all functions as a single region. This typically results in the smallest code size, and is enabled by default for <samp class="option">-Os</samp> or <samp class="option">-O0</samp>. </p> </dd> </dl> </dd> <dt> +<span><code class="code">-fira-hoist-pressure</code><a class="copiable-link" href="#index-fira-hoist-pressure"> ¶</a></span> +</dt> <dd> +<p>Use IRA to evaluate register pressure in the code hoisting pass for decisions to hoist expressions. This option usually results in smaller code, but it can slow the compiler down. </p> <p>This option is enabled at level <samp class="option">-Os</samp> for all targets. </p> </dd> <dt> +<span><code class="code">-fira-loop-pressure</code><a class="copiable-link" href="#index-fira-loop-pressure"> ¶</a></span> +</dt> <dd> +<p>Use IRA to evaluate register pressure in loops for decisions to move loop invariants. This option usually results in generation of faster and smaller code on machines with large register files (>= 32 registers), but it can slow the compiler down. </p> <p>This option is enabled at level <samp class="option">-O3</samp> for some targets. </p> </dd> <dt> + <span><code class="code">-fno-ira-share-save-slots</code><a class="copiable-link" href="#index-fno-ira-share-save-slots"> ¶</a></span> +</dt> <dd> +<p>Disable sharing of stack slots used for saving call-used hard registers living through a call. Each hard register gets a separate stack slot, and as a result function stack frames are larger. </p> </dd> <dt> + <span><code class="code">-fno-ira-share-spill-slots</code><a class="copiable-link" href="#index-fno-ira-share-spill-slots"> ¶</a></span> +</dt> <dd> +<p>Disable sharing of stack slots allocated for pseudo-registers. Each pseudo-register that does not get a hard register gets a separate stack slot, and as a result function stack frames are larger. </p> </dd> <dt> +<span><code class="code">-flra-remat</code><a class="copiable-link" href="#index-flra-remat"> ¶</a></span> +</dt> <dd> +<p>Enable CFG-sensitive rematerialization in LRA. Instead of loading values of spilled pseudos, LRA tries to rematerialize (recalculate) values if it is profitable. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fdelayed-branch</code><a class="copiable-link" href="#index-fdelayed-branch"> ¶</a></span> +</dt> <dd> +<p>If supported for the target machine, attempt to reorder instructions to exploit instruction slots available after delayed branch instructions. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>, but not at <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-fschedule-insns</code><a class="copiable-link" href="#index-fschedule-insns"> ¶</a></span> +</dt> <dd> +<p>If supported for the target machine, attempt to reorder instructions to eliminate execution stalls due to required data being unavailable. This helps machines that have slow floating point or memory load instructions by allowing other instructions to be issued until the result of the load or floating-point instruction is required. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>. </p> </dd> <dt> +<span><code class="code">-fschedule-insns2</code><a class="copiable-link" href="#index-fschedule-insns2"> ¶</a></span> +</dt> <dd> +<p>Similar to <samp class="option">-fschedule-insns</samp>, but requests an additional pass of instruction scheduling after register allocation has been done. This is especially useful on machines with a relatively small number of registers and where memory load instructions take more than one cycle. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> + <span><code class="code">-fno-sched-interblock</code><a class="copiable-link" href="#index-fno-sched-interblock"> ¶</a></span> +</dt> <dd> +<p>Disable instruction scheduling across basic blocks, which is normally enabled when scheduling before register allocation, i.e. with <samp class="option">-fschedule-insns</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> + <span><code class="code">-fno-sched-spec</code><a class="copiable-link" href="#index-fno-sched-spec"> ¶</a></span> +</dt> <dd> +<p>Disable speculative motion of non-load instructions, which is normally enabled when scheduling before register allocation, i.e. with <samp class="option">-fschedule-insns</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-fsched-pressure</code><a class="copiable-link" href="#index-fsched-pressure"> ¶</a></span> +</dt> <dd> +<p>Enable register pressure sensitive insn scheduling before register allocation. This only makes sense when scheduling before register allocation is enabled, i.e. with <samp class="option">-fschedule-insns</samp> or at <samp class="option">-O2</samp> or higher. Usage of this option can improve the generated code and decrease its size by preventing register pressure increase above the number of available hard registers and subsequent spills in register allocation. </p> </dd> <dt> +<span><code class="code">-fsched-spec-load</code><a class="copiable-link" href="#index-fsched-spec-load"> ¶</a></span> +</dt> <dd> +<p>Allow speculative motion of some load instructions. This only makes sense when scheduling before register allocation, i.e. with <samp class="option">-fschedule-insns</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-fsched-spec-load-dangerous</code><a class="copiable-link" href="#index-fsched-spec-load-dangerous"> ¶</a></span> +</dt> <dd> +<p>Allow speculative motion of more load instructions. This only makes sense when scheduling before register allocation, i.e. with <samp class="option">-fschedule-insns</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-fsched-stalled-insns</code><a class="copiable-link" href="#index-fsched-stalled-insns"> ¶</a></span> +</dt> <dt><code class="code">-fsched-stalled-insns=<var class="var">n</var></code></dt> <dd> +<p>Define how many insns (if any) can be moved prematurely from the queue of stalled insns into the ready list during the second scheduling pass. <samp class="option">-fno-sched-stalled-insns</samp> means that no insns are moved prematurely, <samp class="option">-fsched-stalled-insns=0</samp> means there is no limit on how many queued insns can be moved prematurely. <samp class="option">-fsched-stalled-insns</samp> without a value is equivalent to <samp class="option">-fsched-stalled-insns=1</samp>. </p> </dd> <dt> +<span><code class="code">-fsched-stalled-insns-dep</code><a class="copiable-link" href="#index-fsched-stalled-insns-dep"> ¶</a></span> +</dt> <dt><code class="code">-fsched-stalled-insns-dep=<var class="var">n</var></code></dt> <dd> +<p>Define how many insn groups (cycles) are examined for a dependency on a stalled insn that is a candidate for premature removal from the queue of stalled insns. This has an effect only during the second scheduling pass, and only if <samp class="option">-fsched-stalled-insns</samp> is used. <samp class="option">-fno-sched-stalled-insns-dep</samp> is equivalent to <samp class="option">-fsched-stalled-insns-dep=0</samp>. <samp class="option">-fsched-stalled-insns-dep</samp> without a value is equivalent to <samp class="option">-fsched-stalled-insns-dep=1</samp>. </p> </dd> <dt> +<span><code class="code">-fsched2-use-superblocks</code><a class="copiable-link" href="#index-fsched2-use-superblocks"> ¶</a></span> +</dt> <dd> +<p>When scheduling after register allocation, use superblock scheduling. This allows motion across basic block boundaries, resulting in faster schedules. This option is experimental, as not all machine descriptions used by GCC model the CPU closely enough to avoid unreliable results from the algorithm. </p> <p>This only makes sense when scheduling after register allocation, i.e. with <samp class="option">-fschedule-insns2</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-fsched-group-heuristic</code><a class="copiable-link" href="#index-fsched-group-heuristic"> ¶</a></span> +</dt> <dd> +<p>Enable the group heuristic in the scheduler. This heuristic favors the instruction that belongs to a schedule group. This is enabled by default when scheduling is enabled, i.e. with <samp class="option">-fschedule-insns</samp> or <samp class="option">-fschedule-insns2</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-fsched-critical-path-heuristic</code><a class="copiable-link" href="#index-fsched-critical-path-heuristic"> ¶</a></span> +</dt> <dd> +<p>Enable the critical-path heuristic in the scheduler. This heuristic favors instructions on the critical path. This is enabled by default when scheduling is enabled, i.e. with <samp class="option">-fschedule-insns</samp> or <samp class="option">-fschedule-insns2</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-fsched-spec-insn-heuristic</code><a class="copiable-link" href="#index-fsched-spec-insn-heuristic"> ¶</a></span> +</dt> <dd> +<p>Enable the speculative instruction heuristic in the scheduler. This heuristic favors speculative instructions with greater dependency weakness. This is enabled by default when scheduling is enabled, i.e. with <samp class="option">-fschedule-insns</samp> or <samp class="option">-fschedule-insns2</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-fsched-rank-heuristic</code><a class="copiable-link" href="#index-fsched-rank-heuristic"> ¶</a></span> +</dt> <dd> +<p>Enable the rank heuristic in the scheduler. This heuristic favors the instruction belonging to a basic block with greater size or frequency. This is enabled by default when scheduling is enabled, i.e. with <samp class="option">-fschedule-insns</samp> or <samp class="option">-fschedule-insns2</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-fsched-last-insn-heuristic</code><a class="copiable-link" href="#index-fsched-last-insn-heuristic"> ¶</a></span> +</dt> <dd> +<p>Enable the last-instruction heuristic in the scheduler. This heuristic favors the instruction that is less dependent on the last instruction scheduled. This is enabled by default when scheduling is enabled, i.e. with <samp class="option">-fschedule-insns</samp> or <samp class="option">-fschedule-insns2</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-fsched-dep-count-heuristic</code><a class="copiable-link" href="#index-fsched-dep-count-heuristic"> ¶</a></span> +</dt> <dd> +<p>Enable the dependent-count heuristic in the scheduler. This heuristic favors the instruction that has more instructions depending on it. This is enabled by default when scheduling is enabled, i.e. with <samp class="option">-fschedule-insns</samp> or <samp class="option">-fschedule-insns2</samp> or at <samp class="option">-O2</samp> or higher. </p> </dd> <dt> +<span><code class="code">-freschedule-modulo-scheduled-loops</code><a class="copiable-link" href="#index-freschedule-modulo-scheduled-loops"> ¶</a></span> +</dt> <dd> +<p>Modulo scheduling is performed before traditional scheduling. If a loop is modulo scheduled, later scheduling passes may change its schedule. Use this option to control that behavior. </p> </dd> <dt> +<span><code class="code">-fselective-scheduling</code><a class="copiable-link" href="#index-fselective-scheduling"> ¶</a></span> +</dt> <dd> +<p>Schedule instructions using selective scheduling algorithm. Selective scheduling runs instead of the first scheduler pass. </p> </dd> <dt> +<span><code class="code">-fselective-scheduling2</code><a class="copiable-link" href="#index-fselective-scheduling2"> ¶</a></span> +</dt> <dd> +<p>Schedule instructions using selective scheduling algorithm. Selective scheduling runs instead of the second scheduler pass. </p> </dd> <dt> +<span><code class="code">-fsel-sched-pipelining</code><a class="copiable-link" href="#index-fsel-sched-pipelining"> ¶</a></span> +</dt> <dd> +<p>Enable software pipelining of innermost loops during selective scheduling. This option has no effect unless one of <samp class="option">-fselective-scheduling</samp> or <samp class="option">-fselective-scheduling2</samp> is turned on. </p> </dd> <dt> +<span><code class="code">-fsel-sched-pipelining-outer-loops</code><a class="copiable-link" href="#index-fsel-sched-pipelining-outer-loops"> ¶</a></span> +</dt> <dd> +<p>When pipelining loops during selective scheduling, also pipeline outer loops. This option has no effect unless <samp class="option">-fsel-sched-pipelining</samp> is turned on. </p> </dd> <dt> +<span><code class="code">-fsemantic-interposition</code><a class="copiable-link" href="#index-fsemantic-interposition"> ¶</a></span> +</dt> <dd> +<p>Some object formats, like ELF, allow interposing of symbols by the dynamic linker. This means that for symbols exported from the DSO, the compiler cannot perform interprocedural propagation, inlining and other optimizations in anticipation that the function or variable in question may change. While this feature is useful, for example, to rewrite memory allocation functions by a debugging implementation, it is expensive in the terms of code quality. With <samp class="option">-fno-semantic-interposition</samp> the compiler assumes that if interposition happens for functions the overwriting function will have precisely the same semantics (and side effects). Similarly if interposition happens for variables, the constructor of the variable will be the same. The flag has no effect for functions explicitly declared inline (where it is never allowed for interposition to change semantics) and for symbols explicitly declared weak. </p> </dd> <dt> +<span><code class="code">-fshrink-wrap</code><a class="copiable-link" href="#index-fshrink-wrap"> ¶</a></span> +</dt> <dd> +<p>Emit function prologues only before parts of the function that need it, rather than at the top of the function. This flag is enabled by default at <samp class="option">-O</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fshrink-wrap-separate</code><a class="copiable-link" href="#index-fshrink-wrap-separate"> ¶</a></span> +</dt> <dd> +<p>Shrink-wrap separate parts of the prologue and epilogue separately, so that those parts are only executed when needed. This option is on by default, but has no effect unless <samp class="option">-fshrink-wrap</samp> is also turned on and the target supports this. </p> </dd> <dt> +<span><code class="code">-fcaller-saves</code><a class="copiable-link" href="#index-fcaller-saves"> ¶</a></span> +</dt> <dd> +<p>Enable allocation of values to registers that are clobbered by function calls, by emitting extra instructions to save and restore the registers around such calls. Such allocation is done only when it seems to result in better code. </p> <p>This option is always enabled by default on certain machines, usually those which have no call-preserved registers to use instead. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fcombine-stack-adjustments</code><a class="copiable-link" href="#index-fcombine-stack-adjustments"> ¶</a></span> +</dt> <dd> +<p>Tracks stack adjustments (pushes and pops) and stack memory references and then tries to find ways to combine them. </p> <p>Enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fipa-ra</code><a class="copiable-link" href="#index-fipa-ra"> ¶</a></span> +</dt> <dd> +<p>Use caller save registers for allocation if those registers are not used by any called function. In that case it is not necessary to save and restore them around calls. This is only possible if called functions are part of same compilation unit as current function and they are compiled before it. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>, however the option is disabled if generated code will be instrumented for profiling (<samp class="option">-p</samp>, or <samp class="option">-pg</samp>) or if callee’s register usage cannot be known exactly (this happens on targets that do not expose prologues and epilogues in RTL). </p> </dd> <dt> +<span><code class="code">-fconserve-stack</code><a class="copiable-link" href="#index-fconserve-stack"> ¶</a></span> +</dt> <dd> +<p>Attempt to minimize stack usage. The compiler attempts to use less stack space, even if that makes the program slower. This option implies setting the <samp class="option">large-stack-frame</samp> parameter to 100 and the <samp class="option">large-stack-frame-growth</samp> parameter to 400. </p> </dd> <dt> +<span><code class="code">-ftree-reassoc</code><a class="copiable-link" href="#index-ftree-reassoc"> ¶</a></span> +</dt> <dd> +<p>Perform reassociation on trees. This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fcode-hoisting</code><a class="copiable-link" href="#index-fcode-hoisting"> ¶</a></span> +</dt> <dd> +<p>Perform code hoisting. Code hoisting tries to move the evaluation of expressions executed on all paths to the function exit as early as possible. This is especially useful as a code size optimization, but it often helps for code speed as well. This flag is enabled by default at <samp class="option">-O2</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-pre</code><a class="copiable-link" href="#index-ftree-pre"> ¶</a></span> +</dt> <dd> +<p>Perform partial redundancy elimination (PRE) on trees. This flag is enabled by default at <samp class="option">-O2</samp> and <samp class="option">-O3</samp>. </p> </dd> <dt> +<span><code class="code">-ftree-partial-pre</code><a class="copiable-link" href="#index-ftree-partial-pre"> ¶</a></span> +</dt> <dd> +<p>Make partial redundancy elimination (PRE) more aggressive. This flag is enabled by default at <samp class="option">-O3</samp>. </p> </dd> <dt> +<span><code class="code">-ftree-forwprop</code><a class="copiable-link" href="#index-ftree-forwprop"> ¶</a></span> +</dt> <dd> +<p>Perform forward propagation on trees. This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-fre</code><a class="copiable-link" href="#index-ftree-fre"> ¶</a></span> +</dt> <dd> +<p>Perform full redundancy elimination (FRE) on trees. The difference between FRE and PRE is that FRE only considers expressions that are computed on all paths leading to the redundant computation. This analysis is faster than PRE, though it exposes fewer redundancies. This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-phiprop</code><a class="copiable-link" href="#index-ftree-phiprop"> ¶</a></span> +</dt> <dd> +<p>Perform hoisting of loads from conditional pointers on trees. This pass is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fhoist-adjacent-loads</code><a class="copiable-link" href="#index-fhoist-adjacent-loads"> ¶</a></span> +</dt> <dd> +<p>Speculatively hoist loads from both branches of an if-then-else if the loads are from adjacent locations in the same structure and the target architecture has a conditional move instruction. This flag is enabled by default at <samp class="option">-O2</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-copy-prop</code><a class="copiable-link" href="#index-ftree-copy-prop"> ¶</a></span> +</dt> <dd> +<p>Perform copy propagation on trees. This pass eliminates unnecessary copy operations. This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fipa-pure-const</code><a class="copiable-link" href="#index-fipa-pure-const"> ¶</a></span> +</dt> <dd> +<p>Discover which functions are pure or constant. Enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fipa-reference</code><a class="copiable-link" href="#index-fipa-reference"> ¶</a></span> +</dt> <dd> +<p>Discover which static variables do not escape the compilation unit. Enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fipa-reference-addressable</code><a class="copiable-link" href="#index-fipa-reference-addressable"> ¶</a></span> +</dt> <dd> +<p>Discover read-only, write-only and non-addressable static variables. Enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fipa-stack-alignment</code><a class="copiable-link" href="#index-fipa-stack-alignment"> ¶</a></span> +</dt> <dd> +<p>Reduce stack alignment on call sites if possible. Enabled by default. </p> </dd> <dt> +<span><code class="code">-fipa-pta</code><a class="copiable-link" href="#index-fipa-pta"> ¶</a></span> +</dt> <dd> +<p>Perform interprocedural pointer analysis and interprocedural modification and reference analysis. This option can cause excessive memory and compile-time usage on large compilation units. It is not enabled by default at any optimization level. </p> </dd> <dt> +<span><code class="code">-fipa-profile</code><a class="copiable-link" href="#index-fipa-profile"> ¶</a></span> +</dt> <dd> +<p>Perform interprocedural profile propagation. The functions called only from cold functions are marked as cold. Also functions executed once (such as <code class="code">cold</code>, <code class="code">noreturn</code>, static constructors or destructors) are identified. Cold functions and loop less parts of functions executed once are then optimized for size. Enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fipa-modref</code><a class="copiable-link" href="#index-fipa-modref"> ¶</a></span> +</dt> <dd> +<p>Perform interprocedural mod/ref analysis. This optimization analyzes the side effects of functions (memory locations that are modified or referenced) and enables better optimization across the function call boundary. This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fipa-cp</code><a class="copiable-link" href="#index-fipa-cp"> ¶</a></span> +</dt> <dd> +<p>Perform interprocedural constant propagation. This optimization analyzes the program to determine when values passed to functions are constants and then optimizes accordingly. This optimization can substantially increase performance if the application has constants passed to functions. This flag is enabled by default at <samp class="option">-O2</samp>, <samp class="option">-Os</samp> and <samp class="option">-O3</samp>. It is also enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-fipa-cp-clone</code><a class="copiable-link" href="#index-fipa-cp-clone"> ¶</a></span> +</dt> <dd> +<p>Perform function cloning to make interprocedural constant propagation stronger. When enabled, interprocedural constant propagation performs function cloning when externally visible function can be called with constant arguments. Because this optimization can create multiple copies of functions, it may significantly increase code size (see <samp class="option">--param ipa-cp-unit-growth=<var class="var">value</var></samp>). This flag is enabled by default at <samp class="option">-O3</samp>. It is also enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-fipa-bit-cp</code><a class="copiable-link" href="#index-fipa-bit-cp"> ¶</a></span> +</dt> <dd> +<p>When enabled, perform interprocedural bitwise constant propagation. This flag is enabled by default at <samp class="option">-O2</samp> and by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. It requires that <samp class="option">-fipa-cp</samp> is enabled. </p> </dd> <dt> +<span><code class="code">-fipa-vrp</code><a class="copiable-link" href="#index-fipa-vrp"> ¶</a></span> +</dt> <dd> +<p>When enabled, perform interprocedural propagation of value ranges. This flag is enabled by default at <samp class="option">-O2</samp>. It requires that <samp class="option">-fipa-cp</samp> is enabled. </p> </dd> <dt> +<span><code class="code">-fipa-icf</code><a class="copiable-link" href="#index-fipa-icf"> ¶</a></span> +</dt> <dd> +<p>Perform Identical Code Folding for functions and read-only variables. The optimization reduces code size and may disturb unwind stacks by replacing a function by equivalent one with a different name. The optimization works more effectively with link-time optimization enabled. </p> <p>Although the behavior is similar to the Gold Linker’s ICF optimization, GCC ICF works on different levels and thus the optimizations are not same - there are equivalences that are found only by GCC and equivalences found only by Gold. </p> <p>This flag is enabled by default at <samp class="option">-O2</samp> and <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-flive-patching=<var class="var">level</var></code><a class="copiable-link" href="#index-flive-patching"> ¶</a></span> +</dt> <dd> +<p>Control GCC’s optimizations to produce output suitable for live-patching. </p> <p>If the compiler’s optimization uses a function’s body or information extracted from its body to optimize/change another function, the latter is called an impacted function of the former. If a function is patched, its impacted functions should be patched too. </p> <p>The impacted functions are determined by the compiler’s interprocedural optimizations. For example, a caller is impacted when inlining a function into its caller, cloning a function and changing its caller to call this new clone, or extracting a function’s pureness/constness information to optimize its direct or indirect callers, etc. </p> <p>Usually, the more IPA optimizations enabled, the larger the number of impacted functions for each function. In order to control the number of impacted functions and more easily compute the list of impacted function, IPA optimizations can be partially enabled at two different levels. </p> <p>The <var class="var">level</var> argument should be one of the following: </p> <dl class="table"> <dt>‘<samp class="samp">inline-clone</samp>’</dt> <dd> <p>Only enable inlining and cloning optimizations, which includes inlining, cloning, interprocedural scalar replacement of aggregates and partial inlining. As a result, when patching a function, all its callers and its clones’ callers are impacted, therefore need to be patched as well. </p> <p><samp class="option">-flive-patching=inline-clone</samp> disables the following optimization flags: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fwhole-program -fipa-pta -fipa-reference -fipa-ra +-fipa-icf -fipa-icf-functions -fipa-icf-variables +-fipa-bit-cp -fipa-vrp -fipa-pure-const +-fipa-reference-addressable +-fipa-stack-alignment -fipa-modref</pre> +</div> </dd> <dt>‘<samp class="samp">inline-only-static</samp>’</dt> <dd> <p>Only enable inlining of static functions. As a result, when patching a static function, all its callers are impacted and so need to be patched as well. </p> <p>In addition to all the flags that <samp class="option">-flive-patching=inline-clone</samp> disables, <samp class="option">-flive-patching=inline-only-static</samp> disables the following additional optimization flags: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp</pre> +</div> </dd> </dl> <p>When <samp class="option">-flive-patching</samp> is specified without any value, the default value is <var class="var">inline-clone</var>. </p> <p>This flag is disabled by default. </p> <p>Note that <samp class="option">-flive-patching</samp> is not supported with link-time optimization (<samp class="option">-flto</samp>). </p> </dd> <dt> +<span><code class="code">-fisolate-erroneous-paths-dereference</code><a class="copiable-link" href="#index-fisolate-erroneous-paths-dereference"> ¶</a></span> +</dt> <dd> +<p>Detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. Isolate those paths from the main control flow and turn the statement with erroneous or undefined behavior into a trap. This flag is enabled by default at <samp class="option">-O2</samp> and higher and depends on <samp class="option">-fdelete-null-pointer-checks</samp> also being enabled. </p> </dd> <dt> +<span><code class="code">-fisolate-erroneous-paths-attribute</code><a class="copiable-link" href="#index-fisolate-erroneous-paths-attribute"> ¶</a></span> +</dt> <dd> +<p>Detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a <code class="code">returns_nonnull</code> or <code class="code">nonnull</code> attribute. Isolate those paths from the main control flow and turn the statement with erroneous or undefined behavior into a trap. This is not currently enabled, but may be enabled by <samp class="option">-O2</samp> in the future. </p> </dd> <dt> +<span><code class="code">-ftree-sink</code><a class="copiable-link" href="#index-ftree-sink"> ¶</a></span> +</dt> <dd> +<p>Perform forward store motion on trees. This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-bit-ccp</code><a class="copiable-link" href="#index-ftree-bit-ccp"> ¶</a></span> +</dt> <dd> +<p>Perform sparse conditional bit constant propagation on trees and propagate pointer alignment information. This pass only operates on local scalar variables and is enabled by default at <samp class="option">-O1</samp> and higher, except for <samp class="option">-Og</samp>. It requires that <samp class="option">-ftree-ccp</samp> is enabled. </p> </dd> <dt> +<span><code class="code">-ftree-ccp</code><a class="copiable-link" href="#index-ftree-ccp"> ¶</a></span> +</dt> <dd> +<p>Perform sparse conditional constant propagation (CCP) on trees. This pass only operates on local scalar variables and is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fssa-backprop</code><a class="copiable-link" href="#index-fssa-backprop"> ¶</a></span> +</dt> <dd> +<p>Propagate information about uses of a value up the definition chain in order to simplify the definitions. For example, this pass strips sign operations if the sign of a value never matters. The flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fssa-phiopt</code><a class="copiable-link" href="#index-fssa-phiopt"> ¶</a></span> +</dt> <dd> +<p>Perform pattern matching on SSA PHI nodes to optimize conditional code. This pass is enabled by default at <samp class="option">-O1</samp> and higher, except for <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-ftree-switch-conversion</code><a class="copiable-link" href="#index-ftree-switch-conversion"> ¶</a></span> +</dt> <dd> +<p>Perform conversion of simple initializations in a switch to initializations from a scalar array. This flag is enabled by default at <samp class="option">-O2</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-tail-merge</code><a class="copiable-link" href="#index-ftree-tail-merge"> ¶</a></span> +</dt> <dd> +<p>Look for identical code sequences. When found, replace one with a jump to the other. This optimization is known as tail merging or cross jumping. This flag is enabled by default at <samp class="option">-O2</samp> and higher. The compilation time in this pass can be limited using <samp class="option">max-tail-merge-comparisons</samp> parameter and <samp class="option">max-tail-merge-iterations</samp> parameter. </p> </dd> <dt> +<span><code class="code">-ftree-dce</code><a class="copiable-link" href="#index-ftree-dce"> ¶</a></span> +</dt> <dd> +<p>Perform dead code elimination (DCE) on trees. This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-builtin-call-dce</code><a class="copiable-link" href="#index-ftree-builtin-call-dce"> ¶</a></span> +</dt> <dd> +<p>Perform conditional dead code elimination (DCE) for calls to built-in functions that may set <code class="code">errno</code> but are otherwise free of side effects. This flag is enabled by default at <samp class="option">-O2</samp> and higher if <samp class="option">-Os</samp> is not also specified. </p> </dd> <dt> + <span><code class="code">-ffinite-loops</code><a class="copiable-link" href="#index-ffinite-loops"> ¶</a></span> +</dt> <dd> +<p>Assume that a loop with an exit will eventually take the exit and not loop indefinitely. This allows the compiler to remove loops that otherwise have no side-effects, not considering eventual endless looping as such. </p> <p>This option is enabled by default at <samp class="option">-O2</samp> for C++ with -std=c++11 or higher. </p> </dd> <dt> +<span><code class="code">-ftree-dominator-opts</code><a class="copiable-link" href="#index-ftree-dominator-opts"> ¶</a></span> +</dt> <dd> +<p>Perform a variety of simple scalar cleanups (constant/copy propagation, redundancy elimination, range propagation and expression simplification) based on a dominator tree traversal. This also performs jump threading (to reduce jumps to jumps). This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-dse</code><a class="copiable-link" href="#index-ftree-dse"> ¶</a></span> +</dt> <dd> +<p>Perform dead store elimination (DSE) on trees. A dead store is a store into a memory location that is later overwritten by another store without any intervening loads. In this case the earlier store can be deleted. This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-ch</code><a class="copiable-link" href="#index-ftree-ch"> ¶</a></span> +</dt> <dd> +<p>Perform loop header copying on trees. This is beneficial since it increases effectiveness of code motion optimizations. It also saves one jump. This flag is enabled by default at <samp class="option">-O1</samp> and higher. It is not enabled for <samp class="option">-Os</samp>, since it usually increases code size. </p> </dd> <dt> +<span><code class="code">-ftree-loop-optimize</code><a class="copiable-link" href="#index-ftree-loop-optimize"> ¶</a></span> +</dt> <dd> +<p>Perform loop optimizations on trees. This flag is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> + <span><code class="code">-ftree-loop-linear</code><a class="copiable-link" href="#index-ftree-loop-linear"> ¶</a></span> +</dt> <dt><code class="code">-floop-strip-mine</code></dt> <dt><code class="code">-floop-block</code></dt> <dd> +<p>Perform loop nest optimizations. Same as <samp class="option">-floop-nest-optimize</samp>. To use this code transformation, GCC has to be configured with <samp class="option">--with-isl</samp> to enable the Graphite loop transformation infrastructure. </p> </dd> <dt> +<span><code class="code">-fgraphite-identity</code><a class="copiable-link" href="#index-fgraphite-identity"> ¶</a></span> +</dt> <dd> +<p>Enable the identity transformation for graphite. For every SCoP we generate the polyhedral representation and transform it back to gimple. Using <samp class="option">-fgraphite-identity</samp> we can check the costs or benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations are also performed by the code generator isl, like index splitting and dead code elimination in loops. </p> </dd> <dt> +<span><code class="code">-floop-nest-optimize</code><a class="copiable-link" href="#index-floop-nest-optimize"> ¶</a></span> +</dt> <dd> +<p>Enable the isl based loop nest optimizer. This is a generic loop nest optimizer based on the Pluto optimization algorithms. It calculates a loop structure optimized for data-locality and parallelism. This option is experimental. </p> </dd> <dt> +<span><code class="code">-floop-parallelize-all</code><a class="copiable-link" href="#index-floop-parallelize-all"> ¶</a></span> +</dt> <dd> +<p>Use the Graphite data dependence analysis to identify loops that can be parallelized. Parallelize all the loops that can be analyzed to not contain loop carried dependences without checking that it is profitable to parallelize the loops. </p> </dd> <dt> +<span><code class="code">-ftree-coalesce-vars</code><a class="copiable-link" href="#index-ftree-coalesce-vars"> ¶</a></span> +</dt> <dd> +<p>While transforming the program out of the SSA representation, attempt to reduce copying by coalescing versions of different user-defined variables, instead of just compiler temporaries. This may severely limit the ability to debug an optimized program compiled with <samp class="option">-fno-var-tracking-assignments</samp>. In the negated form, this flag prevents SSA coalescing of user variables. This option is enabled by default if optimization is enabled, and it does very little otherwise. </p> </dd> <dt> +<span><code class="code">-ftree-loop-if-convert</code><a class="copiable-link" href="#index-ftree-loop-if-convert"> ¶</a></span> +</dt> <dd> +<p>Attempt to transform conditional jumps in the innermost loops to branch-less equivalents. The intent is to remove control-flow from the innermost loops in order to improve the ability of the vectorization pass to handle these loops. This is enabled by default if vectorization is enabled. </p> </dd> <dt> +<span><code class="code">-ftree-loop-distribution</code><a class="copiable-link" href="#index-ftree-loop-distribution"> ¶</a></span> +</dt> <dd> +<p>Perform loop distribution. This flag can improve cache performance on big loop bodies and allow further loop optimizations, like parallelization or vectorization, to take place. For example, the loop </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">DO I = 1, N + A(I) = B(I) + C + D(I) = E(I) * F +ENDDO</pre> +</div> <p>is transformed to </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">DO I = 1, N + A(I) = B(I) + C +ENDDO +DO I = 1, N + D(I) = E(I) * F +ENDDO</pre> +</div> <p>This flag is enabled by default at <samp class="option">-O3</samp>. It is also enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-ftree-loop-distribute-patterns</code><a class="copiable-link" href="#index-ftree-loop-distribute-patterns"> ¶</a></span> +</dt> <dd> +<p>Perform loop distribution of patterns that can be code generated with calls to a library. This flag is enabled by default at <samp class="option">-O2</samp> and higher, and by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> <p>This pass distributes the initialization loops and generates a call to memset zero. For example, the loop </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">DO I = 1, N + A(I) = 0 + B(I) = A(I) + I +ENDDO</pre> +</div> <p>is transformed to </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">DO I = 1, N + A(I) = 0 +ENDDO +DO I = 1, N + B(I) = A(I) + I +ENDDO</pre> +</div> <p>and the initialization loop is transformed into a call to memset zero. This flag is enabled by default at <samp class="option">-O3</samp>. It is also enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-floop-interchange</code><a class="copiable-link" href="#index-floop-interchange"> ¶</a></span> +</dt> <dd> +<p>Perform loop interchange outside of graphite. This flag can improve cache performance on loop nest and allow further loop optimizations, like vectorization, to take place. For example, the loop </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">for (int i = 0; i < N; i++) + for (int j = 0; j < N; j++) + for (int k = 0; k < N; k++) + c[i][j] = c[i][j] + a[i][k]*b[k][j];</pre> +</div> <p>is transformed to </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">for (int i = 0; i < N; i++) + for (int k = 0; k < N; k++) + for (int j = 0; j < N; j++) + c[i][j] = c[i][j] + a[i][k]*b[k][j];</pre> +</div> <p>This flag is enabled by default at <samp class="option">-O3</samp>. It is also enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-floop-unroll-and-jam</code><a class="copiable-link" href="#index-floop-unroll-and-jam"> ¶</a></span> +</dt> <dd> +<p>Apply unroll and jam transformations on feasible loops. In a loop nest this unrolls the outer loop by some factor and fuses the resulting multiple inner loops. This flag is enabled by default at <samp class="option">-O3</samp>. It is also enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-ftree-loop-im</code><a class="copiable-link" href="#index-ftree-loop-im"> ¶</a></span> +</dt> <dd> +<p>Perform loop invariant motion on trees. This pass moves only invariants that are hard to handle at RTL level (function calls, operations that expand to nontrivial sequences of insns). With <samp class="option">-funswitch-loops</samp> it also moves operands of conditions that are invariant out of the loop, so that we can use just trivial invariantness analysis in loop unswitching. The pass also includes store motion. </p> </dd> <dt> +<span><code class="code">-ftree-loop-ivcanon</code><a class="copiable-link" href="#index-ftree-loop-ivcanon"> ¶</a></span> +</dt> <dd> +<p>Create a canonical counter for number of iterations in loops for which determining number of iterations requires complicated analysis. Later optimizations then may determine the number easily. Useful especially in connection with unrolling. </p> </dd> <dt> +<span><code class="code">-ftree-scev-cprop</code><a class="copiable-link" href="#index-ftree-scev-cprop"> ¶</a></span> +</dt> <dd> +<p>Perform final value replacement. If a variable is modified in a loop in such a way that its value when exiting the loop can be determined using only its initial value and the number of loop iterations, replace uses of the final value by such a computation, provided it is sufficiently cheap. This reduces data dependencies and may allow further simplifications. Enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-fivopts</code><a class="copiable-link" href="#index-fivopts"> ¶</a></span> +</dt> <dd> +<p>Perform induction variable optimizations (strength reduction, induction variable merging and induction variable elimination) on trees. </p> </dd> <dt> +<span><code class="code">-ftree-parallelize-loops=n</code><a class="copiable-link" href="#index-ftree-parallelize-loops"> ¶</a></span> +</dt> <dd> +<p>Parallelize loops, i.e., split their iteration space to run in n threads. This is only possible for loops whose iterations are independent and can be arbitrarily reordered. The optimization is only profitable on multiprocessor machines, for loops that are CPU-intensive, rather than constrained e.g. by memory bandwidth. This option implies <samp class="option">-pthread</samp>, and thus is only supported on targets that have support for <samp class="option">-pthread</samp>. </p> </dd> <dt> +<span><code class="code">-ftree-pta</code><a class="copiable-link" href="#index-ftree-pta"> ¶</a></span> +</dt> <dd> +<p>Perform function-local points-to analysis on trees. This flag is enabled by default at <samp class="option">-O1</samp> and higher, except for <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-ftree-sra</code><a class="copiable-link" href="#index-ftree-sra"> ¶</a></span> +</dt> <dd> +<p>Perform scalar replacement of aggregates. This pass replaces structure references with scalars to prevent committing structures to memory too early. This flag is enabled by default at <samp class="option">-O1</samp> and higher, except for <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-fstore-merging</code><a class="copiable-link" href="#index-fstore-merging"> ¶</a></span> +</dt> <dd> +<p>Perform merging of narrow stores to consecutive memory addresses. This pass merges contiguous stores of immediate values narrower than a word into fewer wider stores to reduce the number of instructions. This is enabled by default at <samp class="option">-O2</samp> and higher as well as <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-ftree-ter</code><a class="copiable-link" href="#index-ftree-ter"> ¶</a></span> +</dt> <dd> +<p>Perform temporary expression replacement during the SSA->normal phase. Single use/single def temporaries are replaced at their use location with their defining expression. This results in non-GIMPLE code, but gives the expanders much more complex trees to work on resulting in better RTL generation. This is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-slsr</code><a class="copiable-link" href="#index-ftree-slsr"> ¶</a></span> +</dt> <dd> +<p>Perform straight-line strength reduction on trees. This recognizes related expressions involving multiplications and replaces them by less expensive calculations when possible. This is enabled by default at <samp class="option">-O1</samp> and higher. </p> </dd> <dt> +<span><code class="code">-ftree-vectorize</code><a class="copiable-link" href="#index-ftree-vectorize"> ¶</a></span> +</dt> <dd> +<p>Perform vectorization on trees. This flag enables <samp class="option">-ftree-loop-vectorize</samp> and <samp class="option">-ftree-slp-vectorize</samp> if not explicitly specified. </p> </dd> <dt> +<span><code class="code">-ftree-loop-vectorize</code><a class="copiable-link" href="#index-ftree-loop-vectorize"> ¶</a></span> +</dt> <dd> +<p>Perform loop vectorization on trees. This flag is enabled by default at <samp class="option">-O2</samp> and by <samp class="option">-ftree-vectorize</samp>, <samp class="option">-fprofile-use</samp>, and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-ftree-slp-vectorize</code><a class="copiable-link" href="#index-ftree-slp-vectorize"> ¶</a></span> +</dt> <dd> +<p>Perform basic block vectorization on trees. This flag is enabled by default at <samp class="option">-O2</samp> and by <samp class="option">-ftree-vectorize</samp>, <samp class="option">-fprofile-use</samp>, and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-ftrivial-auto-var-init=<var class="var">choice</var></code><a class="copiable-link" href="#index-ftrivial-auto-var-init"> ¶</a></span> +</dt> <dd> +<p>Initialize automatic variables with either a pattern or with zeroes to increase the security and predictability of a program by preventing uninitialized memory disclosure and use. GCC still considers an automatic variable that doesn’t have an explicit initializer as uninitialized, <samp class="option">-Wuninitialized</samp> and <samp class="option">-Wanalyzer-use-of-uninitialized-value</samp> will still report warning messages on such automatic variables and the compiler will perform optimization as if the variable were uninitialized. With this option, GCC will also initialize any padding of automatic variables that have structure or union types to zeroes. However, the current implementation cannot initialize automatic variables that are declared between the controlling expression and the first case of a <code class="code">switch</code> statement. Using <samp class="option">-Wtrivial-auto-var-init</samp> to report all such cases. </p> <p>The three values of <var class="var">choice</var> are: </p> <ul class="itemize mark-bullet"> <li>‘<samp class="samp">uninitialized</samp>’ doesn’t initialize any automatic variables. This is C and C++’s default. </li> +<li>‘<samp class="samp">pattern</samp>’ Initialize automatic variables with values which will likely transform logic bugs into crashes down the line, are easily recognized in a crash dump and without being values that programmers can rely on for useful program semantics. The current value is byte-repeatable pattern with byte "0xFE". The values used for pattern initialization might be changed in the future. </li> +<li>‘<samp class="samp">zero</samp>’ Initialize automatic variables with zeroes. </li> +</ul> <p>The default is ‘<samp class="samp">uninitialized</samp>’. </p> <p>You can control this behavior for a specific variable by using the variable attribute <code class="code">uninitialized</code> (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> </dd> <dt> +<span><code class="code">-fvect-cost-model=<var class="var">model</var></code><a class="copiable-link" href="#index-fvect-cost-model"> ¶</a></span> +</dt> <dd> +<p>Alter the cost model used for vectorization. The <var class="var">model</var> argument should be one of ‘<samp class="samp">unlimited</samp>’, ‘<samp class="samp">dynamic</samp>’, ‘<samp class="samp">cheap</samp>’ or ‘<samp class="samp">very-cheap</samp>’. With the ‘<samp class="samp">unlimited</samp>’ model the vectorized code-path is assumed to be profitable while with the ‘<samp class="samp">dynamic</samp>’ model a runtime check guards the vectorized code-path to enable it only for iteration counts that will likely execute faster than when executing the original scalar loop. The ‘<samp class="samp">cheap</samp>’ model disables vectorization of loops where doing so would be cost prohibitive for example due to required runtime checks for data dependence or alignment but otherwise is equal to the ‘<samp class="samp">dynamic</samp>’ model. The ‘<samp class="samp">very-cheap</samp>’ model only allows vectorization if the vector code would entirely replace the scalar code that is being vectorized. For example, if each iteration of a vectorized loop would only be able to handle exactly four iterations of the scalar loop, the ‘<samp class="samp">very-cheap</samp>’ model would only allow vectorization if the scalar iteration count is known to be a multiple of four. </p> <p>The default cost model depends on other optimization flags and is either ‘<samp class="samp">dynamic</samp>’ or ‘<samp class="samp">cheap</samp>’. </p> </dd> <dt> +<span><code class="code">-fsimd-cost-model=<var class="var">model</var></code><a class="copiable-link" href="#index-fsimd-cost-model"> ¶</a></span> +</dt> <dd> +<p>Alter the cost model used for vectorization of loops marked with the OpenMP simd directive. The <var class="var">model</var> argument should be one of ‘<samp class="samp">unlimited</samp>’, ‘<samp class="samp">dynamic</samp>’, ‘<samp class="samp">cheap</samp>’. All values of <var class="var">model</var> have the same meaning as described in <samp class="option">-fvect-cost-model</samp> and by default a cost model defined with <samp class="option">-fvect-cost-model</samp> is used. </p> </dd> <dt> +<span><code class="code">-ftree-vrp</code><a class="copiable-link" href="#index-ftree-vrp"> ¶</a></span> +</dt> <dd> +<p>Perform Value Range Propagation on trees. This is similar to the constant propagation pass, but instead of values, ranges of values are propagated. This allows the optimizers to remove unnecessary range checks like array bound checks and null pointer checks. This is enabled by default at <samp class="option">-O2</samp> and higher. Null pointer check elimination is only done if <samp class="option">-fdelete-null-pointer-checks</samp> is enabled. </p> </dd> <dt> +<span><code class="code">-fsplit-paths</code><a class="copiable-link" href="#index-fsplit-paths"> ¶</a></span> +</dt> <dd> +<p>Split paths leading to loop backedges. This can improve dead code elimination and common subexpression elimination. This is enabled by default at <samp class="option">-O3</samp> and above. </p> </dd> <dt> +<span><code class="code">-fsplit-ivs-in-unroller</code><a class="copiable-link" href="#index-fsplit-ivs-in-unroller"> ¶</a></span> +</dt> <dd> +<p>Enables expression of values of induction variables in later iterations of the unrolled loop using the value in the first iteration. This breaks long dependency chains, thus improving efficiency of the scheduling passes. </p> <p>A combination of <samp class="option">-fweb</samp> and CSE is often sufficient to obtain the same effect. However, that is not reliable in cases where the loop body is more complicated than a single basic block. It also does not work at all on some architectures due to restrictions in the CSE pass. </p> <p>This optimization is enabled by default. </p> </dd> <dt> +<span><code class="code">-fvariable-expansion-in-unroller</code><a class="copiable-link" href="#index-fvariable-expansion-in-unroller"> ¶</a></span> +</dt> <dd> +<p>With this option, the compiler creates multiple copies of some local variables when unrolling a loop, which can result in superior code. </p> <p>This optimization is enabled by default for PowerPC targets, but disabled by default otherwise. </p> </dd> <dt> +<span><code class="code">-fpartial-inlining</code><a class="copiable-link" href="#index-fpartial-inlining"> ¶</a></span> +</dt> <dd> +<p>Inline parts of functions. This option has any effect only when inlining itself is turned on by the <samp class="option">-finline-functions</samp> or <samp class="option">-finline-small-functions</samp> options. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fpredictive-commoning</code><a class="copiable-link" href="#index-fpredictive-commoning"> ¶</a></span> +</dt> <dd> +<p>Perform predictive commoning optimization, i.e., reusing computations (especially memory loads and stores) performed in previous iterations of loops. </p> <p>This option is enabled at level <samp class="option">-O3</samp>. It is also enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-fprefetch-loop-arrays</code><a class="copiable-link" href="#index-fprefetch-loop-arrays"> ¶</a></span> +</dt> <dd> +<p>If supported by the target machine, generate instructions to prefetch memory to improve the performance of loops that access large arrays. </p> <p>This option may generate better or worse code; results are highly dependent on the structure of loops within the source code. </p> <p>Disabled at level <samp class="option">-Os</samp>. </p> </dd> <dt> + <span><code class="code">-fno-printf-return-value</code><a class="copiable-link" href="#index-fno-printf-return-value"> ¶</a></span> +</dt> <dd> +<p>Do not substitute constants for known return value of formatted output functions such as <code class="code">sprintf</code>, <code class="code">snprintf</code>, <code class="code">vsprintf</code>, and <code class="code">vsnprintf</code> (but not <code class="code">printf</code> of <code class="code">fprintf</code>). This transformation allows GCC to optimize or even eliminate branches based on the known return value of these functions called with arguments that are either constant, or whose values are known to be in a range that makes determining the exact return value possible. For example, when <samp class="option">-fprintf-return-value</samp> is in effect, both the branch and the body of the <code class="code">if</code> statement (but not the call to <code class="code">snprint</code>) can be optimized away when <code class="code">i</code> is a 32-bit or smaller integer because the return value is guaranteed to be at most 8. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">char buf[9]; +if (snprintf (buf, "%08x", i) >= sizeof buf) + …</pre> +</div> <p>The <samp class="option">-fprintf-return-value</samp> option relies on other optimizations and yields best results with <samp class="option">-O2</samp> and above. It works in tandem with the <samp class="option">-Wformat-overflow</samp> and <samp class="option">-Wformat-truncation</samp> options. The <samp class="option">-fprintf-return-value</samp> option is enabled by default. </p> </dd> <dt> + <span><code class="code">-fno-peephole</code><a class="copiable-link" href="#index-fno-peephole"> ¶</a></span> +</dt> <dt><code class="code">-fno-peephole2</code></dt> <dd> +<p>Disable any machine-specific peephole optimizations. The difference between <samp class="option">-fno-peephole</samp> and <samp class="option">-fno-peephole2</samp> is in how they are implemented in the compiler; some targets use one, some use the other, a few use both. </p> <p><samp class="option">-fpeephole</samp> is enabled by default. <samp class="option">-fpeephole2</samp> enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> + <span><code class="code">-fno-guess-branch-probability</code><a class="copiable-link" href="#index-fno-guess-branch-probability"> ¶</a></span> +</dt> <dd> +<p>Do not guess branch probabilities using heuristics. </p> <p>GCC uses heuristics to guess branch probabilities if they are not provided by profiling feedback (<samp class="option">-fprofile-arcs</samp>). These heuristics are based on the control flow graph. If some branch probabilities are specified by <code class="code">__builtin_expect</code>, then the heuristics are used to guess branch probabilities for the rest of the control flow graph, taking the <code class="code">__builtin_expect</code> info into account. The interactions between the heuristics and <code class="code">__builtin_expect</code> can be complex, and in some cases, it may be useful to disable the heuristics so that the effects of <code class="code">__builtin_expect</code> are easier to understand. </p> <p>It is also possible to specify expected probability of the expression with <code class="code">__builtin_expect_with_probability</code> built-in function. </p> <p>The default is <samp class="option">-fguess-branch-probability</samp> at levels <samp class="option">-O</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-freorder-blocks</code><a class="copiable-link" href="#index-freorder-blocks"> ¶</a></span> +</dt> <dd> +<p>Reorder basic blocks in the compiled function in order to reduce number of taken branches and improve code locality. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-freorder-blocks-algorithm=<var class="var">algorithm</var></code><a class="copiable-link" href="#index-freorder-blocks-algorithm"> ¶</a></span> +</dt> <dd> +<p>Use the specified algorithm for basic block reordering. The <var class="var">algorithm</var> argument can be ‘<samp class="samp">simple</samp>’, which does not increase code size (except sometimes due to secondary effects like alignment), or ‘<samp class="samp">stc</samp>’, the “software trace cache” algorithm, which tries to put all often executed code together, minimizing the number of branches executed by making extra copies of code. </p> <p>The default is ‘<samp class="samp">simple</samp>’ at levels <samp class="option">-O1</samp>, <samp class="option">-Os</samp>, and ‘<samp class="samp">stc</samp>’ at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>. </p> </dd> <dt> +<span><code class="code">-freorder-blocks-and-partition</code><a class="copiable-link" href="#index-freorder-blocks-and-partition"> ¶</a></span> +</dt> <dd> +<p>In addition to reordering basic blocks in the compiled function, in order to reduce number of taken branches, partitions hot and cold basic blocks into separate sections of the assembly and <samp class="file">.o</samp> files, to improve paging and cache locality performance. </p> <p>This optimization is automatically turned off in the presence of exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined section attribute and on any architecture that does not support named sections. When <samp class="option">-fsplit-stack</samp> is used this option is not enabled by default (to avoid linker errors), but may be enabled explicitly (if using a working linker). </p> <p>Enabled for x86 at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-freorder-functions</code><a class="copiable-link" href="#index-freorder-functions"> ¶</a></span> +</dt> <dd> +<p>Reorder functions in the object file in order to improve code locality. This is implemented by using special subsections <code class="code">.text.hot</code> for most frequently executed functions and <code class="code">.text.unlikely</code> for unlikely executed functions. Reordering is done by the linker so object file format must support named sections and linker must place them in a reasonable way. </p> <p>This option isn’t effective unless you either provide profile feedback (see <samp class="option">-fprofile-arcs</samp> for details) or manually annotate functions with <code class="code">hot</code> or <code class="code">cold</code> attributes (see <a class="pxref" href="common-function-attributes">Common Function Attributes</a>). </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fstrict-aliasing</code><a class="copiable-link" href="#index-fstrict-aliasing"> ¶</a></span> +</dt> <dd> +<p>Allow the compiler to assume the strictest aliasing rules applicable to the language being compiled. For C (and C++), this activates optimizations based on the type of expressions. In particular, an object of one type is assumed never to reside at the same address as an object of a different type, unless the types are almost the same. For example, an <code class="code">unsigned int</code> can alias an <code class="code">int</code>, but not a <code class="code">void*</code> or a <code class="code">double</code>. A character type may alias any other type. </p> <p>Pay special attention to code like this: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">union a_union { + int i; + double d; +}; + +int f() { + union a_union t; + t.d = 3.0; + return t.i; +}</pre> +</div> <p>The practice of reading from a different union member than the one most recently written to (called “type-punning”) is common. Even with <samp class="option">-fstrict-aliasing</samp>, type-punning is allowed, provided the memory is accessed through the union type. So, the code above works as expected. See <a class="xref" href="structures-unions-enumerations-and-bit-fields-implementation">Structures, Unions, Enumerations, and Bit-Fields</a>. However, this code might not: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int f() { + union a_union t; + int* ip; + t.d = 3.0; + ip = &t.i; + return *ip; +}</pre> +</div> <p>Similarly, access by taking the address, casting the resulting pointer and dereferencing the result has undefined behavior, even if the cast uses a union type, e.g.: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int f() { + double d = 3.0; + return ((union a_union *) &d)->i; +}</pre> +</div> <p>The <samp class="option">-fstrict-aliasing</samp> option is enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fipa-strict-aliasing</code><a class="copiable-link" href="#index-fipa-strict-aliasing"> ¶</a></span> +</dt> <dd> +<p>Controls whether rules of <samp class="option">-fstrict-aliasing</samp> are applied across function boundaries. Note that if multiple functions gets inlined into a single function the memory accesses are no longer considered to be crossing a function boundary. </p> <p>The <samp class="option">-fipa-strict-aliasing</samp> option is enabled by default and is effective only in combination with <samp class="option">-fstrict-aliasing</samp>. </p> </dd> <dt> +<span><code class="code">-falign-functions</code><a class="copiable-link" href="#index-falign-functions"> ¶</a></span> +</dt> <dt><code class="code">-falign-functions=<var class="var">n</var></code></dt> <dt><code class="code">-falign-functions=<var class="var">n</var>:<var class="var">m</var></code></dt> <dt><code class="code">-falign-functions=<var class="var">n</var>:<var class="var">m</var>:<var class="var">n2</var></code></dt> <dt><code class="code">-falign-functions=<var class="var">n</var>:<var class="var">m</var>:<var class="var">n2</var>:<var class="var">m2</var></code></dt> <dd> +<p>Align the start of functions to the next power-of-two greater than or equal to <var class="var">n</var>, skipping up to <var class="var">m</var>-1 bytes. This ensures that at least the first <var class="var">m</var> bytes of the function can be fetched by the CPU without crossing an <var class="var">n</var>-byte alignment boundary. </p> <p>If <var class="var">m</var> is not specified, it defaults to <var class="var">n</var>. </p> <p>Examples: <samp class="option">-falign-functions=32</samp> aligns functions to the next 32-byte boundary, <samp class="option">-falign-functions=24</samp> aligns to the next 32-byte boundary only if this can be done by skipping 23 bytes or less, <samp class="option">-falign-functions=32:7</samp> aligns to the next 32-byte boundary only if this can be done by skipping 6 bytes or less. </p> <p>The second pair of <var class="var">n2</var>:<var class="var">m2</var> values allows you to specify a secondary alignment: <samp class="option">-falign-functions=64:7:32:3</samp> aligns to the next 64-byte boundary if this can be done by skipping 6 bytes or less, otherwise aligns to the next 32-byte boundary if this can be done by skipping 2 bytes or less. If <var class="var">m2</var> is not specified, it defaults to <var class="var">n2</var>. </p> <p>Some assemblers only support this flag when <var class="var">n</var> is a power of two; in that case, it is rounded up. </p> <p><samp class="option">-fno-align-functions</samp> and <samp class="option">-falign-functions=1</samp> are equivalent and mean that functions are not aligned. </p> <p>If <var class="var">n</var> is not specified or is zero, use a machine-dependent default. The maximum allowed <var class="var">n</var> option value is 65536. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>. </p> </dd> <dt><code class="code">-flimit-function-alignment</code></dt> <dd> +<p>If this option is enabled, the compiler tries to avoid unnecessarily overaligning functions. It attempts to instruct the assembler to align by the amount specified by <samp class="option">-falign-functions</samp>, but not to skip more bytes than the size of the function. </p> </dd> <dt> +<span><code class="code">-falign-labels</code><a class="copiable-link" href="#index-falign-labels"> ¶</a></span> +</dt> <dt><code class="code">-falign-labels=<var class="var">n</var></code></dt> <dt><code class="code">-falign-labels=<var class="var">n</var>:<var class="var">m</var></code></dt> <dt><code class="code">-falign-labels=<var class="var">n</var>:<var class="var">m</var>:<var class="var">n2</var></code></dt> <dt><code class="code">-falign-labels=<var class="var">n</var>:<var class="var">m</var>:<var class="var">n2</var>:<var class="var">m2</var></code></dt> <dd> +<p>Align all branch targets to a power-of-two boundary. </p> <p>Parameters of this option are analogous to the <samp class="option">-falign-functions</samp> option. <samp class="option">-fno-align-labels</samp> and <samp class="option">-falign-labels=1</samp> are equivalent and mean that labels are not aligned. </p> <p>If <samp class="option">-falign-loops</samp> or <samp class="option">-falign-jumps</samp> are applicable and are greater than this value, then their values are used instead. </p> <p>If <var class="var">n</var> is not specified or is zero, use a machine-dependent default which is very likely to be ‘<samp class="samp">1</samp>’, meaning no alignment. The maximum allowed <var class="var">n</var> option value is 65536. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>. </p> </dd> <dt> +<span><code class="code">-falign-loops</code><a class="copiable-link" href="#index-falign-loops"> ¶</a></span> +</dt> <dt><code class="code">-falign-loops=<var class="var">n</var></code></dt> <dt><code class="code">-falign-loops=<var class="var">n</var>:<var class="var">m</var></code></dt> <dt><code class="code">-falign-loops=<var class="var">n</var>:<var class="var">m</var>:<var class="var">n2</var></code></dt> <dt><code class="code">-falign-loops=<var class="var">n</var>:<var class="var">m</var>:<var class="var">n2</var>:<var class="var">m2</var></code></dt> <dd> +<p>Align loops to a power-of-two boundary. If the loops are executed many times, this makes up for any execution of the dummy padding instructions. </p> <p>If <samp class="option">-falign-labels</samp> is greater than this value, then its value is used instead. </p> <p>Parameters of this option are analogous to the <samp class="option">-falign-functions</samp> option. <samp class="option">-fno-align-loops</samp> and <samp class="option">-falign-loops=1</samp> are equivalent and mean that loops are not aligned. The maximum allowed <var class="var">n</var> option value is 65536. </p> <p>If <var class="var">n</var> is not specified or is zero, use a machine-dependent default. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>. </p> </dd> <dt> +<span><code class="code">-falign-jumps</code><a class="copiable-link" href="#index-falign-jumps"> ¶</a></span> +</dt> <dt><code class="code">-falign-jumps=<var class="var">n</var></code></dt> <dt><code class="code">-falign-jumps=<var class="var">n</var>:<var class="var">m</var></code></dt> <dt><code class="code">-falign-jumps=<var class="var">n</var>:<var class="var">m</var>:<var class="var">n2</var></code></dt> <dt><code class="code">-falign-jumps=<var class="var">n</var>:<var class="var">m</var>:<var class="var">n2</var>:<var class="var">m2</var></code></dt> <dd> +<p>Align branch targets to a power-of-two boundary, for branch targets where the targets can only be reached by jumping. In this case, no dummy operations need be executed. </p> <p>If <samp class="option">-falign-labels</samp> is greater than this value, then its value is used instead. </p> <p>Parameters of this option are analogous to the <samp class="option">-falign-functions</samp> option. <samp class="option">-fno-align-jumps</samp> and <samp class="option">-falign-jumps=1</samp> are equivalent and mean that loops are not aligned. </p> <p>If <var class="var">n</var> is not specified or is zero, use a machine-dependent default. The maximum allowed <var class="var">n</var> option value is 65536. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>. </p> </dd> <dt> +<span><code class="code">-fno-allocation-dce</code><a class="copiable-link" href="#index-fno-allocation-dce"> ¶</a></span> +</dt> <dd> +<p>Do not remove unused C++ allocations in dead code elimination. </p> </dd> <dt> +<span><code class="code">-fallow-store-data-races</code><a class="copiable-link" href="#index-fallow-store-data-races"> ¶</a></span> +</dt> <dd> +<p>Allow the compiler to perform optimizations that may introduce new data races on stores, without proving that the variable cannot be concurrently accessed by other threads. Does not affect optimization of local data. It is safe to use this option if it is known that global data will not be accessed by multiple threads. </p> <p>Examples of optimizations enabled by <samp class="option">-fallow-store-data-races</samp> include hoisting or if-conversions that may cause a value that was already in memory to be re-written with that same value. Such re-writing is safe in a single threaded context but may be unsafe in a multi-threaded context. Note that on some processors, if-conversions may be required in order to enable vectorization. </p> <p>Enabled at level <samp class="option">-Ofast</samp>. </p> </dd> <dt> +<span><code class="code">-funit-at-a-time</code><a class="copiable-link" href="#index-funit-at-a-time"> ¶</a></span> +</dt> <dd> +<p>This option is left for compatibility reasons. <samp class="option">-funit-at-a-time</samp> has no effect, while <samp class="option">-fno-unit-at-a-time</samp> implies <samp class="option">-fno-toplevel-reorder</samp> and <samp class="option">-fno-section-anchors</samp>. </p> <p>Enabled by default. </p> </dd> <dt> + <span><code class="code">-fno-toplevel-reorder</code><a class="copiable-link" href="#index-fno-toplevel-reorder"> ¶</a></span> +</dt> <dd> +<p>Do not reorder top-level functions, variables, and <code class="code">asm</code> statements. Output them in the same order that they appear in the input file. When this option is used, unreferenced static variables are not removed. This option is intended to support existing code that relies on a particular ordering. For new code, it is better to use attributes when possible. </p> <p><samp class="option">-ftoplevel-reorder</samp> is the default at <samp class="option">-O1</samp> and higher, and also at <samp class="option">-O0</samp> if <samp class="option">-fsection-anchors</samp> is explicitly requested. Additionally <samp class="option">-fno-toplevel-reorder</samp> implies <samp class="option">-fno-section-anchors</samp>. </p> </dd> <dt> +<span><code class="code">-funreachable-traps</code><a class="copiable-link" href="#index-funreachable-traps"> ¶</a></span> +</dt> <dd> +<p>With this option, the compiler turns calls to <code class="code">__builtin_unreachable</code> into traps, instead of using them for optimization. This also affects any such calls implicitly generated by the compiler. </p> <p>This option has the same effect as <samp class="option">-fsanitize=unreachable -fsanitize-trap=unreachable</samp>, but does not affect the values of those options. If <samp class="option">-fsanitize=unreachable</samp> is enabled, that option takes priority over this one. </p> <p>This option is enabled by default at <samp class="option">-O0</samp> and <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-fweb</code><a class="copiable-link" href="#index-fweb"> ¶</a></span> +</dt> <dd> +<p>Constructs webs as commonly used for register allocation purposes and assign each web individual pseudo register. This allows the register allocation pass to operate on pseudos directly, but also strengthens several other optimization passes, such as CSE, loop optimizer and trivial dead code remover. It can, however, make debugging impossible, since variables no longer stay in a “home register”. </p> <p>Enabled by default with <samp class="option">-funroll-loops</samp>. </p> </dd> <dt> +<span><code class="code">-fwhole-program</code><a class="copiable-link" href="#index-fwhole-program"> ¶</a></span> +</dt> <dd> +<p>Assume that the current compilation unit represents the whole program being compiled. All public functions and variables with the exception of <code class="code">main</code> and those merged by attribute <code class="code">externally_visible</code> become static functions and in effect are optimized more aggressively by interprocedural optimizers. </p> <p>With <samp class="option">-flto</samp> this option has a limited use. In most cases the precise list of symbols used or exported from the binary is known the resolution info passed to the link-time optimizer by the linker plugin. It is still useful if no linker plugin is used or during incremental link step when final code is produced (with <samp class="option">-flto</samp> <samp class="option">-flinker-output=nolto-rel</samp>). </p> </dd> <dt> +<span><code class="code">-flto[=<var class="var">n</var>]</code><a class="copiable-link" href="#index-flto"> ¶</a></span> +</dt> <dd> +<p>This option runs the standard link-time optimizer. When invoked with source code, it generates GIMPLE (one of GCC’s internal representations) and writes it to special ELF sections in the object file. When the object files are linked together, all the function bodies are read from these ELF sections and instantiated as if they had been part of the same translation unit. </p> <p>To use the link-time optimizer, <samp class="option">-flto</samp> and optimization options should be specified at compile time and during the final link. It is recommended that you compile all the files participating in the same link with the same options and also specify those options at link time. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -c -O2 -flto foo.c +gcc -c -O2 -flto bar.c +gcc -o myprog -flto -O2 foo.o bar.o</pre> +</div> <p>The first two invocations to GCC save a bytecode representation of GIMPLE into special ELF sections inside <samp class="file">foo.o</samp> and <samp class="file">bar.o</samp>. The final invocation reads the GIMPLE bytecode from <samp class="file">foo.o</samp> and <samp class="file">bar.o</samp>, merges the two files into a single internal image, and compiles the result as usual. Since both <samp class="file">foo.o</samp> and <samp class="file">bar.o</samp> are merged into a single image, this causes all the interprocedural analyses and optimizations in GCC to work across the two files as if they were a single one. This means, for example, that the inliner is able to inline functions in <samp class="file">bar.o</samp> into functions in <samp class="file">foo.o</samp> and vice-versa. </p> <p>Another (simpler) way to enable link-time optimization is: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -o myprog -flto -O2 foo.c bar.c</pre> +</div> <p>The above generates bytecode for <samp class="file">foo.c</samp> and <samp class="file">bar.c</samp>, merges them together into a single GIMPLE representation and optimizes them as usual to produce <samp class="file">myprog</samp>. </p> <p>The important thing to keep in mind is that to enable link-time optimizations you need to use the GCC driver to perform the link step. GCC automatically performs link-time optimization if any of the objects involved were compiled with the <samp class="option">-flto</samp> command-line option. You can always override the automatic decision to do link-time optimization by passing <samp class="option">-fno-lto</samp> to the link command. </p> <p>To make whole program optimization effective, it is necessary to make certain whole program assumptions. The compiler needs to know what functions and variables can be accessed by libraries and runtime outside of the link-time optimized unit. When supported by the linker, the linker plugin (see <samp class="option">-fuse-linker-plugin</samp>) passes information to the compiler about used and externally visible symbols. When the linker plugin is not available, <samp class="option">-fwhole-program</samp> should be used to allow the compiler to make these assumptions, which leads to more aggressive optimization decisions. </p> <p>When a file is compiled with <samp class="option">-flto</samp> without <samp class="option">-fuse-linker-plugin</samp>, the generated object file is larger than a regular object file because it contains GIMPLE bytecodes and the usual final code (see <samp class="option">-ffat-lto-objects</samp>). This means that object files with LTO information can be linked as normal object files; if <samp class="option">-fno-lto</samp> is passed to the linker, no interprocedural optimizations are applied. Note that when <samp class="option">-fno-fat-lto-objects</samp> is enabled the compile stage is faster but you cannot perform a regular, non-LTO link on them. </p> <p>When producing the final binary, GCC only applies link-time optimizations to those files that contain bytecode. Therefore, you can mix and match object files and libraries with GIMPLE bytecodes and final object code. GCC automatically selects which files to optimize in LTO mode and which files to link without further processing. </p> <p>Generally, options specified at link time override those specified at compile time, although in some cases GCC attempts to infer link-time options from the settings used to compile the input files. </p> <p>If you do not specify an optimization level option <samp class="option">-O</samp> at link time, then GCC uses the highest optimization level used when compiling the object files. Note that it is generally ineffective to specify an optimization level option only at link time and not at compile time, for two reasons. First, compiling without optimization suppresses compiler passes that gather information needed for effective optimization at link time. Second, some early optimization passes can be performed only at compile time and not at link time. </p> <p>There are some code generation flags preserved by GCC when generating bytecodes, as they need to be used during the final link. Currently, the following options and their settings are taken from the first object file that explicitly specifies them: <samp class="option">-fcommon</samp>, <samp class="option">-fexceptions</samp>, <samp class="option">-fnon-call-exceptions</samp>, <samp class="option">-fgnu-tm</samp> and all the <samp class="option">-m</samp> target flags. </p> <p>The following options <samp class="option">-fPIC</samp>, <samp class="option">-fpic</samp>, <samp class="option">-fpie</samp> and <samp class="option">-fPIE</samp> are combined based on the following scheme: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp"><samp class="option">-fPIC</samp> + <samp class="option">-fpic</samp> = <samp class="option">-fpic</samp> +<samp class="option">-fPIC</samp> + <samp class="option">-fno-pic</samp> = <samp class="option">-fno-pic</samp> +<samp class="option">-fpic/-fPIC</samp> + (no option) = (no option) +<samp class="option">-fPIC</samp> + <samp class="option">-fPIE</samp> = <samp class="option">-fPIE</samp> +<samp class="option">-fpic</samp> + <samp class="option">-fPIE</samp> = <samp class="option">-fpie</samp> +<samp class="option">-fPIC/-fpic</samp> + <samp class="option">-fpie</samp> = <samp class="option">-fpie</samp></pre> +</div> <p>Certain ABI-changing flags are required to match in all compilation units, and trying to override this at link time with a conflicting value is ignored. This includes options such as <samp class="option">-freg-struct-return</samp> and <samp class="option">-fpcc-struct-return</samp>. </p> <p>Other options such as <samp class="option">-ffp-contract</samp>, <samp class="option">-fno-strict-overflow</samp>, <samp class="option">-fwrapv</samp>, <samp class="option">-fno-trapv</samp> or <samp class="option">-fno-strict-aliasing</samp> are passed through to the link stage and merged conservatively for conflicting translation units. Specifically <samp class="option">-fno-strict-overflow</samp>, <samp class="option">-fwrapv</samp> and <samp class="option">-fno-trapv</samp> take precedence; and for example <samp class="option">-ffp-contract=off</samp> takes precedence over <samp class="option">-ffp-contract=fast</samp>. You can override them at link time. </p> <p>Diagnostic options such as <samp class="option">-Wstringop-overflow</samp> are passed through to the link stage and their setting matches that of the compile-step at function granularity. Note that this matters only for diagnostics emitted during optimization. Note that code transforms such as inlining can lead to warnings being enabled or disabled for regions if code not consistent with the setting at compile time. </p> <p>When you need to pass options to the assembler via <samp class="option">-Wa</samp> or <samp class="option">-Xassembler</samp> make sure to either compile such translation units with <samp class="option">-fno-lto</samp> or consistently use the same assembler options on all translation units. You can alternatively also specify assembler options at LTO link time. </p> <p>To enable debug info generation you need to supply <samp class="option">-g</samp> at compile time. If any of the input files at link time were built with debug info generation enabled the link will enable debug info generation as well. Any elaborate debug info settings like the dwarf level <samp class="option">-gdwarf-5</samp> need to be explicitly repeated at the linker command line and mixing different settings in different translation units is discouraged. </p> <p>If LTO encounters objects with C linkage declared with incompatible types in separate translation units to be linked together (undefined behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be issued. The behavior is still undefined at run time. Similar diagnostics may be raised for other languages. </p> <p>Another feature of LTO is that it is possible to apply interprocedural optimizations on files written in different languages: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -c -flto foo.c +g++ -c -flto bar.cc +gfortran -c -flto baz.f90 +g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran</pre> +</div> <p>Notice that the final link is done with <code class="command">g++</code> to get the C++ runtime libraries and <samp class="option">-lgfortran</samp> is added to get the Fortran runtime libraries. In general, when mixing languages in LTO mode, you should use the same link command options as when mixing languages in a regular (non-LTO) compilation. </p> <p>If object files containing GIMPLE bytecode are stored in a library archive, say <samp class="file">libfoo.a</samp>, it is possible to extract and use them in an LTO link if you are using a linker with plugin support. To create static libraries suitable for LTO, use <code class="command">gcc-ar</code> and <code class="command">gcc-ranlib</code> instead of <code class="command">ar</code> and <code class="command">ranlib</code>; to show the symbols of object files with GIMPLE bytecode, use <code class="command">gcc-nm</code>. Those commands require that <code class="command">ar</code>, <code class="command">ranlib</code> and <code class="command">nm</code> have been compiled with plugin support. At link time, use the flag <samp class="option">-fuse-linker-plugin</samp> to ensure that the library participates in the LTO optimization process: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo</pre> +</div> <p>With the linker plugin enabled, the linker extracts the needed GIMPLE files from <samp class="file">libfoo.a</samp> and passes them on to the running GCC to make them part of the aggregated GIMPLE image to be optimized. </p> <p>If you are not using a linker with plugin support and/or do not enable the linker plugin, then the objects inside <samp class="file">libfoo.a</samp> are extracted and linked as usual, but they do not participate in the LTO optimization process. In order to make a static library suitable for both LTO optimization and usual linkage, compile its object files with <samp class="option">-flto</samp> <samp class="option">-ffat-lto-objects</samp>. </p> <p>Link-time optimizations do not require the presence of the whole program to operate. If the program does not require any symbols to be exported, it is possible to combine <samp class="option">-flto</samp> and <samp class="option">-fwhole-program</samp> to allow the interprocedural optimizers to use more aggressive assumptions which may lead to improved optimization opportunities. Use of <samp class="option">-fwhole-program</samp> is not needed when linker plugin is active (see <samp class="option">-fuse-linker-plugin</samp>). </p> <p>The current implementation of LTO makes no attempt to generate bytecode that is portable between different types of hosts. The bytecode files are versioned and there is a strict version check, so bytecode files generated in one version of GCC do not work with an older or newer version of GCC. </p> <p>Link-time optimization does not work well with generation of debugging information on systems other than those using a combination of ELF and DWARF. </p> <p>If you specify the optional <var class="var">n</var>, the optimization and code generation done at link time is executed in parallel using <var class="var">n</var> parallel jobs by utilizing an installed <code class="command">make</code> program. The environment variable <code class="env">MAKE</code> may be used to override the program used. </p> <p>You can also specify <samp class="option">-flto=jobserver</samp> to use GNU make’s job server mode to determine the number of parallel jobs. This is useful when the Makefile calling GCC is already executing in parallel. You must prepend a ‘<samp class="samp">+</samp>’ to the command recipe in the parent Makefile for this to work. This option likely only works if <code class="env">MAKE</code> is GNU make. Even without the option value, GCC tries to automatically detect a running GNU make’s job server. </p> <p>Use <samp class="option">-flto=auto</samp> to use GNU make’s job server, if available, or otherwise fall back to autodetection of the number of CPU threads present in your system. </p> </dd> <dt> +<span><code class="code">-flto-partition=<var class="var">alg</var></code><a class="copiable-link" href="#index-flto-partition"> ¶</a></span> +</dt> <dd> +<p>Specify the partitioning algorithm used by the link-time optimizer. The value is either ‘<samp class="samp">1to1</samp>’ to specify a partitioning mirroring the original source files or ‘<samp class="samp">balanced</samp>’ to specify partitioning into equally sized chunks (whenever possible) or ‘<samp class="samp">max</samp>’ to create new partition for every symbol where possible. Specifying ‘<samp class="samp">none</samp>’ as an algorithm disables partitioning and streaming completely. The default value is ‘<samp class="samp">balanced</samp>’. While ‘<samp class="samp">1to1</samp>’ can be used as an workaround for various code ordering issues, the ‘<samp class="samp">max</samp>’ partitioning is intended for internal testing only. The value ‘<samp class="samp">one</samp>’ specifies that exactly one partition should be used while the value ‘<samp class="samp">none</samp>’ bypasses partitioning and executes the link-time optimization step directly from the WPA phase. </p> </dd> <dt> +<span><code class="code">-flto-compression-level=<var class="var">n</var></code><a class="copiable-link" href="#index-flto-compression-level"> ¶</a></span> +</dt> <dd> +<p>This option specifies the level of compression used for intermediate language written to LTO object files, and is only meaningful in conjunction with LTO mode (<samp class="option">-flto</samp>). GCC currently supports two LTO compression algorithms. For zstd, valid values are 0 (no compression) to 19 (maximum compression), while zlib supports values from 0 to 9. Values outside this range are clamped to either minimum or maximum of the supported values. If the option is not given, a default balanced compression setting is used. </p> </dd> <dt> +<span><code class="code">-fuse-linker-plugin</code><a class="copiable-link" href="#index-fuse-linker-plugin"> ¶</a></span> +</dt> <dd> +<p>Enables the use of a linker plugin during link-time optimization. This option relies on plugin support in the linker, which is available in gold or in GNU ld 2.21 or newer. </p> <p>This option enables the extraction of object files with GIMPLE bytecode out of library archives. This improves the quality of optimization by exposing more code to the link-time optimizer. This information specifies what symbols can be accessed externally (by non-LTO object or during dynamic linking). Resulting code quality improvements on binaries (and shared libraries that use hidden visibility) are similar to <samp class="option">-fwhole-program</samp>. See <samp class="option">-flto</samp> for a description of the effect of this flag and how to use it. </p> <p>This option is enabled by default when LTO support in GCC is enabled and GCC was configured for use with a linker supporting plugins (GNU ld 2.21 or newer or gold). </p> </dd> <dt> +<span><code class="code">-ffat-lto-objects</code><a class="copiable-link" href="#index-ffat-lto-objects"> ¶</a></span> +</dt> <dd> +<p>Fat LTO objects are object files that contain both the intermediate language and the object code. This makes them usable for both LTO linking and normal linking. This option is effective only when compiling with <samp class="option">-flto</samp> and is ignored at link time. </p> <p><samp class="option">-fno-fat-lto-objects</samp> improves compilation time over plain LTO, but requires the complete toolchain to be aware of LTO. It requires a linker with linker plugin support for basic functionality. Additionally, <code class="command">nm</code>, <code class="command">ar</code> and <code class="command">ranlib</code> need to support linker plugins to allow a full-featured build environment (capable of building static libraries etc). GCC provides the <code class="command">gcc-ar</code>, <code class="command">gcc-nm</code>, <code class="command">gcc-ranlib</code> wrappers to pass the right options to these tools. With non fat LTO makefiles need to be modified to use them. </p> <p>Note that modern binutils provide plugin auto-load mechanism. Installing the linker plugin into <samp class="file">$libdir/bfd-plugins</samp> has the same effect as usage of the command wrappers (<code class="command">gcc-ar</code>, <code class="command">gcc-nm</code> and <code class="command">gcc-ranlib</code>). </p> <p>The default is <samp class="option">-fno-fat-lto-objects</samp> on targets with linker plugin support. </p> </dd> <dt> +<span><code class="code">-fcompare-elim</code><a class="copiable-link" href="#index-fcompare-elim"> ¶</a></span> +</dt> <dd> +<p>After register allocation and post-register allocation instruction splitting, identify arithmetic instructions that compute processor flags similar to a comparison operation based on that arithmetic. If possible, eliminate the explicit comparison operation. </p> <p>This pass only applies to certain targets that cannot explicitly represent the comparison operation before register allocation is complete. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fcprop-registers</code><a class="copiable-link" href="#index-fcprop-registers"> ¶</a></span> +</dt> <dd> +<p>After register allocation and post-register allocation instruction splitting, perform a copy-propagation pass to try to reduce scheduling dependencies and occasionally eliminate the copy. </p> <p>Enabled at levels <samp class="option">-O1</samp>, <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-fprofile-correction</code><a class="copiable-link" href="#index-fprofile-correction"> ¶</a></span> +</dt> <dd> +<p>Profiles collected using an instrumented binary for multi-threaded programs may be inconsistent due to missed counter updates. When this option is specified, GCC uses heuristics to correct or smooth out such inconsistencies. By default, GCC emits an error message when an inconsistent profile is detected. </p> <p>This option is enabled by <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-fprofile-partial-training</code><a class="copiable-link" href="#index-fprofile-partial-training"> ¶</a></span> +</dt> <dd> +<p>With <code class="code">-fprofile-use</code> all portions of programs not executed during train run are optimized agressively for size rather than speed. In some cases it is not practical to train all possible hot paths in the program. (For example, program may contain functions specific for a given hardware and trianing may not cover all hardware configurations program is run on.) With <code class="code">-fprofile-partial-training</code> profile feedback will be ignored for all functions not executed during the train run leading them to be optimized as if they were compiled without profile feedback. This leads to better performance when train run is not representative but also leads to significantly bigger code. </p> </dd> <dt> +<span><code class="code">-fprofile-use</code><a class="copiable-link" href="#index-fprofile-use"> ¶</a></span> +</dt> <dt><code class="code">-fprofile-use=<var class="var">path</var></code></dt> <dd> +<p>Enable profile feedback-directed optimizations, and the following optimizations, many of which are generally profitable only with profile feedback available: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fbranch-probabilities -fprofile-values +-funroll-loops -fpeel-loops -ftracer -fvpt +-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp +-fpredictive-commoning -fsplit-loops -funswitch-loops +-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize +-fvect-cost-model=dynamic -ftree-loop-distribute-patterns +-fprofile-reorder-functions</pre> +</div> <p>Before you can use this option, you must first generate profiling information. See <a class="xref" href="instrumentation-options">Program Instrumentation Options</a>, for information about the <samp class="option">-fprofile-generate</samp> option. </p> <p>By default, GCC emits an error message if the feedback profiles do not match the source code. This error can be turned into a warning by using <samp class="option">-Wno-error=coverage-mismatch</samp>. Note this may result in poorly optimized code. Additionally, by default, GCC also emits a warning message if the feedback profiles do not exist (see <samp class="option">-Wmissing-profile</samp>). </p> <p>If <var class="var">path</var> is specified, GCC looks at the <var class="var">path</var> to find the profile feedback data files. See <samp class="option">-fprofile-dir</samp>. </p> </dd> <dt> +<span><code class="code">-fauto-profile</code><a class="copiable-link" href="#index-fauto-profile"> ¶</a></span> +</dt> <dt><code class="code">-fauto-profile=<var class="var">path</var></code></dt> <dd> +<p>Enable sampling-based feedback-directed optimizations, and the following optimizations, many of which are generally profitable only with profile feedback available: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fbranch-probabilities -fprofile-values +-funroll-loops -fpeel-loops -ftracer -fvpt +-finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp +-fpredictive-commoning -fsplit-loops -funswitch-loops +-fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize +-fvect-cost-model=dynamic -ftree-loop-distribute-patterns +-fprofile-correction</pre> +</div> <p><var class="var">path</var> is the name of a file containing AutoFDO profile information. If omitted, it defaults to <samp class="file">fbdata.afdo</samp> in the current directory. </p> <p>Producing an AutoFDO profile data file requires running your program with the <code class="command">perf</code> utility on a supported GNU/Linux target system. For more information, see <a class="uref" href="https://perf.wiki.kernel.org/">https://perf.wiki.kernel.org/</a>. </p> <p>E.g. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">perf record -e br_inst_retired:near_taken -b -o perf.data \ + -- your_program</pre> +</div> <p>Then use the <code class="command">create_gcov</code> tool to convert the raw profile data to a format that can be used by GCC. You must also supply the unstripped binary for your program to this tool. See <a class="uref" href="https://github.com/google/autofdo">https://github.com/google/autofdo</a>. </p> <p>E.g. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">create_gcov --binary=your_program.unstripped --profile=perf.data \ + --gcov=profile.afdo</pre> +</div> </dd> </dl> <p>The following options control compiler behavior regarding floating-point arithmetic. These options trade off between speed and correctness. All must be specifically enabled. </p> <dl class="table"> <dt> +<span><code class="code">-ffloat-store</code><a class="copiable-link" href="#index-ffloat-store"> ¶</a></span> +</dt> <dd> +<p>Do not store floating-point variables in registers, and inhibit other options that might change whether a floating-point value is taken from a register or memory. </p> <p>This option prevents undesirable excess precision on machines such as the 68000 where the floating registers (of the 68881) keep more precision than a <code class="code">double</code> is supposed to have. Similarly for the x86 architecture. For most programs, the excess precision does only good, but a few programs rely on the precise definition of IEEE floating point. Use <samp class="option">-ffloat-store</samp> for such programs, after modifying them to store all pertinent intermediate computations into variables. </p> </dd> <dt> +<span><code class="code">-fexcess-precision=<var class="var">style</var></code><a class="copiable-link" href="#index-fexcess-precision"> ¶</a></span> +</dt> <dd> +<p>This option allows further control over excess precision on machines where floating-point operations occur in a format with more precision or range than the IEEE standard and interchange floating-point types. By default, <samp class="option">-fexcess-precision=fast</samp> is in effect; this means that operations may be carried out in a wider precision than the types specified in the source if that would result in faster code, and it is unpredictable when rounding to the types specified in the source code takes place. When compiling C or C++, if <samp class="option">-fexcess-precision=standard</samp> is specified then excess precision follows the rules specified in ISO C99 or C++; in particular, both casts and assignments cause values to be rounded to their semantic types (whereas <samp class="option">-ffloat-store</samp> only affects assignments). This option is enabled by default for C or C++ if a strict conformance option such as <samp class="option">-std=c99</samp> or <samp class="option">-std=c++17</samp> is used. <samp class="option">-ffast-math</samp> enables <samp class="option">-fexcess-precision=fast</samp> by default regardless of whether a strict conformance option is used. </p> <p><samp class="option">-fexcess-precision=standard</samp> is not implemented for languages other than C or C++. On the x86, it has no effect if <samp class="option">-mfpmath=sse</samp> or <samp class="option">-mfpmath=sse+387</samp> is specified; in the former case, IEEE semantics apply without excess precision, and in the latter, rounding is unpredictable. </p> </dd> <dt> +<span><code class="code">-ffast-math</code><a class="copiable-link" href="#index-ffast-math"> ¶</a></span> +</dt> <dd> +<p>Sets the options <samp class="option">-fno-math-errno</samp>, <samp class="option">-funsafe-math-optimizations</samp>, <samp class="option">-ffinite-math-only</samp>, <samp class="option">-fno-rounding-math</samp>, <samp class="option">-fno-signaling-nans</samp>, <samp class="option">-fcx-limited-range</samp> and <samp class="option">-fexcess-precision=fast</samp>. </p> <p>This option causes the preprocessor macro <code class="code">__FAST_MATH__</code> to be defined. </p> <p>This option is not turned on by any <samp class="option">-O</samp> option besides <samp class="option">-Ofast</samp> since it can result in incorrect output for programs that depend on an exact implementation of IEEE or ISO rules/specifications for math functions. It may, however, yield faster code for programs that do not require the guarantees of these specifications. </p> </dd> <dt> + <span><code class="code">-fno-math-errno</code><a class="copiable-link" href="#index-fno-math-errno"> ¶</a></span> +</dt> <dd> +<p>Do not set <code class="code">errno</code> after calling math functions that are executed with a single instruction, e.g., <code class="code">sqrt</code>. A program that relies on IEEE exceptions for math error handling may want to use this flag for speed while maintaining IEEE arithmetic compatibility. </p> <p>This option is not turned on by any <samp class="option">-O</samp> option since it can result in incorrect output for programs that depend on an exact implementation of IEEE or ISO rules/specifications for math functions. It may, however, yield faster code for programs that do not require the guarantees of these specifications. </p> <p>The default is <samp class="option">-fmath-errno</samp>. </p> <p>On Darwin systems, the math library never sets <code class="code">errno</code>. There is therefore no reason for the compiler to consider the possibility that it might, and <samp class="option">-fno-math-errno</samp> is the default. </p> </dd> <dt> +<span><code class="code">-funsafe-math-optimizations</code><a class="copiable-link" href="#index-funsafe-math-optimizations"> ¶</a></span> +</dt> <dd> <p>Allow optimizations for floating-point arithmetic that (a) assume that arguments and results are valid and (b) may violate IEEE or ANSI standards. When used at link time, it may include libraries or startup files that change the default FPU control word or other similar optimizations. </p> <p>This option is not turned on by any <samp class="option">-O</samp> option since it can result in incorrect output for programs that depend on an exact implementation of IEEE or ISO rules/specifications for math functions. It may, however, yield faster code for programs that do not require the guarantees of these specifications. Enables <samp class="option">-fno-signed-zeros</samp>, <samp class="option">-fno-trapping-math</samp>, <samp class="option">-fassociative-math</samp> and <samp class="option">-freciprocal-math</samp>. </p> <p>The default is <samp class="option">-fno-unsafe-math-optimizations</samp>. </p> </dd> <dt> +<span><code class="code">-fassociative-math</code><a class="copiable-link" href="#index-fassociative-math"> ¶</a></span> +</dt> <dd> <p>Allow re-association of operands in series of floating-point operations. This violates the ISO C and C++ language standard by possibly changing computation result. NOTE: re-ordering may change the sign of zero as well as ignore NaNs and inhibit or create underflow or overflow (and thus cannot be used on code that relies on rounding behavior like <code class="code">(x + 2**52) - 2**52</code>. May also reorder floating-point comparisons and thus may not be used when ordered comparisons are required. This option requires that both <samp class="option">-fno-signed-zeros</samp> and <samp class="option">-fno-trapping-math</samp> be in effect. Moreover, it doesn’t make much sense with <samp class="option">-frounding-math</samp>. For Fortran the option is automatically enabled when both <samp class="option">-fno-signed-zeros</samp> and <samp class="option">-fno-trapping-math</samp> are in effect. </p> <p>The default is <samp class="option">-fno-associative-math</samp>. </p> </dd> <dt> +<span><code class="code">-freciprocal-math</code><a class="copiable-link" href="#index-freciprocal-math"> ¶</a></span> +</dt> <dd> <p>Allow the reciprocal of a value to be used instead of dividing by the value if this enables optimizations. For example <code class="code">x / y</code> can be replaced with <code class="code">x * (1/y)</code>, which is useful if <code class="code">(1/y)</code> is subject to common subexpression elimination. Note that this loses precision and increases the number of flops operating on the value. </p> <p>The default is <samp class="option">-fno-reciprocal-math</samp>. </p> </dd> <dt> +<span><code class="code">-ffinite-math-only</code><a class="copiable-link" href="#index-ffinite-math-only"> ¶</a></span> +</dt> <dd> +<p>Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or +-Infs. </p> <p>This option is not turned on by any <samp class="option">-O</samp> option since it can result in incorrect output for programs that depend on an exact implementation of IEEE or ISO rules/specifications for math functions. It may, however, yield faster code for programs that do not require the guarantees of these specifications. </p> <p>The default is <samp class="option">-fno-finite-math-only</samp>. </p> </dd> <dt> + <span><code class="code">-fno-signed-zeros</code><a class="copiable-link" href="#index-fno-signed-zeros"> ¶</a></span> +</dt> <dd> +<p>Allow optimizations for floating-point arithmetic that ignore the signedness of zero. IEEE arithmetic specifies the behavior of distinct +0.0 and −0.0 values, which then prohibits simplification of expressions such as x+0.0 or 0.0*x (even with <samp class="option">-ffinite-math-only</samp>). This option implies that the sign of a zero result isn’t significant. </p> <p>The default is <samp class="option">-fsigned-zeros</samp>. </p> </dd> <dt> + <span><code class="code">-fno-trapping-math</code><a class="copiable-link" href="#index-fno-trapping-math"> ¶</a></span> +</dt> <dd> +<p>Compile code assuming that floating-point operations cannot generate user-visible traps. These traps include division by zero, overflow, underflow, inexact result and invalid operation. This option requires that <samp class="option">-fno-signaling-nans</samp> be in effect. Setting this option may allow faster code if one relies on “non-stop” IEEE arithmetic, for example. </p> <p>This option should never be turned on by any <samp class="option">-O</samp> option since it can result in incorrect output for programs that depend on an exact implementation of IEEE or ISO rules/specifications for math functions. </p> <p>The default is <samp class="option">-ftrapping-math</samp>. </p> <p>Future versions of GCC may provide finer control of this setting using C99’s <code class="code">FENV_ACCESS</code> pragma. This command-line option will be used along with <samp class="option">-frounding-math</samp> to specify the default state for <code class="code">FENV_ACCESS</code>. </p> </dd> <dt> +<span><code class="code">-frounding-math</code><a class="copiable-link" href="#index-frounding-math"> ¶</a></span> +</dt> <dd> +<p>Disable transformations and optimizations that assume default floating-point rounding behavior. This is round-to-zero for all floating point to integer conversions, and round-to-nearest for all other arithmetic truncations. This option should be specified for programs that change the FP rounding mode dynamically, or that may be executed with a non-default rounding mode. This option disables constant folding of floating-point expressions at compile time (which may be affected by rounding mode) and arithmetic transformations that are unsafe in the presence of sign-dependent rounding modes. </p> <p>The default is <samp class="option">-fno-rounding-math</samp>. </p> <p>This option is experimental and does not currently guarantee to disable all GCC optimizations that are affected by rounding mode. Future versions of GCC may provide finer control of this setting using C99’s <code class="code">FENV_ACCESS</code> pragma. This command-line option will be used along with <samp class="option">-ftrapping-math</samp> to specify the default state for <code class="code">FENV_ACCESS</code>. </p> </dd> <dt> +<span><code class="code">-fsignaling-nans</code><a class="copiable-link" href="#index-fsignaling-nans"> ¶</a></span> +</dt> <dd> +<p>Compile code assuming that IEEE signaling NaNs may generate user-visible traps during floating-point operations. Setting this option disables optimizations that may change the number of exceptions visible with signaling NaNs. This option implies <samp class="option">-ftrapping-math</samp>. </p> <p>This option causes the preprocessor macro <code class="code">__SUPPORT_SNAN__</code> to be defined. </p> <p>The default is <samp class="option">-fno-signaling-nans</samp>. </p> <p>This option is experimental and does not currently guarantee to disable all GCC optimizations that affect signaling NaN behavior. </p> </dd> <dt> + <span><code class="code">-fno-fp-int-builtin-inexact</code><a class="copiable-link" href="#index-fno-fp-int-builtin-inexact"> ¶</a></span> +</dt> <dd> +<p>Do not allow the built-in functions <code class="code">ceil</code>, <code class="code">floor</code>, <code class="code">round</code> and <code class="code">trunc</code>, and their <code class="code">float</code> and <code class="code">long +double</code> variants, to generate code that raises the “inexact” floating-point exception for noninteger arguments. ISO C99 and C11 allow these functions to raise the “inexact” exception, but ISO/IEC TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into ISO C2X, does not allow these functions to do so. </p> <p>The default is <samp class="option">-ffp-int-builtin-inexact</samp>, allowing the exception to be raised, unless C2X or a later C standard is selected. This option does nothing unless <samp class="option">-ftrapping-math</samp> is in effect. </p> <p>Even if <samp class="option">-fno-fp-int-builtin-inexact</samp> is used, if the functions generate a call to a library function then the “inexact” exception may be raised if the library implementation does not follow TS 18661. </p> </dd> <dt> +<span><code class="code">-fsingle-precision-constant</code><a class="copiable-link" href="#index-fsingle-precision-constant"> ¶</a></span> +</dt> <dd> +<p>Treat floating-point constants as single precision instead of implicitly converting them to double-precision constants. </p> </dd> <dt> +<span><code class="code">-fcx-limited-range</code><a class="copiable-link" href="#index-fcx-limited-range"> ¶</a></span> +</dt> <dd> +<p>When enabled, this option states that a range reduction step is not needed when performing complex division. Also, there is no checking whether the result of a complex multiplication or division is <code class="code">NaN ++ I*NaN</code>, with an attempt to rescue the situation in that case. The default is <samp class="option">-fno-cx-limited-range</samp>, but is enabled by <samp class="option">-ffast-math</samp>. </p> <p>This option controls the default setting of the ISO C99 <code class="code">CX_LIMITED_RANGE</code> pragma. Nevertheless, the option applies to all languages. </p> </dd> <dt> +<span><code class="code">-fcx-fortran-rules</code><a class="copiable-link" href="#index-fcx-fortran-rules"> ¶</a></span> +</dt> <dd> +<p>Complex multiplication and division follow Fortran rules. Range reduction is done as part of complex division, but there is no checking whether the result of a complex multiplication or division is <code class="code">NaN ++ I*NaN</code>, with an attempt to rescue the situation in that case. </p> <p>The default is <samp class="option">-fno-cx-fortran-rules</samp>. </p> </dd> </dl> <p>The following options control optimizations that may improve performance, but are not enabled by any <samp class="option">-O</samp> options. This section includes experimental options that may produce broken code. </p> <dl class="table"> <dt> +<span><code class="code">-fbranch-probabilities</code><a class="copiable-link" href="#index-fbranch-probabilities"> ¶</a></span> +</dt> <dd> +<p>After running a program compiled with <samp class="option">-fprofile-arcs</samp> (see <a class="pxref" href="instrumentation-options">Program Instrumentation Options</a>), you can compile it a second time using <samp class="option">-fbranch-probabilities</samp>, to improve optimizations based on the number of times each branch was taken. When a program compiled with <samp class="option">-fprofile-arcs</samp> exits, it saves arc execution counts to a file called <samp class="file"><var class="var">sourcename</var>.gcda</samp> for each source file. The information in this data file is very dependent on the structure of the generated code, so you must use the same source code and the same optimization options for both compilations. See details about the file naming in <samp class="option">-fprofile-arcs</samp>. </p> <p>With <samp class="option">-fbranch-probabilities</samp>, GCC puts a ‘<samp class="samp">REG_BR_PROB</samp>’ note on each ‘<samp class="samp">JUMP_INSN</samp>’ and ‘<samp class="samp">CALL_INSN</samp>’. These can be used to improve optimization. Currently, they are only used in one place: in <samp class="file">reorg.cc</samp>, instead of guessing which path a branch is most likely to take, the ‘<samp class="samp">REG_BR_PROB</samp>’ values are used to exactly determine which path is taken more often. </p> <p>Enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-fprofile-values</code><a class="copiable-link" href="#index-fprofile-values"> ¶</a></span> +</dt> <dd> +<p>If combined with <samp class="option">-fprofile-arcs</samp>, it adds code so that some data about values of expressions in the program is gathered. </p> <p>With <samp class="option">-fbranch-probabilities</samp>, it reads back the data gathered from profiling values of expressions for usage in optimizations. </p> <p>Enabled by <samp class="option">-fprofile-generate</samp>, <samp class="option">-fprofile-use</samp>, and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-fprofile-reorder-functions</code><a class="copiable-link" href="#index-fprofile-reorder-functions"> ¶</a></span> +</dt> <dd> +<p>Function reordering based on profile instrumentation collects first time of execution of a function and orders these functions in ascending order. </p> <p>Enabled with <samp class="option">-fprofile-use</samp>. </p> </dd> <dt> +<span><code class="code">-fvpt</code><a class="copiable-link" href="#index-fvpt"> ¶</a></span> +</dt> <dd> +<p>If combined with <samp class="option">-fprofile-arcs</samp>, this option instructs the compiler to add code to gather information about values of expressions. </p> <p>With <samp class="option">-fbranch-probabilities</samp>, it reads back the data gathered and actually performs the optimizations based on them. Currently the optimizations include specialization of division operations using the knowledge about the value of the denominator. </p> <p>Enabled with <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-frename-registers</code><a class="copiable-link" href="#index-frename-registers"> ¶</a></span> +</dt> <dd> +<p>Attempt to avoid false dependencies in scheduled code by making use of registers left over after register allocation. This optimization most benefits processors with lots of registers. Depending on the debug information format adopted by the target, however, it can make debugging impossible, since variables no longer stay in a “home register”. </p> <p>Enabled by default with <samp class="option">-funroll-loops</samp>. </p> </dd> <dt> +<span><code class="code">-fschedule-fusion</code><a class="copiable-link" href="#index-fschedule-fusion"> ¶</a></span> +</dt> <dd> +<p>Performs a target dependent pass over the instruction stream to schedule instructions of same type together because target machine can execute them more efficiently if they are adjacent to each other in the instruction flow. </p> <p>Enabled at levels <samp class="option">-O2</samp>, <samp class="option">-O3</samp>, <samp class="option">-Os</samp>. </p> </dd> <dt> +<span><code class="code">-ftracer</code><a class="copiable-link" href="#index-ftracer"> ¶</a></span> +</dt> <dd> +<p>Perform tail duplication to enlarge superblock size. This transformation simplifies the control flow of the function allowing other optimizations to do a better job. </p> <p>Enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-funroll-loops</code><a class="copiable-link" href="#index-funroll-loops"> ¶</a></span> +</dt> <dd> +<p>Unroll loops whose number of iterations can be determined at compile time or upon entry to the loop. <samp class="option">-funroll-loops</samp> implies <samp class="option">-frerun-cse-after-loop</samp>, <samp class="option">-fweb</samp> and <samp class="option">-frename-registers</samp>. It also turns on complete loop peeling (i.e. complete removal of loops with a small constant number of iterations). This option makes code larger, and may or may not make it run faster. </p> <p>Enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-funroll-all-loops</code><a class="copiable-link" href="#index-funroll-all-loops"> ¶</a></span> +</dt> <dd> +<p>Unroll all loops, even if their number of iterations is uncertain when the loop is entered. This usually makes programs run more slowly. <samp class="option">-funroll-all-loops</samp> implies the same options as <samp class="option">-funroll-loops</samp>. </p> </dd> <dt> +<span><code class="code">-fpeel-loops</code><a class="copiable-link" href="#index-fpeel-loops"> ¶</a></span> +</dt> <dd> +<p>Peels loops for which there is enough information that they do not roll much (from profile feedback or static analysis). It also turns on complete loop peeling (i.e. complete removal of loops with small constant number of iterations). </p> <p>Enabled by <samp class="option">-O3</samp>, <samp class="option">-fprofile-use</samp>, and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-fmove-loop-invariants</code><a class="copiable-link" href="#index-fmove-loop-invariants"> ¶</a></span> +</dt> <dd> +<p>Enables the loop invariant motion pass in the RTL loop optimizer. Enabled at level <samp class="option">-O1</samp> and higher, except for <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-fmove-loop-stores</code><a class="copiable-link" href="#index-fmove-loop-stores"> ¶</a></span> +</dt> <dd> +<p>Enables the loop store motion pass in the GIMPLE loop optimizer. This moves invariant stores to after the end of the loop in exchange for carrying the stored value in a register across the iteration. Note for this option to have an effect <samp class="option">-ftree-loop-im</samp> has to be enabled as well. Enabled at level <samp class="option">-O1</samp> and higher, except for <samp class="option">-Og</samp>. </p> </dd> <dt> +<span><code class="code">-fsplit-loops</code><a class="copiable-link" href="#index-fsplit-loops"> ¶</a></span> +</dt> <dd> +<p>Split a loop into two if it contains a condition that’s always true for one side of the iteration space and false for the other. </p> <p>Enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-funswitch-loops</code><a class="copiable-link" href="#index-funswitch-loops"> ¶</a></span> +</dt> <dd> +<p>Move branches with loop invariant conditions out of the loop, with duplicates of the loop on both branches (modified according to result of the condition). </p> <p>Enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> +<span><code class="code">-fversion-loops-for-strides</code><a class="copiable-link" href="#index-fversion-loops-for-strides"> ¶</a></span> +</dt> <dd> +<p>If a loop iterates over an array with a variable stride, create another version of the loop that assumes the stride is always one. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">for (int i = 0; i < n; ++i) + x[i * stride] = …;</pre> +</div> <p>becomes: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (stride == 1) + for (int i = 0; i < n; ++i) + x[i] = …; +else + for (int i = 0; i < n; ++i) + x[i * stride] = …;</pre> +</div> <p>This is particularly useful for assumed-shape arrays in Fortran where (for example) it allows better vectorization assuming contiguous accesses. This flag is enabled by default at <samp class="option">-O3</samp>. It is also enabled by <samp class="option">-fprofile-use</samp> and <samp class="option">-fauto-profile</samp>. </p> </dd> <dt> + <span><code class="code">-ffunction-sections</code><a class="copiable-link" href="#index-ffunction-sections"> ¶</a></span> +</dt> <dt><code class="code">-fdata-sections</code></dt> <dd> +<p>Place each function or data item into its own section in the output file if the target supports arbitrary sections. The name of the function or the name of the data item determines the section’s name in the output file. </p> <p>Use these options on systems where the linker can perform optimizations to improve locality of reference in the instruction space. Most systems using the ELF object format have linkers with such optimizations. On AIX, the linker rearranges sections (CSECTs) based on the call graph. The performance impact varies. </p> <p>Together with a linker garbage collection (linker <samp class="option">--gc-sections</samp> option) these options may lead to smaller statically-linked executables (after stripping). </p> <p>On ELF/DWARF systems these options do not degenerate the quality of the debug information. There could be issues with other object files/debug info formats. </p> <p>Only use these options when there are significant benefits from doing so. When you specify these options, the assembler and linker create larger object and executable files and are also slower. These options affect code generation. They prevent optimizations by the compiler and assembler using relative locations inside a translation unit since the locations are unknown until link time. An example of such an optimization is relaxing calls to short call instructions. </p> </dd> <dt> +<span><code class="code">-fstdarg-opt</code><a class="copiable-link" href="#index-fstdarg-opt"> ¶</a></span> +</dt> <dd> +<p>Optimize the prologue of variadic argument functions with respect to usage of those arguments. </p> </dd> <dt> +<span><code class="code">-fsection-anchors</code><a class="copiable-link" href="#index-fsection-anchors"> ¶</a></span> +</dt> <dd> +<p>Try to reduce the number of symbolic address calculations by using shared “anchor” symbols to address nearby objects. This transformation can help to reduce the number of GOT entries and GOT accesses on some targets. </p> <p>For example, the implementation of the following function <code class="code">foo</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static int a, b, c; +int foo (void) { return a + b + c; }</pre> +</div> <p>usually calculates the addresses of all three variables, but if you compile it with <samp class="option">-fsection-anchors</samp>, it accesses the variables from a common anchor point instead. The effect is similar to the following pseudocode (which isn’t valid C): </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int foo (void) +{ + register int *xr = &x; + return xr[&a - &x] + xr[&b - &x] + xr[&c - &x]; +}</pre> +</div> <p>Not all targets support this option. </p> </dd> <dt> +<span><code class="code">-fzero-call-used-regs=<var class="var">choice</var></code><a class="copiable-link" href="#index-fzero-call-used-regs"> ¶</a></span> +</dt> <dd> +<p>Zero call-used registers at function return to increase program security by either mitigating Return-Oriented Programming (ROP) attacks or preventing information leakage through registers. </p> <p>The possible values of <var class="var">choice</var> are the same as for the <code class="code">zero_call_used_regs</code> attribute (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). The default is ‘<samp class="samp">skip</samp>’. </p> <p>You can control this behavior for a specific function by using the function attribute <code class="code">zero_call_used_regs</code> (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> </dd> <dt> +<span><code class="code">--param <var class="var">name</var>=<var class="var">value</var></code><a class="copiable-link" href="#index-param"> ¶</a></span> +</dt> <dd> +<p>In some places, GCC uses various constants to control the amount of optimization that is done. For example, GCC does not inline functions that contain more than a certain number of instructions. You can control some of these constants on the command line using the <samp class="option">--param</samp> option. </p> <p>The names of specific parameters, and the meaning of the values, are tied to the internals of the compiler, and are subject to change without notice in future releases. </p> <p>In order to get the minimal, maximal and default values of a parameter, use the <samp class="option">--help=param -Q</samp> options. </p> <p>In each case, the <var class="var">value</var> is an integer. The following choices of <var class="var">name</var> are recognized for all targets: </p> <dl class="table"> <dt><code class="code">predictable-branch-outcome</code></dt> <dd> +<p>When branch is predicted to be taken with probability lower than this threshold (in percent), then it is considered well predictable. </p> </dd> <dt><code class="code">max-rtl-if-conversion-insns</code></dt> <dd> +<p>RTL if-conversion tries to remove conditional branches around a block and replace them with conditionally executed instructions. This parameter gives the maximum number of instructions in a block which should be considered for if-conversion. The compiler will also use other heuristics to decide whether if-conversion is likely to be profitable. </p> </dd> <dt><code class="code">max-rtl-if-conversion-predictable-cost</code></dt> <dd> +<p>RTL if-conversion will try to remove conditional branches around a block and replace them with conditionally executed instructions. These parameters give the maximum permissible cost for the sequence that would be generated by if-conversion depending on whether the branch is statically determined to be predictable or not. The units for this parameter are the same as those for the GCC internal seq_cost metric. The compiler will try to provide a reasonable default for this parameter using the BRANCH_COST target macro. </p> </dd> <dt><code class="code">max-crossjump-edges</code></dt> <dd> +<p>The maximum number of incoming edges to consider for cross-jumping. The algorithm used by <samp class="option">-fcrossjumping</samp> is <em class="math">O(N^2)</em> in the number of edges incoming to each block. Increasing values mean more aggressive optimization, making the compilation time increase with probably small improvement in executable size. </p> </dd> <dt><code class="code">min-crossjump-insns</code></dt> <dd> +<p>The minimum number of instructions that must be matched at the end of two blocks before cross-jumping is performed on them. This value is ignored in the case where all instructions in the block being cross-jumped from are matched. </p> </dd> <dt><code class="code">max-grow-copy-bb-insns</code></dt> <dd> +<p>The maximum code size expansion factor when copying basic blocks instead of jumping. The expansion is relative to a jump instruction. </p> </dd> <dt><code class="code">max-goto-duplication-insns</code></dt> <dd> +<p>The maximum number of instructions to duplicate to a block that jumps to a computed goto. To avoid <em class="math">O(N^2)</em> behavior in a number of passes, GCC factors computed gotos early in the compilation process, and unfactors them as late as possible. Only computed jumps at the end of a basic blocks with no more than max-goto-duplication-insns are unfactored. </p> </dd> <dt><code class="code">max-delay-slot-insn-search</code></dt> <dd> +<p>The maximum number of instructions to consider when looking for an instruction to fill a delay slot. If more than this arbitrary number of instructions are searched, the time savings from filling the delay slot are minimal, so stop searching. Increasing values mean more aggressive optimization, making the compilation time increase with probably small improvement in execution time. </p> </dd> <dt><code class="code">max-delay-slot-live-search</code></dt> <dd> +<p>When trying to fill delay slots, the maximum number of instructions to consider when searching for a block with valid live register information. Increasing this arbitrarily chosen value means more aggressive optimization, increasing the compilation time. This parameter should be removed when the delay slot code is rewritten to maintain the control-flow graph. </p> </dd> <dt><code class="code">max-gcse-memory</code></dt> <dd> +<p>The approximate maximum amount of memory in <code class="code">kB</code> that can be allocated in order to perform the global common subexpression elimination optimization. If more memory than specified is required, the optimization is not done. </p> </dd> <dt><code class="code">max-gcse-insertion-ratio</code></dt> <dd> +<p>If the ratio of expression insertions to deletions is larger than this value for any expression, then RTL PRE inserts or removes the expression and thus leaves partially redundant computations in the instruction stream. </p> </dd> <dt><code class="code">max-pending-list-length</code></dt> <dd> +<p>The maximum number of pending dependencies scheduling allows before flushing the current state and starting over. Large functions with few branches or calls can create excessively large lists which needlessly consume memory and resources. </p> </dd> <dt><code class="code">max-modulo-backtrack-attempts</code></dt> <dd> +<p>The maximum number of backtrack attempts the scheduler should make when modulo scheduling a loop. Larger values can exponentially increase compilation time. </p> </dd> <dt><code class="code">max-inline-functions-called-once-loop-depth</code></dt> <dd> +<p>Maximal loop depth of a call considered by inline heuristics that tries to inline all functions called once. </p> </dd> <dt><code class="code">max-inline-functions-called-once-insns</code></dt> <dd> +<p>Maximal estimated size of functions produced while inlining functions called once. </p> </dd> <dt><code class="code">max-inline-insns-single</code></dt> <dd> +<p>Several parameters control the tree inliner used in GCC. This number sets the maximum number of instructions (counted in GCC’s internal representation) in a single function that the tree inliner considers for inlining. This only affects functions declared inline and methods implemented in a class declaration (C++). </p> </dd> <dt><code class="code">max-inline-insns-auto</code></dt> <dd> +<p>When you use <samp class="option">-finline-functions</samp> (included in <samp class="option">-O3</samp>), a lot of functions that would otherwise not be considered for inlining by the compiler are investigated. To those functions, a different (more restrictive) limit compared to functions declared inline can be applied (<samp class="option">--param max-inline-insns-auto</samp>). </p> </dd> <dt><code class="code">max-inline-insns-small</code></dt> <dd> +<p>This is bound applied to calls which are considered relevant with <samp class="option">-finline-small-functions</samp>. </p> </dd> <dt><code class="code">max-inline-insns-size</code></dt> <dd> +<p>This is bound applied to calls which are optimized for size. Small growth may be desirable to anticipate optimization oppurtunities exposed by inlining. </p> </dd> <dt><code class="code">uninlined-function-insns</code></dt> <dd> +<p>Number of instructions accounted by inliner for function overhead such as function prologue and epilogue. </p> </dd> <dt><code class="code">uninlined-function-time</code></dt> <dd> +<p>Extra time accounted by inliner for function overhead such as time needed to execute function prologue and epilogue. </p> </dd> <dt><code class="code">inline-heuristics-hint-percent</code></dt> <dd> +<p>The scale (in percents) applied to <samp class="option">inline-insns-single</samp>, <samp class="option">inline-insns-single-O2</samp>, <samp class="option">inline-insns-auto</samp> when inline heuristics hints that inlining is very profitable (will enable later optimizations). </p> </dd> <dt><code class="code">uninlined-thunk-insns</code></dt> <dt><code class="code">uninlined-thunk-time</code></dt> <dd> +<p>Same as <samp class="option">--param uninlined-function-insns</samp> and <samp class="option">--param uninlined-function-time</samp> but applied to function thunks. </p> </dd> <dt><code class="code">inline-min-speedup</code></dt> <dd> +<p>When estimated performance improvement of caller + callee runtime exceeds this threshold (in percent), the function can be inlined regardless of the limit on <samp class="option">--param max-inline-insns-single</samp> and <samp class="option">--param max-inline-insns-auto</samp>. </p> </dd> <dt><code class="code">large-function-insns</code></dt> <dd> +<p>The limit specifying really large functions. For functions larger than this limit after inlining, inlining is constrained by <samp class="option">--param large-function-growth</samp>. This parameter is useful primarily to avoid extreme compilation time caused by non-linear algorithms used by the back end. </p> </dd> <dt><code class="code">large-function-growth</code></dt> <dd> +<p>Specifies maximal growth of large function caused by inlining in percents. For example, parameter value 100 limits large function growth to 2.0 times the original size. </p> </dd> <dt><code class="code">large-unit-insns</code></dt> <dd> +<p>The limit specifying large translation unit. Growth caused by inlining of units larger than this limit is limited by <samp class="option">--param inline-unit-growth</samp>. For small units this might be too tight. For example, consider a unit consisting of function A that is inline and B that just calls A three times. If B is small relative to A, the growth of unit is 300\% and yet such inlining is very sane. For very large units consisting of small inlineable functions, however, the overall unit growth limit is needed to avoid exponential explosion of code size. Thus for smaller units, the size is increased to <samp class="option">--param large-unit-insns</samp> before applying <samp class="option">--param inline-unit-growth</samp>. </p> </dd> <dt><code class="code">lazy-modules</code></dt> <dd> +<p>Maximum number of concurrently open C++ module files when lazy loading. </p> </dd> <dt><code class="code">inline-unit-growth</code></dt> <dd> +<p>Specifies maximal overall growth of the compilation unit caused by inlining. For example, parameter value 20 limits unit growth to 1.2 times the original size. Cold functions (either marked cold via an attribute or by profile feedback) are not accounted into the unit size. </p> </dd> <dt><code class="code">ipa-cp-unit-growth</code></dt> <dd> +<p>Specifies maximal overall growth of the compilation unit caused by interprocedural constant propagation. For example, parameter value 10 limits unit growth to 1.1 times the original size. </p> </dd> <dt><code class="code">ipa-cp-large-unit-insns</code></dt> <dd> +<p>The size of translation unit that IPA-CP pass considers large. </p> </dd> <dt><code class="code">large-stack-frame</code></dt> <dd> +<p>The limit specifying large stack frames. While inlining the algorithm is trying to not grow past this limit too much. </p> </dd> <dt><code class="code">large-stack-frame-growth</code></dt> <dd> +<p>Specifies maximal growth of large stack frames caused by inlining in percents. For example, parameter value 1000 limits large stack frame growth to 11 times the original size. </p> </dd> <dt><code class="code">max-inline-insns-recursive</code></dt> <dt><code class="code">max-inline-insns-recursive-auto</code></dt> <dd> +<p>Specifies the maximum number of instructions an out-of-line copy of a self-recursive inline function can grow into by performing recursive inlining. </p> <p><samp class="option">--param max-inline-insns-recursive</samp> applies to functions declared inline. For functions not declared inline, recursive inlining happens only when <samp class="option">-finline-functions</samp> (included in <samp class="option">-O3</samp>) is enabled; <samp class="option">--param max-inline-insns-recursive-auto</samp> applies instead. </p> </dd> <dt><code class="code">max-inline-recursive-depth</code></dt> <dt><code class="code">max-inline-recursive-depth-auto</code></dt> <dd> +<p>Specifies the maximum recursion depth used for recursive inlining. </p> <p><samp class="option">--param max-inline-recursive-depth</samp> applies to functions declared inline. For functions not declared inline, recursive inlining happens only when <samp class="option">-finline-functions</samp> (included in <samp class="option">-O3</samp>) is enabled; <samp class="option">--param max-inline-recursive-depth-auto</samp> applies instead. </p> </dd> <dt><code class="code">min-inline-recursive-probability</code></dt> <dd> +<p>Recursive inlining is profitable only for function having deep recursion in average and can hurt for function having little recursion depth by increasing the prologue size or complexity of function body to other optimizers. </p> <p>When profile feedback is available (see <samp class="option">-fprofile-generate</samp>) the actual recursion depth can be guessed from the probability that function recurses via a given call expression. This parameter limits inlining only to call expressions whose probability exceeds the given threshold (in percents). </p> </dd> <dt><code class="code">early-inlining-insns</code></dt> <dd> +<p>Specify growth that the early inliner can make. In effect it increases the amount of inlining for code having a large abstraction penalty. </p> </dd> <dt><code class="code">max-early-inliner-iterations</code></dt> <dd> +<p>Limit of iterations of the early inliner. This basically bounds the number of nested indirect calls the early inliner can resolve. Deeper chains are still handled by late inlining. </p> </dd> <dt><code class="code">comdat-sharing-probability</code></dt> <dd> +<p>Probability (in percent) that C++ inline function with comdat visibility are shared across multiple compilation units. </p> </dd> <dt><code class="code">modref-max-bases</code></dt> <dt><code class="code">modref-max-refs</code></dt> <dt><code class="code">modref-max-accesses</code></dt> <dd> +<p>Specifies the maximal number of base pointers, references and accesses stored for a single function by mod/ref analysis. </p> </dd> <dt><code class="code">modref-max-tests</code></dt> <dd> +<p>Specifies the maxmal number of tests alias oracle can perform to disambiguate memory locations using the mod/ref information. This parameter ought to be bigger than <samp class="option">--param modref-max-bases</samp> and <samp class="option">--param modref-max-refs</samp>. </p> </dd> <dt><code class="code">modref-max-depth</code></dt> <dd> +<p>Specifies the maximum depth of DFS walk used by modref escape analysis. Setting to 0 disables the analysis completely. </p> </dd> <dt><code class="code">modref-max-escape-points</code></dt> <dd> +<p>Specifies the maximum number of escape points tracked by modref per SSA-name. </p> </dd> <dt><code class="code">modref-max-adjustments</code></dt> <dd> +<p>Specifies the maximum number the access range is enlarged during modref dataflow analysis. </p> </dd> <dt><code class="code">profile-func-internal-id</code></dt> <dd> +<p>A parameter to control whether to use function internal id in profile database lookup. If the value is 0, the compiler uses an id that is based on function assembler name and filename, which makes old profile data more tolerant to source changes such as function reordering etc. </p> </dd> <dt><code class="code">min-vect-loop-bound</code></dt> <dd> +<p>The minimum number of iterations under which loops are not vectorized when <samp class="option">-ftree-vectorize</samp> is used. The number of iterations after vectorization needs to be greater than the value specified by this option to allow vectorization. </p> </dd> <dt><code class="code">gcse-cost-distance-ratio</code></dt> <dd> +<p>Scaling factor in calculation of maximum distance an expression can be moved by GCSE optimizations. This is currently supported only in the code hoisting pass. The bigger the ratio, the more aggressive code hoisting is with simple expressions, i.e., the expressions that have cost less than <samp class="option">gcse-unrestricted-cost</samp>. Specifying 0 disables hoisting of simple expressions. </p> </dd> <dt><code class="code">gcse-unrestricted-cost</code></dt> <dd> +<p>Cost, roughly measured as the cost of a single typical machine instruction, at which GCSE optimizations do not constrain the distance an expression can travel. This is currently supported only in the code hoisting pass. The lesser the cost, the more aggressive code hoisting is. Specifying 0 allows all expressions to travel unrestricted distances. </p> </dd> <dt><code class="code">max-hoist-depth</code></dt> <dd> +<p>The depth of search in the dominator tree for expressions to hoist. This is used to avoid quadratic behavior in hoisting algorithm. The value of 0 does not limit on the search, but may slow down compilation of huge functions. </p> </dd> <dt><code class="code">max-tail-merge-comparisons</code></dt> <dd> +<p>The maximum amount of similar bbs to compare a bb with. This is used to avoid quadratic behavior in tree tail merging. </p> </dd> <dt><code class="code">max-tail-merge-iterations</code></dt> <dd> +<p>The maximum amount of iterations of the pass over the function. This is used to limit compilation time in tree tail merging. </p> </dd> <dt><code class="code">store-merging-allow-unaligned</code></dt> <dd> +<p>Allow the store merging pass to introduce unaligned stores if it is legal to do so. </p> </dd> <dt><code class="code">max-stores-to-merge</code></dt> <dd> +<p>The maximum number of stores to attempt to merge into wider stores in the store merging pass. </p> </dd> <dt><code class="code">max-store-chains-to-track</code></dt> <dd> +<p>The maximum number of store chains to track at the same time in the attempt to merge them into wider stores in the store merging pass. </p> </dd> <dt><code class="code">max-stores-to-track</code></dt> <dd> +<p>The maximum number of stores to track at the same time in the attemt to to merge them into wider stores in the store merging pass. </p> </dd> <dt><code class="code">max-unrolled-insns</code></dt> <dd> +<p>The maximum number of instructions that a loop may have to be unrolled. If a loop is unrolled, this parameter also determines how many times the loop code is unrolled. </p> </dd> <dt><code class="code">max-average-unrolled-insns</code></dt> <dd> +<p>The maximum number of instructions biased by probabilities of their execution that a loop may have to be unrolled. If a loop is unrolled, this parameter also determines how many times the loop code is unrolled. </p> </dd> <dt><code class="code">max-unroll-times</code></dt> <dd> +<p>The maximum number of unrollings of a single loop. </p> </dd> <dt><code class="code">max-peeled-insns</code></dt> <dd> +<p>The maximum number of instructions that a loop may have to be peeled. If a loop is peeled, this parameter also determines how many times the loop code is peeled. </p> </dd> <dt><code class="code">max-peel-times</code></dt> <dd> +<p>The maximum number of peelings of a single loop. </p> </dd> <dt><code class="code">max-peel-branches</code></dt> <dd> +<p>The maximum number of branches on the hot path through the peeled sequence. </p> </dd> <dt><code class="code">max-completely-peeled-insns</code></dt> <dd> +<p>The maximum number of insns of a completely peeled loop. </p> </dd> <dt><code class="code">max-completely-peel-times</code></dt> <dd> +<p>The maximum number of iterations of a loop to be suitable for complete peeling. </p> </dd> <dt><code class="code">max-completely-peel-loop-nest-depth</code></dt> <dd> +<p>The maximum depth of a loop nest suitable for complete peeling. </p> </dd> <dt><code class="code">max-unswitch-insns</code></dt> <dd> +<p>The maximum number of insns of an unswitched loop. </p> </dd> <dt><code class="code">max-unswitch-depth</code></dt> <dd> +<p>The maximum depth of a loop nest to be unswitched. </p> </dd> <dt><code class="code">lim-expensive</code></dt> <dd> +<p>The minimum cost of an expensive expression in the loop invariant motion. </p> </dd> <dt><code class="code">min-loop-cond-split-prob</code></dt> <dd> +<p>When FDO profile information is available, <samp class="option">min-loop-cond-split-prob</samp> specifies minimum threshold for probability of semi-invariant condition statement to trigger loop split. </p> </dd> <dt><code class="code">iv-consider-all-candidates-bound</code></dt> <dd> +<p>Bound on number of candidates for induction variables, below which all candidates are considered for each use in induction variable optimizations. If there are more candidates than this, only the most relevant ones are considered to avoid quadratic time complexity. </p> </dd> <dt><code class="code">iv-max-considered-uses</code></dt> <dd> +<p>The induction variable optimizations give up on loops that contain more induction variable uses. </p> </dd> <dt><code class="code">iv-always-prune-cand-set-bound</code></dt> <dd> +<p>If the number of candidates in the set is smaller than this value, always try to remove unnecessary ivs from the set when adding a new one. </p> </dd> <dt><code class="code">avg-loop-niter</code></dt> <dd> +<p>Average number of iterations of a loop. </p> </dd> <dt><code class="code">dse-max-object-size</code></dt> <dd> +<p>Maximum size (in bytes) of objects tracked bytewise by dead store elimination. Larger values may result in larger compilation times. </p> </dd> <dt><code class="code">dse-max-alias-queries-per-store</code></dt> <dd> +<p>Maximum number of queries into the alias oracle per store. Larger values result in larger compilation times and may result in more removed dead stores. </p> </dd> <dt><code class="code">scev-max-expr-size</code></dt> <dd> +<p>Bound on size of expressions used in the scalar evolutions analyzer. Large expressions slow the analyzer. </p> </dd> <dt><code class="code">scev-max-expr-complexity</code></dt> <dd> +<p>Bound on the complexity of the expressions in the scalar evolutions analyzer. Complex expressions slow the analyzer. </p> </dd> <dt><code class="code">max-tree-if-conversion-phi-args</code></dt> <dd> +<p>Maximum number of arguments in a PHI supported by TREE if conversion unless the loop is marked with simd pragma. </p> </dd> <dt><code class="code">vect-max-layout-candidates</code></dt> <dd> +<p>The maximum number of possible vector layouts (such as permutations) to consider when optimizing to-be-vectorized code. </p> </dd> <dt><code class="code">vect-max-version-for-alignment-checks</code></dt> <dd> +<p>The maximum number of run-time checks that can be performed when doing loop versioning for alignment in the vectorizer. </p> </dd> <dt><code class="code">vect-max-version-for-alias-checks</code></dt> <dd> +<p>The maximum number of run-time checks that can be performed when doing loop versioning for alias in the vectorizer. </p> </dd> <dt><code class="code">vect-max-peeling-for-alignment</code></dt> <dd> +<p>The maximum number of loop peels to enhance access alignment for vectorizer. Value -1 means no limit. </p> </dd> <dt><code class="code">max-iterations-to-track</code></dt> <dd> +<p>The maximum number of iterations of a loop the brute-force algorithm for analysis of the number of iterations of the loop tries to evaluate. </p> </dd> <dt><code class="code">hot-bb-count-fraction</code></dt> <dd> +<p>The denominator n of fraction 1/n of the maximal execution count of a basic block in the entire program that a basic block needs to at least have in order to be considered hot. The default is 10000, which means that a basic block is considered hot if its execution count is greater than 1/10000 of the maximal execution count. 0 means that it is never considered hot. Used in non-LTO mode. </p> </dd> <dt><code class="code">hot-bb-count-ws-permille</code></dt> <dd> +<p>The number of most executed permilles, ranging from 0 to 1000, of the profiled execution of the entire program to which the execution count of a basic block must be part of in order to be considered hot. The default is 990, which means that a basic block is considered hot if its execution count contributes to the upper 990 permilles, or 99.0%, of the profiled execution of the entire program. 0 means that it is never considered hot. Used in LTO mode. </p> </dd> <dt><code class="code">hot-bb-frequency-fraction</code></dt> <dd> +<p>The denominator n of fraction 1/n of the execution frequency of the entry block of a function that a basic block of this function needs to at least have in order to be considered hot. The default is 1000, which means that a basic block is considered hot in a function if it is executed more frequently than 1/1000 of the frequency of the entry block of the function. 0 means that it is never considered hot. </p> </dd> <dt><code class="code">unlikely-bb-count-fraction</code></dt> <dd> +<p>The denominator n of fraction 1/n of the number of profiled runs of the entire program below which the execution count of a basic block must be in order for the basic block to be considered unlikely executed. The default is 20, which means that a basic block is considered unlikely executed if it is executed in fewer than 1/20, or 5%, of the runs of the program. 0 means that it is always considered unlikely executed. </p> </dd> <dt><code class="code">max-predicted-iterations</code></dt> <dd> +<p>The maximum number of loop iterations we predict statically. This is useful in cases where a function contains a single loop with known bound and another loop with unknown bound. The known number of iterations is predicted correctly, while the unknown number of iterations average to roughly 10. This means that the loop without bounds appears artificially cold relative to the other one. </p> </dd> <dt><code class="code">builtin-expect-probability</code></dt> <dd> +<p>Control the probability of the expression having the specified value. This parameter takes a percentage (i.e. 0 ... 100) as input. </p> </dd> <dt><code class="code">builtin-string-cmp-inline-length</code></dt> <dd> +<p>The maximum length of a constant string for a builtin string cmp call eligible for inlining. </p> </dd> <dt><code class="code">align-threshold</code></dt> <dd> <p>Select fraction of the maximal frequency of executions of a basic block in a function to align the basic block. </p> </dd> <dt><code class="code">align-loop-iterations</code></dt> <dd> <p>A loop expected to iterate at least the selected number of iterations is aligned. </p> </dd> <dt><code class="code">tracer-dynamic-coverage</code></dt> <dt><code class="code">tracer-dynamic-coverage-feedback</code></dt> <dd> <p>This value is used to limit superblock formation once the given percentage of executed instructions is covered. This limits unnecessary code size expansion. </p> <p>The <samp class="option">tracer-dynamic-coverage-feedback</samp> parameter is used only when profile feedback is available. The real profiles (as opposed to statically estimated ones) are much less balanced allowing the threshold to be larger value. </p> </dd> <dt><code class="code">tracer-max-code-growth</code></dt> <dd> +<p>Stop tail duplication once code growth has reached given percentage. This is a rather artificial limit, as most of the duplicates are eliminated later in cross jumping, so it may be set to much higher values than is the desired code growth. </p> </dd> <dt><code class="code">tracer-min-branch-ratio</code></dt> <dd> <p>Stop reverse growth when the reverse probability of best edge is less than this threshold (in percent). </p> </dd> <dt><code class="code">tracer-min-branch-probability</code></dt> <dt><code class="code">tracer-min-branch-probability-feedback</code></dt> <dd> <p>Stop forward growth if the best edge has probability lower than this threshold. </p> <p>Similarly to <samp class="option">tracer-dynamic-coverage</samp> two parameters are provided. <samp class="option">tracer-min-branch-probability-feedback</samp> is used for compilation with profile feedback and <samp class="option">tracer-min-branch-probability</samp> compilation without. The value for compilation with profile feedback needs to be more conservative (higher) in order to make tracer effective. </p> </dd> <dt><code class="code">stack-clash-protection-guard-size</code></dt> <dd> +<p>Specify the size of the operating system provided stack guard as 2 raised to <var class="var">num</var> bytes. Higher values may reduce the number of explicit probes, but a value larger than the operating system provided guard will leave code vulnerable to stack clash style attacks. </p> </dd> <dt><code class="code">stack-clash-protection-probe-interval</code></dt> <dd> +<p>Stack clash protection involves probing stack space as it is allocated. This param controls the maximum distance between probes into the stack as 2 raised to <var class="var">num</var> bytes. Higher values may reduce the number of explicit probes, but a value larger than the operating system provided guard will leave code vulnerable to stack clash style attacks. </p> </dd> <dt><code class="code">max-cse-path-length</code></dt> <dd> <p>The maximum number of basic blocks on path that CSE considers. </p> </dd> <dt><code class="code">max-cse-insns</code></dt> <dd> +<p>The maximum number of instructions CSE processes before flushing. </p> </dd> <dt><code class="code">ggc-min-expand</code></dt> <dd> <p>GCC uses a garbage collector to manage its own memory allocation. This parameter specifies the minimum percentage by which the garbage collector’s heap should be allowed to expand between collections. Tuning this may improve compilation speed; it has no effect on code generation. </p> <p>The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when RAM >= 1GB. If <code class="code">getrlimit</code> is available, the notion of “RAM” is the smallest of actual RAM and <code class="code">RLIMIT_DATA</code> or <code class="code">RLIMIT_AS</code>. If GCC is not able to calculate RAM on a particular platform, the lower bound of 30% is used. Setting this parameter and <samp class="option">ggc-min-heapsize</samp> to zero causes a full collection to occur at every opportunity. This is extremely slow, but can be useful for debugging. </p> </dd> <dt><code class="code">ggc-min-heapsize</code></dt> <dd> <p>Minimum size of the garbage collector’s heap before it begins bothering to collect garbage. The first collection occurs after the heap expands by <samp class="option">ggc-min-expand</samp>% beyond <samp class="option">ggc-min-heapsize</samp>. Again, tuning this may improve compilation speed, and has no effect on code generation. </p> <p>The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but with a lower bound of 4096 (four megabytes) and an upper bound of 131072 (128 megabytes). If GCC is not able to calculate RAM on a particular platform, the lower bound is used. Setting this parameter very large effectively disables garbage collection. Setting this parameter and <samp class="option">ggc-min-expand</samp> to zero causes a full collection to occur at every opportunity. </p> </dd> <dt><code class="code">max-reload-search-insns</code></dt> <dd> +<p>The maximum number of instruction reload should look backward for equivalent register. Increasing values mean more aggressive optimization, making the compilation time increase with probably slightly better performance. </p> </dd> <dt><code class="code">max-cselib-memory-locations</code></dt> <dd> +<p>The maximum number of memory locations cselib should take into account. Increasing values mean more aggressive optimization, making the compilation time increase with probably slightly better performance. </p> </dd> <dt><code class="code">max-sched-ready-insns</code></dt> <dd> +<p>The maximum number of instructions ready to be issued the scheduler should consider at any given time during the first scheduling pass. Increasing values mean more thorough searches, making the compilation time increase with probably little benefit. </p> </dd> <dt><code class="code">max-sched-region-blocks</code></dt> <dd> +<p>The maximum number of blocks in a region to be considered for interblock scheduling. </p> </dd> <dt><code class="code">max-pipeline-region-blocks</code></dt> <dd> +<p>The maximum number of blocks in a region to be considered for pipelining in the selective scheduler. </p> </dd> <dt><code class="code">max-sched-region-insns</code></dt> <dd> +<p>The maximum number of insns in a region to be considered for interblock scheduling. </p> </dd> <dt><code class="code">max-pipeline-region-insns</code></dt> <dd> +<p>The maximum number of insns in a region to be considered for pipelining in the selective scheduler. </p> </dd> <dt><code class="code">min-spec-prob</code></dt> <dd> +<p>The minimum probability (in percents) of reaching a source block for interblock speculative scheduling. </p> </dd> <dt><code class="code">max-sched-extend-regions-iters</code></dt> <dd> +<p>The maximum number of iterations through CFG to extend regions. A value of 0 disables region extensions. </p> </dd> <dt><code class="code">max-sched-insn-conflict-delay</code></dt> <dd> +<p>The maximum conflict delay for an insn to be considered for speculative motion. </p> </dd> <dt><code class="code">sched-spec-prob-cutoff</code></dt> <dd> +<p>The minimal probability of speculation success (in percents), so that speculative insns are scheduled. </p> </dd> <dt><code class="code">sched-state-edge-prob-cutoff</code></dt> <dd> +<p>The minimum probability an edge must have for the scheduler to save its state across it. </p> </dd> <dt><code class="code">sched-mem-true-dep-cost</code></dt> <dd> +<p>Minimal distance (in CPU cycles) between store and load targeting same memory locations. </p> </dd> <dt><code class="code">selsched-max-lookahead</code></dt> <dd> +<p>The maximum size of the lookahead window of selective scheduling. It is a depth of search for available instructions. </p> </dd> <dt><code class="code">selsched-max-sched-times</code></dt> <dd> +<p>The maximum number of times that an instruction is scheduled during selective scheduling. This is the limit on the number of iterations through which the instruction may be pipelined. </p> </dd> <dt><code class="code">selsched-insns-to-rename</code></dt> <dd> +<p>The maximum number of best instructions in the ready list that are considered for renaming in the selective scheduler. </p> </dd> <dt><code class="code">sms-min-sc</code></dt> <dd> +<p>The minimum value of stage count that swing modulo scheduler generates. </p> </dd> <dt><code class="code">max-last-value-rtl</code></dt> <dd> +<p>The maximum size measured as number of RTLs that can be recorded in an expression in combiner for a pseudo register as last known value of that register. </p> </dd> <dt><code class="code">max-combine-insns</code></dt> <dd> +<p>The maximum number of instructions the RTL combiner tries to combine. </p> </dd> <dt><code class="code">integer-share-limit</code></dt> <dd> +<p>Small integer constants can use a shared data structure, reducing the compiler’s memory usage and increasing its speed. This sets the maximum value of a shared integer constant. </p> </dd> <dt><code class="code">ssp-buffer-size</code></dt> <dd> +<p>The minimum size of buffers (i.e. arrays) that receive stack smashing protection when <samp class="option">-fstack-protector</samp> is used. </p> </dd> <dt><code class="code">min-size-for-stack-sharing</code></dt> <dd> +<p>The minimum size of variables taking part in stack slot sharing when not optimizing. </p> </dd> <dt><code class="code">max-jump-thread-duplication-stmts</code></dt> <dd> +<p>Maximum number of statements allowed in a block that needs to be duplicated when threading jumps. </p> </dd> <dt><code class="code">max-jump-thread-paths</code></dt> <dd> +<p>The maximum number of paths to consider when searching for jump threading opportunities. When arriving at a block, incoming edges are only considered if the number of paths to be searched so far multiplied by the number of incoming edges does not exhaust the specified maximum number of paths to consider. </p> </dd> <dt><code class="code">max-fields-for-field-sensitive</code></dt> <dd> +<p>Maximum number of fields in a structure treated in a field sensitive manner during pointer analysis. </p> </dd> <dt><code class="code">prefetch-latency</code></dt> <dd> +<p>Estimate on average number of instructions that are executed before prefetch finishes. The distance prefetched ahead is proportional to this constant. Increasing this number may also lead to less streams being prefetched (see <samp class="option">simultaneous-prefetches</samp>). </p> </dd> <dt><code class="code">simultaneous-prefetches</code></dt> <dd> +<p>Maximum number of prefetches that can run at the same time. </p> </dd> <dt><code class="code">l1-cache-line-size</code></dt> <dd> +<p>The size of cache line in L1 data cache, in bytes. </p> </dd> <dt><code class="code">l1-cache-size</code></dt> <dd> +<p>The size of L1 data cache, in kilobytes. </p> </dd> <dt><code class="code">l2-cache-size</code></dt> <dd> +<p>The size of L2 data cache, in kilobytes. </p> </dd> <dt><code class="code">prefetch-dynamic-strides</code></dt> <dd> +<p>Whether the loop array prefetch pass should issue software prefetch hints for strides that are non-constant. In some cases this may be beneficial, though the fact the stride is non-constant may make it hard to predict when there is clear benefit to issuing these hints. </p> <p>Set to 1 if the prefetch hints should be issued for non-constant strides. Set to 0 if prefetch hints should be issued only for strides that are known to be constant and below <samp class="option">prefetch-minimum-stride</samp>. </p> </dd> <dt><code class="code">prefetch-minimum-stride</code></dt> <dd> +<p>Minimum constant stride, in bytes, to start using prefetch hints for. If the stride is less than this threshold, prefetch hints will not be issued. </p> <p>This setting is useful for processors that have hardware prefetchers, in which case there may be conflicts between the hardware prefetchers and the software prefetchers. If the hardware prefetchers have a maximum stride they can handle, it should be used here to improve the use of software prefetchers. </p> <p>A value of -1 means we don’t have a threshold and therefore prefetch hints can be issued for any constant stride. </p> <p>This setting is only useful for strides that are known and constant. </p> </dd> <dt><code class="code">destructive-interference-size</code></dt> <dt><code class="code">constructive-interference-size</code></dt> <dd> +<p>The values for the C++17 variables <code class="code">std::hardware_destructive_interference_size</code> and <code class="code">std::hardware_constructive_interference_size</code>. The destructive interference size is the minimum recommended offset between two independent concurrently-accessed objects; the constructive interference size is the maximum recommended size of contiguous memory accessed together. Typically both will be the size of an L1 cache line for the target, in bytes. For a generic target covering a range of L1 cache line sizes, typically the constructive interference size will be the small end of the range and the destructive size will be the large end. </p> <p>The destructive interference size is intended to be used for layout, and thus has ABI impact. The default value is not expected to be stable, and on some targets varies with <samp class="option">-mtune</samp>, so use of this variable in a context where ABI stability is important, such as the public interface of a library, is strongly discouraged; if it is used in that context, users can stabilize the value using this option. </p> <p>The constructive interference size is less sensitive, as it is typically only used in a ‘<samp class="samp">static_assert</samp>’ to make sure that a type fits within a cache line. </p> <p>See also <samp class="option">-Winterference-size</samp>. </p> </dd> <dt><code class="code">loop-interchange-max-num-stmts</code></dt> <dd> +<p>The maximum number of stmts in a loop to be interchanged. </p> </dd> <dt><code class="code">loop-interchange-stride-ratio</code></dt> <dd> +<p>The minimum ratio between stride of two loops for interchange to be profitable. </p> </dd> <dt><code class="code">min-insn-to-prefetch-ratio</code></dt> <dd> +<p>The minimum ratio between the number of instructions and the number of prefetches to enable prefetching in a loop. </p> </dd> <dt><code class="code">prefetch-min-insn-to-mem-ratio</code></dt> <dd> +<p>The minimum ratio between the number of instructions and the number of memory references to enable prefetching in a loop. </p> </dd> <dt><code class="code">use-canonical-types</code></dt> <dd> +<p>Whether the compiler should use the “canonical” type system. Should always be 1, which uses a more efficient internal mechanism for comparing types in C++ and Objective-C++. However, if bugs in the canonical type system are causing compilation failures, set this value to 0 to disable canonical types. </p> </dd> <dt><code class="code">switch-conversion-max-branch-ratio</code></dt> <dd> +<p>Switch initialization conversion refuses to create arrays that are bigger than <samp class="option">switch-conversion-max-branch-ratio</samp> times the number of branches in the switch. </p> </dd> <dt><code class="code">max-partial-antic-length</code></dt> <dd> +<p>Maximum length of the partial antic set computed during the tree partial redundancy elimination optimization (<samp class="option">-ftree-pre</samp>) when optimizing at <samp class="option">-O3</samp> and above. For some sorts of source code the enhanced partial redundancy elimination optimization can run away, consuming all of the memory available on the host machine. This parameter sets a limit on the length of the sets that are computed, which prevents the runaway behavior. Setting a value of 0 for this parameter allows an unlimited set length. </p> </dd> <dt><code class="code">rpo-vn-max-loop-depth</code></dt> <dd> +<p>Maximum loop depth that is value-numbered optimistically. When the limit hits the innermost <var class="var">rpo-vn-max-loop-depth</var> loops and the outermost loop in the loop nest are value-numbered optimistically and the remaining ones not. </p> </dd> <dt><code class="code">sccvn-max-alias-queries-per-access</code></dt> <dd> +<p>Maximum number of alias-oracle queries we perform when looking for redundancies for loads and stores. If this limit is hit the search is aborted and the load or store is not considered redundant. The number of queries is algorithmically limited to the number of stores on all paths from the load to the function entry. </p> </dd> <dt><code class="code">ira-max-loops-num</code></dt> <dd> +<p>IRA uses regional register allocation by default. If a function contains more loops than the number given by this parameter, only at most the given number of the most frequently-executed loops form regions for regional register allocation. </p> </dd> <dt><code class="code">ira-max-conflict-table-size</code></dt> <dd> +<p>Although IRA uses a sophisticated algorithm to compress the conflict table, the table can still require excessive amounts of memory for huge functions. If the conflict table for a function could be more than the size in MB given by this parameter, the register allocator instead uses a faster, simpler, and lower-quality algorithm that does not require building a pseudo-register conflict table. </p> </dd> <dt><code class="code">ira-loop-reserved-regs</code></dt> <dd> +<p>IRA can be used to evaluate more accurate register pressure in loops for decisions to move loop invariants (see <samp class="option">-O3</samp>). The number of available registers reserved for some other purposes is given by this parameter. Default of the parameter is the best found from numerous experiments. </p> </dd> <dt><code class="code">ira-consider-dup-in-all-alts</code></dt> <dd> +<p>Make IRA to consider matching constraint (duplicated operand number) heavily in all available alternatives for preferred register class. If it is set as zero, it means IRA only respects the matching constraint when it’s in the only available alternative with an appropriate register class. Otherwise, it means IRA will check all available alternatives for preferred register class even if it has found some choice with an appropriate register class and respect the found qualified matching constraint. </p> </dd> <dt><code class="code">ira-simple-lra-insn-threshold</code></dt> <dd> +<p>Approximate function insn number in 1K units triggering simple local RA. </p> </dd> <dt><code class="code">lra-inheritance-ebb-probability-cutoff</code></dt> <dd> +<p>LRA tries to reuse values reloaded in registers in subsequent insns. This optimization is called inheritance. EBB is used as a region to do this optimization. The parameter defines a minimal fall-through edge probability in percentage used to add BB to inheritance EBB in LRA. The default value was chosen from numerous runs of SPEC2000 on x86-64. </p> </dd> <dt><code class="code">loop-invariant-max-bbs-in-loop</code></dt> <dd> +<p>Loop invariant motion can be very expensive, both in compilation time and in amount of needed compile-time memory, with very large loops. Loops with more basic blocks than this parameter won’t have loop invariant motion optimization performed on them. </p> </dd> <dt><code class="code">loop-max-datarefs-for-datadeps</code></dt> <dd> +<p>Building data dependencies is expensive for very large loops. This parameter limits the number of data references in loops that are considered for data dependence analysis. These large loops are no handled by the optimizations using loop data dependencies. </p> </dd> <dt><code class="code">max-vartrack-size</code></dt> <dd> +<p>Sets a maximum number of hash table slots to use during variable tracking dataflow analysis of any function. If this limit is exceeded with variable tracking at assignments enabled, analysis for that function is retried without it, after removing all debug insns from the function. If the limit is exceeded even without debug insns, var tracking analysis is completely disabled for the function. Setting the parameter to zero makes it unlimited. </p> </dd> <dt><code class="code">max-vartrack-expr-depth</code></dt> <dd> +<p>Sets a maximum number of recursion levels when attempting to map variable names or debug temporaries to value expressions. This trades compilation time for more complete debug information. If this is set too low, value expressions that are available and could be represented in debug information may end up not being used; setting this higher may enable the compiler to find more complex debug expressions, but compile time and memory use may grow. </p> </dd> <dt><code class="code">max-debug-marker-count</code></dt> <dd> +<p>Sets a threshold on the number of debug markers (e.g. begin stmt markers) to avoid complexity explosion at inlining or expanding to RTL. If a function has more such gimple stmts than the set limit, such stmts will be dropped from the inlined copy of a function, and from its RTL expansion. </p> </dd> <dt><code class="code">min-nondebug-insn-uid</code></dt> <dd> +<p>Use uids starting at this parameter for nondebug insns. The range below the parameter is reserved exclusively for debug insns created by <samp class="option">-fvar-tracking-assignments</samp>, but debug insns may get (non-overlapping) uids above it if the reserved range is exhausted. </p> </dd> <dt><code class="code">ipa-sra-deref-prob-threshold</code></dt> <dd> +<p>IPA-SRA replaces a pointer which is known not be NULL with one or more new parameters only when the probability (in percent, relative to function entry) of it being dereferenced is higher than this parameter. </p> </dd> <dt><code class="code">ipa-sra-ptr-growth-factor</code></dt> <dd> +<p>IPA-SRA replaces a pointer to an aggregate with one or more new parameters only when their cumulative size is less or equal to <samp class="option">ipa-sra-ptr-growth-factor</samp> times the size of the original pointer parameter. </p> </dd> <dt><code class="code">ipa-sra-ptrwrap-growth-factor</code></dt> <dd> +<p>Additional maximum allowed growth of total size of new parameters that ipa-sra replaces a pointer to an aggregate with, if it points to a local variable that the caller only writes to and passes it as an argument to other functions. </p> </dd> <dt><code class="code">ipa-sra-max-replacements</code></dt> <dd> +<p>Maximum pieces of an aggregate that IPA-SRA tracks. As a consequence, it is also the maximum number of replacements of a formal parameter. </p> </dd> <dt><code class="code">sra-max-scalarization-size-Ospeed</code></dt> <dt><code class="code">sra-max-scalarization-size-Osize</code></dt> <dd> +<p>The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to replace scalar parts of aggregates with uses of independent scalar variables. These parameters control the maximum size, in storage units, of aggregate which is considered for replacement when compiling for speed (<samp class="option">sra-max-scalarization-size-Ospeed</samp>) or size (<samp class="option">sra-max-scalarization-size-Osize</samp>) respectively. </p> </dd> <dt><code class="code">sra-max-propagations</code></dt> <dd> +<p>The maximum number of artificial accesses that Scalar Replacement of Aggregates (SRA) will track, per one local variable, in order to facilitate copy propagation. </p> </dd> <dt><code class="code">tm-max-aggregate-size</code></dt> <dd> +<p>When making copies of thread-local variables in a transaction, this parameter specifies the size in bytes after which variables are saved with the logging functions as opposed to save/restore code sequence pairs. This option only applies when using <samp class="option">-fgnu-tm</samp>. </p> </dd> <dt><code class="code">graphite-max-nb-scop-params</code></dt> <dd> +<p>To avoid exponential effects in the Graphite loop transforms, the number of parameters in a Static Control Part (SCoP) is bounded. A value of zero can be used to lift the bound. A variable whose value is unknown at compilation time and defined outside a SCoP is a parameter of the SCoP. </p> </dd> <dt><code class="code">loop-block-tile-size</code></dt> <dd> +<p>Loop blocking or strip mining transforms, enabled with <samp class="option">-floop-block</samp> or <samp class="option">-floop-strip-mine</samp>, strip mine each loop in the loop nest by a given number of iterations. The strip length can be changed using the <samp class="option">loop-block-tile-size</samp> parameter. </p> </dd> <dt><code class="code">ipa-jump-function-lookups</code></dt> <dd> +<p>Specifies number of statements visited during jump function offset discovery. </p> </dd> <dt><code class="code">ipa-cp-value-list-size</code></dt> <dd> +<p>IPA-CP attempts to track all possible values and types passed to a function’s parameter in order to propagate them and perform devirtualization. <samp class="option">ipa-cp-value-list-size</samp> is the maximum number of values and types it stores per one formal parameter of a function. </p> </dd> <dt><code class="code">ipa-cp-eval-threshold</code></dt> <dd> +<p>IPA-CP calculates its own score of cloning profitability heuristics and performs those cloning opportunities with scores that exceed <samp class="option">ipa-cp-eval-threshold</samp>. </p> </dd> <dt><code class="code">ipa-cp-max-recursive-depth</code></dt> <dd> +<p>Maximum depth of recursive cloning for self-recursive function. </p> </dd> <dt><code class="code">ipa-cp-min-recursive-probability</code></dt> <dd> +<p>Recursive cloning only when the probability of call being executed exceeds the parameter. </p> </dd> <dt><code class="code">ipa-cp-profile-count-base</code></dt> <dd> +<p>When using <samp class="option">-fprofile-use</samp> option, IPA-CP will consider the measured execution count of a call graph edge at this percentage position in their histogram as the basis for its heuristics calculation. </p> </dd> <dt><code class="code">ipa-cp-recursive-freq-factor</code></dt> <dd> +<p>The number of times interprocedural copy propagation expects recursive functions to call themselves. </p> </dd> <dt><code class="code">ipa-cp-recursion-penalty</code></dt> <dd> +<p>Percentage penalty the recursive functions will receive when they are evaluated for cloning. </p> </dd> <dt><code class="code">ipa-cp-single-call-penalty</code></dt> <dd> +<p>Percentage penalty functions containing a single call to another function will receive when they are evaluated for cloning. </p> </dd> <dt><code class="code">ipa-max-agg-items</code></dt> <dd> +<p>IPA-CP is also capable to propagate a number of scalar values passed in an aggregate. <samp class="option">ipa-max-agg-items</samp> controls the maximum number of such values per one parameter. </p> </dd> <dt><code class="code">ipa-cp-loop-hint-bonus</code></dt> <dd> +<p>When IPA-CP determines that a cloning candidate would make the number of iterations of a loop known, it adds a bonus of <samp class="option">ipa-cp-loop-hint-bonus</samp> to the profitability score of the candidate. </p> </dd> <dt><code class="code">ipa-max-loop-predicates</code></dt> <dd> +<p>The maximum number of different predicates IPA will use to describe when loops in a function have known properties. </p> </dd> <dt><code class="code">ipa-max-aa-steps</code></dt> <dd> +<p>During its analysis of function bodies, IPA-CP employs alias analysis in order to track values pointed to by function parameters. In order not spend too much time analyzing huge functions, it gives up and consider all memory clobbered after examining <samp class="option">ipa-max-aa-steps</samp> statements modifying memory. </p> </dd> <dt><code class="code">ipa-max-switch-predicate-bounds</code></dt> <dd> +<p>Maximal number of boundary endpoints of case ranges of switch statement. For switch exceeding this limit, IPA-CP will not construct cloning cost predicate, which is used to estimate cloning benefit, for default case of the switch statement. </p> </dd> <dt><code class="code">ipa-max-param-expr-ops</code></dt> <dd> +<p>IPA-CP will analyze conditional statement that references some function parameter to estimate benefit for cloning upon certain constant value. But if number of operations in a parameter expression exceeds <samp class="option">ipa-max-param-expr-ops</samp>, the expression is treated as complicated one, and is not handled by IPA analysis. </p> </dd> <dt><code class="code">lto-partitions</code></dt> <dd> +<p>Specify desired number of partitions produced during WHOPR compilation. The number of partitions should exceed the number of CPUs used for compilation. </p> </dd> <dt><code class="code">lto-min-partition</code></dt> <dd> +<p>Size of minimal partition for WHOPR (in estimated instructions). This prevents expenses of splitting very small programs into too many partitions. </p> </dd> <dt><code class="code">lto-max-partition</code></dt> <dd> +<p>Size of max partition for WHOPR (in estimated instructions). to provide an upper bound for individual size of partition. Meant to be used only with balanced partitioning. </p> </dd> <dt><code class="code">lto-max-streaming-parallelism</code></dt> <dd> +<p>Maximal number of parallel processes used for LTO streaming. </p> </dd> <dt><code class="code">cxx-max-namespaces-for-diagnostic-help</code></dt> <dd> +<p>The maximum number of namespaces to consult for suggestions when C++ name lookup fails for an identifier. </p> </dd> <dt><code class="code">sink-frequency-threshold</code></dt> <dd> +<p>The maximum relative execution frequency (in percents) of the target block relative to a statement’s original block to allow statement sinking of a statement. Larger numbers result in more aggressive statement sinking. A small positive adjustment is applied for statements with memory operands as those are even more profitable so sink. </p> </dd> <dt><code class="code">max-stores-to-sink</code></dt> <dd> +<p>The maximum number of conditional store pairs that can be sunk. Set to 0 if either vectorization (<samp class="option">-ftree-vectorize</samp>) or if-conversion (<samp class="option">-ftree-loop-if-convert</samp>) is disabled. </p> </dd> <dt><code class="code">case-values-threshold</code></dt> <dd> +<p>The smallest number of different values for which it is best to use a jump-table instead of a tree of conditional branches. If the value is 0, use the default for the machine. </p> </dd> <dt><code class="code">jump-table-max-growth-ratio-for-size</code></dt> <dd> +<p>The maximum code size growth ratio when expanding into a jump table (in percent). The parameter is used when optimizing for size. </p> </dd> <dt><code class="code">jump-table-max-growth-ratio-for-speed</code></dt> <dd> +<p>The maximum code size growth ratio when expanding into a jump table (in percent). The parameter is used when optimizing for speed. </p> </dd> <dt><code class="code">tree-reassoc-width</code></dt> <dd> +<p>Set the maximum number of instructions executed in parallel in reassociated tree. This parameter overrides target dependent heuristics used by default if has non zero value. </p> </dd> <dt><code class="code">sched-pressure-algorithm</code></dt> <dd> +<p>Choose between the two available implementations of <samp class="option">-fsched-pressure</samp>. Algorithm 1 is the original implementation and is the more likely to prevent instructions from being reordered. Algorithm 2 was designed to be a compromise between the relatively conservative approach taken by algorithm 1 and the rather aggressive approach taken by the default scheduler. It relies more heavily on having a regular register file and accurate register pressure classes. See <samp class="file">haifa-sched.cc</samp> in the GCC sources for more details. </p> <p>The default choice depends on the target. </p> </dd> <dt><code class="code">max-slsr-cand-scan</code></dt> <dd> +<p>Set the maximum number of existing candidates that are considered when seeking a basis for a new straight-line strength reduction candidate. </p> </dd> <dt><code class="code">asan-globals</code></dt> <dd> +<p>Enable buffer overflow detection for global objects. This kind of protection is enabled by default if you are using <samp class="option">-fsanitize=address</samp> option. To disable global objects protection use <samp class="option">--param asan-globals=0</samp>. </p> </dd> <dt><code class="code">asan-stack</code></dt> <dd> +<p>Enable buffer overflow detection for stack objects. This kind of protection is enabled by default when using <samp class="option">-fsanitize=address</samp>. To disable stack protection use <samp class="option">--param asan-stack=0</samp> option. </p> </dd> <dt><code class="code">asan-instrument-reads</code></dt> <dd> +<p>Enable buffer overflow detection for memory reads. This kind of protection is enabled by default when using <samp class="option">-fsanitize=address</samp>. To disable memory reads protection use <samp class="option">--param asan-instrument-reads=0</samp>. </p> </dd> <dt><code class="code">asan-instrument-writes</code></dt> <dd> +<p>Enable buffer overflow detection for memory writes. This kind of protection is enabled by default when using <samp class="option">-fsanitize=address</samp>. To disable memory writes protection use <samp class="option">--param asan-instrument-writes=0</samp> option. </p> </dd> <dt><code class="code">asan-memintrin</code></dt> <dd> +<p>Enable detection for built-in functions. This kind of protection is enabled by default when using <samp class="option">-fsanitize=address</samp>. To disable built-in functions protection use <samp class="option">--param asan-memintrin=0</samp>. </p> </dd> <dt><code class="code">asan-use-after-return</code></dt> <dd> +<p>Enable detection of use-after-return. This kind of protection is enabled by default when using the <samp class="option">-fsanitize=address</samp> option. To disable it use <samp class="option">--param asan-use-after-return=0</samp>. </p> <p>Note: By default the check is disabled at run time. To enable it, add <code class="code">detect_stack_use_after_return=1</code> to the environment variable <code class="env">ASAN_OPTIONS</code>. </p> </dd> <dt><code class="code">asan-instrumentation-with-call-threshold</code></dt> <dd> +<p>If number of memory accesses in function being instrumented is greater or equal to this number, use callbacks instead of inline checks. E.g. to disable inline code use <samp class="option">--param asan-instrumentation-with-call-threshold=0</samp>. </p> </dd> <dt><code class="code">asan-kernel-mem-intrinsic-prefix</code></dt> <dd> +<p>If nonzero, prefix calls to <code class="code">memcpy</code>, <code class="code">memset</code> and <code class="code">memmove</code> with ‘<samp class="samp">__asan_</samp>’ or ‘<samp class="samp">__hwasan_</samp>’ for <samp class="option">-fsanitize=kernel-address</samp> or ‘<samp class="samp">-fsanitize=kernel-hwaddress</samp>’, respectively. </p> </dd> <dt><code class="code">hwasan-instrument-stack</code></dt> <dd> +<p>Enable hwasan instrumentation of statically sized stack-allocated variables. This kind of instrumentation is enabled by default when using <samp class="option">-fsanitize=hwaddress</samp> and disabled by default when using <samp class="option">-fsanitize=kernel-hwaddress</samp>. To disable stack instrumentation use <samp class="option">--param hwasan-instrument-stack=0</samp>, and to enable it use <samp class="option">--param hwasan-instrument-stack=1</samp>. </p> </dd> <dt><code class="code">hwasan-random-frame-tag</code></dt> <dd> +<p>When using stack instrumentation, decide tags for stack variables using a deterministic sequence beginning at a random tag for each frame. With this parameter unset tags are chosen using the same sequence but beginning from 1. This is enabled by default for <samp class="option">-fsanitize=hwaddress</samp> and unavailable for <samp class="option">-fsanitize=kernel-hwaddress</samp>. To disable it use <samp class="option">--param hwasan-random-frame-tag=0</samp>. </p> </dd> <dt><code class="code">hwasan-instrument-allocas</code></dt> <dd> +<p>Enable hwasan instrumentation of dynamically sized stack-allocated variables. This kind of instrumentation is enabled by default when using <samp class="option">-fsanitize=hwaddress</samp> and disabled by default when using <samp class="option">-fsanitize=kernel-hwaddress</samp>. To disable instrumentation of such variables use <samp class="option">--param hwasan-instrument-allocas=0</samp>, and to enable it use <samp class="option">--param hwasan-instrument-allocas=1</samp>. </p> </dd> <dt><code class="code">hwasan-instrument-reads</code></dt> <dd> +<p>Enable hwasan checks on memory reads. Instrumentation of reads is enabled by default for both <samp class="option">-fsanitize=hwaddress</samp> and <samp class="option">-fsanitize=kernel-hwaddress</samp>. To disable checking memory reads use <samp class="option">--param hwasan-instrument-reads=0</samp>. </p> </dd> <dt><code class="code">hwasan-instrument-writes</code></dt> <dd> +<p>Enable hwasan checks on memory writes. Instrumentation of writes is enabled by default for both <samp class="option">-fsanitize=hwaddress</samp> and <samp class="option">-fsanitize=kernel-hwaddress</samp>. To disable checking memory writes use <samp class="option">--param hwasan-instrument-writes=0</samp>. </p> </dd> <dt><code class="code">hwasan-instrument-mem-intrinsics</code></dt> <dd> +<p>Enable hwasan instrumentation of builtin functions. Instrumentation of these builtin functions is enabled by default for both <samp class="option">-fsanitize=hwaddress</samp> and <samp class="option">-fsanitize=kernel-hwaddress</samp>. To disable instrumentation of builtin functions use <samp class="option">--param hwasan-instrument-mem-intrinsics=0</samp>. </p> </dd> <dt><code class="code">use-after-scope-direct-emission-threshold</code></dt> <dd> +<p>If the size of a local variable in bytes is smaller or equal to this number, directly poison (or unpoison) shadow memory instead of using run-time callbacks. </p> </dd> <dt><code class="code">tsan-distinguish-volatile</code></dt> <dd> +<p>Emit special instrumentation for accesses to volatiles. </p> </dd> <dt><code class="code">tsan-instrument-func-entry-exit</code></dt> <dd> +<p>Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit(). </p> </dd> <dt><code class="code">max-fsm-thread-path-insns</code></dt> <dd> +<p>Maximum number of instructions to copy when duplicating blocks on a finite state automaton jump thread path. </p> </dd> <dt><code class="code">threader-debug</code></dt> <dd> +<p>threader-debug=[none|all] Enables verbose dumping of the threader solver. </p> </dd> <dt><code class="code">parloops-chunk-size</code></dt> <dd> +<p>Chunk size of omp schedule for loops parallelized by parloops. </p> </dd> <dt><code class="code">parloops-schedule</code></dt> <dd> +<p>Schedule type of omp schedule for loops parallelized by parloops (static, dynamic, guided, auto, runtime). </p> </dd> <dt><code class="code">parloops-min-per-thread</code></dt> <dd> +<p>The minimum number of iterations per thread of an innermost parallelized loop for which the parallelized variant is preferred over the single threaded one. Note that for a parallelized loop nest the minimum number of iterations of the outermost loop per thread is two. </p> </dd> <dt><code class="code">max-ssa-name-query-depth</code></dt> <dd> +<p>Maximum depth of recursion when querying properties of SSA names in things like fold routines. One level of recursion corresponds to following a use-def chain. </p> </dd> <dt><code class="code">max-speculative-devirt-maydefs</code></dt> <dd> +<p>The maximum number of may-defs we analyze when looking for a must-def specifying the dynamic type of an object that invokes a virtual call we may be able to devirtualize speculatively. </p> </dd> <dt><code class="code">evrp-sparse-threshold</code></dt> <dd> +<p>Maximum number of basic blocks before EVRP uses a sparse cache. </p> </dd> <dt><code class="code">ranger-debug</code></dt> <dd> +<p>Specifies the type of debug output to be issued for ranges. </p> </dd> <dt><code class="code">evrp-switch-limit</code></dt> <dd> +<p>Specifies the maximum number of switch cases before EVRP ignores a switch. </p> </dd> <dt><code class="code">unroll-jam-min-percent</code></dt> <dd> +<p>The minimum percentage of memory references that must be optimized away for the unroll-and-jam transformation to be considered profitable. </p> </dd> <dt><code class="code">unroll-jam-max-unroll</code></dt> <dd> +<p>The maximum number of times the outer loop should be unrolled by the unroll-and-jam transformation. </p> </dd> <dt><code class="code">max-rtl-if-conversion-unpredictable-cost</code></dt> <dd> +<p>Maximum permissible cost for the sequence that would be generated by the RTL if-conversion pass for a branch that is considered unpredictable. </p> </dd> <dt><code class="code">max-variable-expansions-in-unroller</code></dt> <dd> +<p>If <samp class="option">-fvariable-expansion-in-unroller</samp> is used, the maximum number of times that an individual variable will be expanded during loop unrolling. </p> </dd> <dt><code class="code">partial-inlining-entry-probability</code></dt> <dd> +<p>Maximum probability of the entry BB of split region (in percent relative to entry BB of the function) to make partial inlining happen. </p> </dd> <dt><code class="code">max-tracked-strlens</code></dt> <dd> +<p>Maximum number of strings for which strlen optimization pass will track string lengths. </p> </dd> <dt><code class="code">gcse-after-reload-partial-fraction</code></dt> <dd> +<p>The threshold ratio for performing partial redundancy elimination after reload. </p> </dd> <dt><code class="code">gcse-after-reload-critical-fraction</code></dt> <dd> +<p>The threshold ratio of critical edges execution count that permit performing redundancy elimination after reload. </p> </dd> <dt><code class="code">max-loop-header-insns</code></dt> <dd> +<p>The maximum number of insns in loop header duplicated by the copy loop headers pass. </p> </dd> <dt><code class="code">vect-epilogues-nomask</code></dt> <dd> +<p>Enable loop epilogue vectorization using smaller vector size. </p> </dd> <dt><code class="code">vect-partial-vector-usage</code></dt> <dd> +<p>Controls when the loop vectorizer considers using partial vector loads and stores as an alternative to falling back to scalar code. 0 stops the vectorizer from ever using partial vector loads and stores. 1 allows partial vector loads and stores if vectorization removes the need for the code to iterate. 2 allows partial vector loads and stores in all loops. The parameter only has an effect on targets that support partial vector loads and stores. </p> </dd> <dt><code class="code">vect-inner-loop-cost-factor</code></dt> <dd> +<p>The maximum factor which the loop vectorizer applies to the cost of statements in an inner loop relative to the loop being vectorized. The factor applied is the maximum of the estimated number of iterations of the inner loop and this parameter. The default value of this parameter is 50. </p> </dd> <dt><code class="code">vect-induction-float</code></dt> <dd> +<p>Enable loop vectorization of floating point inductions. </p> </dd> <dt><code class="code">avoid-fma-max-bits</code></dt> <dd> +<p>Maximum number of bits for which we avoid creating FMAs. </p> </dd> <dt><code class="code">sms-loop-average-count-threshold</code></dt> <dd> +<p>A threshold on the average loop count considered by the swing modulo scheduler. </p> </dd> <dt><code class="code">sms-dfa-history</code></dt> <dd> +<p>The number of cycles the swing modulo scheduler considers when checking conflicts using DFA. </p> </dd> <dt><code class="code">graphite-allow-codegen-errors</code></dt> <dd> +<p>Whether codegen errors should be ICEs when <samp class="option">-fchecking</samp>. </p> </dd> <dt><code class="code">sms-max-ii-factor</code></dt> <dd> +<p>A factor for tuning the upper bound that swing modulo scheduler uses for scheduling a loop. </p> </dd> <dt><code class="code">lra-max-considered-reload-pseudos</code></dt> <dd> +<p>The max number of reload pseudos which are considered during spilling a non-reload pseudo. </p> </dd> <dt><code class="code">max-pow-sqrt-depth</code></dt> <dd> +<p>Maximum depth of sqrt chains to use when synthesizing exponentiation by a real constant. </p> </dd> <dt><code class="code">max-dse-active-local-stores</code></dt> <dd> +<p>Maximum number of active local stores in RTL dead store elimination. </p> </dd> <dt><code class="code">asan-instrument-allocas</code></dt> <dd> +<p>Enable asan allocas/VLAs protection. </p> </dd> <dt><code class="code">max-iterations-computation-cost</code></dt> <dd> +<p>Bound on the cost of an expression to compute the number of iterations. </p> </dd> <dt><code class="code">max-isl-operations</code></dt> <dd> +<p>Maximum number of isl operations, 0 means unlimited. </p> </dd> <dt><code class="code">graphite-max-arrays-per-scop</code></dt> <dd> +<p>Maximum number of arrays per scop. </p> </dd> <dt><code class="code">max-vartrack-reverse-op-size</code></dt> <dd> +<p>Max. size of loc list for which reverse ops should be added. </p> </dd> <dt><code class="code">fsm-scale-path-stmts</code></dt> <dd> +<p>Scale factor to apply to the number of statements in a threading path crossing a loop backedge when comparing to <samp class="option">--param=max-jump-thread-duplication-stmts</samp>. </p> </dd> <dt><code class="code">uninit-control-dep-attempts</code></dt> <dd> +<p>Maximum number of nested calls to search for control dependencies during uninitialized variable analysis. </p> </dd> <dt><code class="code">sched-autopref-queue-depth</code></dt> <dd> +<p>Hardware autoprefetcher scheduler model control flag. Number of lookahead cycles the model looks into; at ’ ’ only enable instruction sorting heuristic. </p> </dd> <dt><code class="code">loop-versioning-max-inner-insns</code></dt> <dd> +<p>The maximum number of instructions that an inner loop can have before the loop versioning pass considers it too big to copy. </p> </dd> <dt><code class="code">loop-versioning-max-outer-insns</code></dt> <dd> +<p>The maximum number of instructions that an outer loop can have before the loop versioning pass considers it too big to copy, discounting any instructions in inner loops that directly benefit from versioning. </p> </dd> <dt><code class="code">ssa-name-def-chain-limit</code></dt> <dd> +<p>The maximum number of SSA_NAME assignments to follow in determining a property of a variable such as its value. This limits the number of iterations or recursive calls GCC performs when optimizing certain statements or when determining their validity prior to issuing diagnostics. </p> </dd> <dt><code class="code">store-merging-max-size</code></dt> <dd> +<p>Maximum size of a single store merging region in bytes. </p> </dd> <dt><code class="code">hash-table-verification-limit</code></dt> <dd> +<p>The number of elements for which hash table verification is done for each searched element. </p> </dd> <dt><code class="code">max-find-base-term-values</code></dt> <dd> +<p>Maximum number of VALUEs handled during a single find_base_term call. </p> </dd> <dt><code class="code">analyzer-max-enodes-per-program-point</code></dt> <dd> +<p>The maximum number of exploded nodes per program point within the analyzer, before terminating analysis of that point. </p> </dd> <dt><code class="code">analyzer-max-constraints</code></dt> <dd> +<p>The maximum number of constraints per state. </p> </dd> <dt><code class="code">analyzer-min-snodes-for-call-summary</code></dt> <dd> +<p>The minimum number of supernodes within a function for the analyzer to consider summarizing its effects at call sites. </p> </dd> <dt><code class="code">analyzer-max-enodes-for-full-dump</code></dt> <dd> +<p>The maximum depth of exploded nodes that should appear in a dot dump before switching to a less verbose format. </p> </dd> <dt><code class="code">analyzer-max-recursion-depth</code></dt> <dd> +<p>The maximum number of times a callsite can appear in a call stack within the analyzer, before terminating analysis of a call that would recurse deeper. </p> </dd> <dt><code class="code">analyzer-max-svalue-depth</code></dt> <dd> +<p>The maximum depth of a symbolic value, before approximating the value as unknown. </p> </dd> <dt><code class="code">analyzer-max-infeasible-edges</code></dt> <dd> +<p>The maximum number of infeasible edges to reject before declaring a diagnostic as infeasible. </p> </dd> <dt><code class="code">gimple-fe-computed-hot-bb-threshold</code></dt> <dd> +<p>The number of executions of a basic block which is considered hot. The parameter is used only in GIMPLE FE. </p> </dd> <dt><code class="code">analyzer-bb-explosion-factor</code></dt> <dd> +<p>The maximum number of ’after supernode’ exploded nodes within the analyzer per supernode, before terminating analysis. </p> </dd> <dt><code class="code">ranger-logical-depth</code></dt> <dd> +<p>Maximum depth of logical expression evaluation ranger will look through when evaluating outgoing edge ranges. </p> </dd> <dt><code class="code">ranger-recompute-depth</code></dt> <dd> +<p>Maximum depth of instruction chains to consider for recomputation in the outgoing range calculator. </p> </dd> <dt><code class="code">relation-block-limit</code></dt> <dd> +<p>Maximum number of relations the oracle will register in a basic block. </p> </dd> <dt><code class="code">min-pagesize</code></dt> <dd> +<p>Minimum page size for warning purposes. </p> </dd> <dt><code class="code">openacc-kernels</code></dt> <dd> +<p>Specify mode of OpenACC ‘kernels’ constructs handling. With <samp class="option">--param=openacc-kernels=decompose</samp>, OpenACC ‘kernels’ constructs are decomposed into parts, a sequence of compute constructs, each then handled individually. This is work in progress. With <samp class="option">--param=openacc-kernels=parloops</samp>, OpenACC ‘kernels’ constructs are handled by the ‘<samp class="samp">parloops</samp>’ pass, en bloc. This is the current default. </p> </dd> <dt><code class="code">openacc-privatization</code></dt> <dd> +<p>Control whether the <samp class="option">-fopt-info-omp-note</samp> and applicable <samp class="option">-fdump-tree-*-details</samp> options emit OpenACC privatization diagnostics. With <samp class="option">--param=openacc-privatization=quiet</samp>, don’t diagnose. This is the current default. With <samp class="option">--param=openacc-privatization=noisy</samp>, do diagnose. </p> </dd> </dl> <p>The following choices of <var class="var">name</var> are available on AArch64 targets: </p> <dl class="table"> <dt><code class="code">aarch64-sve-compare-costs</code></dt> <dd> +<p>When vectorizing for SVE, consider using “unpacked” vectors for smaller elements and use the cost model to pick the cheapest approach. Also use the cost model to choose between SVE and Advanced SIMD vectorization. </p> <p>Using unpacked vectors includes storing smaller elements in larger containers and accessing elements with extending loads and truncating stores. </p> </dd> <dt><code class="code">aarch64-float-recp-precision</code></dt> <dd> +<p>The number of Newton iterations for calculating the reciprocal for float type. The precision of division is proportional to this param when division approximation is enabled. The default value is 1. </p> </dd> <dt><code class="code">aarch64-double-recp-precision</code></dt> <dd> +<p>The number of Newton iterations for calculating the reciprocal for double type. The precision of division is propotional to this param when division approximation is enabled. The default value is 2. </p> </dd> <dt><code class="code">aarch64-autovec-preference</code></dt> <dd> +<p>Force an ISA selection strategy for auto-vectorization. Accepts values from 0 to 4, inclusive. </p> +<dl class="table"> <dt>‘<samp class="samp">0</samp>’</dt> <dd><p>Use the default heuristics. </p></dd> <dt>‘<samp class="samp">1</samp>’</dt> <dd><p>Use only Advanced SIMD for auto-vectorization. </p></dd> <dt>‘<samp class="samp">2</samp>’</dt> <dd><p>Use only SVE for auto-vectorization. </p></dd> <dt>‘<samp class="samp">3</samp>’</dt> <dd><p>Use both Advanced SIMD and SVE. Prefer Advanced SIMD when the costs are deemed equal. </p></dd> <dt>‘<samp class="samp">4</samp>’</dt> <dd><p>Use both Advanced SIMD and SVE. Prefer SVE when the costs are deemed equal. </p></dd> </dl> <p>The default value is 0. </p> </dd> <dt><code class="code">aarch64-loop-vect-issue-rate-niters</code></dt> <dd> +<p>The tuning for some AArch64 CPUs tries to take both latencies and issue rates into account when deciding whether a loop should be vectorized using SVE, vectorized using Advanced SIMD, or not vectorized at all. If this parameter is set to <var class="var">n</var>, GCC will not use this heuristic for loops that are known to execute in fewer than <var class="var">n</var> Advanced SIMD iterations. </p> </dd> <dt><code class="code">aarch64-vect-unroll-limit</code></dt> <dd> +<p>The vectorizer will use available tuning information to determine whether it would be beneficial to unroll the main vectorized loop and by how much. This parameter set’s the upper bound of how much the vectorizer will unroll the main loop. The default value is four. </p> </dd> </dl> <p>The following choices of <var class="var">name</var> are available on i386 and x86_64 targets: </p> <dl class="table"> <dt><code class="code">x86-stlf-window-ninsns</code></dt> <dd> +<p>Instructions number above which STFL stall penalty can be compensated. </p> </dd> <dt><code class="code">x86-stv-max-visits</code></dt> <dd> +<p>The maximum number of use and def visits when discovering a STV chain before the discovery is aborted. </p> </dd> </dl> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="instrumentation-options">Program Instrumentation Options</a>, Previous: <a href="debugging-options">Options for Debugging Your Program</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Optimize-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Optimize-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/option-summary.html b/devdocs/gcc~13/option-summary.html new file mode 100644 index 00000000..df98e499 --- /dev/null +++ b/devdocs/gcc~13/option-summary.html @@ -0,0 +1,1214 @@ +<div class="section-level-extent" id="Option-Summary"> <div class="nav-panel"> <p> Next: <a href="overall-options" accesskey="n" rel="next">Options Controlling the Kind of Output</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Option-Summary-1"><span>3.1 Option Summary<a class="copiable-link" href="#Option-Summary-1"> ¶</a></span></h1> <p>Here is a summary of all the options, grouped by type. Explanations are in the following sections. </p> <dl class="table"> <dt>Overall Options</dt> <dd> +<p>See <a class="xref" href="overall-options">Options Controlling the Kind of Output</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-c -S -E -o <var class="var">file</var> +-dumpbase <var class="var">dumpbase</var> -dumpbase-ext <var class="var">auxdropsuf</var> +-dumpdir <var class="var">dumppfx</var> -x <var class="var">language</var> +-v -### --help<span class="r">[</span>=<var class="var">class</var><span class="r">[</span>,…<span class="r">]]</span> --target-help --version +-pass-exit-codes -pipe -specs=<var class="var">file</var> -wrapper +@<var class="var">file</var> -ffile-prefix-map=<var class="var">old</var>=<var class="var">new</var> -fcanon-prefix-map +-fplugin=<var class="var">file</var> -fplugin-arg-<var class="var">name</var>=<var class="var">arg</var> +-fdump-ada-spec<span class="r">[</span>-slim<span class="r">]</span> -fada-spec-parent=<var class="var">unit</var> -fdump-go-spec=<var class="var">file</var></pre> +</div> </dd> <dt>C Language Options</dt> <dd> +<p>See <a class="xref" href="c-dialect-options">Options Controlling C Dialect</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-ansi -std=<var class="var">standard</var> -aux-info <var class="var">filename</var> +-fno-asm +-fno-builtin -fno-builtin-<var class="var">function</var> -fcond-mismatch +-ffreestanding -fgimple -fgnu-tm -fgnu89-inline -fhosted +-flax-vector-conversions -fms-extensions +-foffload=<var class="var">arg</var> -foffload-options=<var class="var">arg</var> +-fopenacc -fopenacc-dim=<var class="var">geom</var> +-fopenmp -fopenmp-simd -fopenmp-target-simd-clone<span class="r">[</span>=<var class="var">device-type</var><span class="r">]</span> +-fpermitted-flt-eval-methods=<var class="var">standard</var> +-fplan9-extensions -fsigned-bitfields -funsigned-bitfields +-fsigned-char -funsigned-char -fstrict-flex-arrays[=<var class="var">n</var>] +-fsso-struct=<var class="var">endianness</var></pre> +</div> </dd> <dt>C++ Language Options</dt> <dd> +<p>See <a class="xref" href="c_002b_002b-dialect-options">Options Controlling C++ Dialect</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fabi-version=<var class="var">n</var> -fno-access-control +-faligned-new=<var class="var">n</var> -fargs-in-order=<var class="var">n</var> -fchar8_t -fcheck-new +-fconstexpr-depth=<var class="var">n</var> -fconstexpr-cache-depth=<var class="var">n</var> +-fconstexpr-loop-limit=<var class="var">n</var> -fconstexpr-ops-limit=<var class="var">n</var> +-fno-elide-constructors +-fno-enforce-eh-specs +-fno-gnu-keywords +-fno-implicit-templates +-fno-implicit-inline-templates +-fno-implement-inlines +-fmodule-header<span class="r">[</span>=<var class="var">kind</var><span class="r">]</span> -fmodule-only -fmodules-ts +-fmodule-implicit-inline +-fno-module-lazy +-fmodule-mapper=<var class="var">specification</var> +-fmodule-version-ignore +-fms-extensions +-fnew-inheriting-ctors +-fnew-ttp-matching +-fno-nonansi-builtins -fnothrow-opt -fno-operator-names +-fno-optional-diags -fpermissive +-fno-pretty-templates +-fno-rtti -fsized-deallocation +-ftemplate-backtrace-limit=<var class="var">n</var> +-ftemplate-depth=<var class="var">n</var> +-fno-threadsafe-statics -fuse-cxa-atexit +-fno-weak -nostdinc++ +-fvisibility-inlines-hidden +-fvisibility-ms-compat +-fext-numeric-literals +-flang-info-include-translate<span class="r">[</span>=<var class="var">header</var><span class="r">]</span> +-flang-info-include-translate-not +-flang-info-module-cmi<span class="r">[</span>=<var class="var">module</var><span class="r">]</span> +-stdlib=<var class="var">libstdc++,libc++</var> +-Wabi-tag -Wcatch-value -Wcatch-value=<var class="var">n</var> +-Wno-class-conversion -Wclass-memaccess +-Wcomma-subscript -Wconditionally-supported +-Wno-conversion-null -Wctad-maybe-unsupported +-Wctor-dtor-privacy -Wdangling-reference +-Wno-delete-incomplete +-Wdelete-non-virtual-dtor -Wno-deprecated-array-compare +-Wdeprecated-copy -Wdeprecated-copy-dtor +-Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion +-Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base +-Wno-inherited-variadic-ctor -Wno-init-list-lifetime +-Winvalid-constexpr -Winvalid-imported-macros +-Wno-invalid-offsetof -Wno-literal-suffix +-Wmismatched-new-delete -Wmismatched-tags +-Wmultiple-inheritance -Wnamespaces -Wnarrowing +-Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor +-Wpessimizing-move -Wno-placement-new -Wplacement-new=<var class="var">n</var> +-Wrange-loop-construct -Wredundant-move -Wredundant-tags +-Wreorder -Wregister +-Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates +-Wno-non-template-friend -Wold-style-cast +-Woverloaded-virtual -Wno-pmf-conversions -Wself-move -Wsign-promo +-Wsized-deallocation -Wsuggest-final-methods +-Wsuggest-final-types -Wsuggest-override +-Wno-terminate -Wuseless-cast -Wno-vexing-parse +-Wvirtual-inheritance +-Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant</pre> +</div> </dd> <dt>Objective-C and Objective-C++ Language Options</dt> <dd> +<p>See <a class="xref" href="objective-c-and-objective-c_002b_002b-dialect-options">Options Controlling Objective-C and Objective-C++ Dialects</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fconstant-string-class=<var class="var">class-name</var> +-fgnu-runtime -fnext-runtime +-fno-nil-receivers +-fobjc-abi-version=<var class="var">n</var> +-fobjc-call-cxx-cdtors +-fobjc-direct-dispatch +-fobjc-exceptions +-fobjc-gc +-fobjc-nilcheck +-fobjc-std=objc1 +-fno-local-ivars +-fivar-visibility=<span class="r">[</span>public<span class="r">|</span>protected<span class="r">|</span>private<span class="r">|</span>package<span class="r">]</span> +-freplace-objc-classes +-fzero-link +-gen-decls +-Wassign-intercept -Wno-property-assign-default +-Wno-protocol -Wobjc-root-class -Wselector +-Wstrict-selector-match +-Wundeclared-selector</pre> +</div> </dd> <dt>Diagnostic Message Formatting Options</dt> <dd> +<p>See <a class="xref" href="diagnostic-message-formatting-options">Options to Control Diagnostic Messages Formatting</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fmessage-length=<var class="var">n</var> +-fdiagnostics-plain-output +-fdiagnostics-show-location=<span class="r">[</span>once<span class="r">|</span>every-line<span class="r">]</span> +-fdiagnostics-color=<span class="r">[</span>auto<span class="r">|</span>never<span class="r">|</span>always<span class="r">]</span> +-fdiagnostics-urls=<span class="r">[</span>auto<span class="r">|</span>never<span class="r">|</span>always<span class="r">]</span> +-fdiagnostics-format=<span class="r">[</span>text<span class="r">|</span>sarif-stderr<span class="r">|</span>sarif-file<span class="r">|</span>json<span class="r">|</span>json-stderr<span class="r">|</span>json-file<span class="r">]</span> +-fno-diagnostics-show-option -fno-diagnostics-show-caret +-fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers +-fno-diagnostics-show-cwe +-fno-diagnostics-show-rule +-fdiagnostics-minimum-margin-width=<var class="var">width</var> +-fdiagnostics-parseable-fixits -fdiagnostics-generate-patch +-fdiagnostics-show-template-tree -fno-elide-type +-fdiagnostics-path-format=<span class="r">[</span>none<span class="r">|</span>separate-events<span class="r">|</span>inline-events<span class="r">]</span> +-fdiagnostics-show-path-depths +-fno-show-column +-fdiagnostics-column-unit=<span class="r">[</span>display<span class="r">|</span>byte<span class="r">]</span> +-fdiagnostics-column-origin=<var class="var">origin</var> +-fdiagnostics-escape-format=<span class="r">[</span>unicode<span class="r">|</span>bytes<span class="r">]</span></pre> +</div> </dd> <dt>Warning Options</dt> <dd> +<p>See <a class="xref" href="warning-options">Options to Request or Suppress Warnings</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fsyntax-only -fmax-errors=<var class="var">n</var> -Wpedantic +-pedantic-errors +-w -Wextra -Wall -Wabi=<var class="var">n</var> +-Waddress -Wno-address-of-packed-member -Waggregate-return +-Walloc-size-larger-than=<var class="var">byte-size</var> -Walloc-zero +-Walloca -Walloca-larger-than=<var class="var">byte-size</var> +-Wno-aggressive-loop-optimizations +-Warith-conversion +-Warray-bounds -Warray-bounds=<var class="var">n</var> -Warray-compare +-Wno-attributes -Wattribute-alias=<var class="var">n</var> -Wno-attribute-alias +-Wno-attribute-warning +-Wbidi-chars=<span class="r">[</span>none<span class="r">|</span>unpaired<span class="r">|</span>any<span class="r">|</span>ucn<span class="r">]</span> +-Wbool-compare -Wbool-operation +-Wno-builtin-declaration-mismatch +-Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat +-Wc11-c2x-compat +-Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat +-Wc++20-compat +-Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions +-Wno-c++20-extensions -Wno-c++23-extensions +-Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual +-Wchar-subscripts +-Wclobbered -Wcomment +-Wno-complain-wrong-lang +-Wconversion -Wno-coverage-mismatch -Wno-cpp +-Wdangling-else -Wdangling-pointer -Wdangling-pointer=<var class="var">n</var> +-Wdate-time +-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init +-Wdisabled-optimization +-Wno-discarded-array-qualifiers -Wno-discarded-qualifiers +-Wno-div-by-zero -Wdouble-promotion +-Wduplicated-branches -Wduplicated-cond +-Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion +-Wenum-int-mismatch +-Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors +-Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 +-Wno-format-contains-nul -Wno-format-extra-args +-Wformat-nonliteral -Wformat-overflow=<var class="var">n</var> +-Wformat-security -Wformat-signedness -Wformat-truncation=<var class="var">n</var> +-Wformat-y2k -Wframe-address +-Wframe-larger-than=<var class="var">byte-size</var> -Wno-free-nonheap-object +-Wno-if-not-aligned -Wno-ignored-attributes +-Wignored-qualifiers -Wno-incompatible-pointer-types +-Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=<var class="var">n</var> +-Wno-implicit-function-declaration -Wno-implicit-int +-Winfinite-recursion +-Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context +-Wno-int-to-pointer-cast -Wno-invalid-memory-model +-Winvalid-pch -Winvalid-utf8 -Wno-unicode -Wjump-misses-init +-Wlarger-than=<var class="var">byte-size</var> -Wlogical-not-parentheses -Wlogical-op +-Wlong-long -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized +-Wmemset-elt-size -Wmemset-transposed-args +-Wmisleading-indentation -Wmissing-attributes -Wmissing-braces +-Wmissing-field-initializers -Wmissing-format-attribute +-Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile +-Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare +-Wnormalized=<span class="r">[</span>none<span class="r">|</span>id<span class="r">|</span>nfc<span class="r">|</span>nfkc<span class="r">]</span> +-Wnull-dereference -Wno-odr +-Wopenacc-parallelism +-Wopenmp-simd +-Wno-overflow -Woverlength-strings -Wno-override-init-side-effects +-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded +-Wparentheses -Wno-pedantic-ms-format +-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast +-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls +-Wrestrict -Wno-return-local-addr -Wreturn-type +-Wno-scalar-storage-order -Wsequence-point +-Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local +-Wno-shadow-ivar +-Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value +-Wno-shift-overflow -Wshift-overflow=<var class="var">n</var> +-Wsign-compare -Wsign-conversion +-Wno-sizeof-array-argument +-Wsizeof-array-div +-Wsizeof-pointer-div -Wsizeof-pointer-memaccess +-Wstack-protector -Wstack-usage=<var class="var">byte-size</var> -Wstrict-aliasing +-Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=<var class="var">n</var> +-Wstring-compare +-Wno-stringop-overflow -Wno-stringop-overread +-Wno-stringop-truncation -Wstrict-flex-arrays +-Wsuggest-attribute=<span class="r">[</span>pure<span class="r">|</span>const<span class="r">|</span>noreturn<span class="r">|</span>format<span class="r">|</span>malloc<span class="r">]</span> +-Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum +-Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand +-Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs +-Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef +-Wuninitialized -Wunknown-pragmas +-Wunsuffixed-float-constants -Wunused +-Wunused-but-set-parameter -Wunused-but-set-variable +-Wunused-const-variable -Wunused-const-variable=<var class="var">n</var> +-Wunused-function -Wunused-label -Wunused-local-typedefs +-Wunused-macros +-Wunused-parameter -Wno-unused-result +-Wunused-value -Wunused-variable +-Wno-varargs -Wvariadic-macros +-Wvector-operation-performance +-Wvla -Wvla-larger-than=<var class="var">byte-size</var> -Wno-vla-larger-than +-Wvolatile-register-var -Wwrite-strings +-Wxor-used-as-pow +-Wzero-length-bounds</pre> +</div> </dd> <dt>Static Analyzer Options</dt> <dd> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fanalyzer +-fanalyzer-call-summaries +-fanalyzer-checker=<var class="var">name</var> +-fno-analyzer-feasibility +-fanalyzer-fine-grained +-fno-analyzer-state-merge +-fno-analyzer-state-purge +-fno-analyzer-suppress-followups +-fanalyzer-transitivity +-fno-analyzer-undo-inlining +-fanalyzer-verbose-edges +-fanalyzer-verbose-state-changes +-fanalyzer-verbosity=<var class="var">level</var> +-fdump-analyzer +-fdump-analyzer-callgraph +-fdump-analyzer-exploded-graph +-fdump-analyzer-exploded-nodes +-fdump-analyzer-exploded-nodes-2 +-fdump-analyzer-exploded-nodes-3 +-fdump-analyzer-exploded-paths +-fdump-analyzer-feasibility +-fdump-analyzer-json +-fdump-analyzer-state-purge +-fdump-analyzer-stderr +-fdump-analyzer-supergraph +-fdump-analyzer-untracked +-Wno-analyzer-double-fclose +-Wno-analyzer-double-free +-Wno-analyzer-exposure-through-output-file +-Wno-analyzer-exposure-through-uninit-copy +-Wno-analyzer-fd-access-mode-mismatch +-Wno-analyzer-fd-double-close +-Wno-analyzer-fd-leak +-Wno-analyzer-fd-phase-mismatch +-Wno-analyzer-fd-type-mismatch +-Wno-analyzer-fd-use-after-close +-Wno-analyzer-fd-use-without-check +-Wno-analyzer-file-leak +-Wno-analyzer-free-of-non-heap +-Wno-analyzer-imprecise-fp-arithmetic +-Wno-analyzer-infinite-recursion +-Wno-analyzer-jump-through-null +-Wno-analyzer-malloc-leak +-Wno-analyzer-mismatching-deallocation +-Wno-analyzer-null-argument +-Wno-analyzer-null-dereference +-Wno-analyzer-out-of-bounds +-Wno-analyzer-possible-null-argument +-Wno-analyzer-possible-null-dereference +-Wno-analyzer-putenv-of-auto-var +-Wno-analyzer-shift-count-negative +-Wno-analyzer-shift-count-overflow +-Wno-analyzer-stale-setjmp-buffer +-Wno-analyzer-tainted-allocation-size +-Wno-analyzer-tainted-assertion +-Wno-analyzer-tainted-array-index +-Wno-analyzer-tainted-divisor +-Wno-analyzer-tainted-offset +-Wno-analyzer-tainted-size +-Wanalyzer-too-complex +-Wno-analyzer-unsafe-call-within-signal-handler +-Wno-analyzer-use-after-free +-Wno-analyzer-use-of-pointer-in-stale-stack-frame +-Wno-analyzer-use-of-uninitialized-value +-Wno-analyzer-va-arg-type-mismatch +-Wno-analyzer-va-list-exhausted +-Wno-analyzer-va-list-leak +-Wno-analyzer-va-list-use-after-va-end +-Wno-analyzer-write-to-const +-Wno-analyzer-write-to-string-literal</pre> +</div> </dd> <dt>C and Objective-C-only Warning Options</dt> <dd> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-Wbad-function-cast -Wmissing-declarations +-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs +-Wold-style-declaration -Wold-style-definition +-Wstrict-prototypes -Wtraditional -Wtraditional-conversion +-Wdeclaration-after-statement -Wpointer-sign</pre> +</div> </dd> <dt>Debugging Options</dt> <dd> +<p>See <a class="xref" href="debugging-options">Options for Debugging Your Program</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-g -g<var class="var">level</var> -gdwarf -gdwarf-<var class="var">version</var> +-gbtf -gctf -gctf<var class="var">level</var> +-ggdb -grecord-gcc-switches -gno-record-gcc-switches +-gstrict-dwarf -gno-strict-dwarf +-gas-loc-support -gno-as-loc-support +-gas-locview-support -gno-as-locview-support +-gcolumn-info -gno-column-info -gdwarf32 -gdwarf64 +-gstatement-frontiers -gno-statement-frontiers +-gvariable-location-views -gno-variable-location-views +-ginternal-reset-location-views -gno-internal-reset-location-views +-ginline-points -gno-inline-points +-gvms -gz<span class="r">[</span>=<var class="var">type</var><span class="r">]</span> +-gsplit-dwarf -gdescribe-dies -gno-describe-dies +-fdebug-prefix-map=<var class="var">old</var>=<var class="var">new</var> -fdebug-types-section +-fno-eliminate-unused-debug-types +-femit-struct-debug-baseonly -femit-struct-debug-reduced +-femit-struct-debug-detailed<span class="r">[</span>=<var class="var">spec-list</var><span class="r">]</span> +-fno-eliminate-unused-debug-symbols -femit-class-debug-always +-fno-merge-debug-strings -fno-dwarf2-cfi-asm +-fvar-tracking -fvar-tracking-assignments</pre> +</div> </dd> <dt>Optimization Options</dt> <dd> +<p>See <a class="xref" href="optimize-options">Options that Control Optimization</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-faggressive-loop-optimizations +-falign-functions[=<var class="var">n</var>[:<var class="var">m</var>:[<var class="var">n2</var>[:<var class="var">m2</var>]]]] +-falign-jumps[=<var class="var">n</var>[:<var class="var">m</var>:[<var class="var">n2</var>[:<var class="var">m2</var>]]]] +-falign-labels[=<var class="var">n</var>[:<var class="var">m</var>:[<var class="var">n2</var>[:<var class="var">m2</var>]]]] +-falign-loops[=<var class="var">n</var>[:<var class="var">m</var>:[<var class="var">n2</var>[:<var class="var">m2</var>]]]] +-fno-allocation-dce -fallow-store-data-races +-fassociative-math -fauto-profile -fauto-profile[=<var class="var">path</var>] +-fauto-inc-dec -fbranch-probabilities +-fcaller-saves +-fcombine-stack-adjustments -fconserve-stack +-fcompare-elim -fcprop-registers -fcrossjumping +-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules +-fcx-limited-range +-fdata-sections -fdce -fdelayed-branch +-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively +-fdevirtualize-at-ltrans -fdse +-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects +-ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=<var class="var">style</var> +-ffinite-loops +-fforward-propagate -ffp-contract=<var class="var">style</var> -ffunction-sections +-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity +-fgcse-sm -fhoist-adjacent-loads -fif-conversion +-fif-conversion2 -findirect-inlining +-finline-functions -finline-functions-called-once -finline-limit=<var class="var">n</var> +-finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone +-fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const +-fipa-reference -fipa-reference-addressable +-fipa-stack-alignment -fipa-icf -fira-algorithm=<var class="var">algorithm</var> +-flive-patching=<var class="var">level</var> +-fira-region=<var class="var">region</var> -fira-hoist-pressure +-fira-loop-pressure -fno-ira-share-save-slots +-fno-ira-share-spill-slots +-fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute +-fivopts -fkeep-inline-functions -fkeep-static-functions +-fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage +-floop-block -floop-interchange -floop-strip-mine +-floop-unroll-and-jam -floop-nest-optimize +-floop-parallelize-all -flra-remat -flto -flto-compression-level +-flto-partition=<var class="var">alg</var> -fmerge-all-constants +-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves +-fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg +-fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse +-fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole +-fno-peephole2 -fno-printf-return-value -fno-sched-interblock +-fno-sched-spec -fno-signed-zeros +-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss +-fomit-frame-pointer -foptimize-sibling-calls +-fpartial-inlining -fpeel-loops -fpredictive-commoning +-fprefetch-loop-arrays +-fprofile-correction +-fprofile-use -fprofile-use=<var class="var">path</var> -fprofile-partial-training +-fprofile-values -fprofile-reorder-functions +-freciprocal-math -free -frename-registers -freorder-blocks +-freorder-blocks-algorithm=<var class="var">algorithm</var> +-freorder-blocks-and-partition -freorder-functions +-frerun-cse-after-loop -freschedule-modulo-scheduled-loops +-frounding-math -fsave-optimization-record +-fsched2-use-superblocks -fsched-pressure +-fsched-spec-load -fsched-spec-load-dangerous +-fsched-stalled-insns-dep[=<var class="var">n</var>] -fsched-stalled-insns[=<var class="var">n</var>] +-fsched-group-heuristic -fsched-critical-path-heuristic +-fsched-spec-insn-heuristic -fsched-rank-heuristic +-fsched-last-insn-heuristic -fsched-dep-count-heuristic +-fschedule-fusion +-fschedule-insns -fschedule-insns2 -fsection-anchors +-fselective-scheduling -fselective-scheduling2 +-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops +-fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate +-fsignaling-nans +-fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops +-fsplit-paths +-fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt +-fstdarg-opt -fstore-merging -fstrict-aliasing -fipa-strict-aliasing +-fthread-jumps -ftracer -ftree-bit-ccp +-ftree-builtin-call-dce -ftree-ccp -ftree-ch +-ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts +-ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting +-ftree-loop-if-convert -ftree-loop-im +-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns +-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize +-ftree-loop-vectorize +-ftree-parallelize-loops=<var class="var">n</var> -ftree-pre -ftree-partial-pre -ftree-pta +-ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra +-ftree-switch-conversion -ftree-tail-merge +-ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init +-funconstrained-commons -funit-at-a-time -funroll-all-loops +-funroll-loops -funsafe-math-optimizations -funswitch-loops +-fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt +-fweb -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs +--param <var class="var">name</var>=<var class="var">value</var> +-O -O0 -O1 -O2 -O3 -Os -Ofast -Og -Oz</pre> +</div> </dd> <dt>Program Instrumentation Options</dt> <dd> +<p>See <a class="xref" href="instrumentation-options">Program Instrumentation Options</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-p -pg -fprofile-arcs --coverage -ftest-coverage +-fprofile-abs-path +-fprofile-dir=<var class="var">path</var> -fprofile-generate -fprofile-generate=<var class="var">path</var> +-fprofile-info-section -fprofile-info-section=<var class="var">name</var> +-fprofile-note=<var class="var">path</var> -fprofile-prefix-path=<var class="var">path</var> +-fprofile-update=<var class="var">method</var> -fprofile-filter-files=<var class="var">regex</var> +-fprofile-exclude-files=<var class="var">regex</var> +-fprofile-reproducible=<span class="r">[</span>multithreaded<span class="r">|</span>parallel-runs<span class="r">|</span>serial<span class="r">]</span> +-fsanitize=<var class="var">style</var> -fsanitize-recover -fsanitize-recover=<var class="var">style</var> +-fsanitize-trap -fsanitize-trap=<var class="var">style</var> +-fasan-shadow-offset=<var class="var">number</var> -fsanitize-sections=<var class="var">s1</var>,<var class="var">s2</var>,... +-fsanitize-undefined-trap-on-error -fbounds-check +-fcf-protection=<span class="r">[</span>full<span class="r">|</span>branch<span class="r">|</span>return<span class="r">|</span>none<span class="r">|</span>check<span class="r">]</span> +-fharden-compares -fharden-conditional-branches +-fstack-protector -fstack-protector-all -fstack-protector-strong +-fstack-protector-explicit -fstack-check +-fstack-limit-register=<var class="var">reg</var> -fstack-limit-symbol=<var class="var">sym</var> +-fno-stack-limit -fsplit-stack +-fvtable-verify=<span class="r">[</span>std<span class="r">|</span>preinit<span class="r">|</span>none<span class="r">]</span> +-fvtv-counts -fvtv-debug +-finstrument-functions -finstrument-functions-once +-finstrument-functions-exclude-function-list=<var class="var">sym</var>,<var class="var">sym</var>,… +-finstrument-functions-exclude-file-list=<var class="var">file</var>,<var class="var">file</var>,… +-fprofile-prefix-map=<var class="var">old</var>=<var class="var">new</var></pre> +</div> </dd> <dt>Preprocessor Options</dt> <dd> +<p>See <a class="xref" href="preprocessor-options">Options Controlling the Preprocessor</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-A<var class="var">question</var>=<var class="var">answer</var> +-A-<var class="var">question</var><span class="r">[</span>=<var class="var">answer</var><span class="r">]</span> +-C -CC -D<var class="var">macro</var><span class="r">[</span>=<var class="var">defn</var><span class="r">]</span> +-dD -dI -dM -dN -dU +-fdebug-cpp -fdirectives-only -fdollars-in-identifiers +-fexec-charset=<var class="var">charset</var> -fextended-identifiers +-finput-charset=<var class="var">charset</var> -flarge-source-files +-fmacro-prefix-map=<var class="var">old</var>=<var class="var">new</var> -fmax-include-depth=<var class="var">depth</var> +-fno-canonical-system-headers -fpch-deps -fpch-preprocess +-fpreprocessed -ftabstop=<var class="var">width</var> -ftrack-macro-expansion +-fwide-exec-charset=<var class="var">charset</var> -fworking-directory +-H -imacros <var class="var">file</var> -include <var class="var">file</var> +-M -MD -MF -MG -MM -MMD -MP -MQ -MT -Mno-modules +-no-integrated-cpp -P -pthread -remap +-traditional -traditional-cpp -trigraphs +-U<var class="var">macro</var> -undef +-Wp,<var class="var">option</var> -Xpreprocessor <var class="var">option</var></pre> +</div> </dd> <dt>Assembler Options</dt> <dd> +<p>See <a class="xref" href="assembler-options">Passing Options to the Assembler</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-Wa,<var class="var">option</var> -Xassembler <var class="var">option</var></pre> +</div> </dd> <dt>Linker Options</dt> <dd> +<p>See <a class="xref" href="link-options">Options for Linking</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp"><var class="var">object-file-name</var> -fuse-ld=<var class="var">linker</var> -l<var class="var">library</var> +-nostartfiles -nodefaultlibs -nolibc -nostdlib -nostdlib++ +-e <var class="var">entry</var> --entry=<var class="var">entry</var> +-pie -pthread -r -rdynamic +-s -static -static-pie -static-libgcc -static-libstdc++ +-static-libasan -static-libtsan -static-liblsan -static-libubsan +-shared -shared-libgcc -symbolic +-T <var class="var">script</var> -Wl,<var class="var">option</var> -Xlinker <var class="var">option</var> +-u <var class="var">symbol</var> -z <var class="var">keyword</var></pre> +</div> </dd> <dt>Directory Options</dt> <dd> +<p>See <a class="xref" href="directory-options">Options for Directory Search</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-B<var class="var">prefix</var> -I<var class="var">dir</var> -I- +-idirafter <var class="var">dir</var> +-imacros <var class="var">file</var> -imultilib <var class="var">dir</var> +-iplugindir=<var class="var">dir</var> -iprefix <var class="var">file</var> +-iquote <var class="var">dir</var> -isysroot <var class="var">dir</var> -isystem <var class="var">dir</var> +-iwithprefix <var class="var">dir</var> -iwithprefixbefore <var class="var">dir</var> +-L<var class="var">dir</var> -no-canonical-prefixes --no-sysroot-suffix +-nostdinc -nostdinc++ --sysroot=<var class="var">dir</var></pre> +</div> </dd> <dt>Code Generation Options</dt> <dd> +<p>See <a class="xref" href="code-gen-options">Options for Code Generation Conventions</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fcall-saved-<var class="var">reg</var> -fcall-used-<var class="var">reg</var> +-ffixed-<var class="var">reg</var> -fexceptions +-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables +-fasynchronous-unwind-tables +-fno-gnu-unique +-finhibit-size-directive -fcommon -fno-ident +-fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt +-fno-jump-tables -fno-bit-tests +-frecord-gcc-switches +-freg-struct-return -fshort-enums -fshort-wchar +-fverbose-asm -fpack-struct[=<var class="var">n</var>] +-fleading-underscore -ftls-model=<var class="var">model</var> +-fstack-reuse=<var class="var">reuse_level</var> +-ftrampolines -ftrapv -fwrapv +-fvisibility=<span class="r">[</span>default<span class="r">|</span>internal<span class="r">|</span>hidden<span class="r">|</span>protected<span class="r">]</span> +-fstrict-volatile-bitfields -fsync-libcalls</pre> +</div> </dd> <dt>Developer Options</dt> <dd> +<p>See <a class="xref" href="developer-options">GCC Developer Options</a>. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-d<var class="var">letters</var> -dumpspecs -dumpmachine -dumpversion +-dumpfullversion -fcallgraph-info<span class="r">[</span>=su,da<span class="r">]</span> +-fchecking -fchecking=<var class="var">n</var> +-fdbg-cnt-list -fdbg-cnt=<var class="var">counter-value-list</var> +-fdisable-ipa-<var class="var">pass_name</var> +-fdisable-rtl-<var class="var">pass_name</var> +-fdisable-rtl-<var class="var">pass-name</var>=<var class="var">range-list</var> +-fdisable-tree-<var class="var">pass_name</var> +-fdisable-tree-<var class="var">pass-name</var>=<var class="var">range-list</var> +-fdump-debug -fdump-earlydebug +-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links +-fdump-final-insns<span class="r">[</span>=<var class="var">file</var><span class="r">]</span> +-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline +-fdump-lang-all +-fdump-lang-<var class="var">switch</var> +-fdump-lang-<var class="var">switch</var>-<var class="var">options</var> +-fdump-lang-<var class="var">switch</var>-<var class="var">options</var>=<var class="var">filename</var> +-fdump-passes +-fdump-rtl-<var class="var">pass</var> -fdump-rtl-<var class="var">pass</var>=<var class="var">filename</var> +-fdump-statistics +-fdump-tree-all +-fdump-tree-<var class="var">switch</var> +-fdump-tree-<var class="var">switch</var>-<var class="var">options</var> +-fdump-tree-<var class="var">switch</var>-<var class="var">options</var>=<var class="var">filename</var> +-fcompare-debug<span class="r">[</span>=<var class="var">opts</var><span class="r">]</span> -fcompare-debug-second +-fenable-<var class="var">kind</var>-<var class="var">pass</var> +-fenable-<var class="var">kind</var>-<var class="var">pass</var>=<var class="var">range-list</var> +-fira-verbose=<var class="var">n</var> +-flto-report -flto-report-wpa -fmem-report-wpa +-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report +-fopt-info -fopt-info-<var class="var">options</var><span class="r">[</span>=<var class="var">file</var><span class="r">]</span> +-fmultiflags -fprofile-report +-frandom-seed=<var class="var">string</var> -fsched-verbose=<var class="var">n</var> +-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose +-fstats -fstack-usage -ftime-report -ftime-report-details +-fvar-tracking-assignments-toggle -gtoggle +-print-file-name=<var class="var">library</var> -print-libgcc-file-name +-print-multi-directory -print-multi-lib -print-multi-os-directory +-print-prog-name=<var class="var">program</var> -print-search-dirs -Q +-print-sysroot -print-sysroot-headers-suffix +-save-temps -save-temps=cwd -save-temps=obj -time<span class="r">[</span>=<var class="var">file</var><span class="r">]</span></pre> +</div> </dd> <dt>Machine-Dependent Options</dt> <dd> +<p>See <a class="xref" href="submodel-options">Machine-Dependent Options</a>. </p> <p><em class="emph">AArch64 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mabi=<var class="var">name</var> -mbig-endian -mlittle-endian +-mgeneral-regs-only +-mcmodel=tiny -mcmodel=small -mcmodel=large +-mstrict-align -mno-strict-align +-momit-leaf-frame-pointer +-mtls-dialect=desc -mtls-dialect=traditional +-mtls-size=<var class="var">size</var> +-mfix-cortex-a53-835769 -mfix-cortex-a53-843419 +-mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div +-mpc-relative-literal-loads +-msign-return-address=<var class="var">scope</var> +-mbranch-protection=<var class="var">none</var>|<var class="var">standard</var>|<var class="var">pac-ret</var>[+<var class="var">leaf</var> ++<var class="var">b-key</var>]|<var class="var">bti</var> +-mharden-sls=<var class="var">opts</var> +-march=<var class="var">name</var> -mcpu=<var class="var">name</var> -mtune=<var class="var">name</var> +-moverride=<var class="var">string</var> -mverbose-cost-dump +-mstack-protector-guard=<var class="var">guard</var> -mstack-protector-guard-reg=<var class="var">sysreg</var> +-mstack-protector-guard-offset=<var class="var">offset</var> -mtrack-speculation +-moutline-atomics</pre> +</div> <p><em class="emph">Adapteva Epiphany Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mhalf-reg-file -mprefer-short-insn-regs +-mbranch-cost=<var class="var">num</var> -mcmove -mnops=<var class="var">num</var> -msoft-cmpsf +-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=<var class="var">num</var> +-mround-nearest -mlong-calls -mshort-calls -msmall16 +-mfp-mode=<var class="var">mode</var> -mvect-double -max-vect-align=<var class="var">num</var> +-msplit-vecmove-early -m1reg-<var class="var">reg</var></pre> +</div> <p><em class="emph">AMD GCN Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-march=<var class="var">gpu</var> -mtune=<var class="var">gpu</var> -mstack-size=<var class="var">bytes</var></pre> +</div> <p><em class="emph">ARC Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mbarrel-shifter -mjli-always +-mcpu=<var class="var">cpu</var> -mA6 -mARC600 -mA7 -mARC700 +-mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr +-mea -mno-mpy -mmul32x16 -mmul64 -matomic +-mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap +-mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape +-mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof +-mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved +-mrgf-banked-regs -mlpc-width=<var class="var">width</var> -G <var class="var">num</var> +-mvolatile-cache -mtp-regno=<var class="var">regno</var> +-malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc +-mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi +-mexpand-adddi -mindexed-loads -mlra -mlra-priority-none +-mlra-priority-compact -mlra-priority-noncompact -mmillicode +-mmixed-code -mq-class -mRcq -mRcw -msize-level=<var class="var">level</var> +-mtune=<var class="var">cpu</var> -mmultcost=<var class="var">num</var> -mcode-density-frame +-munalign-prob-threshold=<var class="var">probability</var> -mmpy-option=<var class="var">multo</var> +-mdiv-rem -mcode-density -mll64 -mfpu=<var class="var">fpu</var> -mrf16 -mbranch-index</pre> +</div> <p><em class="emph">ARM Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mapcs-frame -mno-apcs-frame +-mabi=<var class="var">name</var> +-mapcs-stack-check -mno-apcs-stack-check +-mapcs-reentrant -mno-apcs-reentrant +-mgeneral-regs-only +-msched-prolog -mno-sched-prolog +-mlittle-endian -mbig-endian +-mbe8 -mbe32 +-mfloat-abi=<var class="var">name</var> +-mfp16-format=<var class="var">name</var> +-mthumb-interwork -mno-thumb-interwork +-mcpu=<var class="var">name</var> -march=<var class="var">name</var> -mfpu=<var class="var">name</var> +-mtune=<var class="var">name</var> -mprint-tune-info +-mstructure-size-boundary=<var class="var">n</var> +-mabort-on-noreturn +-mlong-calls -mno-long-calls +-msingle-pic-base -mno-single-pic-base +-mpic-register=<var class="var">reg</var> +-mnop-fun-dllimport +-mpoke-function-name +-mthumb -marm -mflip-thumb +-mtpcs-frame -mtpcs-leaf-frame +-mcaller-super-interworking -mcallee-super-interworking +-mtp=<var class="var">name</var> -mtls-dialect=<var class="var">dialect</var> +-mword-relocations +-mfix-cortex-m3-ldrd +-mfix-cortex-a57-aes-1742098 +-mfix-cortex-a72-aes-1655431 +-munaligned-access +-mneon-for-64bits +-mslow-flash-data +-masm-syntax-unified +-mrestrict-it +-mverbose-cost-dump +-mpure-code +-mcmse +-mfix-cmse-cve-2021-35465 +-mstack-protector-guard=<var class="var">guard</var> -mstack-protector-guard-offset=<var class="var">offset</var> +-mfdpic +-mbranch-protection=<var class="var">none</var>|<var class="var">standard</var>|<var class="var">pac-ret</var>[+<var class="var">leaf</var>] +[+<var class="var">bti</var>]|<var class="var">bti</var>[+<var class="var">pac-ret</var>[+<var class="var">leaf</var>]]</pre> +</div> <p><em class="emph">AVR Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mmcu=<var class="var">mcu</var> -mabsdata -maccumulate-args +-mbranch-cost=<var class="var">cost</var> +-mcall-prologues -mgas-isr-prologues -mint8 +-mdouble=<var class="var">bits</var> -mlong-double=<var class="var">bits</var> +-mn_flash=<var class="var">size</var> -mno-interrupts +-mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack +-mfract-convert-truncate +-mshort-calls -nodevicelib -nodevicespecs +-Waddr-space-convert -Wmisspelled-isr</pre> +</div> <p><em class="emph">Blackfin Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mcpu=<var class="var">cpu</var><span class="r">[</span>-<var class="var">sirevision</var><span class="r">]</span> +-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer +-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly +-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library +-mno-id-shared-library -mshared-library-id=<var class="var">n</var> +-mleaf-id-shared-library -mno-leaf-id-shared-library +-msep-data -mno-sep-data -mlong-calls -mno-long-calls +-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram +-micplb</pre> +</div> <p><em class="emph">C6X Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mbig-endian -mlittle-endian -march=<var class="var">cpu</var> +-msim -msdata=<var class="var">sdata-type</var></pre> +</div> <p><em class="emph">CRIS Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mcpu=<var class="var">cpu</var> -march=<var class="var">cpu</var> +-mtune=<var class="var">cpu</var> -mmax-stack-frame=<var class="var">n</var> +-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects +-mstack-align -mdata-align -mconst-align +-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue +-melf -maout -sim -sim2 +-mmul-bug-workaround -mno-mul-bug-workaround</pre> +</div> <p><em class="emph">C-SKY Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-march=<var class="var">arch</var> -mcpu=<var class="var">cpu</var> +-mbig-endian -EB -mlittle-endian -EL +-mhard-float -msoft-float -mfpu=<var class="var">fpu</var> -mdouble-float -mfdivdu +-mfloat-abi=<var class="var">name</var> +-melrw -mistack -mmp -mcp -mcache -msecurity -mtrust +-mdsp -medsp -mvdsp +-mdiv -msmart -mhigh-registers -manchor +-mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt +-mbranch-cost=<var class="var">n</var> -mcse-cc -msched-prolog -msim</pre> +</div> <p><em class="emph">Darwin Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-all_load -allowable_client -arch -arch_errors_fatal +-arch_only -bind_at_load -bundle -bundle_loader +-client_name -compatibility_version -current_version +-dead_strip +-dependency-file -dylib_file -dylinker_install_name +-dynamic -dynamiclib -exported_symbols_list +-filelist -flat_namespace -force_cpusubtype_ALL +-force_flat_namespace -headerpad_max_install_names +-iframework +-image_base -init -install_name -keep_private_externs +-multi_module -multiply_defined -multiply_defined_unused +-noall_load -no_dead_strip_inits_and_terms +-nofixprebinding -nomultidefs -noprebind -noseglinkedit +-pagezero_size -prebind -prebind_all_twolevel_modules +-private_bundle -read_only_relocs -sectalign +-sectobjectsymbols -whyload -seg1addr +-sectcreate -sectobjectsymbols -sectorder +-segaddr -segs_read_only_addr -segs_read_write_addr +-seg_addr_table -seg_addr_table_filename -seglinkedit +-segprot -segs_read_only_addr -segs_read_write_addr +-single_module -static -sub_library -sub_umbrella +-twolevel_namespace -umbrella -undefined +-unexported_symbols_list -weak_reference_mismatches +-whatsloaded -F -gused -gfull -mmacosx-version-min=<var class="var">version</var> +-mkernel -mone-byte-bool</pre> +</div> <p><em class="emph">DEC Alpha Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mno-fp-regs -msoft-float +-mieee -mieee-with-inexact -mieee-conformant +-mfp-trap-mode=<var class="var">mode</var> -mfp-rounding-mode=<var class="var">mode</var> +-mtrap-precision=<var class="var">mode</var> -mbuild-constants +-mcpu=<var class="var">cpu-type</var> -mtune=<var class="var">cpu-type</var> +-mbwx -mmax -mfix -mcix +-mfloat-vax -mfloat-ieee +-mexplicit-relocs -msmall-data -mlarge-data +-msmall-text -mlarge-text +-mmemory-latency=<var class="var">time</var></pre> +</div> <p><em class="emph">eBPF Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mbig-endian -mlittle-endian -mkernel=<var class="var">version</var> +-mframe-limit=<var class="var">bytes</var> -mxbpf -mco-re -mno-co-re +-mjmpext -mjmp32 -malu32 -mcpu=<var class="var">version</var></pre> +</div> <p><em class="emph">FR30 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-msmall-model -mno-lsim</pre> +</div> <p><em class="emph">FT32 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-msim -mlra -mnodiv -mft32b -mcompress -mnopm</pre> +</div> <p><em class="emph">FRV Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 +-mhard-float -msoft-float +-malloc-cc -mfixed-cc -mdword -mno-dword +-mdouble -mno-double +-mmedia -mno-media -mmuladd -mno-muladd +-mfdpic -minline-plt -mgprel-ro -multilib-library-pic +-mlinked-fp -mlong-calls -malign-labels +-mlibrary-pic -macc-4 -macc-8 +-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move +-moptimize-membar -mno-optimize-membar +-mscc -mno-scc -mcond-exec -mno-cond-exec +-mvliw-branch -mno-vliw-branch +-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec +-mno-nested-cond-exec -mtomcat-stats +-mTLS -mtls +-mcpu=<var class="var">cpu</var></pre> +</div> <p><em class="emph">GNU/Linux Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mglibc -muclibc -mmusl -mbionic -mandroid +-tno-android-cc -tno-android-ld</pre> +</div> <p><em class="emph">H8/300 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300</pre> +</div> <p><em class="emph">HPPA Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-march=<var class="var">architecture-type</var> +-matomic-libcalls -mbig-switch +-mcaller-copies -mdisable-fpregs -mdisable-indexing +-mordered -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld +-mfixed-range=<var class="var">register-range</var> +-mcoherent-ldcw -mjump-in-delay -mlinker-opt -mlong-calls +-mlong-load-store -mno-atomic-libcalls -mno-disable-fpregs +-mno-disable-indexing -mno-fast-indirect-calls -mno-gas +-mno-jump-in-delay -mno-long-load-store +-mno-portable-runtime -mno-soft-float +-mno-space-regs -msoft-float -mpa-risc-1-0 +-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime +-mschedule=<var class="var">cpu-type</var> -mspace-regs -msoft-mult -msio -mwsio +-munix=<var class="var">unix-std</var> -nolibdld -static -threads</pre> +</div> <p><em class="emph">IA-64 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic +-mvolatile-asm-stop -mregister-names -msdata -mno-sdata +-mconstant-gp -mauto-pic -mfused-madd +-minline-float-divide-min-latency +-minline-float-divide-max-throughput +-mno-inline-float-divide +-minline-int-divide-min-latency +-minline-int-divide-max-throughput +-mno-inline-int-divide +-minline-sqrt-min-latency -minline-sqrt-max-throughput +-mno-inline-sqrt +-mdwarf2-asm -mearly-stop-bits +-mfixed-range=<var class="var">register-range</var> -mtls-size=<var class="var">tls-size</var> +-mtune=<var class="var">cpu-type</var> -milp32 -mlp64 +-msched-br-data-spec -msched-ar-data-spec -msched-control-spec +-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec +-msched-spec-ldc -msched-spec-control-ldc +-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns +-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path +-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost +-msched-max-memory-insns-hard-limit -msched-max-memory-insns=<var class="var">max-insns</var></pre> +</div> <p><em class="emph">LM32 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled +-msign-extend-enabled -muser-enabled</pre> +</div> <p><em class="emph">LoongArch Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-march=<var class="var">cpu-type</var> -mtune=<var class="var">cpu-type</var> -mabi=<var class="var">base-abi-type</var> +-mfpu=<var class="var">fpu-type</var> -msoft-float -msingle-float -mdouble-float +-mbranch-cost=<var class="var">n</var> -mcheck-zero-division -mno-check-zero-division +-mcond-move-int -mno-cond-move-int +-mcond-move-float -mno-cond-move-float +-memcpy -mno-memcpy -mstrict-align -mno-strict-align +-mmax-inline-memcpy-size=<var class="var">n</var> +-mexplicit-relocs -mno-explicit-relocs +-mdirect-extern-access -mno-direct-extern-access +-mcmodel=<var class="var">code-model</var></pre> +</div> <p><em class="emph">M32R/D Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-m32r2 -m32rx -m32r +-mdebug +-malign-loops -mno-align-loops +-missue-rate=<var class="var">number</var> +-mbranch-cost=<var class="var">number</var> +-mmodel=<var class="var">code-size-model-type</var> +-msdata=<var class="var">sdata-type</var> +-mno-flush-func -mflush-func=<var class="var">name</var> +-mno-flush-trap -mflush-trap=<var class="var">number</var> +-G <var class="var">num</var></pre> +</div> <p><em class="emph">M32C Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mcpu=<var class="var">cpu</var> -msim -memregs=<var class="var">number</var></pre> +</div> <p><em class="emph">M680x0 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-march=<var class="var">arch</var> -mcpu=<var class="var">cpu</var> -mtune=<var class="var">tune</var> +-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 +-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 +-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 +-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort +-mno-short -mhard-float -m68881 -msoft-float -mpcrel +-malign-int -mstrict-align -msep-data -mno-sep-data +-mshared-library-id=n -mid-shared-library -mno-id-shared-library +-mxgot -mno-xgot -mlong-jump-table-offsets</pre> +</div> <p><em class="emph">MCore Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates +-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields +-m4byte-functions -mno-4byte-functions -mcallgraph-data +-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim +-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment</pre> +</div> <p><em class="emph">MicroBlaze Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-msoft-float -mhard-float -msmall-divides -mcpu=<var class="var">cpu</var> +-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift +-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss +-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt +-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-<var class="var">app-model</var> +-mpic-data-is-text-relative</pre> +</div> <p><em class="emph">MIPS Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-EL -EB -march=<var class="var">arch</var> -mtune=<var class="var">arch</var> +-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 +-mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 +-mips16 -mno-mips16 -mflip-mips16 +-minterlink-compressed -mno-interlink-compressed +-minterlink-mips16 -mno-interlink-mips16 +-mabi=<var class="var">abi</var> -mabicalls -mno-abicalls +-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot +-mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float +-mno-float -msingle-float -mdouble-float +-modd-spreg -mno-odd-spreg +-mabs=<var class="var">mode</var> -mnan=<var class="var">encoding</var> +-mdsp -mno-dsp -mdspr2 -mno-dspr2 +-mmcu -mmno-mcu +-meva -mno-eva +-mvirt -mno-virt +-mxpa -mno-xpa +-mcrc -mno-crc +-mginv -mno-ginv +-mmicromips -mno-micromips +-mmsa -mno-msa +-mloongson-mmi -mno-loongson-mmi +-mloongson-ext -mno-loongson-ext +-mloongson-ext2 -mno-loongson-ext2 +-mfpu=<var class="var">fpu-type</var> +-msmartmips -mno-smartmips +-mpaired-single -mno-paired-single -mdmx -mno-mdmx +-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc +-mlong64 -mlong32 -msym32 -mno-sym32 +-G<var class="var">num</var> -mlocal-sdata -mno-local-sdata +-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt +-membedded-data -mno-embedded-data +-muninit-const-in-rodata -mno-uninit-const-in-rodata +-mcode-readable=<var class="var">setting</var> +-msplit-addresses -mno-split-addresses +-mexplicit-relocs -mno-explicit-relocs +-mcheck-zero-division -mno-check-zero-division +-mdivide-traps -mdivide-breaks +-mload-store-pairs -mno-load-store-pairs +-munaligned-access -mno-unaligned-access +-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls +-mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp +-mfix-24k -mno-fix-24k +-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 +-mfix-r5900 -mno-fix-r5900 +-mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 +-mfix-vr4120 -mno-fix-vr4120 +-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 +-mflush-func=<var class="var">func</var> -mno-flush-func +-mbranch-cost=<var class="var">num</var> -mbranch-likely -mno-branch-likely +-mcompact-branches=<var class="var">policy</var> +-mfp-exceptions -mno-fp-exceptions +-mvr4130-align -mno-vr4130-align -msynci -mno-synci +-mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 +-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address +-mframe-header-opt -mno-frame-header-opt</pre> +</div> <p><em class="emph">MMIX Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu +-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols +-melf -mbranch-predict -mno-branch-predict -mbase-addresses +-mno-base-addresses -msingle-exit -mno-single-exit</pre> +</div> <p><em class="emph">MN10300 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mmult-bug -mno-mult-bug +-mno-am33 -mam33 -mam33-2 -mam34 +-mtune=<var class="var">cpu-type</var> +-mreturn-pointer-on-d0 +-mno-crt0 -mrelax -mliw -msetlb</pre> +</div> <p><em class="emph">Moxie Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-meb -mel -mmul.x -mno-crt0</pre> +</div> <p><em class="emph">MSP430 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax +-mwarn-mcu +-mcode-region= -mdata-region= +-msilicon-errata= -msilicon-errata-warn= +-mhwmult= -minrt -mtiny-printf -mmax-inline-shift=</pre> +</div> <p><em class="emph">NDS32 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mbig-endian -mlittle-endian +-mreduced-regs -mfull-regs +-mcmov -mno-cmov +-mext-perf -mno-ext-perf +-mext-perf2 -mno-ext-perf2 +-mext-string -mno-ext-string +-mv3push -mno-v3push +-m16bit -mno-16bit +-misr-vector-size=<var class="var">num</var> +-mcache-block-size=<var class="var">num</var> +-march=<var class="var">arch</var> +-mcmodel=<var class="var">code-model</var> +-mctor-dtor -mrelax</pre> +</div> <p><em class="emph">Nios II Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-G <var class="var">num</var> -mgpopt=<var class="var">option</var> -mgpopt -mno-gpopt +-mgprel-sec=<var class="var">regexp</var> -mr0rel-sec=<var class="var">regexp</var> +-mel -meb +-mno-bypass-cache -mbypass-cache +-mno-cache-volatile -mcache-volatile +-mno-fast-sw-div -mfast-sw-div +-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div +-mcustom-<var class="var">insn</var>=<var class="var">N</var> -mno-custom-<var class="var">insn</var> +-mcustom-fpu-cfg=<var class="var">name</var> +-mhal -msmallc -msys-crt0=<var class="var">name</var> -msys-lib=<var class="var">name</var> +-march=<var class="var">arch</var> -mbmx -mno-bmx -mcdx -mno-cdx</pre> +</div> <p><em class="emph">Nvidia PTX Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-m64 -mmainkernel -moptimize</pre> +</div> <p><em class="emph">OpenRISC Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mboard=<var class="var">name</var> -mnewlib -mhard-mul -mhard-div +-msoft-mul -msoft-div +-msoft-float -mhard-float -mdouble-float -munordered-float +-mcmov -mror -mrori -msext -msfimm -mshftimm +-mcmodel=<var class="var">code-model</var></pre> +</div> <p><em class="emph">PDP-11 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 +-mint32 -mno-int16 -mint16 -mno-int32 +-msplit -munix-asm -mdec-asm -mgnu-asm -mlra</pre> +</div> <p><em class="emph">PowerPC Options</em> See RS/6000 and PowerPC Options. </p> <p><em class="emph">PRU Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mmcu=<var class="var">mcu</var> -minrt -mno-relax -mloop +-mabi=<var class="var">variant</var></pre> +</div> <p><em class="emph">RISC-V Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mbranch-cost=<var class="var">N-instruction</var> +-mplt -mno-plt +-mabi=<var class="var">ABI-string</var> +-mfdiv -mno-fdiv +-mdiv -mno-div +-misa-spec=<var class="var">ISA-spec-string</var> +-march=<var class="var">ISA-string</var> +-mtune=<var class="var">processor-string</var> +-mpreferred-stack-boundary=<var class="var">num</var> +-msmall-data-limit=<var class="var">N-bytes</var> +-msave-restore -mno-save-restore +-mshorten-memrefs -mno-shorten-memrefs +-mstrict-align -mno-strict-align +-mcmodel=medlow -mcmodel=medany +-mexplicit-relocs -mno-explicit-relocs +-mrelax -mno-relax +-mriscv-attribute -mno-riscv-attribute +-malign-data=<var class="var">type</var> +-mbig-endian -mlittle-endian +-mstack-protector-guard=<var class="var">guard</var> -mstack-protector-guard-reg=<var class="var">reg</var> +-mstack-protector-guard-offset=<var class="var">offset</var> +-mcsr-check -mno-csr-check</pre> +</div> <p><em class="emph">RL78 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs +-mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 +-m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts</pre> +</div> <p><em class="emph">RS/6000 and PowerPC Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mcpu=<var class="var">cpu-type</var> +-mtune=<var class="var">cpu-type</var> +-mcmodel=<var class="var">code-model</var> +-mpowerpc64 +-maltivec -mno-altivec +-mpowerpc-gpopt -mno-powerpc-gpopt +-mpowerpc-gfxopt -mno-powerpc-gfxopt +-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd +-mfprnd -mno-fprnd +-mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp +-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc +-m64 -m32 -mxl-compat -mno-xl-compat -mpe +-malign-power -malign-natural +-msoft-float -mhard-float -mmultiple -mno-multiple +-mupdate -mno-update +-mavoid-indexed-addresses -mno-avoid-indexed-addresses +-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align +-mstrict-align -mno-strict-align -mrelocatable +-mno-relocatable -mrelocatable-lib -mno-relocatable-lib +-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian +-mdynamic-no-pic -mswdiv -msingle-pic-base +-mprioritize-restricted-insns=<var class="var">priority</var> +-msched-costly-dep=<var class="var">dependence_type</var> +-minsert-sched-nops=<var class="var">scheme</var> +-mcall-aixdesc -mcall-eabi -mcall-freebsd +-mcall-linux -mcall-netbsd -mcall-openbsd +-mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi +-mtraceback=<var class="var">traceback_type</var> +-maix-struct-return -msvr4-struct-return +-mabi=<var class="var">abi-type</var> -msecure-plt -mbss-plt +-mlongcall -mno-longcall -mpltseq -mno-pltseq +-mblock-move-inline-limit=<var class="var">num</var> +-mblock-compare-inline-limit=<var class="var">num</var> +-mblock-compare-inline-loop-limit=<var class="var">num</var> +-mno-block-ops-unaligned-vsx +-mstring-compare-inline-limit=<var class="var">num</var> +-misel -mno-isel +-mvrsave -mno-vrsave +-mmulhw -mno-mulhw +-mdlmzb -mno-dlmzb +-mprototype -mno-prototype +-msim -mmvme -mads -myellowknife -memb -msdata +-msdata=<var class="var">opt</var> -mreadonly-in-sdata -mvxworks -G <var class="var">num</var> +-mrecip -mrecip=<var class="var">opt</var> -mno-recip -mrecip-precision +-mno-recip-precision +-mveclibabi=<var class="var">type</var> -mfriz -mno-friz +-mpointers-to-nested-functions -mno-pointers-to-nested-functions +-msave-toc-indirect -mno-save-toc-indirect +-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector +-mcrypto -mno-crypto -mhtm -mno-htm +-mquad-memory -mno-quad-memory +-mquad-memory-atomic -mno-quad-memory-atomic +-mcompat-align-parm -mno-compat-align-parm +-mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware +-mgnu-attribute -mno-gnu-attribute +-mstack-protector-guard=<var class="var">guard</var> -mstack-protector-guard-reg=<var class="var">reg</var> +-mstack-protector-guard-offset=<var class="var">offset</var> -mprefixed -mno-prefixed +-mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect +-mprivileged -mno-privileged</pre> +</div> <p><em class="emph">RX Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-m64bit-doubles -m32bit-doubles -fpu -nofpu +-mcpu= +-mbig-endian-data -mlittle-endian-data +-msmall-data +-msim -mno-sim +-mas100-syntax -mno-as100-syntax +-mrelax +-mmax-constant-size= +-mint-register= +-mpid +-mallow-string-insns -mno-allow-string-insns +-mjsr +-mno-warn-multiple-fast-interrupts +-msave-acc-in-interrupts</pre> +</div> <p><em class="emph">S/390 and zSeries Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mtune=<var class="var">cpu-type</var> -march=<var class="var">cpu-type</var> +-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp +-mlong-double-64 -mlong-double-128 +-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack +-msmall-exec -mno-small-exec -mmvcle -mno-mvcle +-m64 -m31 -mdebug -mno-debug -mesa -mzarch +-mhtm -mvx -mzvector +-mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip +-mfused-madd -mno-fused-madd +-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard +-mhotpatch=<var class="var">halfwords</var>,<var class="var">halfwords</var></pre> +</div> <p><em class="emph">SH Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-m1 -m2 -m2e +-m2a-nofpu -m2a-single-only -m2a-single -m2a +-m3 -m3e +-m4-nofpu -m4-single-only -m4-single -m4 +-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al +-mb -ml -mdalign -mrelax +-mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave +-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct +-mprefergot -musermode -multcost=<var class="var">number</var> -mdiv=<var class="var">strategy</var> +-mdivsi3_libfunc=<var class="var">name</var> -mfixed-range=<var class="var">register-range</var> +-maccumulate-outgoing-args +-matomic-model=<var class="var">atomic-model</var> +-mbranch-cost=<var class="var">num</var> -mzdcbranch -mno-zdcbranch +-mcbranch-force-delay-slot +-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra +-mpretend-cmove -mtas</pre> +</div> <p><em class="emph">Solaris 2 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text +-pthreads</pre> +</div> <p><em class="emph">SPARC Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mcpu=<var class="var">cpu-type</var> +-mtune=<var class="var">cpu-type</var> +-mcmodel=<var class="var">code-model</var> +-mmemory-model=<var class="var">mem-model</var> +-m32 -m64 -mapp-regs -mno-app-regs +-mfaster-structs -mno-faster-structs -mflat -mno-flat +-mfpu -mno-fpu -mhard-float -msoft-float +-mhard-quad-float -msoft-quad-float +-mstack-bias -mno-stack-bias +-mstd-struct-return -mno-std-struct-return +-munaligned-doubles -mno-unaligned-doubles +-muser-mode -mno-user-mode +-mv8plus -mno-v8plus -mvis -mno-vis +-mvis2 -mno-vis2 -mvis3 -mno-vis3 +-mvis4 -mno-vis4 -mvis4b -mno-vis4b +-mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld +-mpopc -mno-popc -msubxc -mno-subxc +-mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc +-mlra -mno-lra</pre> +</div> <p><em class="emph">System V Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-Qy -Qn -YP,<var class="var">paths</var> -Ym,<var class="var">dir</var></pre> +</div> <p><em class="emph">V850 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mlong-calls -mno-long-calls -mep -mno-ep +-mprolog-function -mno-prolog-function -mspace +-mtda=<var class="var">n</var> -msda=<var class="var">n</var> -mzda=<var class="var">n</var> +-mapp-regs -mno-app-regs +-mdisable-callt -mno-disable-callt +-mv850e2v3 -mv850e2 -mv850e1 -mv850es +-mv850e -mv850 -mv850e3v5 +-mloop +-mrelax +-mlong-jumps +-msoft-float +-mhard-float +-mgcc-abi +-mrh850-abi +-mbig-switch</pre> +</div> <p><em class="emph">VAX Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mg -mgnu -munix -mlra</pre> +</div> <p><em class="emph">Visium Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float +-mcpu=<var class="var">cpu-type</var> -mtune=<var class="var">cpu-type</var> -msv-mode -muser-mode</pre> +</div> <p><em class="emph">VMS Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mvms-return-codes -mdebug-main=<var class="var">prefix</var> -mmalloc64 +-mpointer-size=<var class="var">size</var></pre> +</div> <p><em class="emph">VxWorks Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mrtp -non-static -Bstatic -Bdynamic +-Xbind-lazy -Xbind-now</pre> +</div> <p><em class="emph">x86 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mtune=<var class="var">cpu-type</var> -march=<var class="var">cpu-type</var> +-mtune-ctrl=<var class="var">feature-list</var> -mdump-tune-features -mno-default +-mfpmath=<var class="var">unit</var> +-masm=<var class="var">dialect</var> -mno-fancy-math-387 +-mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float +-mno-wide-multiply -mrtd -malign-double +-mpreferred-stack-boundary=<var class="var">num</var> +-mincoming-stack-boundary=<var class="var">num</var> +-mcld -mcx16 -msahf -mmovbe -mcrc32 -mmwait +-mrecip -mrecip=<var class="var">opt</var> +-mvzeroupper -mprefer-avx128 -mprefer-vector-width=<var class="var">opt</var> +-mmove-max=<var class="var">bits</var> -mstore-max=<var class="var">bits</var> +-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx +-mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl +-mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes +-mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd +-mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves +-msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop +-madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp +-mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg +-mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call +-mavx512vbmi2 -mavx512bf16 -menqcmd +-mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq +-mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid +-mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk +-mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset -mavxvnni +-mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16 +-mprefetchi -mraoint -mamx-complex +-mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops +-minline-stringops-dynamically -mstringop-strategy=<var class="var">alg</var> +-mkl -mwidekl +-mmemcpy-strategy=<var class="var">strategy</var> -mmemset-strategy=<var class="var">strategy</var> +-mpush-args -maccumulate-outgoing-args -m128bit-long-double +-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 +-mregparm=<var class="var">num</var> -msseregparm +-mveclibabi=<var class="var">type</var> -mvect8-ret-in-mem +-mpc32 -mpc64 -mpc80 -mdaz-ftz -mstackrealign +-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs +-mcmodel=<var class="var">code-model</var> -mabi=<var class="var">name</var> -maddress-mode=<var class="var">mode</var> +-m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=<var class="var">num</var> +-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv +-minstrument-return=<var class="var">type</var> -mfentry-name=<var class="var">name</var> -mfentry-section=<var class="var">name</var> +-mavx256-split-unaligned-load -mavx256-split-unaligned-store +-malign-data=<var class="var">type</var> -mstack-protector-guard=<var class="var">guard</var> +-mstack-protector-guard-reg=<var class="var">reg</var> +-mstack-protector-guard-offset=<var class="var">offset</var> +-mstack-protector-guard-symbol=<var class="var">symbol</var> +-mgeneral-regs-only -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop +-mindirect-branch=<var class="var">choice</var> -mfunction-return=<var class="var">choice</var> +-mindirect-branch-register -mharden-sls=<var class="var">choice</var> +-mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access +-munroll-only-small-loops -mlam=<var class="var">choice</var></pre> +</div> <p><em class="emph">x86 Windows Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mconsole -mcygwin -mno-cygwin -mdll +-mnop-fun-dllimport -mthread +-municode -mwin32 -mwindows -fno-set-stack-executable</pre> +</div> <p><em class="emph">Xstormy16 Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-msim</pre> +</div> <p><em class="emph">Xtensa Options</em> </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-mconst16 -mno-const16 +-mfused-madd -mno-fused-madd +-mforce-no-pic +-mserialize-volatile -mno-serialize-volatile +-mtext-section-literals -mno-text-section-literals +-mauto-litpools -mno-auto-litpools +-mtarget-align -mno-target-align +-mlongcalls -mno-longcalls +-mabi=<var class="var">abi-type</var> +-mextra-l32r-costs=<var class="var">cycles</var></pre> +</div> <p><em class="emph">zSeries Options</em> See S/390 and zSeries Options. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="overall-options">Options Controlling the Kind of Output</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Option-Summary.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Option-Summary.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/other-built-in-functions.html b/devdocs/gcc~13/other-built-in-functions.html new file mode 100644 index 00000000..e06f1105 --- /dev/null +++ b/devdocs/gcc~13/other-built-in-functions.html @@ -0,0 +1,11 @@ +<div class="subsubsection-level-extent" id="Other-Built-in-Functions"> <div class="nav-panel"> <p> Previous: <a href="raw-read_002fwrite-functions" accesskey="p" rel="prev">Raw Read/Write Functions</a>, Up: <a href="fr-v-built-in-functions" accesskey="u" rel="up">FR-V Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Other-Built-in-Functions-1"><span>6.60.13.5 Other Built-in Functions<a class="copiable-link" href="#Other-Built-in-Functions-1"> ¶</a></span></h1> <p>This section describes built-in functions that are not named after a specific FR-V instruction. </p> <dl class="table"> <dt><code class="code">sw2 __IACCreadll (iacc <var class="var">reg</var>)</code></dt> <dd> +<p>Return the full 64-bit value of IACC0. The <var class="var">reg</var> argument is reserved for future expansion and must be 0. </p> </dd> <dt><code class="code">sw1 __IACCreadl (iacc <var class="var">reg</var>)</code></dt> <dd> +<p>Return the value of IACC0H if <var class="var">reg</var> is 0 and IACC0L if <var class="var">reg</var> is 1. Other values of <var class="var">reg</var> are rejected as invalid. </p> </dd> <dt><code class="code">void __IACCsetll (iacc <var class="var">reg</var>, sw2 <var class="var">x</var>)</code></dt> <dd> +<p>Set the full 64-bit value of IACC0 to <var class="var">x</var>. The <var class="var">reg</var> argument is reserved for future expansion and must be 0. </p> </dd> <dt><code class="code">void __IACCsetl (iacc <var class="var">reg</var>, sw1 <var class="var">x</var>)</code></dt> <dd> +<p>Set IACC0H to <var class="var">x</var> if <var class="var">reg</var> is 0 and IACC0L to <var class="var">x</var> if <var class="var">reg</var> is 1. Other values of <var class="var">reg</var> are rejected as invalid. </p> </dd> <dt><code class="code">void __data_prefetch0 (const void *<var class="var">x</var>)</code></dt> <dd> +<p>Use the <code class="code">dcpl</code> instruction to load the contents of address <var class="var">x</var> into the data cache. </p> </dd> <dt><code class="code">void __data_prefetch (const void *<var class="var">x</var>)</code></dt> <dd><p>Use the <code class="code">nldub</code> instruction to load the contents of address <var class="var">x</var> into the data cache. The instruction is issued in slot I1. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Other-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Other-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/other-builtins.html b/devdocs/gcc~13/other-builtins.html new file mode 100644 index 00000000..25e7527f --- /dev/null +++ b/devdocs/gcc~13/other-builtins.html @@ -0,0 +1,420 @@ +<div class="section-level-extent" id="Other-Builtins"> <div class="nav-panel"> <p> Next: <a href="target-builtins" accesskey="n" rel="next">Built-in Functions Specific to Particular Target Machines</a>, Previous: <a href="object-size-checking" accesskey="p" rel="prev">Object Size Checking</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Other-Built-in-Functions-Provided-by-GCC"><span>6.59 Other Built-in Functions Provided by GCC<a class="copiable-link" href="#Other-Built-in-Functions-Provided-by-GCC"> ¶</a></span></h1> <p>GCC provides a large number of built-in functions other than the ones mentioned above. Some of these are for internal use in the processing of exceptions or variable-length argument lists and are not documented here because they may change from time to time; we do not recommend general use of these functions. </p> <p>The remaining functions are provided for optimization purposes. </p> <p>With the exception of built-ins that have library equivalents such as the standard C library functions discussed below, or that expand to library calls, GCC built-in functions are always expanded inline and thus do not have corresponding entry points and their address cannot be obtained. Attempting to use them in an expression other than a function call results in a compile-time error. </p> <p>GCC includes built-in versions of many of the functions in the standard C library. These functions come in two forms: one whose names start with the <code class="code">__builtin_</code> prefix, and the other without. Both forms have the same type (including prototype), the same address (when their address is taken), and the same meaning as the C library functions even if you specify the <samp class="option">-fno-builtin</samp> option see <a class="pxref" href="c-dialect-options">Options Controlling C Dialect</a>). Many of these functions are only optimized in certain cases; if they are not optimized in a particular case, a call to the library function is emitted. </p> <p>Outside strict ISO C mode (<samp class="option">-ansi</samp>, <samp class="option">-std=c90</samp>, <samp class="option">-std=c99</samp> or <samp class="option">-std=c11</samp>), the functions <code class="code">_exit</code>, <code class="code">alloca</code>, <code class="code">bcmp</code>, <code class="code">bzero</code>, <code class="code">dcgettext</code>, <code class="code">dgettext</code>, <code class="code">dremf</code>, <code class="code">dreml</code>, <code class="code">drem</code>, <code class="code">exp10f</code>, <code class="code">exp10l</code>, <code class="code">exp10</code>, <code class="code">ffsll</code>, <code class="code">ffsl</code>, <code class="code">ffs</code>, <code class="code">fprintf_unlocked</code>, <code class="code">fputs_unlocked</code>, <code class="code">gammaf</code>, <code class="code">gammal</code>, <code class="code">gamma</code>, <code class="code">gammaf_r</code>, <code class="code">gammal_r</code>, <code class="code">gamma_r</code>, <code class="code">gettext</code>, <code class="code">index</code>, <code class="code">isascii</code>, <code class="code">j0f</code>, <code class="code">j0l</code>, <code class="code">j0</code>, <code class="code">j1f</code>, <code class="code">j1l</code>, <code class="code">j1</code>, <code class="code">jnf</code>, <code class="code">jnl</code>, <code class="code">jn</code>, <code class="code">lgammaf_r</code>, <code class="code">lgammal_r</code>, <code class="code">lgamma_r</code>, <code class="code">mempcpy</code>, <code class="code">pow10f</code>, <code class="code">pow10l</code>, <code class="code">pow10</code>, <code class="code">printf_unlocked</code>, <code class="code">rindex</code>, <code class="code">roundeven</code>, <code class="code">roundevenf</code>, <code class="code">roundevenl</code>, <code class="code">scalbf</code>, <code class="code">scalbl</code>, <code class="code">scalb</code>, <code class="code">signbit</code>, <code class="code">signbitf</code>, <code class="code">signbitl</code>, <code class="code">signbitd32</code>, <code class="code">signbitd64</code>, <code class="code">signbitd128</code>, <code class="code">significandf</code>, <code class="code">significandl</code>, <code class="code">significand</code>, <code class="code">sincosf</code>, <code class="code">sincosl</code>, <code class="code">sincos</code>, <code class="code">stpcpy</code>, <code class="code">stpncpy</code>, <code class="code">strcasecmp</code>, <code class="code">strdup</code>, <code class="code">strfmon</code>, <code class="code">strncasecmp</code>, <code class="code">strndup</code>, <code class="code">strnlen</code>, <code class="code">toascii</code>, <code class="code">y0f</code>, <code class="code">y0l</code>, <code class="code">y0</code>, <code class="code">y1f</code>, <code class="code">y1l</code>, <code class="code">y1</code>, <code class="code">ynf</code>, <code class="code">ynl</code> and <code class="code">yn</code> may be handled as built-in functions. All these functions have corresponding versions prefixed with <code class="code">__builtin_</code>, which may be used even in strict C90 mode. </p> <p>The ISO C99 functions <code class="code">_Exit</code>, <code class="code">acoshf</code>, <code class="code">acoshl</code>, <code class="code">acosh</code>, <code class="code">asinhf</code>, <code class="code">asinhl</code>, <code class="code">asinh</code>, <code class="code">atanhf</code>, <code class="code">atanhl</code>, <code class="code">atanh</code>, <code class="code">cabsf</code>, <code class="code">cabsl</code>, <code class="code">cabs</code>, <code class="code">cacosf</code>, <code class="code">cacoshf</code>, <code class="code">cacoshl</code>, <code class="code">cacosh</code>, <code class="code">cacosl</code>, <code class="code">cacos</code>, <code class="code">cargf</code>, <code class="code">cargl</code>, <code class="code">carg</code>, <code class="code">casinf</code>, <code class="code">casinhf</code>, <code class="code">casinhl</code>, <code class="code">casinh</code>, <code class="code">casinl</code>, <code class="code">casin</code>, <code class="code">catanf</code>, <code class="code">catanhf</code>, <code class="code">catanhl</code>, <code class="code">catanh</code>, <code class="code">catanl</code>, <code class="code">catan</code>, <code class="code">cbrtf</code>, <code class="code">cbrtl</code>, <code class="code">cbrt</code>, <code class="code">ccosf</code>, <code class="code">ccoshf</code>, <code class="code">ccoshl</code>, <code class="code">ccosh</code>, <code class="code">ccosl</code>, <code class="code">ccos</code>, <code class="code">cexpf</code>, <code class="code">cexpl</code>, <code class="code">cexp</code>, <code class="code">cimagf</code>, <code class="code">cimagl</code>, <code class="code">cimag</code>, <code class="code">clogf</code>, <code class="code">clogl</code>, <code class="code">clog</code>, <code class="code">conjf</code>, <code class="code">conjl</code>, <code class="code">conj</code>, <code class="code">copysignf</code>, <code class="code">copysignl</code>, <code class="code">copysign</code>, <code class="code">cpowf</code>, <code class="code">cpowl</code>, <code class="code">cpow</code>, <code class="code">cprojf</code>, <code class="code">cprojl</code>, <code class="code">cproj</code>, <code class="code">crealf</code>, <code class="code">creall</code>, <code class="code">creal</code>, <code class="code">csinf</code>, <code class="code">csinhf</code>, <code class="code">csinhl</code>, <code class="code">csinh</code>, <code class="code">csinl</code>, <code class="code">csin</code>, <code class="code">csqrtf</code>, <code class="code">csqrtl</code>, <code class="code">csqrt</code>, <code class="code">ctanf</code>, <code class="code">ctanhf</code>, <code class="code">ctanhl</code>, <code class="code">ctanh</code>, <code class="code">ctanl</code>, <code class="code">ctan</code>, <code class="code">erfcf</code>, <code class="code">erfcl</code>, <code class="code">erfc</code>, <code class="code">erff</code>, <code class="code">erfl</code>, <code class="code">erf</code>, <code class="code">exp2f</code>, <code class="code">exp2l</code>, <code class="code">exp2</code>, <code class="code">expm1f</code>, <code class="code">expm1l</code>, <code class="code">expm1</code>, <code class="code">fdimf</code>, <code class="code">fdiml</code>, <code class="code">fdim</code>, <code class="code">fmaf</code>, <code class="code">fmal</code>, <code class="code">fmaxf</code>, <code class="code">fmaxl</code>, <code class="code">fmax</code>, <code class="code">fma</code>, <code class="code">fminf</code>, <code class="code">fminl</code>, <code class="code">fmin</code>, <code class="code">hypotf</code>, <code class="code">hypotl</code>, <code class="code">hypot</code>, <code class="code">ilogbf</code>, <code class="code">ilogbl</code>, <code class="code">ilogb</code>, <code class="code">imaxabs</code>, <code class="code">isblank</code>, <code class="code">iswblank</code>, <code class="code">lgammaf</code>, <code class="code">lgammal</code>, <code class="code">lgamma</code>, <code class="code">llabs</code>, <code class="code">llrintf</code>, <code class="code">llrintl</code>, <code class="code">llrint</code>, <code class="code">llroundf</code>, <code class="code">llroundl</code>, <code class="code">llround</code>, <code class="code">log1pf</code>, <code class="code">log1pl</code>, <code class="code">log1p</code>, <code class="code">log2f</code>, <code class="code">log2l</code>, <code class="code">log2</code>, <code class="code">logbf</code>, <code class="code">logbl</code>, <code class="code">logb</code>, <code class="code">lrintf</code>, <code class="code">lrintl</code>, <code class="code">lrint</code>, <code class="code">lroundf</code>, <code class="code">lroundl</code>, <code class="code">lround</code>, <code class="code">nearbyintf</code>, <code class="code">nearbyintl</code>, <code class="code">nearbyint</code>, <code class="code">nextafterf</code>, <code class="code">nextafterl</code>, <code class="code">nextafter</code>, <code class="code">nexttowardf</code>, <code class="code">nexttowardl</code>, <code class="code">nexttoward</code>, <code class="code">remainderf</code>, <code class="code">remainderl</code>, <code class="code">remainder</code>, <code class="code">remquof</code>, <code class="code">remquol</code>, <code class="code">remquo</code>, <code class="code">rintf</code>, <code class="code">rintl</code>, <code class="code">rint</code>, <code class="code">roundf</code>, <code class="code">roundl</code>, <code class="code">round</code>, <code class="code">scalblnf</code>, <code class="code">scalblnl</code>, <code class="code">scalbln</code>, <code class="code">scalbnf</code>, <code class="code">scalbnl</code>, <code class="code">scalbn</code>, <code class="code">snprintf</code>, <code class="code">tgammaf</code>, <code class="code">tgammal</code>, <code class="code">tgamma</code>, <code class="code">truncf</code>, <code class="code">truncl</code>, <code class="code">trunc</code>, <code class="code">vfscanf</code>, <code class="code">vscanf</code>, <code class="code">vsnprintf</code> and <code class="code">vsscanf</code> are handled as built-in functions except in strict ISO C90 mode (<samp class="option">-ansi</samp> or <samp class="option">-std=c90</samp>). </p> <p>There are also built-in versions of the ISO C99 functions <code class="code">acosf</code>, <code class="code">acosl</code>, <code class="code">asinf</code>, <code class="code">asinl</code>, <code class="code">atan2f</code>, <code class="code">atan2l</code>, <code class="code">atanf</code>, <code class="code">atanl</code>, <code class="code">ceilf</code>, <code class="code">ceill</code>, <code class="code">cosf</code>, <code class="code">coshf</code>, <code class="code">coshl</code>, <code class="code">cosl</code>, <code class="code">expf</code>, <code class="code">expl</code>, <code class="code">fabsf</code>, <code class="code">fabsl</code>, <code class="code">floorf</code>, <code class="code">floorl</code>, <code class="code">fmodf</code>, <code class="code">fmodl</code>, <code class="code">frexpf</code>, <code class="code">frexpl</code>, <code class="code">ldexpf</code>, <code class="code">ldexpl</code>, <code class="code">log10f</code>, <code class="code">log10l</code>, <code class="code">logf</code>, <code class="code">logl</code>, <code class="code">modfl</code>, <code class="code">modff</code>, <code class="code">powf</code>, <code class="code">powl</code>, <code class="code">sinf</code>, <code class="code">sinhf</code>, <code class="code">sinhl</code>, <code class="code">sinl</code>, <code class="code">sqrtf</code>, <code class="code">sqrtl</code>, <code class="code">tanf</code>, <code class="code">tanhf</code>, <code class="code">tanhl</code> and <code class="code">tanl</code> that are recognized in any mode since ISO C90 reserves these names for the purpose to which ISO C99 puts them. All these functions have corresponding versions prefixed with <code class="code">__builtin_</code>. </p> <p>There are also built-in functions <code class="code">__builtin_fabsf<var class="var">n</var></code>, <code class="code">__builtin_fabsf<var class="var">n</var>x</code>, <code class="code">__builtin_copysignf<var class="var">n</var></code> and <code class="code">__builtin_copysignf<var class="var">n</var>x</code>, corresponding to the TS 18661-3 functions <code class="code">fabsf<var class="var">n</var></code>, <code class="code">fabsf<var class="var">n</var>x</code>, <code class="code">copysignf<var class="var">n</var></code> and <code class="code">copysignf<var class="var">n</var>x</code>, for supported types <code class="code">_Float<var class="var">n</var></code> and <code class="code">_Float<var class="var">n</var>x</code>. </p> <p>There are also GNU extension functions <code class="code">clog10</code>, <code class="code">clog10f</code> and <code class="code">clog10l</code> which names are reserved by ISO C99 for future use. All these functions have versions prefixed with <code class="code">__builtin_</code>. </p> <p>The ISO C94 functions <code class="code">iswalnum</code>, <code class="code">iswalpha</code>, <code class="code">iswcntrl</code>, <code class="code">iswdigit</code>, <code class="code">iswgraph</code>, <code class="code">iswlower</code>, <code class="code">iswprint</code>, <code class="code">iswpunct</code>, <code class="code">iswspace</code>, <code class="code">iswupper</code>, <code class="code">iswxdigit</code>, <code class="code">towlower</code> and <code class="code">towupper</code> are handled as built-in functions except in strict ISO C90 mode (<samp class="option">-ansi</samp> or <samp class="option">-std=c90</samp>). </p> <p>The ISO C90 functions <code class="code">abort</code>, <code class="code">abs</code>, <code class="code">acos</code>, <code class="code">asin</code>, <code class="code">atan2</code>, <code class="code">atan</code>, <code class="code">calloc</code>, <code class="code">ceil</code>, <code class="code">cosh</code>, <code class="code">cos</code>, <code class="code">exit</code>, <code class="code">exp</code>, <code class="code">fabs</code>, <code class="code">floor</code>, <code class="code">fmod</code>, <code class="code">fprintf</code>, <code class="code">fputs</code>, <code class="code">free</code>, <code class="code">frexp</code>, <code class="code">fscanf</code>, <code class="code">isalnum</code>, <code class="code">isalpha</code>, <code class="code">iscntrl</code>, <code class="code">isdigit</code>, <code class="code">isgraph</code>, <code class="code">islower</code>, <code class="code">isprint</code>, <code class="code">ispunct</code>, <code class="code">isspace</code>, <code class="code">isupper</code>, <code class="code">isxdigit</code>, <code class="code">tolower</code>, <code class="code">toupper</code>, <code class="code">labs</code>, <code class="code">ldexp</code>, <code class="code">log10</code>, <code class="code">log</code>, <code class="code">malloc</code>, <code class="code">memchr</code>, <code class="code">memcmp</code>, <code class="code">memcpy</code>, <code class="code">memset</code>, <code class="code">modf</code>, <code class="code">pow</code>, <code class="code">printf</code>, <code class="code">putchar</code>, <code class="code">puts</code>, <code class="code">realloc</code>, <code class="code">scanf</code>, <code class="code">sinh</code>, <code class="code">sin</code>, <code class="code">snprintf</code>, <code class="code">sprintf</code>, <code class="code">sqrt</code>, <code class="code">sscanf</code>, <code class="code">strcat</code>, <code class="code">strchr</code>, <code class="code">strcmp</code>, <code class="code">strcpy</code>, <code class="code">strcspn</code>, <code class="code">strlen</code>, <code class="code">strncat</code>, <code class="code">strncmp</code>, <code class="code">strncpy</code>, <code class="code">strpbrk</code>, <code class="code">strrchr</code>, <code class="code">strspn</code>, <code class="code">strstr</code>, <code class="code">tanh</code>, <code class="code">tan</code>, <code class="code">vfprintf</code>, <code class="code">vprintf</code> and <code class="code">vsprintf</code> are all recognized as built-in functions unless <samp class="option">-fno-builtin</samp> is specified (or <samp class="option">-fno-builtin-<var class="var">function</var></samp> is specified for an individual function). All of these functions have corresponding versions prefixed with <code class="code">__builtin_</code>. </p> <p>GCC provides built-in versions of the ISO C99 floating-point comparison macros that avoid raising exceptions for unordered operands. They have the same names as the standard macros ( <code class="code">isgreater</code>, <code class="code">isgreaterequal</code>, <code class="code">isless</code>, <code class="code">islessequal</code>, <code class="code">islessgreater</code>, and <code class="code">isunordered</code>) , with <code class="code">__builtin_</code> prefixed. We intend for a library implementor to be able to simply <code class="code">#define</code> each standard macro to its built-in equivalent. In the same fashion, GCC provides <code class="code">fpclassify</code>, <code class="code">isfinite</code>, <code class="code">isinf_sign</code>, <code class="code">isnormal</code> and <code class="code">signbit</code> built-ins used with <code class="code">__builtin_</code> prefixed. The <code class="code">isinf</code> and <code class="code">isnan</code> built-in functions appear both with and without the <code class="code">__builtin_</code> prefix. With <code class="code">-ffinite-math-only</code> option the <code class="code">isinf</code> and <code class="code">isnan</code> built-in functions will always return 0. </p> <p>GCC provides built-in versions of the ISO C99 floating-point rounding and exceptions handling functions <code class="code">fegetround</code>, <code class="code">feclearexcept</code> and <code class="code">feraiseexcept</code>. They may not be available for all targets, and because they need close interaction with libc internal values, they may not be available for all target libcs, but in all cases they will gracefully fallback to libc calls. These built-in functions appear both with and without the <code class="code">__builtin_</code> prefix. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005falloca"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_alloca</strong> <code class="def-code-arguments">(size_t size)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005falloca"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">__builtin_alloca</code> function must be called at block scope. The function allocates an object <var class="var">size</var> bytes large on the stack of the calling function. The object is aligned on the default stack alignment boundary for the target determined by the <code class="code">__BIGGEST_ALIGNMENT__</code> macro. The <code class="code">__builtin_alloca</code> function returns a pointer to the first byte of the allocated object. The lifetime of the allocated object ends just before the calling function returns to its caller. This is so even when <code class="code">__builtin_alloca</code> is called within a nested block. </p> <p>For example, the following function allocates eight objects of <code class="code">n</code> bytes each on the stack, storing a pointer to each in consecutive elements of the array <code class="code">a</code>. It then passes the array to function <code class="code">g</code> which can safely use the storage pointed to by each of the array elements. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (unsigned n) +{ + void *a [8]; + for (int i = 0; i != 8; ++i) + a [i] = __builtin_alloca (n); + + g (a, n); // <span class="r">safe</span> +}</pre> +</div> <p>Since the <code class="code">__builtin_alloca</code> function doesn’t validate its argument it is the responsibility of its caller to make sure the argument doesn’t cause it to exceed the stack size limit. The <code class="code">__builtin_alloca</code> function is provided to make it possible to allocate on the stack arrays of bytes with an upper bound that may be computed at run time. Since C99 Variable Length Arrays offer similar functionality under a portable, more convenient, and safer interface they are recommended instead, in both C99 and C++ programs where GCC provides them as an extension. See <a class="xref" href="variable-length">Arrays of Variable Length</a>, for details. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005falloca_005fwith_005falign"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_alloca_with_align</strong> <code class="def-code-arguments">(size_t size, size_t alignment)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005falloca_005fwith_005falign"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">__builtin_alloca_with_align</code> function must be called at block scope. The function allocates an object <var class="var">size</var> bytes large on the stack of the calling function. The allocated object is aligned on the boundary specified by the argument <var class="var">alignment</var> whose unit is given in bits (not bytes). The <var class="var">size</var> argument must be positive and not exceed the stack size limit. The <var class="var">alignment</var> argument must be a constant integer expression that evaluates to a power of 2 greater than or equal to <code class="code">CHAR_BIT</code> and less than some unspecified maximum. Invocations with other values are rejected with an error indicating the valid bounds. The function returns a pointer to the first byte of the allocated object. The lifetime of the allocated object ends at the end of the block in which the function was called. The allocated storage is released no later than just before the calling function returns to its caller, but may be released at the end of the block in which the function was called. </p> <p>For example, in the following function the call to <code class="code">g</code> is unsafe because when <code class="code">overalign</code> is non-zero, the space allocated by <code class="code">__builtin_alloca_with_align</code> may have been released at the end of the <code class="code">if</code> statement in which it was called. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (unsigned n, bool overalign) +{ + void *p; + if (overalign) + p = __builtin_alloca_with_align (n, 64 /* bits */); + else + p = __builtin_alloc (n); + + g (p, n); // <span class="r">unsafe</span> +}</pre> +</div> <p>Since the <code class="code">__builtin_alloca_with_align</code> function doesn’t validate its <var class="var">size</var> argument it is the responsibility of its caller to make sure the argument doesn’t cause it to exceed the stack size limit. The <code class="code">__builtin_alloca_with_align</code> function is provided to make it possible to allocate on the stack overaligned arrays of bytes with an upper bound that may be computed at run time. Since C99 Variable Length Arrays offer the same functionality under a portable, more convenient, and safer interface they are recommended instead, in both C99 and C++ programs where GCC provides them as an extension. See <a class="xref" href="variable-length">Arrays of Variable Length</a>, for details. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005falloca_005fwith_005falign_005fand_005fmax"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <code class="def-code-arguments">(size_t size, size_t alignment, size_t max_size)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005falloca_005fwith_005falign_005fand_005fmax"> ¶</a></span> +</dt> <dd> +<p>Similar to <code class="code">__builtin_alloca_with_align</code> but takes an extra argument specifying an upper bound for <var class="var">size</var> in case its value cannot be computed at compile time, for use by <samp class="option">-fstack-usage</samp>, <samp class="option">-Wstack-usage</samp> and <samp class="option">-Walloca-larger-than</samp>. <var class="var">max_size</var> must be a constant integer expression, it has no effect on code generation and no attempt is made to check its compatibility with <var class="var">size</var>. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fhas_005fattribute"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_has_attribute</strong> <code class="def-code-arguments">(<var class="var">type-or-expression</var>, <var class="var">attribute</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fhas_005fattribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">__builtin_has_attribute</code> function evaluates to an integer constant expression equal to <code class="code">true</code> if the symbol or type referenced by the <var class="var">type-or-expression</var> argument has been declared with the <var class="var">attribute</var> referenced by the second argument. For an <var class="var">type-or-expression</var> argument that does not reference a symbol, since attributes do not apply to expressions the built-in consider the type of the argument. Neither argument is evaluated. The <var class="var">type-or-expression</var> argument is subject to the same restrictions as the argument to <code class="code">typeof</code> (see <a class="pxref" href="typeof">Referring to a Type with <code class="code">typeof</code></a>). The <var class="var">attribute</var> argument is an attribute name optionally followed by a comma-separated list of arguments enclosed in parentheses. Both forms of attribute names—with and without double leading and trailing underscores—are recognized. See <a class="xref" href="attribute-syntax">Attribute Syntax</a>, for details. When no attribute arguments are specified for an attribute that expects one or more arguments the function returns <code class="code">true</code> if <var class="var">type-or-expression</var> has been declared with the attribute regardless of the attribute argument values. Arguments provided for an attribute that expects some are validated and matched up to the provided number. The function returns <code class="code">true</code> if all provided arguments match. For example, the first call to the function below evaluates to <code class="code">true</code> because <code class="code">x</code> is declared with the <code class="code">aligned</code> attribute but the second call evaluates to <code class="code">false</code> because <code class="code">x</code> is declared <code class="code">aligned (8)</code> and not <code class="code">aligned (4)</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__ ((aligned (8))) int x; +_Static_assert (__builtin_has_attribute (x, aligned), "aligned"); +_Static_assert (!__builtin_has_attribute (x, aligned (4)), "aligned (4)");</pre> +</div> <p>Due to a limitation the <code class="code">__builtin_has_attribute</code> function returns <code class="code">false</code> for the <code class="code">mode</code> attribute even if the type or variable referenced by the <var class="var">type-or-expression</var> argument was declared with one. The function is also not supported with labels, and in C with enumerators. </p> <p>Note that unlike the <code class="code">__has_attribute</code> preprocessor operator which is suitable for use in <code class="code">#if</code> preprocessing directives <code class="code">__builtin_has_attribute</code> is an intrinsic function that is not recognized in such contexts. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fspeculation_005fsafe_005fvalue-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__builtin_speculation_safe_value</strong> <code class="def-code-arguments">(<var class="var">type</var> val, <var class="var">type</var> failval)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fspeculation_005fsafe_005fvalue-1"> ¶</a></span> +</dt> <dd> <p>This built-in function can be used to help mitigate against unsafe speculative execution. <var class="var">type</var> may be any integral type or any pointer type. </p> <ol class="enumerate"> <li> If the CPU is not speculatively executing the code, then <var class="var">val</var> is returned. </li> +<li> If the CPU is executing speculatively then either: <ul class="itemize mark-bullet"> <li>The function may cause execution to pause until it is known that the code is no-longer being executed speculatively (in which case <var class="var">val</var> can be returned, as above); or </li> +<li>The function may use target-dependent speculation tracking state to cause <var class="var">failval</var> to be returned when it is known that speculative execution has incorrectly predicted a conditional branch operation. </li> +</ul> </li> +</ol> <p>The second argument, <var class="var">failval</var>, is optional and defaults to zero if omitted. </p> <p>GCC defines the preprocessor macro <code class="code">__HAVE_BUILTIN_SPECULATION_SAFE_VALUE</code> for targets that have been updated to support this builtin. </p> <p>The built-in function can be used where a variable appears to be used in a safe way, but the CPU, due to speculative execution may temporarily ignore the bounds checks. Consider, for example, the following function: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int array[500]; +int f (unsigned untrusted_index) +{ + if (untrusted_index < 500) + return array[untrusted_index]; + return 0; +}</pre> +</div> <p>If the function is called repeatedly with <code class="code">untrusted_index</code> less than the limit of 500, then a branch predictor will learn that the block of code that returns a value stored in <code class="code">array</code> will be executed. If the function is subsequently called with an out-of-range value it will still try to execute that block of code first until the CPU determines that the prediction was incorrect (the CPU will unwind any incorrect operations at that point). However, depending on how the result of the function is used, it might be possible to leave traces in the cache that can reveal what was stored at the out-of-bounds location. The built-in function can be used to provide some protection against leaking data in this way by changing the code to: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int array[500]; +int f (unsigned untrusted_index) +{ + if (untrusted_index < 500) + return array[__builtin_speculation_safe_value (untrusted_index)]; + return 0; +}</pre> +</div> <p>The built-in function will either cause execution to stall until the conditional branch has been fully resolved, or it may permit speculative execution to continue, but using 0 instead of <code class="code">untrusted_value</code> if that exceeds the limit. </p> <p>If accessing any memory location is potentially unsafe when speculative execution is incorrect, then the code can be rewritten as </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int array[500]; +int f (unsigned untrusted_index) +{ + if (untrusted_index < 500) + return *__builtin_speculation_safe_value (&array[untrusted_index], NULL); + return 0; +}</pre> +</div> <p>which will cause a <code class="code">NULL</code> pointer to be used for the unsafe case. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftypes_005fcompatible_005fp"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_types_compatible_p</strong> <code class="def-code-arguments">(<var class="var">type1</var>, <var class="var">type2</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftypes_005fcompatible_005fp"> ¶</a></span> +</dt> <dd> <p>You can use the built-in function <code class="code">__builtin_types_compatible_p</code> to determine whether two types are the same. </p> <p>This built-in function returns 1 if the unqualified versions of the types <var class="var">type1</var> and <var class="var">type2</var> (which are types, not expressions) are compatible, 0 otherwise. The result of this built-in function can be used in integer constant expressions. </p> <p>This built-in function ignores top level qualifiers (e.g., <code class="code">const</code>, <code class="code">volatile</code>). For example, <code class="code">int</code> is equivalent to <code class="code">const +int</code>. </p> <p>The type <code class="code">int[]</code> and <code class="code">int[5]</code> are compatible. On the other hand, <code class="code">int</code> and <code class="code">char *</code> are not compatible, even if the size of their types, on the particular architecture are the same. Also, the amount of pointer indirection is taken into account when determining similarity. Consequently, <code class="code">short *</code> is not similar to <code class="code">short **</code>. Furthermore, two types that are typedefed are considered compatible if their underlying types are compatible. </p> <p>An <code class="code">enum</code> type is not considered to be compatible with another <code class="code">enum</code> type even if both are compatible with the same integer type; this is what the C standard specifies. For example, <code class="code">enum {foo, bar}</code> is not similar to <code class="code">enum {hot, dog}</code>. </p> <p>You typically use this function in code whose execution varies depending on the arguments’ types. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define foo(x) \ + ({ \ + typeof (x) tmp = (x); \ + if (__builtin_types_compatible_p (typeof (x), long double)) \ + tmp = foo_long_double (tmp); \ + else if (__builtin_types_compatible_p (typeof (x), double)) \ + tmp = foo_double (tmp); \ + else if (__builtin_types_compatible_p (typeof (x), float)) \ + tmp = foo_float (tmp); \ + else \ + abort (); \ + tmp; \ + })</pre> +</div> <p><em class="emph">Note:</em> This construct is only available for C. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcall_005fwith_005fstatic_005fchain"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__builtin_call_with_static_chain</strong> <code class="def-code-arguments">(<var class="var">call_exp</var>, <var class="var">pointer_exp</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcall_005fwith_005fstatic_005fchain"> ¶</a></span> +</dt> <dd> <p>The <var class="var">call_exp</var> expression must be a function call, and the <var class="var">pointer_exp</var> expression must be a pointer. The <var class="var">pointer_exp</var> is passed to the function call in the target’s static chain location. The result of builtin is the result of the function call. </p> <p><em class="emph">Note:</em> This builtin is only available for C. This builtin can be used to call Go closures from C. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fchoose_005fexpr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__builtin_choose_expr</strong> <code class="def-code-arguments">(<var class="var">const_exp</var>, <var class="var">exp1</var>, <var class="var">exp2</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fchoose_005fexpr"> ¶</a></span> +</dt> <dd> <p>You can use the built-in function <code class="code">__builtin_choose_expr</code> to evaluate code depending on the value of a constant expression. This built-in function returns <var class="var">exp1</var> if <var class="var">const_exp</var>, which is an integer constant expression, is nonzero. Otherwise it returns <var class="var">exp2</var>. </p> <p>This built-in function is analogous to the ‘<samp class="samp">? :</samp>’ operator in C, except that the expression returned has its type unaltered by promotion rules. Also, the built-in function does not evaluate the expression that is not chosen. For example, if <var class="var">const_exp</var> evaluates to <code class="code">true</code>, <var class="var">exp2</var> is not evaluated even if it has side effects. </p> <p>This built-in function can return an lvalue if the chosen argument is an lvalue. </p> <p>If <var class="var">exp1</var> is returned, the return type is the same as <var class="var">exp1</var>’s type. Similarly, if <var class="var">exp2</var> is returned, its return type is the same as <var class="var">exp2</var>. </p> <p>Example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define foo(x) \ + __builtin_choose_expr ( \ + __builtin_types_compatible_p (typeof (x), double), \ + foo_double (x), \ + __builtin_choose_expr ( \ + __builtin_types_compatible_p (typeof (x), float), \ + foo_float (x), \ + /* <span class="r">The void expression results in a compile-time error</span> \ + <span class="r">when assigning the result to something.</span> */ \ + (void)0))</pre> +</div> <p><em class="emph">Note:</em> This construct is only available for C. Furthermore, the unused expression (<var class="var">exp1</var> or <var class="var">exp2</var> depending on the value of <var class="var">const_exp</var>) may still generate syntax errors. This may change in future revisions. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftgmath"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__builtin_tgmath</strong> <code class="def-code-arguments">(<var class="var">functions</var>, <var class="var">arguments</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftgmath"> ¶</a></span> +</dt> <dd> <p>The built-in function <code class="code">__builtin_tgmath</code>, available only for C and Objective-C, calls a function determined according to the rules of <code class="code"><tgmath.h></code> macros. It is intended to be used in implementations of that header, so that expansions of macros from that header only expand each of their arguments once, to avoid problems when calls to such macros are nested inside the arguments of other calls to such macros; in addition, it results in better diagnostics for invalid calls to <code class="code"><tgmath.h></code> macros than implementations using other GNU C language features. For example, the <code class="code">pow</code> type-generic macro might be defined as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define pow(a, b) __builtin_tgmath (powf, pow, powl, \ + cpowf, cpow, cpowl, a, b)</pre> +</div> <p>The arguments to <code class="code">__builtin_tgmath</code> are at least two pointers to functions, followed by the arguments to the type-generic macro (which will be passed as arguments to the selected function). All the pointers to functions must be pointers to prototyped functions, none of which may have variable arguments, and all of which must have the same number of parameters; the number of parameters of the first function determines how many arguments to <code class="code">__builtin_tgmath</code> are interpreted as function pointers, and how many as the arguments to the called function. </p> <p>The types of the specified functions must all be different, but related to each other in the same way as a set of functions that may be selected between by a macro in <code class="code"><tgmath.h></code>. This means that the functions are parameterized by a floating-point type <var class="var">t</var>, different for each such function. The function return types may all be the same type, or they may be <var class="var">t</var> for each function, or they may be the real type corresponding to <var class="var">t</var> for each function (if some of the types <var class="var">t</var> are complex). Likewise, for each parameter position, the type of the parameter in that position may always be the same type, or may be <var class="var">t</var> for each function (this case must apply for at least one parameter position), or may be the real type corresponding to <var class="var">t</var> for each function. </p> <p>The standard rules for <code class="code"><tgmath.h></code> macros are used to find a common type <var class="var">u</var> from the types of the arguments for parameters whose types vary between the functions; complex integer types (a GNU extension) are treated like the complex type corresponding to the real floating type that would be chosen for the corresponding real integer type. If the function return types vary, or are all the same integer type, the function called is the one for which <var class="var">t</var> is <var class="var">u</var>, and it is an error if there is no such function. If the function return types are all the same floating-point type, the type-generic macro is taken to be one of those from TS 18661 that rounds the result to a narrower type; if there is a function for which <var class="var">t</var> is <var class="var">u</var>, it is called, and otherwise the first function, if any, for which <var class="var">t</var> has at least the range and precision of <var class="var">u</var> is called, and it is an error if there is no such function. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fconstant_005fp"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_constant_p</strong> <code class="def-code-arguments">(<var class="var">exp</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fconstant_005fp"> ¶</a></span> +</dt> <dd> +<p>You can use the built-in function <code class="code">__builtin_constant_p</code> to determine if a value is known to be constant at compile time and hence that GCC can perform constant-folding on expressions involving that value. The argument of the function is the value to test. The function returns the integer 1 if the argument is known to be a compile-time constant and 0 if it is not known to be a compile-time constant. A return of 0 does not indicate that the value is <em class="emph">not</em> a constant, but merely that GCC cannot prove it is a constant with the specified value of the <samp class="option">-O</samp> option. </p> <p>You typically use this function in an embedded application where memory is a critical resource. If you have some complex calculation, you may want it to be folded if it involves constants, but need to call a function if it does not. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define Scale_Value(X) \ + (__builtin_constant_p (X) \ + ? ((X) * SCALE + OFFSET) : Scale (X))</pre> +</div> <p>You may use this built-in function in either a macro or an inline function. However, if you use it in an inlined function and pass an argument of the function as the argument to the built-in, GCC never returns 1 when you call the inline function with a string constant or compound literal (see <a class="pxref" href="compound-literals">Compound Literals</a>) and does not return 1 when you pass a constant numeric value to the inline function unless you specify the <samp class="option">-O</samp> option. </p> <p>You may also use <code class="code">__builtin_constant_p</code> in initializers for static data. For instance, you can write </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static const int table[] = { + __builtin_constant_p (EXPRESSION) ? (EXPRESSION) : -1, + /* <span class="r">…</span> */ +};</pre> +</div> <p>This is an acceptable initializer even if <var class="var">EXPRESSION</var> is not a constant expression, including the case where <code class="code">__builtin_constant_p</code> returns 1 because <var class="var">EXPRESSION</var> can be folded to a constant but <var class="var">EXPRESSION</var> contains operands that are not otherwise permitted in a static initializer (for example, <code class="code">0 && foo ()</code>). GCC must be more conservative about evaluating the built-in in this case, because it has no opportunity to perform optimization. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fis_005fconstant_005fevaluated"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__builtin_is_constant_evaluated</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fis_005fconstant_005fevaluated"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">__builtin_is_constant_evaluated</code> function is available only in C++. The built-in is intended to be used by implementations of the <code class="code">std::is_constant_evaluated</code> C++ function. Programs should make use of the latter function rather than invoking the built-in directly. </p> <p>The main use case of the built-in is to determine whether a <code class="code">constexpr</code> function is being called in a <code class="code">constexpr</code> context. A call to the function evaluates to a core constant expression with the value <code class="code">true</code> if and only if it occurs within the evaluation of an expression or conversion that is manifestly constant-evaluated as defined in the C++ standard. Manifestly constant-evaluated contexts include constant-expressions, the conditions of <code class="code">constexpr if</code> statements, constraint-expressions, and initializers of variables usable in constant expressions. For more details refer to the latest revision of the C++ standard. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fclear_005fpadding"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_clear_padding</strong> <code class="def-code-arguments">(<var class="var">ptr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fclear_005fpadding"> ¶</a></span> +</dt> <dd> +<p>The built-in function <code class="code">__builtin_clear_padding</code> function clears padding bits inside of the object representation of object pointed by <var class="var">ptr</var>, which has to be a pointer. The value representation of the object is not affected. The type of the object is assumed to be the type the pointer points to. Inside of a union, the only cleared bits are bits that are padding bits for all the union members. </p> <p>This built-in-function is useful if the padding bits of an object might have intederminate values and the object representation needs to be bitwise compared to some other object, for example for atomic operations. </p> <p>For C++, <var class="var">ptr</var> argument type should be pointer to trivially-copyable type, unless the argument is address of a variable or parameter, because otherwise it isn’t known if the type isn’t just a base class whose padding bits are reused or laid out differently in a derived class. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fbit_005fcast"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__builtin_bit_cast</strong> <code class="def-code-arguments">(<var class="var">type</var>, <var class="var">arg</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fbit_005fcast"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">__builtin_bit_cast</code> function is available only in C++. The built-in is intended to be used by implementations of the <code class="code">std::bit_cast</code> C++ template function. Programs should make use of the latter function rather than invoking the built-in directly. </p> <p>This built-in function allows reinterpreting the bits of the <var class="var">arg</var> argument as if it had type <var class="var">type</var>. <var class="var">type</var> and the type of the <var class="var">arg</var> argument need to be trivially copyable types with the same size. When manifestly constant-evaluated, it performs extra diagnostics required for <code class="code">std::bit_cast</code> and returns a constant expression if <var class="var">arg</var> is a constant expression. For more details refer to the latest revision of the C++ standard. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fexpect"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long</code> <strong class="def-name">__builtin_expect</strong> <code class="def-code-arguments">(long <var class="var">exp</var>, long <var class="var">c</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fexpect"> ¶</a></span> +</dt> <dd> + <p>You may use <code class="code">__builtin_expect</code> to provide the compiler with branch prediction information. In general, you should prefer to use actual profile feedback for this (<samp class="option">-fprofile-arcs</samp>), as programmers are notoriously bad at predicting how their programs actually perform. However, there are applications in which this data is hard to collect. </p> <p>The return value is the value of <var class="var">exp</var>, which should be an integral expression. The semantics of the built-in are that it is expected that <var class="var">exp</var> == <var class="var">c</var>. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (__builtin_expect (x, 0)) + foo ();</pre> +</div> <p>indicates that we do not expect to call <code class="code">foo</code>, since we expect <code class="code">x</code> to be zero. Since you are limited to integral expressions for <var class="var">exp</var>, you should use constructions such as </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (__builtin_expect (ptr != NULL, 1)) + foo (*ptr);</pre> +</div> <p>when testing pointer or floating-point values. </p> <p>For the purposes of branch prediction optimizations, the probability that a <code class="code">__builtin_expect</code> expression is <code class="code">true</code> is controlled by GCC’s <code class="code">builtin-expect-probability</code> parameter, which defaults to 90%. </p> <p>You can also use <code class="code">__builtin_expect_with_probability</code> to explicitly assign a probability value to individual expressions. If the built-in is used in a loop construct, the provided probability will influence the expected number of iterations made by loop optimizations. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fexpect_005fwith_005fprobability"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long</code> <strong class="def-name">__builtin_expect_with_probability</strong><a class="copiable-link" href="#index-_005f_005fbuiltin_005fexpect_005fwith_005fprobability"> ¶</a></span> +</dt> <dd> +<p>(long <var class="var">exp</var>, long <var class="var">c</var>, double <var class="var">probability</var>) </p> <p>This function has the same semantics as <code class="code">__builtin_expect</code>, but the caller provides the expected probability that <var class="var">exp</var> == <var class="var">c</var>. The last argument, <var class="var">probability</var>, is a floating-point value in the range 0.0 to 1.0, inclusive. The <var class="var">probability</var> argument must be constant floating-point expression. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftrap"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_trap</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftrap"> ¶</a></span> +</dt> <dd><p>This function causes the program to exit abnormally. GCC implements this function by using a target-dependent mechanism (such as intentionally executing an illegal instruction) or by calling <code class="code">abort</code>. The mechanism used may vary from release to release so you should not rely on any particular implementation. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005funreachable"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_unreachable</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005funreachable"> ¶</a></span> +</dt> <dd> +<p>If control flow reaches the point of the <code class="code">__builtin_unreachable</code>, the program is undefined. It is useful in situations where the compiler cannot deduce the unreachability of the code. </p> <p>One such case is immediately following an <code class="code">asm</code> statement that either never terminates, or one that transfers control elsewhere and never returns. In this example, without the <code class="code">__builtin_unreachable</code>, GCC issues a warning that control reaches the end of a non-void function. It also generates code to return after the <code class="code">asm</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int f (int c, int v) +{ + if (c) + { + return v; + } + else + { + asm("jmp error_handler"); + __builtin_unreachable (); + } +}</pre> +</div> <p>Because the <code class="code">asm</code> statement unconditionally transfers control out of the function, control never reaches the end of the function body. The <code class="code">__builtin_unreachable</code> is in fact unreachable and communicates this fact to the compiler. </p> <p>Another use for <code class="code">__builtin_unreachable</code> is following a call a function that never returns but that is not declared <code class="code">__attribute__((noreturn))</code>, as in this example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void function_that_never_returns (void); + +int g (int c) +{ + if (c) + { + return 1; + } + else + { + function_that_never_returns (); + __builtin_unreachable (); + } +}</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fassoc_005fbarrier"> +<span class="category-def">Built-in Function: </span><span><code class="def-type"><var class="var">type</var></code> <strong class="def-name">__builtin_assoc_barrier</strong> <code class="def-code-arguments">(<var class="var">type</var> <var class="var">expr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fassoc_005fbarrier"> ¶</a></span> +</dt> <dd> +<p>This built-in inhibits re-association of the floating-point expression <var class="var">expr</var> with expressions consuming the return value of the built-in. The expression <var class="var">expr</var> itself can be reordered, and the whole expression <var class="var">expr</var> can be reordered with operands after the barrier. The barrier is only relevant when <code class="code">-fassociative-math</code> is active, since otherwise floating-point is not treated as associative. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">float x0 = a + b - b; +float x1 = __builtin_assoc_barrier(a + b) - b;</pre> +</div> <p>means that, with <code class="code">-fassociative-math</code>, <code class="code">x0</code> can be optimized to <code class="code">x0 = a</code> but <code class="code">x1</code> cannot. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fassume_005faligned"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_assume_aligned</strong> <code class="def-code-arguments">(const void *<var class="var">exp</var>, size_t <var class="var">align</var>, ...)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fassume_005faligned"> ¶</a></span> +</dt> <dd> +<p>This function returns its first argument, and allows the compiler to assume that the returned pointer is at least <var class="var">align</var> bytes aligned. This built-in can have either two or three arguments, if it has three, the third argument should have integer type, and if it is nonzero means misalignment offset. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void *x = __builtin_assume_aligned (arg, 16);</pre> +</div> <p>means that the compiler can assume <code class="code">x</code>, set to <code class="code">arg</code>, is at least 16-byte aligned, while: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void *x = __builtin_assume_aligned (arg, 32, 8);</pre> +</div> <p>means that the compiler can assume for <code class="code">x</code>, set to <code class="code">arg</code>, that <code class="code">(char *) x - 8</code> is 32-byte aligned. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fLINE"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_LINE</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fLINE"> ¶</a></span> +</dt> <dd><p>This function is the equivalent of the preprocessor <code class="code">__LINE__</code> macro and returns a constant integer expression that evaluates to the line number of the invocation of the built-in. When used as a C++ default argument for a function <var class="var">F</var>, it returns the line number of the call to <var class="var">F</var>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fFUNCTION"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">__builtin_FUNCTION</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fFUNCTION"> ¶</a></span> +</dt> <dd><p>This function is the equivalent of the <code class="code">__FUNCTION__</code> symbol and returns an address constant pointing to the name of the function from which the built-in was invoked, or the empty string if the invocation is not at function scope. When used as a C++ default argument for a function <var class="var">F</var>, it returns the name of <var class="var">F</var>’s caller or the empty string if the call was not made at function scope. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fFILE"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">__builtin_FILE</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fFILE"> ¶</a></span> +</dt> <dd> +<p>This function is the equivalent of the preprocessor <code class="code">__FILE__</code> macro and returns an address constant pointing to the file name containing the invocation of the built-in, or the empty string if the invocation is not at function scope. When used as a C++ default argument for a function <var class="var">F</var>, it returns the file name of the call to <var class="var">F</var> or the empty string if the call was not made at function scope. </p> <p>For example, in the following, each call to function <code class="code">foo</code> will print a line similar to <code class="code">"file.c:123: foo: message"</code> with the name of the file and the line number of the <code class="code">printf</code> call, the name of the function <code class="code">foo</code>, followed by the word <code class="code">message</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">const char* +function (const char *func = __builtin_FUNCTION ()) +{ + return func; +} + +void foo (void) +{ + printf ("%s:%i: %s: message\n", file (), line (), function ()); +}</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005f_005f_005fclear_005fcache"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin___clear_cache</strong> <code class="def-code-arguments">(void *<var class="var">begin</var>, void *<var class="var">end</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005f_005f_005fclear_005fcache"> ¶</a></span> +</dt> <dd> +<p>This function is used to flush the processor’s instruction cache for the region of memory between <var class="var">begin</var> inclusive and <var class="var">end</var> exclusive. Some targets require that the instruction cache be flushed, after modifying memory containing code, in order to obtain deterministic behavior. </p> <p>If the target does not require instruction cache flushes, <code class="code">__builtin___clear_cache</code> has no effect. Otherwise either instructions are emitted in-line to clear the instruction cache or a call to the <code class="code">__clear_cache</code> function in libgcc is made. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fprefetch"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_prefetch</strong> <code class="def-code-arguments">(const void *<var class="var">addr</var>, ...)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fprefetch"> ¶</a></span> +</dt> <dd> +<p>This function is used to minimize cache-miss latency by moving data into a cache before it is accessed. You can insert calls to <code class="code">__builtin_prefetch</code> into code for which you know addresses of data in memory that is likely to be accessed soon. If the target supports them, data prefetch instructions are generated. If the prefetch is done early enough before the access then the data will be in the cache by the time it is accessed. </p> <p>The value of <var class="var">addr</var> is the address of the memory to prefetch. There are two optional arguments, <var class="var">rw</var> and <var class="var">locality</var>. The value of <var class="var">rw</var> is a compile-time constant one or zero; one means that the prefetch is preparing for a write to the memory address and zero, the default, means that the prefetch is preparing for a read. The value <var class="var">locality</var> must be a compile-time constant integer between zero and three. A value of zero means that the data has no temporal locality, so it need not be left in the cache after the access. A value of three means that the data has a high degree of temporal locality and should be left in all levels of cache possible. Values of one and two mean, respectively, a low or moderate degree of temporal locality. The default is three. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">for (i = 0; i < n; i++) + { + a[i] = a[i] + b[i]; + __builtin_prefetch (&a[i+j], 1, 1); + __builtin_prefetch (&b[i+j], 0, 1); + /* <span class="r">…</span> */ + }</pre> +</div> <p>Data prefetch does not generate faults if <var class="var">addr</var> is invalid, but the address expression itself must be valid. For example, a prefetch of <code class="code">p->next</code> does not fault if <code class="code">p->next</code> is not a valid address, but evaluation faults if <code class="code">p</code> is not a valid address. </p> <p>If the target does not support data prefetch, the address expression is evaluated if it includes side effects but no other code is generated and GCC does not issue a warning. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fobject_005fsize-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">__builtin_object_size</strong> <code class="def-code-arguments">(const void * <var class="var">ptr</var>, int <var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fobject_005fsize-1"> ¶</a></span> +</dt> <dd><p>Returns a constant size estimate of an object pointed to by <var class="var">ptr</var>. See <a class="xref" href="object-size-checking">Object Size Checking</a>, for a detailed description of the function. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fdynamic_005fobject_005fsize-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">__builtin_dynamic_object_size</strong> <code class="def-code-arguments">(const void * <var class="var">ptr</var>, int <var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fdynamic_005fobject_005fsize-1"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_object_size</code> except that the return value need not be a constant. See <a class="xref" href="object-size-checking">Object Size Checking</a>, for a detailed description of the function. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fhuge_005fval"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">double</code> <strong class="def-name">__builtin_huge_val</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fhuge_005fval"> ¶</a></span> +</dt> <dd><p>Returns a positive infinity, if supported by the floating-point format, else <code class="code">DBL_MAX</code>. This function is suitable for implementing the ISO C macro <code class="code">HUGE_VAL</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fhuge_005fvalf"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">float</code> <strong class="def-name">__builtin_huge_valf</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fhuge_005fvalf"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_huge_val</code>, except the return type is <code class="code">float</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fhuge_005fvall"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long double</code> <strong class="def-name">__builtin_huge_vall</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fhuge_005fvall"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_huge_val</code>, except the return type is <code class="code">long double</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fhuge_005fvalfn"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Float<var class="var">n</var></code> <strong class="def-name">__builtin_huge_valf<var class="var">n</var></strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fhuge_005fvalfn"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_huge_val</code>, except the return type is <code class="code">_Float<var class="var">n</var></code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fhuge_005fvalfnx"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Float<var class="var">n</var>x</code> <strong class="def-name">__builtin_huge_valf<var class="var">n</var>x</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fhuge_005fvalfnx"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_huge_val</code>, except the return type is <code class="code">_Float<var class="var">n</var>x</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ffpclassify"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_fpclassify</strong> <code class="def-code-arguments">(int, int, int, int, int, ...)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ffpclassify"> ¶</a></span> +</dt> <dd><p>This built-in implements the C99 fpclassify functionality. The first five int arguments should be the target library’s notion of the possible FP classes and are used for return values. They must be constant values and they must appear in this order: <code class="code">FP_NAN</code>, <code class="code">FP_INFINITE</code>, <code class="code">FP_NORMAL</code>, <code class="code">FP_SUBNORMAL</code> and <code class="code">FP_ZERO</code>. The ellipsis is for exactly one floating-point value to classify. GCC treats the last argument as type-generic, which means it does not do default promotion from float to double. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005finf"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">double</code> <strong class="def-name">__builtin_inf</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005finf"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_huge_val</code>, except a warning is generated if the target floating-point format does not support infinities. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005finfd32"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Decimal32</code> <strong class="def-name">__builtin_infd32</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005finfd32"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_inf</code>, except the return type is <code class="code">_Decimal32</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005finfd64"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Decimal64</code> <strong class="def-name">__builtin_infd64</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005finfd64"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_inf</code>, except the return type is <code class="code">_Decimal64</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005finfd128"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Decimal128</code> <strong class="def-name">__builtin_infd128</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005finfd128"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_inf</code>, except the return type is <code class="code">_Decimal128</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005finff"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">float</code> <strong class="def-name">__builtin_inff</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005finff"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_inf</code>, except the return type is <code class="code">float</code>. This function is suitable for implementing the ISO C99 macro <code class="code">INFINITY</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005finfl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long double</code> <strong class="def-name">__builtin_infl</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005finfl"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_inf</code>, except the return type is <code class="code">long double</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005finffn"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Float<var class="var">n</var></code> <strong class="def-name">__builtin_inff<var class="var">n</var></strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005finffn"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_inf</code>, except the return type is <code class="code">_Float<var class="var">n</var></code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005finffnx"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Float<var class="var">n</var></code> <strong class="def-name">__builtin_inff<var class="var">n</var>x</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005finffnx"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_inf</code>, except the return type is <code class="code">_Float<var class="var">n</var>x</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fisinf_005fsign"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_isinf_sign</strong> <code class="def-code-arguments">(...)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fisinf_005fsign"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">isinf</code>, except the return value is -1 for an argument of <code class="code">-Inf</code> and 1 for an argument of <code class="code">+Inf</code>. Note while the parameter list is an ellipsis, this function only accepts exactly one floating-point argument. GCC treats this parameter as type-generic, which means it does not do default promotion from float to double. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnan"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">double</code> <strong class="def-name">__builtin_nan</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnan"> ¶</a></span> +</dt> <dd> +<p>This is an implementation of the ISO C99 function <code class="code">nan</code>. </p> <p>Since ISO C99 defines this function in terms of <code class="code">strtod</code>, which we do not implement, a description of the parsing is in order. The string is parsed as by <code class="code">strtol</code>; that is, the base is recognized by leading ‘<samp class="samp">0</samp>’ or ‘<samp class="samp">0x</samp>’ prefixes. The number parsed is placed in the significand such that the least significant bit of the number is at the least significant bit of the significand. The number is truncated to fit the significand field provided. The significand is forced to be a quiet NaN. </p> <p>This function, if given a string literal all of which would have been consumed by <code class="code">strtol</code>, is evaluated early enough that it is considered a compile-time constant. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnand32"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Decimal32</code> <strong class="def-name">__builtin_nand32</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnand32"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nan</code>, except the return type is <code class="code">_Decimal32</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnand64"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Decimal64</code> <strong class="def-name">__builtin_nand64</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnand64"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nan</code>, except the return type is <code class="code">_Decimal64</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnand128"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Decimal128</code> <strong class="def-name">__builtin_nand128</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnand128"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nan</code>, except the return type is <code class="code">_Decimal128</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnanf"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">float</code> <strong class="def-name">__builtin_nanf</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnanf"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nan</code>, except the return type is <code class="code">float</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnanl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long double</code> <strong class="def-name">__builtin_nanl</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnanl"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nan</code>, except the return type is <code class="code">long double</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnanfn"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Float<var class="var">n</var></code> <strong class="def-name">__builtin_nanf<var class="var">n</var></strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnanfn"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nan</code>, except the return type is <code class="code">_Float<var class="var">n</var></code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnanfnx"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Float<var class="var">n</var>x</code> <strong class="def-name">__builtin_nanf<var class="var">n</var>x</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnanfnx"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nan</code>, except the return type is <code class="code">_Float<var class="var">n</var>x</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnans"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">double</code> <strong class="def-name">__builtin_nans</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnans"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nan</code>, except the significand is forced to be a signaling NaN. The <code class="code">nans</code> function is proposed by <a class="uref" href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n965.htm">WG14 N965</a>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnansd32"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Decimal32</code> <strong class="def-name">__builtin_nansd32</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnansd32"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nans</code>, except the return type is <code class="code">_Decimal32</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnansd64"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Decimal64</code> <strong class="def-name">__builtin_nansd64</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnansd64"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nans</code>, except the return type is <code class="code">_Decimal64</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnansd128"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Decimal128</code> <strong class="def-name">__builtin_nansd128</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnansd128"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nans</code>, except the return type is <code class="code">_Decimal128</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnansf"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">float</code> <strong class="def-name">__builtin_nansf</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnansf"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nans</code>, except the return type is <code class="code">float</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnansl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long double</code> <strong class="def-name">__builtin_nansl</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnansl"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nans</code>, except the return type is <code class="code">long double</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnansfn"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Float<var class="var">n</var></code> <strong class="def-name">__builtin_nansf<var class="var">n</var></strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnansfn"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nans</code>, except the return type is <code class="code">_Float<var class="var">n</var></code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnansfnx"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">_Float<var class="var">n</var>x</code> <strong class="def-name">__builtin_nansf<var class="var">n</var>x</strong> <code class="def-code-arguments">(const char *str)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnansfnx"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nans</code>, except the return type is <code class="code">_Float<var class="var">n</var>x</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fissignaling"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_issignaling</strong> <code class="def-code-arguments">(...)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fissignaling"> ¶</a></span> +</dt> <dd><p>Return non-zero if the argument is a signaling NaN and zero otherwise. Note while the parameter list is an ellipsis, this function only accepts exactly one floating-point argument. GCC treats this parameter as type-generic, which means it does not do default promotion from float to double. This built-in function can work even without the non-default <code class="code">-fsignaling-nans</code> option, although if a signaling NaN is computed, stored or passed as argument to some function other than this built-in in the current translation unit, it is safer to use <code class="code">-fsignaling-nans</code>. With <code class="code">-ffinite-math-only</code> option this built-in function will always return 0. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fffs"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_ffs</strong> <code class="def-code-arguments">(int x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fffs"> ¶</a></span> +</dt> <dd><p>Returns one plus the index of the least significant 1-bit of <var class="var">x</var>, or if <var class="var">x</var> is zero, returns zero. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fclz"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_clz</strong> <code class="def-code-arguments">(unsigned int x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fclz"> ¶</a></span> +</dt> <dd><p>Returns the number of leading 0-bits in <var class="var">x</var>, starting at the most significant bit position. If <var class="var">x</var> is 0, the result is undefined. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fctz"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_ctz</strong> <code class="def-code-arguments">(unsigned int x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fctz"> ¶</a></span> +</dt> <dd><p>Returns the number of trailing 0-bits in <var class="var">x</var>, starting at the least significant bit position. If <var class="var">x</var> is 0, the result is undefined. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fclrsb"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_clrsb</strong> <code class="def-code-arguments">(int x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fclrsb"> ¶</a></span> +</dt> <dd><p>Returns the number of leading redundant sign bits in <var class="var">x</var>, i.e. the number of bits following the most significant bit that are identical to it. There are no special cases for 0 or other values. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpopcount"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_popcount</strong> <code class="def-code-arguments">(unsigned int x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpopcount"> ¶</a></span> +</dt> <dd><p>Returns the number of 1-bits in <var class="var">x</var>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fparity"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_parity</strong> <code class="def-code-arguments">(unsigned int x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fparity"> ¶</a></span> +</dt> <dd><p>Returns the parity of <var class="var">x</var>, i.e. the number of 1-bits in <var class="var">x</var> modulo 2. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fffsl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_ffsl</strong> <code class="def-code-arguments">(long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fffsl"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_ffs</code>, except the argument type is <code class="code">long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fclzl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_clzl</strong> <code class="def-code-arguments">(unsigned long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fclzl"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_clz</code>, except the argument type is <code class="code">unsigned long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fctzl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_ctzl</strong> <code class="def-code-arguments">(unsigned long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fctzl"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_ctz</code>, except the argument type is <code class="code">unsigned long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fclrsbl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_clrsbl</strong> <code class="def-code-arguments">(long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fclrsbl"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_clrsb</code>, except the argument type is <code class="code">long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpopcountl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_popcountl</strong> <code class="def-code-arguments">(unsigned long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpopcountl"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_popcount</code>, except the argument type is <code class="code">unsigned long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fparityl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_parityl</strong> <code class="def-code-arguments">(unsigned long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fparityl"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_parity</code>, except the argument type is <code class="code">unsigned long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fffsll"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_ffsll</strong> <code class="def-code-arguments">(long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fffsll"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_ffs</code>, except the argument type is <code class="code">long long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fclzll"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_clzll</strong> <code class="def-code-arguments">(unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fclzll"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_clz</code>, except the argument type is <code class="code">unsigned long long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fctzll"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_ctzll</strong> <code class="def-code-arguments">(unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fctzll"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_ctz</code>, except the argument type is <code class="code">unsigned long long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fclrsbll"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_clrsbll</strong> <code class="def-code-arguments">(long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fclrsbll"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_clrsb</code>, except the argument type is <code class="code">long long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpopcountll"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_popcountll</strong> <code class="def-code-arguments">(unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpopcountll"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_popcount</code>, except the argument type is <code class="code">unsigned long long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fparityll"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_parityll</strong> <code class="def-code-arguments">(unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fparityll"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_parity</code>, except the argument type is <code class="code">unsigned long long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpowi"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">double</code> <strong class="def-name">__builtin_powi</strong> <code class="def-code-arguments">(double, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpowi"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fpowif"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">float</code> <strong class="def-name">__builtin_powif</strong> <code class="def-code-arguments">(float, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpowif"> ¶</a></span> +</dt> <dt class="deftypefnx def-cmd-deftypefn" id="index-_005f_005fbuiltin_005fpowil"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long double</code> <strong class="def-name">__builtin_powil</strong> <code class="def-code-arguments">(long double, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpowil"> ¶</a></span> +</dt> <dd><p>Returns the first argument raised to the power of the second. Unlike the <code class="code">pow</code> function no guarantees about precision and rounding are made. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fbswap16"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">uint16_t</code> <strong class="def-name">__builtin_bswap16</strong> <code class="def-code-arguments">(uint16_t x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fbswap16"> ¶</a></span> +</dt> <dd><p>Returns <var class="var">x</var> with the order of the bytes reversed; for example, <code class="code">0xaabb</code> becomes <code class="code">0xbbaa</code>. Byte here always means exactly 8 bits. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fbswap32"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">uint32_t</code> <strong class="def-name">__builtin_bswap32</strong> <code class="def-code-arguments">(uint32_t x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fbswap32"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_bswap16</code>, except the argument and return types are 32-bit. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fbswap64"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">uint64_t</code> <strong class="def-name">__builtin_bswap64</strong> <code class="def-code-arguments">(uint64_t x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fbswap64"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_bswap32</code>, except the argument and return types are 64-bit. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fbswap128"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">uint128_t</code> <strong class="def-name">__builtin_bswap128</strong> <code class="def-code-arguments">(uint128_t x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fbswap128"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_bswap64</code>, except the argument and return types are 128-bit. Only supported on targets when 128-bit types are supported. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fextend_005fpointer"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">Pmode</code> <strong class="def-name">__builtin_extend_pointer</strong> <code class="def-code-arguments">(void * x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fextend_005fpointer"> ¶</a></span> +</dt> <dd><p>On targets where the user visible pointer size is smaller than the size of an actual hardware address this function returns the extended user pointer. Targets where this is true included ILP32 mode on x86_64 or Aarch64. This function is mainly useful when writing inline assembly code. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fgoacc_005fparlevel_005fid"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_goacc_parlevel_id</strong> <code class="def-code-arguments">(int x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fgoacc_005fparlevel_005fid"> ¶</a></span> +</dt> <dd><p>Returns the openacc gang, worker or vector id depending on whether <var class="var">x</var> is 0, 1 or 2. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fgoacc_005fparlevel_005fsize"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_goacc_parlevel_size</strong> <code class="def-code-arguments">(int x)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fgoacc_005fparlevel_005fsize"> ¶</a></span> +</dt> <dd><p>Returns the openacc gang, worker or vector size depending on whether <var class="var">x</var> is 0, 1 or 2. </p></dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a>, Previous: <a href="object-size-checking">Object Size Checking</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Other-Builtins.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Other-Builtins.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/other-mips-built-in-functions.html b/devdocs/gcc~13/other-mips-built-in-functions.html new file mode 100644 index 00000000..e02604d8 --- /dev/null +++ b/devdocs/gcc~13/other-mips-built-in-functions.html @@ -0,0 +1,9 @@ +<div class="subsection-level-extent" id="Other-MIPS-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="msp430-built-in-functions" accesskey="n" rel="next">MSP430 Built-in Functions</a>, Previous: <a href="mips-simd-architecture-_0028msa_0029-support" accesskey="p" rel="prev">MIPS SIMD Architecture (MSA) Support</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Other-MIPS-Built-in-Functions-1"><span>6.60.19 Other MIPS Built-in Functions<a class="copiable-link" href="#Other-MIPS-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC provides other MIPS-specific built-in functions: </p> <dl class="table"> <dt><code class="code">void __builtin_mips_cache (int <var class="var">op</var>, const volatile void *<var class="var">addr</var>)</code></dt> <dd> +<p>Insert a ‘<samp class="samp">cache</samp>’ instruction with operands <var class="var">op</var> and <var class="var">addr</var>. GCC defines the preprocessor macro <code class="code">___GCC_HAVE_BUILTIN_MIPS_CACHE</code> when this function is available. </p> </dd> <dt><code class="code">unsigned int __builtin_mips_get_fcsr (void)</code></dt> <dt><code class="code">void __builtin_mips_set_fcsr (unsigned int <var class="var">value</var>)</code></dt> <dd> +<p>Get and set the contents of the floating-point control and status register (FPU control register 31). These functions are only available in hard-float code but can be called in both MIPS16 and non-MIPS16 contexts. </p> <p><code class="code">__builtin_mips_set_fcsr</code> can be used to change any bit of the register except the condition codes, which GCC assumes are preserved. </p> +</dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Other-MIPS-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Other-MIPS-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/overall-options.html b/devdocs/gcc~13/overall-options.html new file mode 100644 index 00000000..156e2905 --- /dev/null +++ b/devdocs/gcc~13/overall-options.html @@ -0,0 +1,153 @@ +<div class="section-level-extent" id="Overall-Options"> <div class="nav-panel"> <p> Next: <a href="invoking-g_002b_002b" accesskey="n" rel="next">Compiling C++ Programs</a>, Previous: <a href="option-summary" accesskey="p" rel="prev">Option Summary</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-Controlling-the-Kind-of-Output"><span>3.2 Options Controlling the Kind of Output<a class="copiable-link" href="#Options-Controlling-the-Kind-of-Output"> ¶</a></span></h1> <p>Compilation can involve up to four stages: preprocessing, compilation proper, assembly and linking, always in that order. GCC is capable of preprocessing and compiling several files either into several assembler input files, or into one assembler input file; then each assembler input file produces an object file, and linking combines all the object files (those newly compiled, and those specified as input) into an executable file. </p> <p>For any given input file, the file name suffix determines what kind of compilation is done: </p> <dl class="table"> <dt><code class="code"><var class="var">file</var>.c</code></dt> <dd> +<p>C source code that must be preprocessed. </p> </dd> <dt><code class="code"><var class="var">file</var>.i</code></dt> <dd> +<p>C source code that should not be preprocessed. </p> </dd> <dt><code class="code"><var class="var">file</var>.ii</code></dt> <dd> +<p>C++ source code that should not be preprocessed. </p> </dd> <dt><code class="code"><var class="var">file</var>.m</code></dt> <dd> +<p>Objective-C source code. Note that you must link with the <samp class="file">libobjc</samp> library to make an Objective-C program work. </p> </dd> <dt><code class="code"><var class="var">file</var>.mi</code></dt> <dd> +<p>Objective-C source code that should not be preprocessed. </p> </dd> <dt><code class="code"><var class="var">file</var>.mm</code></dt> <dt><code class="code"><var class="var">file</var>.M</code></dt> <dd> +<p>Objective-C++ source code. Note that you must link with the <samp class="file">libobjc</samp> library to make an Objective-C++ program work. Note that ‘<samp class="samp">.M</samp>’ refers to a literal capital M. </p> </dd> <dt><code class="code"><var class="var">file</var>.mii</code></dt> <dd> +<p>Objective-C++ source code that should not be preprocessed. </p> </dd> <dt><code class="code"><var class="var">file</var>.h</code></dt> <dd> +<p>C, C++, Objective-C or Objective-C++ header file to be turned into a precompiled header (default), or C, C++ header file to be turned into an Ada spec (via the <samp class="option">-fdump-ada-spec</samp> switch). </p> </dd> <dt><code class="code"><var class="var">file</var>.cc</code></dt> <dt><code class="code"><var class="var">file</var>.cp</code></dt> <dt><code class="code"><var class="var">file</var>.cxx</code></dt> <dt><code class="code"><var class="var">file</var>.cpp</code></dt> <dt><code class="code"><var class="var">file</var>.CPP</code></dt> <dt><code class="code"><var class="var">file</var>.c++</code></dt> <dt><code class="code"><var class="var">file</var>.C</code></dt> <dd> +<p>C++ source code that must be preprocessed. Note that in ‘<samp class="samp">.cxx</samp>’, the last two letters must both be literally ‘<samp class="samp">x</samp>’. Likewise, ‘<samp class="samp">.C</samp>’ refers to a literal capital C. </p> </dd> <dt><code class="code"><var class="var">file</var>.mm</code></dt> <dt><code class="code"><var class="var">file</var>.M</code></dt> <dd> +<p>Objective-C++ source code that must be preprocessed. </p> </dd> <dt><code class="code"><var class="var">file</var>.mii</code></dt> <dd> +<p>Objective-C++ source code that should not be preprocessed. </p> </dd> <dt><code class="code"><var class="var">file</var>.hh</code></dt> <dt><code class="code"><var class="var">file</var>.H</code></dt> <dt><code class="code"><var class="var">file</var>.hp</code></dt> <dt><code class="code"><var class="var">file</var>.hxx</code></dt> <dt><code class="code"><var class="var">file</var>.hpp</code></dt> <dt><code class="code"><var class="var">file</var>.HPP</code></dt> <dt><code class="code"><var class="var">file</var>.h++</code></dt> <dt><code class="code"><var class="var">file</var>.tcc</code></dt> <dd> +<p>C++ header file to be turned into a precompiled header or Ada spec. </p> </dd> <dt><code class="code"><var class="var">file</var>.f</code></dt> <dt><code class="code"><var class="var">file</var>.for</code></dt> <dt><code class="code"><var class="var">file</var>.ftn</code></dt> <dd> +<p>Fixed form Fortran source code that should not be preprocessed. </p> </dd> <dt><code class="code"><var class="var">file</var>.F</code></dt> <dt><code class="code"><var class="var">file</var>.FOR</code></dt> <dt><code class="code"><var class="var">file</var>.fpp</code></dt> <dt><code class="code"><var class="var">file</var>.FPP</code></dt> <dt><code class="code"><var class="var">file</var>.FTN</code></dt> <dd> +<p>Fixed form Fortran source code that must be preprocessed (with the traditional preprocessor). </p> </dd> <dt><code class="code"><var class="var">file</var>.f90</code></dt> <dt><code class="code"><var class="var">file</var>.f95</code></dt> <dt><code class="code"><var class="var">file</var>.f03</code></dt> <dt><code class="code"><var class="var">file</var>.f08</code></dt> <dd> +<p>Free form Fortran source code that should not be preprocessed. </p> </dd> <dt><code class="code"><var class="var">file</var>.F90</code></dt> <dt><code class="code"><var class="var">file</var>.F95</code></dt> <dt><code class="code"><var class="var">file</var>.F03</code></dt> <dt><code class="code"><var class="var">file</var>.F08</code></dt> <dd> +<p>Free form Fortran source code that must be preprocessed (with the traditional preprocessor). </p> </dd> <dt><code class="code"><var class="var">file</var>.go</code></dt> <dd> +<p>Go source code. </p> </dd> <dt><code class="code"><var class="var">file</var>.d</code></dt> <dd> +<p>D source code. </p> </dd> <dt><code class="code"><var class="var">file</var>.di</code></dt> <dd> +<p>D interface file. </p> </dd> <dt><code class="code"><var class="var">file</var>.dd</code></dt> <dd> +<p>D documentation code (Ddoc). </p> </dd> <dt><code class="code"><var class="var">file</var>.ads</code></dt> <dd> +<p>Ada source code file that contains a library unit declaration (a declaration of a package, subprogram, or generic, or a generic instantiation), or a library unit renaming declaration (a package, generic, or subprogram renaming declaration). Such files are also called <em class="dfn">specs</em>. </p> </dd> <dt><code class="code"><var class="var">file</var>.adb</code></dt> <dd> +<p>Ada source code file containing a library unit body (a subprogram or package body). Such files are also called <em class="dfn">bodies</em>. </p> </dd> <dt><code class="code"><var class="var">file</var>.s</code></dt> <dd> +<p>Assembler code. </p> </dd> <dt><code class="code"><var class="var">file</var>.S</code></dt> <dt><code class="code"><var class="var">file</var>.sx</code></dt> <dd> +<p>Assembler code that must be preprocessed. </p> </dd> <dt><code class="code"><var class="var">other</var></code></dt> <dd><p>An object file to be fed straight into linking. Any file name with no recognized suffix is treated this way. </p></dd> </dl> <p>You can specify the input language explicitly with the <samp class="option">-x</samp> option: </p> <dl class="table"> <dt><code class="code">-x <var class="var">language</var></code></dt> <dd> +<p>Specify explicitly the <var class="var">language</var> for the following input files (rather than letting the compiler choose a default based on the file name suffix). This option applies to all following input files until the next <samp class="option">-x</samp> option. Possible values for <var class="var">language</var> are: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">c c-header cpp-output +c++ c++-header c++-system-header c++-user-header c++-cpp-output +objective-c objective-c-header objective-c-cpp-output +objective-c++ objective-c++-header objective-c++-cpp-output +assembler assembler-with-cpp +ada +d +f77 f77-cpp-input f95 f95-cpp-input +go</pre> +</div> </dd> <dt><code class="code">-x none</code></dt> <dd><p>Turn off any specification of a language, so that subsequent files are handled according to their file name suffixes (as they are if <samp class="option">-x</samp> has not been used at all). </p></dd> </dl> <p>If you only want some of the stages of compilation, you can use <samp class="option">-x</samp> (or filename suffixes) to tell <code class="command">gcc</code> where to start, and one of the options <samp class="option">-c</samp>, <samp class="option">-S</samp>, or <samp class="option">-E</samp> to say where <code class="command">gcc</code> is to stop. Note that some combinations (for example, ‘<samp class="samp">-x cpp-output -E</samp>’) instruct <code class="command">gcc</code> to do nothing at all. </p> <dl class="table"> <dt> +<span><code class="code">-c</code><a class="copiable-link" href="#index-c"> ¶</a></span> +</dt> <dd> +<p>Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file. </p> <p>By default, the object file name for a source file is made by replacing the suffix ‘<samp class="samp">.c</samp>’, ‘<samp class="samp">.i</samp>’, ‘<samp class="samp">.s</samp>’, etc., with ‘<samp class="samp">.o</samp>’. </p> <p>Unrecognized input files, not requiring compilation or assembly, are ignored. </p> </dd> <dt> +<span><code class="code">-S</code><a class="copiable-link" href="#index-S"> ¶</a></span> +</dt> <dd> +<p>Stop after the stage of compilation proper; do not assemble. The output is in the form of an assembler code file for each non-assembler input file specified. </p> <p>By default, the assembler file name for a source file is made by replacing the suffix ‘<samp class="samp">.c</samp>’, ‘<samp class="samp">.i</samp>’, etc., with ‘<samp class="samp">.s</samp>’. </p> <p>Input files that don’t require compilation are ignored. </p> </dd> <dt> +<span><code class="code">-E</code><a class="copiable-link" href="#index-E"> ¶</a></span> +</dt> <dd> +<p>Stop after the preprocessing stage; do not run the compiler proper. The output is in the form of preprocessed source code, which is sent to the standard output. </p> <p>Input files that don’t require preprocessing are ignored. </p> </dd> <dt> + <span><code class="code">-o <var class="var">file</var></code><a class="copiable-link" href="#index-output-file-option"> ¶</a></span> +</dt> <dd> +<p>Place the primary output in file <var class="var">file</var>. This applies to whatever sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code. </p> <p>If <samp class="option">-o</samp> is not specified, the default is to put an executable file in <samp class="file">a.out</samp>, the object file for <samp class="file"><var class="var">source</var>.<var class="var">suffix</var></samp> in <samp class="file"><var class="var">source</var>.o</samp>, its assembler file in <samp class="file"><var class="var">source</var>.s</samp>, a precompiled header file in <samp class="file"><var class="var">source</var>.<var class="var">suffix</var>.gch</samp>, and all preprocessed C source on standard output. </p> <p>Though <samp class="option">-o</samp> names only the primary output, it also affects the naming of auxiliary and dump outputs. See the examples below. Unless overridden, both auxiliary outputs and dump outputs are placed in the same directory as the primary output. In auxiliary outputs, the suffix of the input file is replaced with that of the auxiliary output file type; in dump outputs, the suffix of the dump file is appended to the input file suffix. In compilation commands, the base name of both auxiliary and dump outputs is that of the primary output; in compile and link commands, the primary output name, minus the executable suffix, is combined with the input file name. If both share the same base name, disregarding the suffix, the result of the combination is that base name, otherwise, they are concatenated, separated by a dash. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -c foo.c ...</pre> +</div> <p>will use <samp class="file">foo.o</samp> as the primary output, and place aux outputs and dumps next to it, e.g., aux file <samp class="file">foo.dwo</samp> for <samp class="option">-gsplit-dwarf</samp>, and dump file <samp class="file">foo.c.???r.final</samp> for <samp class="option">-fdump-rtl-final</samp>. </p> <p>If a non-linker output file is explicitly specified, aux and dump files by default take the same base name: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -c foo.c -o dir/foobar.o ...</pre> +</div> <p>will name aux outputs <samp class="file">dir/foobar.*</samp> and dump outputs <samp class="file">dir/foobar.c.*</samp>. </p> <p>A linker output will instead prefix aux and dump outputs: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c bar.c -o dir/foobar ...</pre> +</div> <p>will generally name aux outputs <samp class="file">dir/foobar-foo.*</samp> and <samp class="file">dir/foobar-bar.*</samp>, and dump outputs <samp class="file">dir/foobar-foo.c.*</samp> and <samp class="file">dir/foobar-bar.c.*</samp>. </p> <p>The one exception to the above is when the executable shares the base name with the single input: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c -o dir/foo ...</pre> +</div> <p>in which case aux outputs are named <samp class="file">dir/foo.*</samp> and dump outputs named <samp class="file">dir/foo.c.*</samp>. </p> <p>The location and the names of auxiliary and dump outputs can be adjusted by the options <samp class="option">-dumpbase</samp>, <samp class="option">-dumpbase-ext</samp>, <samp class="option">-dumpdir</samp>, <samp class="option">-save-temps=cwd</samp>, and <samp class="option">-save-temps=obj</samp>. </p> </dd> <dt> +<span><code class="code">-dumpbase <var class="var">dumpbase</var></code><a class="copiable-link" href="#index-dumpbase"> ¶</a></span> +</dt> <dd> +<p>This option sets the base name for auxiliary and dump output files. It does not affect the name of the primary output file. Intermediate outputs, when preserved, are not regarded as primary outputs, but as auxiliary outputs: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -save-temps -S foo.c</pre> +</div> <p>saves the (no longer) temporary preprocessed file in <samp class="file">foo.i</samp>, and then compiles to the (implied) output file <samp class="file">foo.s</samp>, whereas: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -save-temps -dumpbase save-foo -c foo.c</pre> +</div> <p>preprocesses to in <samp class="file">save-foo.i</samp>, compiles to <samp class="file">save-foo.s</samp> (now an intermediate, thus auxiliary output), and then assembles to the (implied) output file <samp class="file">foo.o</samp>. </p> <p>Absent this option, dump and aux files take their names from the input file, or from the (non-linker) output file, if one is explicitly specified: dump output files (e.g. those requested by <samp class="option">-fdump-*</samp> options) with the input name suffix, and aux output files (those requested by other non-dump options, e.g. <code class="code">-save-temps</code>, <code class="code">-gsplit-dwarf</code>, <code class="code">-fcallgraph-info</code>) without it. </p> <p>Similar suffix differentiation of dump and aux outputs can be attained for explicitly-given <samp class="option">-dumpbase basename.suf</samp> by also specifying <samp class="option">-dumpbase-ext .suf</samp>. </p> <p>If <var class="var">dumpbase</var> is explicitly specified with any directory component, any <var class="var">dumppfx</var> specification (e.g. <samp class="option">-dumpdir</samp> or <samp class="option">-save-temps=*</samp>) is ignored, and instead of appending to it, <var class="var">dumpbase</var> fully overrides it: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \ + -dumpdir pfx- -save-temps=cwd ...</pre> +</div> <p>creates auxiliary and dump outputs named <samp class="file">alt/foo.*</samp>, disregarding <samp class="file">dir/</samp> in <samp class="option">-o</samp>, the <samp class="file">./</samp> prefix implied by <samp class="option">-save-temps=cwd</samp>, and <samp class="file">pfx-</samp> in <samp class="option">-dumpdir</samp>. </p> <p>When <samp class="option">-dumpbase</samp> is specified in a command that compiles multiple inputs, or that compiles and then links, it may be combined with <var class="var">dumppfx</var>, as specified under <samp class="option">-dumpdir</samp>. Then, each input file is compiled using the combined <var class="var">dumppfx</var>, and default values for <var class="var">dumpbase</var> and <var class="var">auxdropsuf</var> are computed for each input file: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c bar.c -c -dumpbase main ...</pre> +</div> <p>creates <samp class="file">foo.o</samp> and <samp class="file">bar.o</samp> as primary outputs, and avoids overwriting the auxiliary and dump outputs by using the <var class="var">dumpbase</var> as a prefix, creating auxiliary and dump outputs named <samp class="file">main-foo.*</samp> and <samp class="file">main-bar.*</samp>. </p> <p>An empty string specified as <var class="var">dumpbase</var> avoids the influence of the output basename in the naming of auxiliary and dump outputs during compilation, computing default values : </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -c foo.c -o dir/foobar.o -dumpbase '' ...</pre> +</div> <p>will name aux outputs <samp class="file">dir/foo.*</samp> and dump outputs <samp class="file">dir/foo.c.*</samp>. Note how their basenames are taken from the input name, but the directory still defaults to that of the output. </p> <p>The empty-string dumpbase does not prevent the use of the output basename for outputs during linking: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...</pre> +</div> <p>The compilation of the source files will name auxiliary outputs <samp class="file">dir/foo.*</samp> and <samp class="file">dir/bar.*</samp>, and dump outputs <samp class="file">dir/foo.c.*</samp> and <samp class="file">dir/bar.c.*</samp>. LTO recompilation during linking will use <samp class="file">dir/foobar.</samp> as the prefix for dumps and auxiliary files. </p> </dd> <dt> +<span><code class="code">-dumpbase-ext <var class="var">auxdropsuf</var></code><a class="copiable-link" href="#index-dumpbase-ext"> ¶</a></span> +</dt> <dd> +<p>When forming the name of an auxiliary (but not a dump) output file, drop trailing <var class="var">auxdropsuf</var> from <var class="var">dumpbase</var> before appending any suffixes. If not specified, this option defaults to the suffix of a default <var class="var">dumpbase</var>, i.e., the suffix of the input file when <samp class="option">-dumpbase</samp> is not present in the command line, or <var class="var">dumpbase</var> is combined with <var class="var">dumppfx</var>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...</pre> +</div> <p>creates <samp class="file">dir/foo.o</samp> as the main output, and generates auxiliary outputs in <samp class="file">dir/x-foo.*</samp>, taking the location of the primary output, and dropping the <samp class="file">.c</samp> suffix from the <var class="var">dumpbase</var>. Dump outputs retain the suffix: <samp class="file">dir/x-foo.c.*</samp>. </p> <p>This option is disregarded if it does not match the suffix of a specified <var class="var">dumpbase</var>, except as an alternative to the executable suffix when appending the linker output base name to <var class="var">dumppfx</var>, as specified below: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c bar.c -o main.out -dumpbase-ext .out ...</pre> +</div> <p>creates <samp class="file">main.out</samp> as the primary output, and avoids overwriting the auxiliary and dump outputs by using the executable name minus <var class="var">auxdropsuf</var> as a prefix, creating auxiliary outputs named <samp class="file">main-foo.*</samp> and <samp class="file">main-bar.*</samp> and dump outputs named <samp class="file">main-foo.c.*</samp> and <samp class="file">main-bar.c.*</samp>. </p> </dd> <dt> +<span><code class="code">-dumpdir <var class="var">dumppfx</var></code><a class="copiable-link" href="#index-dumpdir"> ¶</a></span> +</dt> <dd> +<p>When forming the name of an auxiliary or dump output file, use <var class="var">dumppfx</var> as a prefix: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -dumpdir pfx- -c foo.c ...</pre> +</div> <p>creates <samp class="file">foo.o</samp> as the primary output, and auxiliary outputs named <samp class="file">pfx-foo.*</samp>, combining the given <var class="var">dumppfx</var> with the default <var class="var">dumpbase</var> derived from the default primary output, derived in turn from the input name. Dump outputs also take the input name suffix: <samp class="file">pfx-foo.c.*</samp>. </p> <p>If <var class="var">dumppfx</var> is to be used as a directory name, it must end with a directory separator: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...</pre> +</div> <p>creates <samp class="file">obj/bar.o</samp> as the primary output, and auxiliary outputs named <samp class="file">dir/bar.*</samp>, combining the given <var class="var">dumppfx</var> with the default <var class="var">dumpbase</var> derived from the primary output name. Dump outputs also take the input name suffix: <samp class="file">dir/bar.c.*</samp>. </p> <p>It defaults to the location of the output file, unless the output file is a special file like <code class="code">/dev/null</code>. Options <samp class="option">-save-temps=cwd</samp> and <samp class="option">-save-temps=obj</samp> override this default, just like an explicit <samp class="option">-dumpdir</samp> option. In case multiple such options are given, the last one prevails: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -dumpdir pfx- -c foo.c -save-temps=obj ...</pre> +</div> <p>outputs <samp class="file">foo.o</samp>, with auxiliary outputs named <samp class="file">foo.*</samp> because <samp class="option">-save-temps=*</samp> overrides the <var class="var">dumppfx</var> given by the earlier <samp class="option">-dumpdir</samp> option. It does not matter that <samp class="option">=obj</samp> is the default for <samp class="option">-save-temps</samp>, nor that the output directory is implicitly the current directory. Dump outputs are named <samp class="file">foo.c.*</samp>. </p> <p>When compiling from multiple input files, if <samp class="option">-dumpbase</samp> is specified, <var class="var">dumpbase</var>, minus a <var class="var">auxdropsuf</var> suffix, and a dash are appended to (or override, if containing any directory components) an explicit or defaulted <var class="var">dumppfx</var>, so that each of the multiple compilations gets differently-named aux and dump outputs. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...</pre> +</div> <p>outputs auxiliary dumps to <samp class="file">dir/pfx-main-foo.*</samp> and <samp class="file">dir/pfx-main-bar.*</samp>, appending <var class="var">dumpbase</var>- to <var class="var">dumppfx</var>. Dump outputs retain the input file suffix: <samp class="file">dir/pfx-main-foo.c.*</samp> and <samp class="file">dir/pfx-main-bar.c.*</samp>, respectively. Contrast with the single-input compilation: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...</pre> +</div> <p>that, applying <samp class="option">-dumpbase</samp> to a single source, does not compute and append a separate <var class="var">dumpbase</var> per input file. Its auxiliary and dump outputs go in <samp class="file">dir/pfx-main.*</samp>. </p> <p>When compiling and then linking from multiple input files, a defaulted or explicitly specified <var class="var">dumppfx</var> also undergoes the <var class="var">dumpbase</var>- transformation above (e.g. the compilation of <samp class="file">foo.c</samp> and <samp class="file">bar.c</samp> above, but without <samp class="option">-c</samp>). If neither <samp class="option">-dumpdir</samp> nor <samp class="option">-dumpbase</samp> are given, the linker output base name, minus <var class="var">auxdropsuf</var>, if specified, or the executable suffix otherwise, plus a dash is appended to the default <var class="var">dumppfx</var> instead. Note, however, that unlike earlier cases of linking: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c bar.c -dumpdir dir/pfx- -o main ...</pre> +</div> <p>does not append the output name <samp class="file">main</samp> to <var class="var">dumppfx</var>, because <samp class="option">-dumpdir</samp> is explicitly specified. The goal is that the explicitly-specified <var class="var">dumppfx</var> may contain the specified output name as part of the prefix, if desired; only an explicitly-specified <samp class="option">-dumpbase</samp> would be combined with it, in order to avoid simply discarding a meaningful option. </p> <p>When compiling and then linking from a single input file, the linker output base name will only be appended to the default <var class="var">dumppfx</var> as above if it does not share the base name with the single input file name. This has been covered in single-input linking cases above, but not with an explicit <samp class="option">-dumpdir</samp> that inhibits the combination, even if overridden by <samp class="option">-save-temps=*</samp>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...</pre> +</div> <p>Auxiliary outputs are named <samp class="file">foo.*</samp>, and dump outputs <samp class="file">foo.c.*</samp>, in the current working directory as ultimately requested by <samp class="option">-save-temps=cwd</samp>. </p> <p>Summing it all up for an intuitive though slightly imprecise data flow: the primary output name is broken into a directory part and a basename part; <var class="var">dumppfx</var> is set to the former, unless overridden by <samp class="option">-dumpdir</samp> or <samp class="option">-save-temps=*</samp>, and <var class="var">dumpbase</var> is set to the latter, unless overriden by <samp class="option">-dumpbase</samp>. If there are multiple inputs or linking, this <var class="var">dumpbase</var> may be combined with <var class="var">dumppfx</var> and taken from each input file. Auxiliary output names for each input are formed by combining <var class="var">dumppfx</var>, <var class="var">dumpbase</var> minus suffix, and the auxiliary output suffix; dump output names are only different in that the suffix from <var class="var">dumpbase</var> is retained. </p> <p>When it comes to auxiliary and dump outputs created during LTO recompilation, a combination of <var class="var">dumppfx</var> and <var class="var">dumpbase</var>, as given or as derived from the linker output name but not from inputs, even in cases in which this combination would not otherwise be used as such, is passed down with a trailing period replacing the compiler-added dash, if any, as a <samp class="option">-dumpdir</samp> option to <code class="command">lto-wrapper</code>; being involved in linking, this program does not normally get any <samp class="option">-dumpbase</samp> and <samp class="option">-dumpbase-ext</samp>, and it ignores them. </p> <p>When running sub-compilers, <code class="command">lto-wrapper</code> appends LTO stage names to the received <var class="var">dumppfx</var>, ensures it contains a directory component so that it overrides any <samp class="option">-dumpdir</samp>, and passes that as <samp class="option">-dumpbase</samp> to sub-compilers. </p> </dd> <dt> +<span><code class="code">-v</code><a class="copiable-link" href="#index-v"> ¶</a></span> +</dt> <dd> +<p>Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the compiler driver program and of the preprocessor and the compiler proper. </p> </dd> <dt> +<span><code class="code">-###</code><a class="copiable-link" href="#index-_0023_0023_0023"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-v</samp> except the commands are not executed and arguments are quoted unless they contain only alphanumeric characters or <code class="code">./-_</code>. This is useful for shell scripts to capture the driver-generated command lines. </p> </dd> <dt> +<span><code class="code">--help</code><a class="copiable-link" href="#index-help"> ¶</a></span> +</dt> <dd> +<p>Print (on the standard output) a description of the command-line options understood by <code class="command">gcc</code>. If the <samp class="option">-v</samp> option is also specified then <samp class="option">--help</samp> is also passed on to the various processes invoked by <code class="command">gcc</code>, so that they can display the command-line options they accept. If the <samp class="option">-Wextra</samp> option has also been specified (prior to the <samp class="option">--help</samp> option), then command-line options that have no documentation associated with them are also displayed. </p> </dd> <dt> +<span><code class="code">--target-help</code><a class="copiable-link" href="#index-target-help"> ¶</a></span> +</dt> <dd> +<p>Print (on the standard output) a description of target-specific command-line options for each tool. For some targets extra target-specific information may also be printed. </p> </dd> <dt><code class="code">--help={<var class="var">class</var><span class="r">|[</span>^<span class="r">]</span><var class="var">qualifier</var>}<span class="r">[</span>,…<span class="r">]</span></code></dt> <dd> +<p>Print (on the standard output) a description of the command-line options understood by the compiler that fit into all specified classes and qualifiers. These are the supported classes: </p> <dl class="table"> <dt>‘<samp class="samp">optimizers</samp>’</dt> <dd> +<p>Display all of the optimization options supported by the compiler. </p> </dd> <dt>‘<samp class="samp">warnings</samp>’</dt> <dd> +<p>Display all of the options controlling warning messages produced by the compiler. </p> </dd> <dt>‘<samp class="samp">target</samp>’</dt> <dd> +<p>Display target-specific options. Unlike the <samp class="option">--target-help</samp> option however, target-specific options of the linker and assembler are not displayed. This is because those tools do not currently support the extended <samp class="option">--help=</samp> syntax. </p> </dd> <dt>‘<samp class="samp">params</samp>’</dt> <dd> +<p>Display the values recognized by the <samp class="option">--param</samp> option. </p> </dd> <dt><var class="var">language</var></dt> <dd> +<p>Display the options supported for <var class="var">language</var>, where <var class="var">language</var> is the name of one of the languages supported in this version of GCC. If an option is supported by all languages, one needs to select ‘<samp class="samp">common</samp>’ class. </p> </dd> <dt>‘<samp class="samp">common</samp>’</dt> <dd><p>Display the options that are common to all languages. </p></dd> </dl> <p>These are the supported qualifiers: </p> <dl class="table"> <dt>‘<samp class="samp">undocumented</samp>’</dt> <dd> +<p>Display only those options that are undocumented. </p> </dd> <dt>‘<samp class="samp">joined</samp>’</dt> <dd> +<p>Display options taking an argument that appears after an equal sign in the same continuous piece of text, such as: ‘<samp class="samp">--help=target</samp>’. </p> </dd> <dt>‘<samp class="samp">separate</samp>’</dt> <dd><p>Display options taking an argument that appears as a separate word following the original option, such as: ‘<samp class="samp">-o output-file</samp>’. </p></dd> </dl> <p>Thus for example to display all the undocumented target-specific switches supported by the compiler, use: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">--help=target,undocumented</pre> +</div> <p>The sense of a qualifier can be inverted by prefixing it with the ‘<samp class="samp">^</samp>’ character, so for example to display all binary warning options (i.e., ones that are either on or off and that do not take an argument) that have a description, use: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">--help=warnings,^joined,^undocumented</pre> +</div> <p>The argument to <samp class="option">--help=</samp> should not consist solely of inverted qualifiers. </p> <p>Combining several classes is possible, although this usually restricts the output so much that there is nothing to display. One case where it does work, however, is when one of the classes is <var class="var">target</var>. For example, to display all the target-specific optimization options, use: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">--help=target,optimizers</pre> +</div> <p>The <samp class="option">--help=</samp> option can be repeated on the command line. Each successive use displays its requested class of options, skipping those that have already been displayed. If <samp class="option">--help</samp> is also specified anywhere on the command line then this takes precedence over any <samp class="option">--help=</samp> option. </p> <p>If the <samp class="option">-Q</samp> option appears on the command line before the <samp class="option">--help=</samp> option, then the descriptive text displayed by <samp class="option">--help=</samp> is changed. Instead of describing the displayed options, an indication is given as to whether the option is enabled, disabled or set to a specific value (assuming that the compiler knows this at the point where the <samp class="option">--help=</samp> option is used). </p> <p>Here is a truncated example from the ARM port of <code class="command">gcc</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">% gcc -Q -mabi=2 --help=target -c +The following options are target specific: +-mabi= 2 +-mabort-on-noreturn [disabled] +-mapcs [disabled]</pre> +</div> <p>The output is sensitive to the effects of previous command-line options, so for example it is possible to find out which optimizations are enabled at <samp class="option">-O2</samp> by using: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-Q -O2 --help=optimizers</pre> +</div> <p>Alternatively you can discover which binary optimizations are enabled by <samp class="option">-O3</samp> by using: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts +gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts +diff /tmp/O2-opts /tmp/O3-opts | grep enabled</pre> +</div> </dd> <dt> +<span><code class="code">--version</code><a class="copiable-link" href="#index-version"> ¶</a></span> +</dt> <dd> +<p>Display the version number and copyrights of the invoked GCC. </p> </dd> <dt> +<span><code class="code">-pass-exit-codes</code><a class="copiable-link" href="#index-pass-exit-codes"> ¶</a></span> +</dt> <dd> +<p>Normally the <code class="command">gcc</code> program exits with the code of 1 if any phase of the compiler returns a non-success return code. If you specify <samp class="option">-pass-exit-codes</samp>, the <code class="command">gcc</code> program instead returns with the numerically highest error produced by any phase returning an error indication. The C, C++, and Fortran front ends return 4 if an internal compiler error is encountered. </p> </dd> <dt> +<span><code class="code">-pipe</code><a class="copiable-link" href="#index-pipe"> ¶</a></span> +</dt> <dd> +<p>Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble. </p> </dd> <dt> +<span><code class="code">-specs=<var class="var">file</var></code><a class="copiable-link" href="#index-specs"> ¶</a></span> +</dt> <dd> +<p>Process <var class="var">file</var> after the compiler reads in the standard <samp class="file">specs</samp> file, in order to override the defaults which the <code class="command">gcc</code> driver program uses when determining what switches to pass to <code class="command">cc1</code>, <code class="command">cc1plus</code>, <code class="command">as</code>, <code class="command">ld</code>, etc. More than one <samp class="option">-specs=<var class="var">file</var></samp> can be specified on the command line, and they are processed in order, from left to right. See <a class="xref" href="spec-files">Specifying Subprocesses and the Switches to Pass to Them</a>, for information about the format of the <var class="var">file</var>. </p> </dd> <dt> +<span><code class="code">-wrapper</code><a class="copiable-link" href="#index-wrapper"> ¶</a></span> +</dt> <dd> +<p>Invoke all subcommands under a wrapper program. The name of the wrapper program and its parameters are passed as a comma separated list. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">gcc -c t.c -wrapper gdb,--args</pre> +</div> <p>This invokes all subprograms of <code class="command">gcc</code> under ‘<samp class="samp">gdb --args</samp>’, thus the invocation of <code class="command">cc1</code> is ‘<samp class="samp">gdb --args cc1 …</samp>’. </p> </dd> <dt> +<span><code class="code">-ffile-prefix-map=<var class="var">old</var>=<var class="var">new</var></code><a class="copiable-link" href="#index-ffile-prefix-map"> ¶</a></span> +</dt> <dd> +<p>When compiling files residing in directory <samp class="file"><var class="var">old</var></samp>, record any references to them in the result of the compilation as if the files resided in directory <samp class="file"><var class="var">new</var></samp> instead. Specifying this option is equivalent to specifying all the individual <samp class="option">-f*-prefix-map</samp> options. This can be used to make reproducible builds that are location independent. Directories referenced by directives are not affected by these options. See also <samp class="option">-fmacro-prefix-map</samp>, <samp class="option">-fdebug-prefix-map</samp>, <samp class="option">-fprofile-prefix-map</samp> and <samp class="option">-fcanon-prefix-map</samp>. </p> </dd> <dt> +<span><code class="code">-fcanon-prefix-map</code><a class="copiable-link" href="#index-fcanon-prefix-map"> ¶</a></span> +</dt> <dd> +<p>For the <samp class="option">-f*-prefix-map</samp> options normally comparison of <samp class="file"><var class="var">old</var></samp> prefix against the filename that would be normally referenced in the result of the compilation is done using textual comparison of the prefixes, or ignoring character case for case insensitive filesystems and considering slashes and backslashes as equal on DOS based filesystems. The <samp class="option">-fcanon-prefix-map</samp> causes such comparisons to be done on canonicalized paths of <samp class="file"><var class="var">old</var></samp> and the referenced filename. </p> </dd> <dt> +<span><code class="code">-fplugin=<var class="var">name</var>.so</code><a class="copiable-link" href="#index-fplugin"> ¶</a></span> +</dt> <dd> +<p>Load the plugin code in file <var class="var">name</var>.so, assumed to be a shared object to be dlopen’d by the compiler. The base name of the shared object file is used to identify the plugin for the purposes of argument parsing (See <samp class="option">-fplugin-arg-<var class="var">name</var>-<var class="var">key</var>=<var class="var">value</var></samp> below). Each plugin should define the callback functions specified in the Plugins API. </p> </dd> <dt> +<span><code class="code">-fplugin-arg-<var class="var">name</var>-<var class="var">key</var>=<var class="var">value</var></code><a class="copiable-link" href="#index-fplugin-arg"> ¶</a></span> +</dt> <dd> +<p>Define an argument called <var class="var">key</var> with a value of <var class="var">value</var> for the plugin called <var class="var">name</var>. </p> </dd> <dt> +<span><code class="code">-fdump-ada-spec<span class="r">[</span>-slim<span class="r">]</span></code><a class="copiable-link" href="#index-fdump-ada-spec"> ¶</a></span> +</dt> <dd> +<p>For C and C++ source and include files, generate corresponding Ada specs. See <a data-manual="gnat_ugn" href="https://gcc.gnu.org/onlinedocs/gnat_ugn/Generating-Ada-Bindings-for-C-and-C_002b_002b-headers.html#Generating-Ada-Bindings-for-C-and-C_002b_002b-headers">Generating Ada Bindings for C and C++ headers</a> in GNAT User’s Guide, which provides detailed documentation on this feature. </p> </dd> <dt> +<span><code class="code">-fada-spec-parent=<var class="var">unit</var></code><a class="copiable-link" href="#index-fada-spec-parent"> ¶</a></span> +</dt> <dd> +<p>In conjunction with <samp class="option">-fdump-ada-spec<span class="r">[</span>-slim<span class="r">]</span></samp> above, generate Ada specs as child units of parent <var class="var">unit</var>. </p> </dd> <dt> +<span><code class="code">-fdump-go-spec=<var class="var">file</var></code><a class="copiable-link" href="#index-fdump-go-spec"> ¶</a></span> +</dt> <dd> +<p>For input files in any language, generate corresponding Go declarations in <var class="var">file</var>. This generates Go <code class="code">const</code>, <code class="code">type</code>, <code class="code">var</code>, and <code class="code">func</code> declarations which may be a useful way to start writing a Go interface to code written in some other language. </p> </dd> <dt><code class="code">@<var class="var">file</var></code></dt> <dd> +<p>Read command-line options from <var class="var">file</var>. The options read are inserted in place of the original @<var class="var">file</var> option. If <var class="var">file</var> does not exist, or cannot be read, then the option will be treated literally, and not removed. </p> <p>Options in <var class="var">file</var> are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The <var class="var">file</var> may itself contain additional @<var class="var">file</var> options; any such options will be processed recursively. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="invoking-g_002b_002b">Compiling C++ Programs</a>, Previous: <a href="option-summary">Option Summary</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Overall-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Overall-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/paired-single-arithmetic.html b/devdocs/gcc~13/paired-single-arithmetic.html new file mode 100644 index 00000000..2d4ca99c --- /dev/null +++ b/devdocs/gcc~13/paired-single-arithmetic.html @@ -0,0 +1,39 @@ +<div class="subsubsection-level-extent" id="Paired-Single-Arithmetic"> <div class="nav-panel"> <p> Next: <a href="paired-single-built-in-functions" accesskey="n" rel="next">Paired-Single Built-in Functions</a>, Up: <a href="mips-loongson-built-in-functions" accesskey="u" rel="up">MIPS Loongson Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Paired-Single-Arithmetic-1"><span>6.60.17.1 Paired-Single Arithmetic<a class="copiable-link" href="#Paired-Single-Arithmetic-1"> ¶</a></span></h1> <p>The table below lists the <code class="code">v2sf</code> operations for which hardware support exists. <code class="code">a</code>, <code class="code">b</code> and <code class="code">c</code> are <code class="code">v2sf</code> values and <code class="code">x</code> is an integral value. </p> <table class="multitable"> <thead><tr> +<th width="50%">C code</th> +<th width="50%">MIPS instruction</th> +</tr></thead> <tbody> +<tr> +<td width="50%"><code class="code">a + b</code></td> +<td width="50%"><code class="code">add.ps</code></td> +</tr> <tr> +<td width="50%"><code class="code">a - b</code></td> +<td width="50%"><code class="code">sub.ps</code></td> +</tr> <tr> +<td width="50%"><code class="code">-a</code></td> +<td width="50%"><code class="code">neg.ps</code></td> +</tr> <tr> +<td width="50%"><code class="code">a * b</code></td> +<td width="50%"><code class="code">mul.ps</code></td> +</tr> <tr> +<td width="50%"><code class="code">a * b + c</code></td> +<td width="50%"><code class="code">madd.ps</code></td> +</tr> <tr> +<td width="50%"><code class="code">a * b - c</code></td> +<td width="50%"><code class="code">msub.ps</code></td> +</tr> <tr> +<td width="50%"><code class="code">-(a * b + c)</code></td> +<td width="50%"><code class="code">nmadd.ps</code></td> +</tr> <tr> +<td width="50%"><code class="code">-(a * b - c)</code></td> +<td width="50%"><code class="code">nmsub.ps</code></td> +</tr> <tr> +<td width="50%"><code class="code">x ? a : b</code></td> +<td width="50%"> +<code class="code">movn.ps</code>/<code class="code">movz.ps</code> +</td> +</tr> </tbody> </table> <p>Note that the multiply-accumulate instructions can be disabled using the command-line option <code class="code">-mno-fused-madd</code>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Paired-Single-Arithmetic.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Paired-Single-Arithmetic.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/paired-single-built-in-functions.html b/devdocs/gcc~13/paired-single-built-in-functions.html new file mode 100644 index 00000000..6de9bf6d --- /dev/null +++ b/devdocs/gcc~13/paired-single-built-in-functions.html @@ -0,0 +1,31 @@ +<div class="subsubsection-level-extent" id="Paired-Single-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="mips-3d-built-in-functions" accesskey="n" rel="next">MIPS-3D Built-in Functions</a>, Previous: <a href="paired-single-arithmetic" accesskey="p" rel="prev">Paired-Single Arithmetic</a>, Up: <a href="mips-loongson-built-in-functions" accesskey="u" rel="up">MIPS Loongson Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Paired-Single-Built-in-Functions-1"><span>6.60.17.2 Paired-Single Built-in Functions<a class="copiable-link" href="#Paired-Single-Built-in-Functions-1"> ¶</a></span></h1> <p>The following paired-single functions map directly to a particular MIPS instruction. Please refer to the architecture specification for details on what each instruction does. </p> <dl class="table"> <dt><code class="code">v2sf __builtin_mips_pll_ps (v2sf, v2sf)</code></dt> <dd> +<p>Pair lower lower (<code class="code">pll.ps</code>). </p> </dd> <dt><code class="code">v2sf __builtin_mips_pul_ps (v2sf, v2sf)</code></dt> <dd> +<p>Pair upper lower (<code class="code">pul.ps</code>). </p> </dd> <dt><code class="code">v2sf __builtin_mips_plu_ps (v2sf, v2sf)</code></dt> <dd> +<p>Pair lower upper (<code class="code">plu.ps</code>). </p> </dd> <dt><code class="code">v2sf __builtin_mips_puu_ps (v2sf, v2sf)</code></dt> <dd> +<p>Pair upper upper (<code class="code">puu.ps</code>). </p> </dd> <dt><code class="code">v2sf __builtin_mips_cvt_ps_s (float, float)</code></dt> <dd> +<p>Convert pair to paired single (<code class="code">cvt.ps.s</code>). </p> </dd> <dt><code class="code">float __builtin_mips_cvt_s_pl (v2sf)</code></dt> <dd> +<p>Convert pair lower to single (<code class="code">cvt.s.pl</code>). </p> </dd> <dt><code class="code">float __builtin_mips_cvt_s_pu (v2sf)</code></dt> <dd> +<p>Convert pair upper to single (<code class="code">cvt.s.pu</code>). </p> </dd> <dt><code class="code">v2sf __builtin_mips_abs_ps (v2sf)</code></dt> <dd> +<p>Absolute value (<code class="code">abs.ps</code>). </p> </dd> <dt><code class="code">v2sf __builtin_mips_alnv_ps (v2sf, v2sf, int)</code></dt> <dd> +<p>Align variable (<code class="code">alnv.ps</code>). </p> <p><em class="emph">Note:</em> The value of the third parameter must be 0 or 4 modulo 8, otherwise the result is unpredictable. Please read the instruction description for details. </p> +</dd> </dl> <p>The following multi-instruction functions are also available. In each case, <var class="var">cond</var> can be any of the 16 floating-point conditions: <code class="code">f</code>, <code class="code">un</code>, <code class="code">eq</code>, <code class="code">ueq</code>, <code class="code">olt</code>, <code class="code">ult</code>, <code class="code">ole</code>, <code class="code">ule</code>, <code class="code">sf</code>, <code class="code">ngle</code>, <code class="code">seq</code>, <code class="code">ngl</code>, <code class="code">lt</code>, <code class="code">nge</code>, <code class="code">le</code> or <code class="code">ngt</code>. </p> <dl class="table"> <dt><code class="code">v2sf __builtin_mips_movt_c_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>, v2sf <var class="var">c</var>, v2sf <var class="var">d</var>)</code></dt> <dt><code class="code">v2sf __builtin_mips_movf_c_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>, v2sf <var class="var">c</var>, v2sf <var class="var">d</var>)</code></dt> <dd> +<p>Conditional move based on floating-point comparison (<code class="code">c.<var class="var">cond</var>.ps</code>, <code class="code">movt.ps</code>/<code class="code">movf.ps</code>). </p> <p>The <code class="code">movt</code> functions return the value <var class="var">x</var> computed by: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">c.<var class="var">cond</var>.ps <var class="var">cc</var>,<var class="var">a</var>,<var class="var">b</var> +mov.ps <var class="var">x</var>,<var class="var">c</var> +movt.ps <var class="var">x</var>,<var class="var">d</var>,<var class="var">cc</var></pre> +</div> <p>The <code class="code">movf</code> functions are similar but use <code class="code">movf.ps</code> instead of <code class="code">movt.ps</code>. </p> </dd> <dt><code class="code">int __builtin_mips_upper_c_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>)</code></dt> <dt><code class="code">int __builtin_mips_lower_c_<var class="var">cond</var>_ps (v2sf <var class="var">a</var>, v2sf <var class="var">b</var>)</code></dt> <dd> +<p>Comparison of two paired-single values (<code class="code">c.<var class="var">cond</var>.ps</code>, <code class="code">bc1t</code>/<code class="code">bc1f</code>). </p> <p>These functions compare <var class="var">a</var> and <var class="var">b</var> using <code class="code">c.<var class="var">cond</var>.ps</code> and return either the upper or lower half of the result. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2sf a, b; +if (__builtin_mips_upper_c_eq_ps (a, b)) + upper_halves_are_equal (); +else + upper_halves_are_unequal (); + +if (__builtin_mips_lower_c_eq_ps (a, b)) + lower_halves_are_equal (); +else + lower_halves_are_unequal ();</pre> +</div> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="mips-3d-built-in-functions">MIPS-3D Built-in Functions</a>, Previous: <a href="paired-single-arithmetic">Paired-Single Arithmetic</a>, Up: <a href="mips-loongson-built-in-functions">MIPS Loongson Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Paired-Single-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Paired-Single-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/pdp-11-options.html b/devdocs/gcc~13/pdp-11-options.html new file mode 100644 index 00000000..b0236565 --- /dev/null +++ b/devdocs/gcc~13/pdp-11-options.html @@ -0,0 +1,47 @@ +<div class="subsection-level-extent" id="PDP-11-Options"> <div class="nav-panel"> <p> Next: <a href="powerpc-options" accesskey="n" rel="next">PowerPC Options</a>, Previous: <a href="openrisc-options" accesskey="p" rel="prev">OpenRISC Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PDP-11-Options-1"><span>3.19.37 PDP-11 Options<a class="copiable-link" href="#PDP-11-Options-1"> ¶</a></span></h1> <p>These options are defined for the PDP-11: </p> <dl class="table"> <dt> +<span><code class="code">-mfpu</code><a class="copiable-link" href="#index-mfpu-3"> ¶</a></span> +</dt> <dd> +<p>Use hardware FPP floating point. This is the default. (FIS floating point on the PDP-11/40 is not supported.) Implies -m45. </p> </dd> <dt> +<span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-10"> ¶</a></span> +</dt> <dd> +<p>Do not use hardware floating point. </p> </dd> <dt> +<span><code class="code">-mac0</code><a class="copiable-link" href="#index-mac0"> ¶</a></span> +</dt> <dd> +<p>Return floating-point results in ac0 (fr0 in Unix assembler syntax). </p> </dd> <dt> +<span><code class="code">-mno-ac0</code><a class="copiable-link" href="#index-mno-ac0"> ¶</a></span> +</dt> <dd> +<p>Return floating-point results in memory. This is the default. </p> </dd> <dt> +<span><code class="code">-m40</code><a class="copiable-link" href="#index-m40"> ¶</a></span> +</dt> <dd> +<p>Generate code for a PDP-11/40. Implies -msoft-float -mno-split. </p> </dd> <dt> +<span><code class="code">-m45</code><a class="copiable-link" href="#index-m45"> ¶</a></span> +</dt> <dd> +<p>Generate code for a PDP-11/45. This is the default. </p> </dd> <dt> +<span><code class="code">-m10</code><a class="copiable-link" href="#index-m10"> ¶</a></span> +</dt> <dd> +<p>Generate code for a PDP-11/10. Implies -msoft-float -mno-split. </p> </dd> <dt> + <span><code class="code">-mint16</code><a class="copiable-link" href="#index-mint16"> ¶</a></span> +</dt> <dt><code class="code">-mno-int32</code></dt> <dd> +<p>Use 16-bit <code class="code">int</code>. This is the default. </p> </dd> <dt> + <span><code class="code">-mint32</code><a class="copiable-link" href="#index-mint32-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-int16</code></dt> <dd> +<p>Use 32-bit <code class="code">int</code>. </p> </dd> <dt> +<span><code class="code">-msplit</code><a class="copiable-link" href="#index-msplit"> ¶</a></span> +</dt> <dd> +<p>Target has split instruction and data space. Implies -m45. </p> </dd> <dt> +<span><code class="code">-munix-asm</code><a class="copiable-link" href="#index-munix-asm"> ¶</a></span> +</dt> <dd> +<p>Use Unix assembler syntax. </p> </dd> <dt> +<span><code class="code">-mdec-asm</code><a class="copiable-link" href="#index-mdec-asm"> ¶</a></span> +</dt> <dd> +<p>Use DEC assembler syntax. </p> </dd> <dt> +<span><code class="code">-mgnu-asm</code><a class="copiable-link" href="#index-mgnu-asm"> ¶</a></span> +</dt> <dd> +<p>Use GNU assembler syntax. This is the default. </p> </dd> <dt> +<span><code class="code">-mlra</code><a class="copiable-link" href="#index-mlra-2"> ¶</a></span> +</dt> <dd><p>Use the new LRA register allocator. By default, the old “reload” allocator is used. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="powerpc-options">PowerPC Options</a>, Previous: <a href="openrisc-options">OpenRISC Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PDP-11-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PDP-11-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/pointer-arith.html b/devdocs/gcc~13/pointer-arith.html new file mode 100644 index 00000000..1f3b3de5 --- /dev/null +++ b/devdocs/gcc~13/pointer-arith.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Pointer-Arith"> <div class="nav-panel"> <p> Next: <a href="variadic-pointer-args" accesskey="n" rel="next">Pointer Arguments in Variadic Functions</a>, Previous: <a href="subscripting" accesskey="p" rel="prev">Non-Lvalue Arrays May Have Subscripts</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Arithmetic-on-void--and-Function-Pointers"><span>6.24 Arithmetic on void- and Function-Pointers<a class="copiable-link" href="#Arithmetic-on-void--and-Function-Pointers"> ¶</a></span></h1> <p>In GNU C, addition and subtraction operations are supported on pointers to <code class="code">void</code> and on pointers to functions. This is done by treating the size of a <code class="code">void</code> or of a function as 1. </p> <p>A consequence of this is that <code class="code">sizeof</code> is also allowed on <code class="code">void</code> and on function types, and returns 1. </p> <p>The option <samp class="option">-Wpointer-arith</samp> requests a warning if these extensions are used. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Pointer-Arith.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Pointer-Arith.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/pointers-to-arrays.html b/devdocs/gcc~13/pointers-to-arrays.html new file mode 100644 index 00000000..8a1fac9d --- /dev/null +++ b/devdocs/gcc~13/pointers-to-arrays.html @@ -0,0 +1,12 @@ +<div class="section-level-extent" id="Pointers-to-Arrays"> <div class="nav-panel"> <p> Next: <a href="initializers" accesskey="n" rel="next">Non-Constant Initializers</a>, Previous: <a href="variadic-pointer-args" accesskey="p" rel="prev">Pointer Arguments in Variadic Functions</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Pointers-to-Arrays-with-Qualifiers-Work-as-Expected"><span>6.26 Pointers to Arrays with Qualifiers Work as Expected<a class="copiable-link" href="#Pointers-to-Arrays-with-Qualifiers-Work-as-Expected"> ¶</a></span></h1> <p>In GNU C, pointers to arrays with qualifiers work similar to pointers to other qualified types. For example, a value of type <code class="code">int (*)[5]</code> can be used to initialize a variable of type <code class="code">const int (*)[5]</code>. These types are incompatible in ISO C because the <code class="code">const</code> qualifier is formally attached to the element type of the array and not the array itself. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern void +transpose (int N, int M, double out[M][N], const double in[N][M]); +double x[3][2]; +double y[2][3]; +<span class="r">…</span> +transpose(3, 2, y, x);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Pointers-to-Arrays.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Pointers-to-Arrays.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-2_002e06.html b/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-2_002e06.html new file mode 100644 index 00000000..b641a667 --- /dev/null +++ b/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-2_002e06.html @@ -0,0 +1,110 @@ +<div class="subsubsection-level-extent" id="PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e06"> <div class="nav-panel"> <p> Next: <a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e07" accesskey="n" rel="next">PowerPC AltiVec Built-in Functions Available on ISA 2.07</a>, Previous: <a href="powerpc-altivec-built-in-functions-on-isa-2_002e05" accesskey="p" rel="prev">PowerPC AltiVec Built-in Functions on ISA 2.05</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions" accesskey="u" rel="up">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e06-1"><span>6.60.23.2 PowerPC AltiVec Built-in Functions Available on ISA 2.06<a class="copiable-link" href="#PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e06-1"> ¶</a></span></h1> <p>The AltiVec built-in functions described in this section are available on the PowerPC family of processors starting with ISA 2.06 or later. These are normally enabled by adding <samp class="option">-mvsx</samp> to the command line. </p> <p>When <samp class="option">-mvsx</samp> is used, the following additional vector types are implemented. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector unsigned __int128 +vector signed __int128 +vector unsigned long long int +vector signed long long int +vector double</pre> +</div> <p>The long long types are only implemented for 64-bit code generation. </p> <p>Only functions excluded from the PVIPR are listed here. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void vec_dst (const unsigned long *, int, const int); +void vec_dst (const long *, int, const int); + +void vec_dststt (const unsigned long *, int, const int); +void vec_dststt (const long *, int, const int); + +void vec_dstt (const unsigned long *, int, const int); +void vec_dstt (const long *, int, const int); + +vector unsigned char vec_lvsl (int, const unsigned long *); +vector unsigned char vec_lvsl (int, const long *); + +vector unsigned char vec_lvsr (int, const unsigned long *); +vector unsigned char vec_lvsr (int, const long *); + +vector unsigned char vec_lvsl (int, const double *); +vector unsigned char vec_lvsr (int, const double *); + +vector double vec_vsx_ld (int, const vector double *); +vector double vec_vsx_ld (int, const double *); +vector float vec_vsx_ld (int, const vector float *); +vector float vec_vsx_ld (int, const float *); +vector bool int vec_vsx_ld (int, const vector bool int *); +vector signed int vec_vsx_ld (int, const vector signed int *); +vector signed int vec_vsx_ld (int, const int *); +vector signed int vec_vsx_ld (int, const long *); +vector unsigned int vec_vsx_ld (int, const vector unsigned int *); +vector unsigned int vec_vsx_ld (int, const unsigned int *); +vector unsigned int vec_vsx_ld (int, const unsigned long *); +vector bool short vec_vsx_ld (int, const vector bool short *); +vector pixel vec_vsx_ld (int, const vector pixel *); +vector signed short vec_vsx_ld (int, const vector signed short *); +vector signed short vec_vsx_ld (int, const short *); +vector unsigned short vec_vsx_ld (int, const vector unsigned short *); +vector unsigned short vec_vsx_ld (int, const unsigned short *); +vector bool char vec_vsx_ld (int, const vector bool char *); +vector signed char vec_vsx_ld (int, const vector signed char *); +vector signed char vec_vsx_ld (int, const signed char *); +vector unsigned char vec_vsx_ld (int, const vector unsigned char *); +vector unsigned char vec_vsx_ld (int, const unsigned char *); + +void vec_vsx_st (vector double, int, vector double *); +void vec_vsx_st (vector double, int, double *); +void vec_vsx_st (vector float, int, vector float *); +void vec_vsx_st (vector float, int, float *); +void vec_vsx_st (vector signed int, int, vector signed int *); +void vec_vsx_st (vector signed int, int, int *); +void vec_vsx_st (vector unsigned int, int, vector unsigned int *); +void vec_vsx_st (vector unsigned int, int, unsigned int *); +void vec_vsx_st (vector bool int, int, vector bool int *); +void vec_vsx_st (vector bool int, int, unsigned int *); +void vec_vsx_st (vector bool int, int, int *); +void vec_vsx_st (vector signed short, int, vector signed short *); +void vec_vsx_st (vector signed short, int, short *); +void vec_vsx_st (vector unsigned short, int, vector unsigned short *); +void vec_vsx_st (vector unsigned short, int, unsigned short *); +void vec_vsx_st (vector bool short, int, vector bool short *); +void vec_vsx_st (vector bool short, int, unsigned short *); +void vec_vsx_st (vector pixel, int, vector pixel *); +void vec_vsx_st (vector pixel, int, unsigned short *); +void vec_vsx_st (vector pixel, int, short *); +void vec_vsx_st (vector bool short, int, short *); +void vec_vsx_st (vector signed char, int, vector signed char *); +void vec_vsx_st (vector signed char, int, signed char *); +void vec_vsx_st (vector unsigned char, int, vector unsigned char *); +void vec_vsx_st (vector unsigned char, int, unsigned char *); +void vec_vsx_st (vector bool char, int, vector bool char *); +void vec_vsx_st (vector bool char, int, unsigned char *); +void vec_vsx_st (vector bool char, int, signed char *); + +vector double vec_xxpermdi (vector double, vector double, const int); +vector float vec_xxpermdi (vector float, vector float, const int); +vector long long vec_xxpermdi (vector long long, vector long long, const int); +vector unsigned long long vec_xxpermdi (vector unsigned long long, + vector unsigned long long, const int); +vector int vec_xxpermdi (vector int, vector int, const int); +vector unsigned int vec_xxpermdi (vector unsigned int, + vector unsigned int, const int); +vector short vec_xxpermdi (vector short, vector short, const int); +vector unsigned short vec_xxpermdi (vector unsigned short, + vector unsigned short, const int); +vector signed char vec_xxpermdi (vector signed char, vector signed char, + const int); +vector unsigned char vec_xxpermdi (vector unsigned char, + vector unsigned char, const int); + +vector double vec_xxsldi (vector double, vector double, int); +vector float vec_xxsldi (vector float, vector float, int); +vector long long vec_xxsldi (vector long long, vector long long, int); +vector unsigned long long vec_xxsldi (vector unsigned long long, + vector unsigned long long, int); +vector int vec_xxsldi (vector int, vector int, int); +vector unsigned int vec_xxsldi (vector unsigned int, vector unsigned int, int); +vector short vec_xxsldi (vector short, vector short, int); +vector unsigned short vec_xxsldi (vector unsigned short, + vector unsigned short, int); +vector signed char vec_xxsldi (vector signed char, vector signed char, int); +vector unsigned char vec_xxsldi (vector unsigned char, + vector unsigned char, int);</pre> +</div> <p>Note that the ‘<samp class="samp">vec_ld</samp>’ and ‘<samp class="samp">vec_st</samp>’ built-in functions always generate the AltiVec ‘<samp class="samp">LVX</samp>’ and ‘<samp class="samp">STVX</samp>’ instructions even if the VSX instruction set is available. The ‘<samp class="samp">vec_vsx_ld</samp>’ and ‘<samp class="samp">vec_vsx_st</samp>’ built-in functions always generate the VSX ‘<samp class="samp">LXVD2X</samp>’, ‘<samp class="samp">LXVW4X</samp>’, ‘<samp class="samp">STXVD2X</samp>’, and ‘<samp class="samp">STXVW4X</samp>’ instructions. </p> </div> <div class="nav-panel"> <p> Next: <a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e07">PowerPC AltiVec Built-in Functions Available on ISA 2.07</a>, Previous: <a href="powerpc-altivec-built-in-functions-on-isa-2_002e05">PowerPC AltiVec Built-in Functions on ISA 2.05</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e06.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e06.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-2_002e07.html b/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-2_002e07.html new file mode 100644 index 00000000..9d05c366 --- /dev/null +++ b/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-2_002e07.html @@ -0,0 +1,167 @@ +<div class="subsubsection-level-extent" id="PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e07"> <div class="nav-panel"> <p> Next: <a href="powerpc-altivec-built-in-functions-available-on-isa-3_002e0" accesskey="n" rel="next">PowerPC AltiVec Built-in Functions Available on ISA 3.0</a>, Previous: <a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e06" accesskey="p" rel="prev">PowerPC AltiVec Built-in Functions Available on ISA 2.06</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions" accesskey="u" rel="up">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e07-1"><span>6.60.23.3 PowerPC AltiVec Built-in Functions Available on ISA 2.07<a class="copiable-link" href="#PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e07-1"> ¶</a></span></h1> <p>If the ISA 2.07 additions to the vector/scalar (power8-vector) instruction set are available, the following additional functions are available for both 32-bit and 64-bit targets. For 64-bit targets, you can use <var class="var">vector long</var> instead of <var class="var">vector long long</var>, <var class="var">vector bool long</var> instead of <var class="var">vector bool long long</var>, and <var class="var">vector unsigned long</var> instead of <var class="var">vector unsigned long long</var>. </p> <p>Only functions excluded from the PVIPR are listed here. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector long long vec_vaddudm (vector long long, vector long long); +vector long long vec_vaddudm (vector bool long long, vector long long); +vector long long vec_vaddudm (vector long long, vector bool long long); +vector unsigned long long vec_vaddudm (vector unsigned long long, + vector unsigned long long); +vector unsigned long long vec_vaddudm (vector bool unsigned long long, + vector unsigned long long); +vector unsigned long long vec_vaddudm (vector unsigned long long, + vector bool unsigned long long); + +vector long long vec_vclz (vector long long); +vector unsigned long long vec_vclz (vector unsigned long long); +vector int vec_vclz (vector int); +vector unsigned int vec_vclz (vector int); +vector short vec_vclz (vector short); +vector unsigned short vec_vclz (vector unsigned short); +vector signed char vec_vclz (vector signed char); +vector unsigned char vec_vclz (vector unsigned char); + +vector signed char vec_vclzb (vector signed char); +vector unsigned char vec_vclzb (vector unsigned char); + +vector long long vec_vclzd (vector long long); +vector unsigned long long vec_vclzd (vector unsigned long long); + +vector short vec_vclzh (vector short); +vector unsigned short vec_vclzh (vector unsigned short); + +vector int vec_vclzw (vector int); +vector unsigned int vec_vclzw (vector int); + +vector signed char vec_vgbbd (vector signed char); +vector unsigned char vec_vgbbd (vector unsigned char); + +vector long long vec_vmaxsd (vector long long, vector long long); + +vector unsigned long long vec_vmaxud (vector unsigned long long, + unsigned vector long long); + +vector long long vec_vminsd (vector long long, vector long long); + +vector unsigned long long vec_vminud (vector long long, vector long long); + +vector int vec_vpksdss (vector long long, vector long long); +vector unsigned int vec_vpksdss (vector long long, vector long long); + +vector unsigned int vec_vpkudus (vector unsigned long long, + vector unsigned long long); + +vector int vec_vpkudum (vector long long, vector long long); +vector unsigned int vec_vpkudum (vector unsigned long long, + vector unsigned long long); +vector bool int vec_vpkudum (vector bool long long, vector bool long long); + +vector long long vec_vpopcnt (vector long long); +vector unsigned long long vec_vpopcnt (vector unsigned long long); +vector int vec_vpopcnt (vector int); +vector unsigned int vec_vpopcnt (vector int); +vector short vec_vpopcnt (vector short); +vector unsigned short vec_vpopcnt (vector unsigned short); +vector signed char vec_vpopcnt (vector signed char); +vector unsigned char vec_vpopcnt (vector unsigned char); + +vector signed char vec_vpopcntb (vector signed char); +vector unsigned char vec_vpopcntb (vector unsigned char); + +vector long long vec_vpopcntd (vector long long); +vector unsigned long long vec_vpopcntd (vector unsigned long long); + +vector short vec_vpopcnth (vector short); +vector unsigned short vec_vpopcnth (vector unsigned short); + +vector int vec_vpopcntw (vector int); +vector unsigned int vec_vpopcntw (vector int); + +vector long long vec_vrld (vector long long, vector unsigned long long); +vector unsigned long long vec_vrld (vector unsigned long long, + vector unsigned long long); + +vector long long vec_vsld (vector long long, vector unsigned long long); +vector long long vec_vsld (vector unsigned long long, + vector unsigned long long); + +vector long long vec_vsrad (vector long long, vector unsigned long long); +vector unsigned long long vec_vsrad (vector unsigned long long, + vector unsigned long long); + +vector long long vec_vsrd (vector long long, vector unsigned long long); +vector unsigned long long char vec_vsrd (vector unsigned long long, + vector unsigned long long); + +vector long long vec_vsubudm (vector long long, vector long long); +vector long long vec_vsubudm (vector bool long long, vector long long); +vector long long vec_vsubudm (vector long long, vector bool long long); +vector unsigned long long vec_vsubudm (vector unsigned long long, + vector unsigned long long); +vector unsigned long long vec_vsubudm (vector bool long long, + vector unsigned long long); +vector unsigned long long vec_vsubudm (vector unsigned long long, + vector bool long long); + +vector long long vec_vupkhsw (vector int); +vector unsigned long long vec_vupkhsw (vector unsigned int); + +vector long long vec_vupklsw (vector int); +vector unsigned long long vec_vupklsw (vector int);</pre> +</div> <p>If the ISA 2.07 additions to the vector/scalar (power8-vector) instruction set are available, the following additional functions are available for 64-bit targets. New vector types (<var class="var">vector __int128</var> and <var class="var">vector __uint128</var>) are available to hold the <var class="var">__int128</var> and <var class="var">__uint128</var> types to use these builtins. </p> <p>The normal vector extract, and set operations work on <var class="var">vector __int128</var> and <var class="var">vector __uint128</var> types, but the index value must be 0. </p> <p>Only functions excluded from the PVIPR are listed here. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector __int128 vec_vaddcuq (vector __int128, vector __int128); +vector __uint128 vec_vaddcuq (vector __uint128, vector __uint128); + +vector __int128 vec_vadduqm (vector __int128, vector __int128); +vector __uint128 vec_vadduqm (vector __uint128, vector __uint128); + +vector __int128 vec_vaddecuq (vector __int128, vector __int128, + vector __int128); +vector __uint128 vec_vaddecuq (vector __uint128, vector __uint128, + vector __uint128); + +vector __int128 vec_vaddeuqm (vector __int128, vector __int128, + vector __int128); +vector __uint128 vec_vaddeuqm (vector __uint128, vector __uint128, + vector __uint128); + +vector __int128 vec_vsubecuq (vector __int128, vector __int128, + vector __int128); +vector __uint128 vec_vsubecuq (vector __uint128, vector __uint128, + vector __uint128); + +vector __int128 vec_vsubeuqm (vector __int128, vector __int128, + vector __int128); +vector __uint128 vec_vsubeuqm (vector __uint128, vector __uint128, + vector __uint128); + +vector __int128 vec_vsubcuq (vector __int128, vector __int128); +vector __uint128 vec_vsubcuq (vector __uint128, vector __uint128); + +__int128 vec_vsubuqm (__int128, __int128); +__uint128 vec_vsubuqm (__uint128, __uint128); + +vector __int128 __builtin_bcdadd (vector __int128, vector __int128, const int); +vector unsigned char __builtin_bcdadd (vector unsigned char, vector unsigned char, + const int); +int __builtin_bcdadd_lt (vector __int128, vector __int128, const int); +int __builtin_bcdadd_lt (vector unsigned char, vector unsigned char, const int); +int __builtin_bcdadd_eq (vector __int128, vector __int128, const int); +int __builtin_bcdadd_eq (vector unsigned char, vector unsigned char, const int); +int __builtin_bcdadd_gt (vector __int128, vector __int128, const int); +int __builtin_bcdadd_gt (vector unsigned char, vector unsigned char, const int); +int __builtin_bcdadd_ov (vector __int128, vector __int128, const int); +int __builtin_bcdadd_ov (vector unsigned char, vector unsigned char, const int); + +vector __int128 __builtin_bcdsub (vector __int128, vector __int128, const int); +vector unsigned char __builtin_bcdsub (vector unsigned char, vector unsigned char, + const int); +int __builtin_bcdsub_lt (vector __int128, vector __int128, const int); +int __builtin_bcdsub_lt (vector unsigned char, vector unsigned char, const int); +int __builtin_bcdsub_eq (vector __int128, vector __int128, const int); +int __builtin_bcdsub_eq (vector unsigned char, vector unsigned char, const int); +int __builtin_bcdsub_gt (vector __int128, vector __int128, const int); +int __builtin_bcdsub_gt (vector unsigned char, vector unsigned char, const int); +int __builtin_bcdsub_ov (vector __int128, vector __int128, const int); +int __builtin_bcdsub_ov (vector unsigned char, vector unsigned char, const int);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="powerpc-altivec-built-in-functions-available-on-isa-3_002e0">PowerPC AltiVec Built-in Functions Available on ISA 3.0</a>, Previous: <a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e06">PowerPC AltiVec Built-in Functions Available on ISA 2.06</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e07.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-2_002e07.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-3_002e0.html b/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-3_002e0.html new file mode 100644 index 00000000..19415247 --- /dev/null +++ b/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-3_002e0.html @@ -0,0 +1,173 @@ +<div class="subsubsection-level-extent" id="PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e0"> <div class="nav-panel"> <p> Next: <a href="powerpc-altivec-built-in-functions-available-on-isa-3_002e1" accesskey="n" rel="next">PowerPC AltiVec Built-in Functions Available on ISA 3.1</a>, Previous: <a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e07" accesskey="p" rel="prev">PowerPC AltiVec Built-in Functions Available on ISA 2.07</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions" accesskey="u" rel="up">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e0-1"><span>6.60.23.4 PowerPC AltiVec Built-in Functions Available on ISA 3.0<a class="copiable-link" href="#PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e0-1"> ¶</a></span></h1> <p>The following additional built-in functions are also available for the PowerPC family of processors, starting with ISA 3.0 (<samp class="option">-mcpu=power9</samp>) or later. </p> <p>Only instructions excluded from the PVIPR are listed here. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int scalar_extract_exp (double source); +unsigned long long int scalar_extract_exp (__ieee128 source); + +unsigned long long int scalar_extract_sig (double source); +unsigned __int128 scalar_extract_sig (__ieee128 source); + +double scalar_insert_exp (unsigned long long int significand, + unsigned long long int exponent); +double scalar_insert_exp (double significand, unsigned long long int exponent); + +ieee_128 scalar_insert_exp (unsigned __int128 significand, + unsigned long long int exponent); +ieee_128 scalar_insert_exp (ieee_128 significand, unsigned long long int exponent); + +int scalar_cmp_exp_gt (double arg1, double arg2); +int scalar_cmp_exp_lt (double arg1, double arg2); +int scalar_cmp_exp_eq (double arg1, double arg2); +int scalar_cmp_exp_unordered (double arg1, double arg2); + +bool scalar_test_data_class (float source, const int condition); +bool scalar_test_data_class (double source, const int condition); +bool scalar_test_data_class (__ieee128 source, const int condition); + +bool scalar_test_neg (float source); +bool scalar_test_neg (double source); +bool scalar_test_neg (__ieee128 source);</pre> +</div> <p>The <code class="code">scalar_extract_exp</code> and <code class="code">scalar_extract_sig</code> functions require a 64-bit environment supporting ISA 3.0 or later. The <code class="code">scalar_extract_exp</code> and <code class="code">scalar_extract_sig</code> built-in functions return the significand and the biased exponent value respectively of their <code class="code">source</code> arguments. When supplied with a 64-bit <code class="code">source</code> argument, the result returned by <code class="code">scalar_extract_sig</code> has the <code class="code">0x0010000000000000</code> bit set if the function’s <code class="code">source</code> argument is in normalized form. Otherwise, this bit is set to 0. When supplied with a 128-bit <code class="code">source</code> argument, the <code class="code">0x00010000000000000000000000000000</code> bit of the result is treated similarly. Note that the sign of the significand is not represented in the result returned from the <code class="code">scalar_extract_sig</code> function. Use the <code class="code">scalar_test_neg</code> function to test the sign of its <code class="code">double</code> argument. </p> <p>The <code class="code">scalar_insert_exp</code> functions require a 64-bit environment supporting ISA 3.0 or later. When supplied with a 64-bit first argument, the <code class="code">scalar_insert_exp</code> built-in function returns a double-precision floating point value that is constructed by assembling the values of its <code class="code">significand</code> and <code class="code">exponent</code> arguments. The sign of the result is copied from the most significant bit of the <code class="code">significand</code> argument. The significand and exponent components of the result are composed of the least significant 11 bits of the <code class="code">exponent</code> argument and the least significant 52 bits of the <code class="code">significand</code> argument respectively. </p> <p>When supplied with a 128-bit first argument, the <code class="code">scalar_insert_exp</code> built-in function returns a quad-precision ieee floating point value. The sign bit of the result is copied from the most significant bit of the <code class="code">significand</code> argument. The significand and exponent components of the result are composed of the least significant 15 bits of the <code class="code">exponent</code> argument and the least significant 112 bits of the <code class="code">significand</code> argument respectively. </p> <p>The <code class="code">scalar_cmp_exp_gt</code>, <code class="code">scalar_cmp_exp_lt</code>, <code class="code">scalar_cmp_exp_eq</code>, and <code class="code">scalar_cmp_exp_unordered</code> built-in functions return a non-zero value if <code class="code">arg1</code> is greater than, less than, equal to, or not comparable to <code class="code">arg2</code> respectively. The arguments are not comparable if one or the other equals NaN (not a number). </p> <p>The <code class="code">scalar_test_data_class</code> built-in function returns 1 if any of the condition tests enabled by the value of the <code class="code">condition</code> variable are true, and 0 otherwise. The <code class="code">condition</code> argument must be a compile-time constant integer with value not exceeding 127. The <code class="code">condition</code> argument is encoded as a bitmask with each bit enabling the testing of a different condition, as characterized by the following: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">0x40 Test for NaN +0x20 Test for +Infinity +0x10 Test for -Infinity +0x08 Test for +Zero +0x04 Test for -Zero +0x02 Test for +Denormal +0x01 Test for -Denormal</pre> +</div> <p>The <code class="code">scalar_test_neg</code> built-in function returns 1 if its <code class="code">source</code> argument holds a negative value, 0 otherwise. </p> <p>The following built-in functions are also available for the PowerPC family of processors, starting with ISA 3.0 or later (<samp class="option">-mcpu=power9</samp>). These string functions are described separately in order to group the descriptions closer to the function prototypes. </p> <p>Only functions excluded from the PVIPR are listed here. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int vec_all_nez (vector signed char, vector signed char); +int vec_all_nez (vector unsigned char, vector unsigned char); +int vec_all_nez (vector signed short, vector signed short); +int vec_all_nez (vector unsigned short, vector unsigned short); +int vec_all_nez (vector signed int, vector signed int); +int vec_all_nez (vector unsigned int, vector unsigned int); + +int vec_any_eqz (vector signed char, vector signed char); +int vec_any_eqz (vector unsigned char, vector unsigned char); +int vec_any_eqz (vector signed short, vector signed short); +int vec_any_eqz (vector unsigned short, vector unsigned short); +int vec_any_eqz (vector signed int, vector signed int); +int vec_any_eqz (vector unsigned int, vector unsigned int); + +signed char vec_xlx (unsigned int index, vector signed char data); +unsigned char vec_xlx (unsigned int index, vector unsigned char data); +signed short vec_xlx (unsigned int index, vector signed short data); +unsigned short vec_xlx (unsigned int index, vector unsigned short data); +signed int vec_xlx (unsigned int index, vector signed int data); +unsigned int vec_xlx (unsigned int index, vector unsigned int data); +float vec_xlx (unsigned int index, vector float data); + +signed char vec_xrx (unsigned int index, vector signed char data); +unsigned char vec_xrx (unsigned int index, vector unsigned char data); +signed short vec_xrx (unsigned int index, vector signed short data); +unsigned short vec_xrx (unsigned int index, vector unsigned short data); +signed int vec_xrx (unsigned int index, vector signed int data); +unsigned int vec_xrx (unsigned int index, vector unsigned int data); +float vec_xrx (unsigned int index, vector float data);</pre> +</div> <p>The <code class="code">vec_all_nez</code>, <code class="code">vec_any_eqz</code>, and <code class="code">vec_cmpnez</code> perform pairwise comparisons between the elements at the same positions within their two vector arguments. The <code class="code">vec_all_nez</code> function returns a non-zero value if and only if all pairwise comparisons are not equal and no element of either vector argument contains a zero. The <code class="code">vec_any_eqz</code> function returns a non-zero value if and only if at least one pairwise comparison is equal or if at least one element of either vector argument contains a zero. The <code class="code">vec_cmpnez</code> function returns a vector of the same type as its two arguments, within which each element consists of all ones to denote that either the corresponding elements of the incoming arguments are not equal or that at least one of the corresponding elements contains zero. Otherwise, the element of the returned vector contains all zeros. </p> <p>The <code class="code">vec_xlx</code> and <code class="code">vec_xrx</code> functions extract the single element selected by the <code class="code">index</code> argument from the vector represented by the <code class="code">data</code> argument. The <code class="code">index</code> argument always specifies a byte offset, regardless of the size of the vector element. With <code class="code">vec_xlx</code>, <code class="code">index</code> is the offset of the first byte of the element to be extracted. With <code class="code">vec_xrx</code>, <code class="code">index</code> represents the last byte of the element to be extracted, measured from the right end of the vector. In other words, the last byte of the element to be extracted is found at position <code class="code">(15 - index)</code>. There is no requirement that <code class="code">index</code> be a multiple of the vector element size. However, if the size of the vector element added to <code class="code">index</code> is greater than 15, the content of the returned value is undefined. </p> <p>The following functions are also available if the ISA 3.0 instruction set additions (<samp class="option">-mcpu=power9</samp>) are available. </p> <p>Only functions excluded from the PVIPR are listed here. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector long long vec_vctz (vector long long); +vector unsigned long long vec_vctz (vector unsigned long long); +vector int vec_vctz (vector int); +vector unsigned int vec_vctz (vector int); +vector short vec_vctz (vector short); +vector unsigned short vec_vctz (vector unsigned short); +vector signed char vec_vctz (vector signed char); +vector unsigned char vec_vctz (vector unsigned char); + +vector signed char vec_vctzb (vector signed char); +vector unsigned char vec_vctzb (vector unsigned char); + +vector long long vec_vctzd (vector long long); +vector unsigned long long vec_vctzd (vector unsigned long long); + +vector short vec_vctzh (vector short); +vector unsigned short vec_vctzh (vector unsigned short); + +vector int vec_vctzw (vector int); +vector unsigned int vec_vctzw (vector int); + +vector int vec_vprtyb (vector int); +vector unsigned int vec_vprtyb (vector unsigned int); +vector long long vec_vprtyb (vector long long); +vector unsigned long long vec_vprtyb (vector unsigned long long); + +vector int vec_vprtybw (vector int); +vector unsigned int vec_vprtybw (vector unsigned int); + +vector long long vec_vprtybd (vector long long); +vector unsigned long long vec_vprtybd (vector unsigned long long);</pre> +</div> <p>On 64-bit targets, if the ISA 3.0 additions (<samp class="option">-mcpu=power9</samp>) are available: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector long vec_vprtyb (vector long); +vector unsigned long vec_vprtyb (vector unsigned long); +vector __int128 vec_vprtyb (vector __int128); +vector __uint128 vec_vprtyb (vector __uint128); + +vector long vec_vprtybd (vector long); +vector unsigned long vec_vprtybd (vector unsigned long); + +vector __int128 vec_vprtybq (vector __int128); +vector __uint128 vec_vprtybd (vector __uint128);</pre> +</div> <p>The following built-in functions are available for the PowerPC family of processors, starting with ISA 3.0 or later (<samp class="option">-mcpu=power9</samp>). </p> <p>Only functions excluded from the PVIPR are listed here. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__vector unsigned char +vec_absdb (__vector unsigned char arg1, __vector unsigned char arg2); +__vector unsigned short +vec_absdh (__vector unsigned short arg1, __vector unsigned short arg2); +__vector unsigned int +vec_absdw (__vector unsigned int arg1, __vector unsigned int arg2);</pre> +</div> <p>The <code class="code">vec_absd</code>, <code class="code">vec_absdb</code>, <code class="code">vec_absdh</code>, and <code class="code">vec_absdw</code> built-in functions each computes the absolute differences of the pairs of vector elements supplied in its two vector arguments, placing the absolute differences into the corresponding elements of the vector result. </p> <p>The following built-in functions are available for the PowerPC family of processors, starting with ISA 3.0 or later (<samp class="option">-mcpu=power9</samp>): </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector unsigned int vec_vrlnm (vector unsigned int, vector unsigned int); +vector unsigned long long vec_vrlnm (vector unsigned long long, + vector unsigned long long);</pre> +</div> <p>The result of <code class="code">vec_vrlnm</code> is obtained by rotating each element of the first argument vector left and ANDing it with a mask. The second argument vector contains the mask beginning in bits 11:15, the mask end in bits 19:23, and the shift count in bits 27:31, of each element. </p> <p>If the cryptographic instructions are enabled (<samp class="option">-mcrypto</samp> or <samp class="option">-mcpu=power8</samp>), the following builtins are enabled. </p> <p>Only functions excluded from the PVIPR are listed here. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector unsigned long long __builtin_crypto_vsbox (vector unsigned long long); + +vector unsigned long long __builtin_crypto_vcipher (vector unsigned long long, + vector unsigned long long); + +vector unsigned long long __builtin_crypto_vcipherlast + (vector unsigned long long, + vector unsigned long long); + +vector unsigned long long __builtin_crypto_vncipher (vector unsigned long long, + vector unsigned long long); + +vector unsigned long long __builtin_crypto_vncipherlast (vector unsigned long long, + vector unsigned long long); + +vector unsigned char __builtin_crypto_vpermxor (vector unsigned char, + vector unsigned char, + vector unsigned char); + +vector unsigned short __builtin_crypto_vpermxor (vector unsigned short, + vector unsigned short, + vector unsigned short); + +vector unsigned int __builtin_crypto_vpermxor (vector unsigned int, + vector unsigned int, + vector unsigned int); + +vector unsigned long long __builtin_crypto_vpermxor (vector unsigned long long, + vector unsigned long long, + vector unsigned long long); + +vector unsigned char __builtin_crypto_vpmsumb (vector unsigned char, + vector unsigned char); + +vector unsigned short __builtin_crypto_vpmsumh (vector unsigned short, + vector unsigned short); + +vector unsigned int __builtin_crypto_vpmsumw (vector unsigned int, + vector unsigned int); + +vector unsigned long long __builtin_crypto_vpmsumd (vector unsigned long long, + vector unsigned long long); + +vector unsigned long long __builtin_crypto_vshasigmad (vector unsigned long long, + int, int); + +vector unsigned int __builtin_crypto_vshasigmaw (vector unsigned int, int, int);</pre> +</div> <p>The second argument to <var class="var">__builtin_crypto_vshasigmad</var> and <var class="var">__builtin_crypto_vshasigmaw</var> must be a constant integer that is 0 or 1. The third argument to these built-in functions must be a constant integer in the range of 0 to 15. </p> <p>The following sign extension builtins are provided: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector signed int vec_signexti (vector signed char a); +vector signed long long vec_signextll (vector signed char a); +vector signed int vec_signexti (vector signed short a); +vector signed long long vec_signextll (vector signed short a); +vector signed long long vec_signextll (vector signed int a); +vector signed long long vec_signextq (vector signed long long a);</pre> +</div> <p>Each element of the result is produced by sign-extending the element of the input vector that would fall in the least significant portion of the result element. For example, a sign-extension of a vector signed char to a vector signed long long will sign extend the rightmost byte of each doubleword. </p> </div> <div class="nav-panel"> <p> Next: <a href="powerpc-altivec-built-in-functions-available-on-isa-3_002e1">PowerPC AltiVec Built-in Functions Available on ISA 3.1</a>, Previous: <a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e07">PowerPC AltiVec Built-in Functions Available on ISA 2.07</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e0.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e0.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-3_002e1.html b/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-3_002e1.html new file mode 100644 index 00000000..fefba375 --- /dev/null +++ b/devdocs/gcc~13/powerpc-altivec-built-in-functions-available-on-isa-3_002e1.html @@ -0,0 +1,335 @@ +<div class="subsubsection-level-extent" id="PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e1"> <div class="nav-panel"> <p> Previous: <a href="powerpc-altivec-built-in-functions-available-on-isa-3_002e0" accesskey="p" rel="prev">PowerPC AltiVec Built-in Functions Available on ISA 3.0</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions" accesskey="u" rel="up">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e1-1"><span>6.60.23.5 PowerPC AltiVec Built-in Functions Available on ISA 3.1<a class="copiable-link" href="#PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e1-1"> ¶</a></span></h1> <p>The following additional built-in functions are also available for the PowerPC family of processors, starting with ISA 3.1 (<samp class="option">-mcpu=power10</samp>): </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_cfuge (vector unsigned long long int, vector unsigned long long int);</pre> +</div> <p>Perform a vector centrifuge operation, as if implemented by the <code class="code">vcfuged</code> instruction. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_cntlzm (vector unsigned long long int, vector unsigned long long int);</pre> +</div> <p>Perform a vector count leading zeros under bit mask operation, as if implemented by the <code class="code">vclzdm</code> instruction. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_cnttzm (vector unsigned long long int, vector unsigned long long int);</pre> +</div> <p>Perform a vector count trailing zeros under bit mask operation, as if implemented by the <code class="code">vctzdm</code> instruction. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed char</pre> +<pre class="exdent" data-language="cpp">vec_clrl (vector signed char a, unsigned int n);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char</pre> +<pre class="exdent" data-language="cpp">vec_clrl (vector unsigned char a, unsigned int n);</pre> +</div> <p>Clear the left-most <code class="code">(16 - n)</code> bytes of vector argument <code class="code">a</code>, as if implemented by the <code class="code">vclrlb</code> instruction on a big-endian target and by the <code class="code">vclrrb</code> instruction on a little-endian target. A value of <code class="code">n</code> that is greater than 16 is treated as if it equaled 16. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed char</pre> +<pre class="exdent" data-language="cpp">vec_clrr (vector signed char a, unsigned int n);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char</pre> +<pre class="exdent" data-language="cpp">vec_clrr (vector unsigned char a, unsigned int n);</pre> +</div> <p>Clear the right-most <code class="code">(16 - n)</code> bytes of vector argument <code class="code">a</code>, as if implemented by the <code class="code">vclrrb</code> instruction on a big-endian target and by the <code class="code">vclrlb</code> instruction on a little-endian target. A value of <code class="code">n</code> that is greater than 16 is treated as if it equaled 16. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_gnb (vector unsigned __int128, const unsigned char);</pre> +</div> <p>Perform a 128-bit vector gather operation, as if implemented by the <code class="code">vgnb</code> instruction. The second argument must be a literal integer value between 2 and 7 inclusive. </p> <p>Vector Extract </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_extractl (vector unsigned char, vector unsigned char, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_extractl (vector unsigned short, vector unsigned short, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_extractl (vector unsigned int, vector unsigned int, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_extractl (vector unsigned long long, vector unsigned long long, unsigned int);</pre> +</div> <p>Extract an element from two concatenated vectors starting at the given byte index in natural-endian order, and place it zero-extended in doubleword 1 of the result according to natural element order. If the byte index is out of range for the data type, the intrinsic will be rejected. For little-endian, this output will match the placement by the hardware instruction, i.e., dword[0] in RTL notation. For big-endian, an additional instruction is needed to move it from the "left" doubleword to the "right" one. For little-endian, semantics matching the <code class="code">vextdubvrx</code>, <code class="code">vextduhvrx</code>, <code class="code">vextduwvrx</code> instruction will be generated, while for big-endian, semantics matching the <code class="code">vextdubvlx</code>, <code class="code">vextduhvlx</code>, <code class="code">vextduwvlx</code> instructions will be generated. Note that some fairly anomalous results can be generated if the byte index is not aligned on an element boundary for the element being extracted. This is a limitation of the bi-endian vector programming model is consistent with the limitation on <code class="code">vec_perm</code>. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_extracth (vector unsigned char, vector unsigned char, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_extracth (vector unsigned short, vector unsigned short,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_extracth (vector unsigned int, vector unsigned int, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_extracth (vector unsigned long long, vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned int);</pre> +</div> <p>Extract an element from two concatenated vectors starting at the given byte index. The index is based on big endian order for a little endian system. Similarly, the index is based on little endian order for a big endian system. The extraced elements are zero-extended and put in doubleword 1 according to natural element order. If the byte index is out of range for the data type, the intrinsic will be rejected. For little-endian, this output will match the placement by the hardware instruction (vextdubvrx, vextduhvrx, vextduwvrx, vextddvrx) i.e., dword[0] in RTL notation. For big-endian, an additional instruction is needed to move it from the "left" doubleword to the "right" one. For little-endian, semantics matching the <code class="code">vextdubvlx</code>, <code class="code">vextduhvlx</code>, <code class="code">vextduwvlx</code> instructions will be generated, while for big-endian, semantics matching the <code class="code">vextdubvrx</code>, <code class="code">vextduhvrx</code>, <code class="code">vextduwvrx</code> instructions will be generated. Note that some fairly anomalous results can be generated if the byte index is not aligned on the element boundary for the element being extracted. This is a limitation of the bi-endian vector programming model consistent with the limitation on <code class="code">vec_perm</code>. </p> +<div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_pdep (vector unsigned long long int, vector unsigned long long int);</pre> +</div> <p>Perform a vector parallel bits deposit operation, as if implemented by the <code class="code">vpdepd</code> instruction. </p> <p>Vector Insert </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned char</pre> +<pre class="exdent" data-language="cpp">vec_insertl (unsigned char, vector unsigned char, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short</pre> +<pre class="exdent" data-language="cpp">vec_insertl (unsigned short, vector unsigned short, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int</pre> +<pre class="exdent" data-language="cpp">vec_insertl (unsigned int, vector unsigned int, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long</pre> +<pre class="exdent" data-language="cpp">vec_insertl (unsigned long long, vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char</pre> +<pre class="exdent" data-language="cpp">vec_insertl (vector unsigned char, vector unsigned char, unsigned int;</pre> +<pre class="exdent" data-language="cpp">vector unsigned short</pre> +<pre class="exdent" data-language="cpp">vec_insertl (vector unsigned short, vector unsigned short,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int</pre> +<pre class="exdent" data-language="cpp">vec_insertl (vector unsigned int, vector unsigned int, unsigned int);</pre> +</div> <p>Let src be the first argument, when the first argument is a scalar, or the rightmost element of the left doubleword of the first argument, when the first argument is a vector. Insert the source into the destination at the position given by the third argument, using natural element order in the second argument. The rest of the second argument is unchanged. If the byte index is greater than 14 for halfwords, greater than 12 for words, or greater than 8 for doublewords the result is undefined. For little-endian, the generated code will be semantically equivalent to <code class="code">vins[bhwd]rx</code> instructions. Similarly for big-endian it will be semantically equivalent to <code class="code">vins[bhwd]lx</code>. Note that some fairly anomalous results can be generated if the byte index is not aligned on an element boundary for the type of element being inserted. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned char</pre> +<pre class="exdent" data-language="cpp">vec_inserth (unsigned char, vector unsigned char, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short</pre> +<pre class="exdent" data-language="cpp">vec_inserth (unsigned short, vector unsigned short, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int</pre> +<pre class="exdent" data-language="cpp">vec_inserth (unsigned int, vector unsigned int, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long</pre> +<pre class="exdent" data-language="cpp">vec_inserth (unsigned long long, vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char</pre> +<pre class="exdent" data-language="cpp">vec_inserth (vector unsigned char, vector unsigned char, unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short</pre> +<pre class="exdent" data-language="cpp">vec_inserth (vector unsigned short, vector unsigned short,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int</pre> +<pre class="exdent" data-language="cpp">vec_inserth (vector unsigned int, vector unsigned int, unsigned int);</pre> +</div> <p>Let src be the first argument, when the first argument is a scalar, or the rightmost element of the first argument, when the first argument is a vector. Insert src into the second argument at the position identified by the third argument, using opposite element order in the second argument, and leaving the rest of the second argument unchanged. If the byte index is greater than 14 for halfwords, 12 for words, or 8 for doublewords, the intrinsic will be rejected. Note that the underlying hardware instruction uses the same register for the second argument and the result. For little-endian, the code generation will be semantically equivalent to <code class="code">vins[bhwd]lx</code>, while for big-endian it will be semantically equivalent to <code class="code">vins[bhwd]rx</code>. Note that some fairly anomalous results can be generated if the byte index is not aligned on an element boundary for the sort of element being inserted. </p> <p>Vector Replace Element </p> +<div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed int vec_replace_elt (vector signed int, signed int,</pre> +<pre class="example-preformatted" data-language="cpp">const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int vec_replace_elt (vector unsigned int,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned int, const int);</pre> +<pre class="exdent" data-language="cpp">vector float vec_replace_elt (vector float, float, const int);</pre> +<pre class="exdent" data-language="cpp">vector signed long long vec_replace_elt (vector signed long long,</pre> +<pre class="example-preformatted" data-language="cpp">signed long long, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long vec_replace_elt (vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned long long, const int);</pre> +<pre class="exdent" data-language="cpp">vector double rec_replace_elt (vector double, double, const int);</pre> +</div> <p>The third argument (constrained to [0,3]) identifies the natural-endian element number of the first argument that will be replaced by the second argument to produce the result. The other elements of the first argument will remain unchanged in the result. </p> <p>If it’s desirable to insert a word at an unaligned position, use vec_replace_unaligned instead. </p> <p>Vector Replace Unaligned </p> +<div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned char vec_replace_unaligned (vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">signed int, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char vec_replace_unaligned (vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned int, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char vec_replace_unaligned (vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">float, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char vec_replace_unaligned (vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">signed long long, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char vec_replace_unaligned (vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">unsigned long long, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char vec_replace_unaligned (vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">double, const int);</pre> +</div> <p>The second argument replaces a portion of the first argument to produce the result, with the rest of the first argument unchanged in the result. The third argument identifies the byte index (using left-to-right, or big-endian order) where the high-order byte of the second argument will be placed, with the remaining bytes of the second argument placed naturally "to the right" of the high-order byte. </p> <p>The programmer is responsible for understanding the endianness issues involved with the first argument and the result. </p> <p>Vector Shift Left Double Bit Immediate </p> +<div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed char vec_sldb (vector signed char, vector signed char,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char vec_sldb (vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned char, const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector signed short vec_sldb (vector signed short, vector signed short,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short vec_sldb (vector unsigned short,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned short, const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector signed int vec_sldb (vector signed int, vector signed int,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int vec_sldb (vector unsigned int, vector unsigned int,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector signed long long vec_sldb (vector signed long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed long long, const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long vec_sldb (vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned long long, const unsigned int);</pre> +</div> <p>Shift the combined input vectors left by the amount specified by the low-order three bits of the third argument, and return the leftmost remaining 128 bits. Code using this instruction must be endian-aware. </p> <p>Vector Shift Right Double Bit Immediate </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed char vec_srdb (vector signed char, vector signed char,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char vec_srdb (vector unsigned char, vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector signed short vec_srdb (vector signed short, vector signed short,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short vec_srdb (vector unsigned short, vector unsigned short,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector signed int vec_srdb (vector signed int, vector signed int,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int vec_srdb (vector unsigned int, vector unsigned int,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector signed long long vec_srdb (vector signed long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed long long, const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long vec_srdb (vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned long long, const unsigned int);</pre> +</div> <p>Shift the combined input vectors right by the amount specified by the low-order three bits of the third argument, and return the remaining 128 bits. Code using this built-in must be endian-aware. </p> <p>Vector Splat </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed int vec_splati (const signed int);</pre> +<pre class="exdent" data-language="cpp">vector float vec_splati (const float);</pre> +</div> <p>Splat a 32-bit immediate into a vector of words. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector double vec_splatid (const float);</pre> +</div> <p>Convert a single precision floating-point value to double-precision and splat the result to a vector of double-precision floats. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed int vec_splati_ins (vector signed int,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int, const signed int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int vec_splati_ins (vector unsigned int,</pre> +<pre class="example-preformatted" data-language="cpp">const unsigned int, const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector float vec_splati_ins (vector float, const unsigned int,</pre> +<pre class="example-preformatted" data-language="cpp">const float);</pre> +</div> <p>Argument 2 must be either 0 or 1. Splat the value of argument 3 into the word identified by argument 2 of each doubleword of argument 1 and return the result. The other words of argument 1 are unchanged. </p> <p>Vector Blend Variable </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed char vec_blendv (vector signed char, vector signed char,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned char);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char vec_blendv (vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned char, vector unsigned char);</pre> +<pre class="exdent" data-language="cpp">vector signed short vec_blendv (vector signed short,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed short, vector unsigned short);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short vec_blendv (vector unsigned short,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned short, vector unsigned short);</pre> +<pre class="exdent" data-language="cpp">vector signed int vec_blendv (vector signed int, vector signed int,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int vec_blendv (vector unsigned int,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned int, vector unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector signed long long vec_blendv (vector signed long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed long long, vector unsigned long long);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long vec_blendv (vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned long long, vector unsigned long long);</pre> +<pre class="exdent" data-language="cpp">vector float vec_blendv (vector float, vector float,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector double vec_blendv (vector double, vector double,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned long long);</pre> +</div> <p>Blend the first and second argument vectors according to the sign bits of the corresponding elements of the third argument vector. This is similar to the <code class="code">vsel</code> and <code class="code">xxsel</code> instructions but for bigger elements. </p> <p>Vector Permute Extended </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed char vec_permx (vector signed char, vector signed char,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned char, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned char vec_permx (vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned char, vector unsigned char, const int);</pre> +<pre class="exdent" data-language="cpp">vector signed short vec_permx (vector signed short,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed short, vector unsigned char, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short vec_permx (vector unsigned short,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned short, vector unsigned char, const int);</pre> +<pre class="exdent" data-language="cpp">vector signed int vec_permx (vector signed int, vector signed int,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned char, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int vec_permx (vector unsigned int,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned int, vector unsigned char, const int);</pre> +<pre class="exdent" data-language="cpp">vector signed long long vec_permx (vector signed long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed long long, vector unsigned char, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long vec_permx (vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned long long, vector unsigned char, const int);</pre> +<pre class="exdent" data-language="cpp">vector float (vector float, vector float, vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">const int);</pre> +<pre class="exdent" data-language="cpp">vector double (vector double, vector double, vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">const int);</pre> +</div> <p>Perform a partial permute of the first two arguments, which form a 32-byte section of an emulated vector up to 256 bytes wide, using the partial permute control vector in the third argument. The fourth argument (constrained to values of 0-7) identifies which 32-byte section of the emulated vector is contained in the first two arguments. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_pext (vector unsigned long long int, vector unsigned long long int);</pre> +</div> <p>Perform a vector parallel bit extract operation, as if implemented by the <code class="code">vpextd</code> instruction. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned char vec_stril (vector unsigned char);</pre> +<pre class="exdent" data-language="cpp">vector signed char vec_stril (vector signed char);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short vec_stril (vector unsigned short);</pre> +<pre class="exdent" data-language="cpp">vector signed short vec_stril (vector signed short);</pre> +</div> <p>Isolate the left-most non-zero elements of the incoming vector argument, replacing all elements to the right of the left-most zero element found within the argument with zero. The typical implementation uses the <code class="code">vstribl</code> or <code class="code">vstrihl</code> instruction on big-endian targets and uses the <code class="code">vstribr</code> or <code class="code">vstrihr</code> instruction on little-endian targets. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">int vec_stril_p (vector unsigned char);</pre> +<pre class="exdent" data-language="cpp">int vec_stril_p (vector signed char);</pre> +<pre class="exdent" data-language="cpp">int short vec_stril_p (vector unsigned short);</pre> +<pre class="exdent" data-language="cpp">int vec_stril_p (vector signed short);</pre> +</div> <p>Return a non-zero value if and only if the argument contains a zero element. The typical implementation uses the <code class="code">vstribl.</code> or <code class="code">vstrihl.</code> instruction on big-endian targets and uses the <code class="code">vstribr.</code> or <code class="code">vstrihr.</code> instruction on little-endian targets. Choose this built-in to check for presence of zero element if the same argument is also passed to <code class="code">vec_stril</code>. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned char vec_strir (vector unsigned char);</pre> +<pre class="exdent" data-language="cpp">vector signed char vec_strir (vector signed char);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short vec_strir (vector unsigned short);</pre> +<pre class="exdent" data-language="cpp">vector signed short vec_strir (vector signed short);</pre> +</div> <p>Isolate the right-most non-zero elements of the incoming vector argument, replacing all elements to the left of the right-most zero element found within the argument with zero. The typical implementation uses the <code class="code">vstribr</code> or <code class="code">vstrihr</code> instruction on big-endian targets and uses the <code class="code">vstribl</code> or <code class="code">vstrihl</code> instruction on little-endian targets. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">int vec_strir_p (vector unsigned char);</pre> +<pre class="exdent" data-language="cpp">int vec_strir_p (vector signed char);</pre> +<pre class="exdent" data-language="cpp">int short vec_strir_p (vector unsigned short);</pre> +<pre class="exdent" data-language="cpp">int vec_strir_p (vector signed short);</pre> +</div> <p>Return a non-zero value if and only if the argument contains a zero element. The typical implementation uses the <code class="code">vstribr.</code> or <code class="code">vstrihr.</code> instruction on big-endian targets and uses the <code class="code">vstribl.</code> or <code class="code">vstrihl.</code> instruction on little-endian targets. Choose this built-in to check for presence of zero element if the same argument is also passed to <code class="code">vec_strir</code>. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned char</pre> +<pre class="exdent" data-language="cpp">vec_ternarylogic (vector unsigned char, vector unsigned char,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned char, const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short</pre> +<pre class="exdent" data-language="cpp">vec_ternarylogic (vector unsigned short, vector unsigned short,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned short, const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int</pre> +<pre class="exdent" data-language="cpp">vec_ternarylogic (vector unsigned int, vector unsigned int,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned int, const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long int</pre> +<pre class="exdent" data-language="cpp">vec_ternarylogic (vector unsigned long long int, vector unsigned long long int,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned long long int, const unsigned int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned __int128</pre> +<pre class="exdent" data-language="cpp">vec_ternarylogic (vector unsigned __int128, vector unsigned __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned __int128, const unsigned int);</pre> +</div> <p>Perform a 128-bit vector evaluate operation, as if implemented by the <code class="code">xxeval</code> instruction. The fourth argument must be a literal integer value between 0 and 255 inclusive. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned char vec_genpcvm (vector unsigned char, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned short vec_genpcvm (vector unsigned short, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int vec_genpcvm (vector unsigned int, const int);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int vec_genpcvm (vector unsigned long long int,</pre> +<pre class="example-preformatted" data-language="cpp">const int);</pre> +</div> <p>Vector Integer Multiply/Divide/Modulo </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed int</pre> +<pre class="exdent" data-language="cpp">vec_mulh (vector signed int a, vector signed int b);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int</pre> +<pre class="exdent" data-language="cpp">vec_mulh (vector unsigned int a, vector unsigned int b);</pre> +</div> <p>For each integer value <code class="code">i</code> from 0 to 3, do the following. The integer value in word element <code class="code">i</code> of a is multiplied by the integer value in word element <code class="code">i</code> of b. The high-order 32 bits of the 64-bit product are placed into word element <code class="code">i</code> of the vector returned. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed long long</pre> +<pre class="exdent" data-language="cpp">vec_mulh (vector signed long long a, vector signed long long b);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long</pre> +<pre class="exdent" data-language="cpp">vec_mulh (vector unsigned long long a, vector unsigned long long b);</pre> +</div> <p>For each integer value <code class="code">i</code> from 0 to 1, do the following. The integer value in doubleword element <code class="code">i</code> of a is multiplied by the integer value in doubleword element <code class="code">i</code> of b. The high-order 64 bits of the 128-bit product are placed into doubleword element <code class="code">i</code> of the vector returned. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned long long</pre> +<pre class="exdent" data-language="cpp">vec_mul (vector unsigned long long a, vector unsigned long long b);</pre> +<pre class="exdent" data-language="cpp">vector signed long long</pre> +<pre class="exdent" data-language="cpp">vec_mul (vector signed long long a, vector signed long long b);</pre> +</div> <p>For each integer value <code class="code">i</code> from 0 to 1, do the following. The integer value in doubleword element <code class="code">i</code> of a is multiplied by the integer value in doubleword element <code class="code">i</code> of b. The low-order 64 bits of the 128-bit product are placed into doubleword element <code class="code">i</code> of the vector returned. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed int</pre> +<pre class="exdent" data-language="cpp">vec_div (vector signed int a, vector signed int b);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int</pre> +<pre class="exdent" data-language="cpp">vec_div (vector unsigned int a, vector unsigned int b);</pre> +</div> <p>For each integer value <code class="code">i</code> from 0 to 3, do the following. The integer in word element <code class="code">i</code> of a is divided by the integer in word element <code class="code">i</code> of b. The unique integer quotient is placed into the word element <code class="code">i</code> of the vector returned. If an attempt is made to perform any of the divisions <anything> ÷ 0 then the quotient is undefined. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed long long</pre> +<pre class="exdent" data-language="cpp">vec_div (vector signed long long a, vector signed long long b);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long</pre> +<pre class="exdent" data-language="cpp">vec_div (vector unsigned long long a, vector unsigned long long b);</pre> +</div> <p>For each integer value <code class="code">i</code> from 0 to 1, do the following. The integer in doubleword element <code class="code">i</code> of a is divided by the integer in doubleword element <code class="code">i</code> of b. The unique integer quotient is placed into the doubleword element <code class="code">i</code> of the vector returned. If an attempt is made to perform any of the divisions 0x8000_0000_0000_0000 ÷ -1 or <anything> ÷ 0 then the quotient is undefined. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed int</pre> +<pre class="exdent" data-language="cpp">vec_dive (vector signed int a, vector signed int b);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int</pre> +<pre class="exdent" data-language="cpp">vec_dive (vector unsigned int a, vector unsigned int b);</pre> +</div> <p>For each integer value <code class="code">i</code> from 0 to 3, do the following. The integer in word element <code class="code">i</code> of a is shifted left by 32 bits, then divided by the integer in word element <code class="code">i</code> of b. The unique integer quotient is placed into the word element <code class="code">i</code> of the vector returned. If the quotient cannot be represented in 32 bits, or if an attempt is made to perform any of the divisions <anything> ÷ 0 then the quotient is undefined. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed long long</pre> +<pre class="exdent" data-language="cpp">vec_dive (vector signed long long a, vector signed long long b);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long</pre> +<pre class="exdent" data-language="cpp">vec_dive (vector unsigned long long a, vector unsigned long long b);</pre> +</div> <p>For each integer value <code class="code">i</code> from 0 to 1, do the following. The integer in doubleword element <code class="code">i</code> of a is shifted left by 64 bits, then divided by the integer in doubleword element <code class="code">i</code> of b. The unique integer quotient is placed into the doubleword element <code class="code">i</code> of the vector returned. If the quotient cannot be represented in 64 bits, or if an attempt is made to perform <anything> ÷ 0 then the quotient is undefined. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed int</pre> +<pre class="exdent" data-language="cpp">vec_mod (vector signed int a, vector signed int b);</pre> +<pre class="exdent" data-language="cpp">vector unsigned int</pre> +<pre class="exdent" data-language="cpp">vec_mod (vector unsigned int a, vector unsigned int b);</pre> +</div> <p>For each integer value <code class="code">i</code> from 0 to 3, do the following. The integer in word element <code class="code">i</code> of a is divided by the integer in word element <code class="code">i</code> of b. The unique integer remainder is placed into the word element <code class="code">i</code> of the vector returned. If an attempt is made to perform any of the divisions 0x8000_0000 ÷ -1 or <anything> ÷ 0 then the remainder is undefined. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector signed long long</pre> +<pre class="exdent" data-language="cpp">vec_mod (vector signed long long a, vector signed long long b);</pre> +<pre class="exdent" data-language="cpp">vector unsigned long long</pre> +<pre class="exdent" data-language="cpp">vec_mod (vector unsigned long long a, vector unsigned long long b);</pre> +</div> <p>For each integer value <code class="code">i</code> from 0 to 1, do the following. The integer in doubleword element <code class="code">i</code> of a is divided by the integer in doubleword element <code class="code">i</code> of b. The unique integer remainder is placed into the doubleword element <code class="code">i</code> of the vector returned. If an attempt is made to perform <anything> ÷ 0 then the remainder is undefined. </p> <p>Generate PCV from specified Mask size, as if implemented by the <code class="code">xxgenpcvbm</code>, <code class="code">xxgenpcvhm</code>, <code class="code">xxgenpcvwm</code> instructions, where immediate value is either 0, 1, 2 or 3. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_rl (vector unsigned __int128 A,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned __int128 B);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_rl (vector signed __int128 A,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned __int128 B);</pre> +</div> <p>Result value: Each element of R is obtained by rotating the corresponding element of A left by the number of bits specified by the corresponding element of B. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_rlmi (vector unsigned __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned __int128, +vector unsigned __int128);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_rlmi (vector signed __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed __int128, +vector unsigned __int128);</pre> +</div> <p>Returns the result of rotating the first input and inserting it under mask into the second input. The first bit in the mask, the last bit in the mask are obtained from the two 7-bit fields bits [108:115] and bits [117:123] respectively of the second input. The shift is obtained from the third input in the 7-bit field [125:131] where all bits counted from zero at the left. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_rlnm (vector unsigned __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned __int128, +vector unsigned __int128);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_rlnm (vector signed __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned __int128, +vector unsigned __int128);</pre> +</div> <p>Returns the result of rotating the first input and ANDing it with a mask. The first bit in the mask and the last bit in the mask are obtained from the two 7-bit fields bits [117:123] and bits [125:131] respectively of the second input. The shift is obtained from the third input in the 7-bit field bits [125:131] where all bits counted from zero at the left. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_sl(vector unsigned __int128 A, vector unsigned __int128 B);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_sl(vector signed __int128 A, vector unsigned __int128 B);</pre> +</div> <p>Result value: Each element of R is obtained by shifting the corresponding element of A left by the number of bits specified by the corresponding element of B. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_sr(vector unsigned __int128 A, vector unsigned __int128 B);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_sr(vector signed __int128 A, vector unsigned __int128 B);</pre> +</div> <p>Result value: Each element of R is obtained by shifting the corresponding element of A right by the number of bits specified by the corresponding element of B. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_sra(vector unsigned __int128 A, vector unsigned __int128 B);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_sra(vector signed __int128 A, vector unsigned __int128 B);</pre> +</div> <p>Result value: Each element of R is obtained by arithmetic shifting the corresponding element of A right by the number of bits specified by the corresponding element of B. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_mule (vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned long long);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_mule (vector signed long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed long long);</pre> +</div> <p>Returns a vector containing a 128-bit integer result of multiplying the even doubleword elements of the two inputs. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_mulo (vector unsigned long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned long long);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_mulo (vector signed long long,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed long long);</pre> +</div> <p>Returns a vector containing a 128-bit integer result of multiplying the odd doubleword elements of the two inputs. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_div (vector unsigned __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned __int128);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_div (vector signed __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed __int128);</pre> +</div> <p>Returns the result of dividing the first operand by the second operand. An attempt to divide any value by zero or to divide the most negative signed 128-bit integer by negative one results in an undefined value. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_dive (vector unsigned __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned __int128);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_dive (vector signed __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed __int128);</pre> +</div> <p>The result is produced by shifting the first input left by 128 bits and dividing by the second. If an attempt is made to divide by zero or the result is larger than 128 bits, the result is undefined. </p> <div class="example smallexample"> <pre class="exdent" data-language="cpp">vector unsigned __int128 vec_mod (vector unsigned __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector unsigned __int128);</pre> +<pre class="exdent" data-language="cpp">vector signed __int128 vec_mod (vector signed __int128,</pre> +<pre class="example-preformatted" data-language="cpp">vector signed __int128);</pre> +</div> <p>The result is the modulo result of dividing the first input by the second input. </p> <p>The following builtins perform 128-bit vector comparisons. The <code class="code">vec_all_xx</code>, <code class="code">vec_any_xx</code>, and <code class="code">vec_cmpxx</code>, where <code class="code">xx</code> is one of the operations <code class="code">eq, ne, gt, lt, ge, le</code> perform pairwise comparisons between the elements at the same positions within their two vector arguments. The <code class="code">vec_all_xx</code>function returns a non-zero value if and only if all pairwise comparisons are true. The <code class="code">vec_any_xx</code> function returns a non-zero value if and only if at least one pairwise comparison is true. The <code class="code">vec_cmpxx</code>function returns a vector of the same type as its two arguments, within which each element consists of all ones to denote that specified logical comparison of the corresponding elements was true. Otherwise, the element of the returned vector contains all zeros. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector bool __int128 vec_cmpeq (vector signed __int128, vector signed __int128); +vector bool __int128 vec_cmpeq (vector unsigned __int128, vector unsigned __int128); +vector bool __int128 vec_cmpne (vector signed __int128, vector signed __int128); +vector bool __int128 vec_cmpne (vector unsigned __int128, vector unsigned __int128); +vector bool __int128 vec_cmpgt (vector signed __int128, vector signed __int128); +vector bool __int128 vec_cmpgt (vector unsigned __int128, vector unsigned __int128); +vector bool __int128 vec_cmplt (vector signed __int128, vector signed __int128); +vector bool __int128 vec_cmplt (vector unsigned __int128, vector unsigned __int128); +vector bool __int128 vec_cmpge (vector signed __int128, vector signed __int128); +vector bool __int128 vec_cmpge (vector unsigned __int128, vector unsigned __int128); +vector bool __int128 vec_cmple (vector signed __int128, vector signed __int128); +vector bool __int128 vec_cmple (vector unsigned __int128, vector unsigned __int128); + +int vec_all_eq (vector signed __int128, vector signed __int128); +int vec_all_eq (vector unsigned __int128, vector unsigned __int128); +int vec_all_ne (vector signed __int128, vector signed __int128); +int vec_all_ne (vector unsigned __int128, vector unsigned __int128); +int vec_all_gt (vector signed __int128, vector signed __int128); +int vec_all_gt (vector unsigned __int128, vector unsigned __int128); +int vec_all_lt (vector signed __int128, vector signed __int128); +int vec_all_lt (vector unsigned __int128, vector unsigned __int128); +int vec_all_ge (vector signed __int128, vector signed __int128); +int vec_all_ge (vector unsigned __int128, vector unsigned __int128); +int vec_all_le (vector signed __int128, vector signed __int128); +int vec_all_le (vector unsigned __int128, vector unsigned __int128); + +int vec_any_eq (vector signed __int128, vector signed __int128); +int vec_any_eq (vector unsigned __int128, vector unsigned __int128); +int vec_any_ne (vector signed __int128, vector signed __int128); +int vec_any_ne (vector unsigned __int128, vector unsigned __int128); +int vec_any_gt (vector signed __int128, vector signed __int128); +int vec_any_gt (vector unsigned __int128, vector unsigned __int128); +int vec_any_lt (vector signed __int128, vector signed __int128); +int vec_any_lt (vector unsigned __int128, vector unsigned __int128); +int vec_any_ge (vector signed __int128, vector signed __int128); +int vec_any_ge (vector unsigned __int128, vector unsigned __int128); +int vec_any_le (vector signed __int128, vector signed __int128); +int vec_any_le (vector unsigned __int128, vector unsigned __int128);</pre> +</div> </div> <div class="nav-panel"> <p> Previous: <a href="powerpc-altivec-built-in-functions-available-on-isa-3_002e0">PowerPC AltiVec Built-in Functions Available on ISA 3.0</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e1.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-Available-on-ISA-3_002e1.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-altivec-built-in-functions-on-isa-2_002e05.html b/devdocs/gcc~13/powerpc-altivec-built-in-functions-on-isa-2_002e05.html new file mode 100644 index 00000000..76aae081 --- /dev/null +++ b/devdocs/gcc~13/powerpc-altivec-built-in-functions-on-isa-2_002e05.html @@ -0,0 +1,470 @@ +<div class="subsubsection-level-extent" id="PowerPC-AltiVec-Built-in-Functions-on-ISA-2_002e05"> <div class="nav-panel"> <p> Next: <a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e06" accesskey="n" rel="next">PowerPC AltiVec Built-in Functions Available on ISA 2.06</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions" accesskey="u" rel="up">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="PowerPC-AltiVec-Built-in-Functions-on-ISA-2_002e05-1"><span>6.60.23.1 PowerPC AltiVec Built-in Functions on ISA 2.05<a class="copiable-link" href="#PowerPC-AltiVec-Built-in-Functions-on-ISA-2_002e05-1"> ¶</a></span></h1> <p>The following interfaces are supported for the generic and specific AltiVec operations and the AltiVec predicates. In cases where there is a direct mapping between generic and specific operations, only the generic names are shown here, although the specific operations can also be used. </p> <p>Arguments that are documented as <code class="code">const int</code> require literal integral values within the range required for that operation. </p> <p>Only functions excluded from the PVIPR are listed here. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void vec_dss (const int); + +void vec_dssall (void); + +void vec_dst (const vector unsigned char *, int, const int); +void vec_dst (const vector signed char *, int, const int); +void vec_dst (const vector bool char *, int, const int); +void vec_dst (const vector unsigned short *, int, const int); +void vec_dst (const vector signed short *, int, const int); +void vec_dst (const vector bool short *, int, const int); +void vec_dst (const vector pixel *, int, const int); +void vec_dst (const vector unsigned int *, int, const int); +void vec_dst (const vector signed int *, int, const int); +void vec_dst (const vector bool int *, int, const int); +void vec_dst (const vector float *, int, const int); +void vec_dst (const unsigned char *, int, const int); +void vec_dst (const signed char *, int, const int); +void vec_dst (const unsigned short *, int, const int); +void vec_dst (const short *, int, const int); +void vec_dst (const unsigned int *, int, const int); +void vec_dst (const int *, int, const int); +void vec_dst (const float *, int, const int); + +void vec_dstst (const vector unsigned char *, int, const int); +void vec_dstst (const vector signed char *, int, const int); +void vec_dstst (const vector bool char *, int, const int); +void vec_dstst (const vector unsigned short *, int, const int); +void vec_dstst (const vector signed short *, int, const int); +void vec_dstst (const vector bool short *, int, const int); +void vec_dstst (const vector pixel *, int, const int); +void vec_dstst (const vector unsigned int *, int, const int); +void vec_dstst (const vector signed int *, int, const int); +void vec_dstst (const vector bool int *, int, const int); +void vec_dstst (const vector float *, int, const int); +void vec_dstst (const unsigned char *, int, const int); +void vec_dstst (const signed char *, int, const int); +void vec_dstst (const unsigned short *, int, const int); +void vec_dstst (const short *, int, const int); +void vec_dstst (const unsigned int *, int, const int); +void vec_dstst (const int *, int, const int); +void vec_dstst (const unsigned long *, int, const int); +void vec_dstst (const long *, int, const int); +void vec_dstst (const float *, int, const int); + +void vec_dststt (const vector unsigned char *, int, const int); +void vec_dststt (const vector signed char *, int, const int); +void vec_dststt (const vector bool char *, int, const int); +void vec_dststt (const vector unsigned short *, int, const int); +void vec_dststt (const vector signed short *, int, const int); +void vec_dststt (const vector bool short *, int, const int); +void vec_dststt (const vector pixel *, int, const int); +void vec_dststt (const vector unsigned int *, int, const int); +void vec_dststt (const vector signed int *, int, const int); +void vec_dststt (const vector bool int *, int, const int); +void vec_dststt (const vector float *, int, const int); +void vec_dststt (const unsigned char *, int, const int); +void vec_dststt (const signed char *, int, const int); +void vec_dststt (const unsigned short *, int, const int); +void vec_dststt (const short *, int, const int); +void vec_dststt (const unsigned int *, int, const int); +void vec_dststt (const int *, int, const int); +void vec_dststt (const float *, int, const int); + +void vec_dstt (const vector unsigned char *, int, const int); +void vec_dstt (const vector signed char *, int, const int); +void vec_dstt (const vector bool char *, int, const int); +void vec_dstt (const vector unsigned short *, int, const int); +void vec_dstt (const vector signed short *, int, const int); +void vec_dstt (const vector bool short *, int, const int); +void vec_dstt (const vector pixel *, int, const int); +void vec_dstt (const vector unsigned int *, int, const int); +void vec_dstt (const vector signed int *, int, const int); +void vec_dstt (const vector bool int *, int, const int); +void vec_dstt (const vector float *, int, const int); +void vec_dstt (const unsigned char *, int, const int); +void vec_dstt (const signed char *, int, const int); +void vec_dstt (const unsigned short *, int, const int); +void vec_dstt (const short *, int, const int); +void vec_dstt (const unsigned int *, int, const int); +void vec_dstt (const int *, int, const int); +void vec_dstt (const float *, int, const int); + +vector signed char vec_lvebx (int, char *); +vector unsigned char vec_lvebx (int, unsigned char *); + +vector signed short vec_lvehx (int, short *); +vector unsigned short vec_lvehx (int, unsigned short *); + +vector float vec_lvewx (int, float *); +vector signed int vec_lvewx (int, int *); +vector unsigned int vec_lvewx (int, unsigned int *); + +vector unsigned char vec_lvsl (int, const unsigned char *); +vector unsigned char vec_lvsl (int, const signed char *); +vector unsigned char vec_lvsl (int, const unsigned short *); +vector unsigned char vec_lvsl (int, const short *); +vector unsigned char vec_lvsl (int, const unsigned int *); +vector unsigned char vec_lvsl (int, const int *); +vector unsigned char vec_lvsl (int, const float *); + +vector unsigned char vec_lvsr (int, const unsigned char *); +vector unsigned char vec_lvsr (int, const signed char *); +vector unsigned char vec_lvsr (int, const unsigned short *); +vector unsigned char vec_lvsr (int, const short *); +vector unsigned char vec_lvsr (int, const unsigned int *); +vector unsigned char vec_lvsr (int, const int *); +vector unsigned char vec_lvsr (int, const float *); + +void vec_stvebx (vector signed char, int, signed char *); +void vec_stvebx (vector unsigned char, int, unsigned char *); +void vec_stvebx (vector bool char, int, signed char *); +void vec_stvebx (vector bool char, int, unsigned char *); + +void vec_stvehx (vector signed short, int, short *); +void vec_stvehx (vector unsigned short, int, unsigned short *); +void vec_stvehx (vector bool short, int, short *); +void vec_stvehx (vector bool short, int, unsigned short *); + +void vec_stvewx (vector float, int, float *); +void vec_stvewx (vector signed int, int, int *); +void vec_stvewx (vector unsigned int, int, unsigned int *); +void vec_stvewx (vector bool int, int, int *); +void vec_stvewx (vector bool int, int, unsigned int *); + +vector float vec_vaddfp (vector float, vector float); + +vector signed char vec_vaddsbs (vector bool char, vector signed char); +vector signed char vec_vaddsbs (vector signed char, vector bool char); +vector signed char vec_vaddsbs (vector signed char, vector signed char); + +vector signed short vec_vaddshs (vector bool short, vector signed short); +vector signed short vec_vaddshs (vector signed short, vector bool short); +vector signed short vec_vaddshs (vector signed short, vector signed short); + +vector signed int vec_vaddsws (vector bool int, vector signed int); +vector signed int vec_vaddsws (vector signed int, vector bool int); +vector signed int vec_vaddsws (vector signed int, vector signed int); + +vector signed char vec_vaddubm (vector bool char, vector signed char); +vector signed char vec_vaddubm (vector signed char, vector bool char); +vector signed char vec_vaddubm (vector signed char, vector signed char); +vector unsigned char vec_vaddubm (vector bool char, vector unsigned char); +vector unsigned char vec_vaddubm (vector unsigned char, vector bool char); +vector unsigned char vec_vaddubm (vector unsigned char, vector unsigned char); + +vector unsigned char vec_vaddubs (vector bool char, vector unsigned char); +vector unsigned char vec_vaddubs (vector unsigned char, vector bool char); +vector unsigned char vec_vaddubs (vector unsigned char, vector unsigned char); + +vector signed short vec_vadduhm (vector bool short, vector signed short); +vector signed short vec_vadduhm (vector signed short, vector bool short); +vector signed short vec_vadduhm (vector signed short, vector signed short); +vector unsigned short vec_vadduhm (vector bool short, vector unsigned short); +vector unsigned short vec_vadduhm (vector unsigned short, vector bool short); +vector unsigned short vec_vadduhm (vector unsigned short, vector unsigned short); + +vector unsigned short vec_vadduhs (vector bool short, vector unsigned short); +vector unsigned short vec_vadduhs (vector unsigned short, vector bool short); +vector unsigned short vec_vadduhs (vector unsigned short, vector unsigned short); + +vector signed int vec_vadduwm (vector bool int, vector signed int); +vector signed int vec_vadduwm (vector signed int, vector bool int); +vector signed int vec_vadduwm (vector signed int, vector signed int); +vector unsigned int vec_vadduwm (vector bool int, vector unsigned int); +vector unsigned int vec_vadduwm (vector unsigned int, vector bool int); +vector unsigned int vec_vadduwm (vector unsigned int, vector unsigned int); + +vector unsigned int vec_vadduws (vector bool int, vector unsigned int); +vector unsigned int vec_vadduws (vector unsigned int, vector bool int); +vector unsigned int vec_vadduws (vector unsigned int, vector unsigned int); + +vector signed char vec_vavgsb (vector signed char, vector signed char); + +vector signed short vec_vavgsh (vector signed short, vector signed short); + +vector signed int vec_vavgsw (vector signed int, vector signed int); + +vector unsigned char vec_vavgub (vector unsigned char, vector unsigned char); + +vector unsigned short vec_vavguh (vector unsigned short, vector unsigned short); + +vector unsigned int vec_vavguw (vector unsigned int, vector unsigned int); + +vector float vec_vcfsx (vector signed int, const int); + +vector float vec_vcfux (vector unsigned int, const int); + +vector bool int vec_vcmpeqfp (vector float, vector float); + +vector bool char vec_vcmpequb (vector signed char, vector signed char); +vector bool char vec_vcmpequb (vector unsigned char, vector unsigned char); + +vector bool short vec_vcmpequh (vector signed short, vector signed short); +vector bool short vec_vcmpequh (vector unsigned short, vector unsigned short); + +vector bool int vec_vcmpequw (vector signed int, vector signed int); +vector bool int vec_vcmpequw (vector unsigned int, vector unsigned int); + +vector bool int vec_vcmpgtfp (vector float, vector float); + +vector bool char vec_vcmpgtsb (vector signed char, vector signed char); + +vector bool short vec_vcmpgtsh (vector signed short, vector signed short); + +vector bool int vec_vcmpgtsw (vector signed int, vector signed int); + +vector bool char vec_vcmpgtub (vector unsigned char, vector unsigned char); + +vector bool short vec_vcmpgtuh (vector unsigned short, vector unsigned short); + +vector bool int vec_vcmpgtuw (vector unsigned int, vector unsigned int); + +vector float vec_vmaxfp (vector float, vector float); + +vector signed char vec_vmaxsb (vector bool char, vector signed char); +vector signed char vec_vmaxsb (vector signed char, vector bool char); +vector signed char vec_vmaxsb (vector signed char, vector signed char); + +vector signed short vec_vmaxsh (vector bool short, vector signed short); +vector signed short vec_vmaxsh (vector signed short, vector bool short); +vector signed short vec_vmaxsh (vector signed short, vector signed short); + +vector signed int vec_vmaxsw (vector bool int, vector signed int); +vector signed int vec_vmaxsw (vector signed int, vector bool int); +vector signed int vec_vmaxsw (vector signed int, vector signed int); + +vector unsigned char vec_vmaxub (vector bool char, vector unsigned char); +vector unsigned char vec_vmaxub (vector unsigned char, vector bool char); +vector unsigned char vec_vmaxub (vector unsigned char, vector unsigned char); + +vector unsigned short vec_vmaxuh (vector bool short, vector unsigned short); +vector unsigned short vec_vmaxuh (vector unsigned short, vector bool short); +vector unsigned short vec_vmaxuh (vector unsigned short, vector unsigned short); + +vector unsigned int vec_vmaxuw (vector bool int, vector unsigned int); +vector unsigned int vec_vmaxuw (vector unsigned int, vector bool int); +vector unsigned int vec_vmaxuw (vector unsigned int, vector unsigned int); + +vector float vec_vminfp (vector float, vector float); + +vector signed char vec_vminsb (vector bool char, vector signed char); +vector signed char vec_vminsb (vector signed char, vector bool char); +vector signed char vec_vminsb (vector signed char, vector signed char); + +vector signed short vec_vminsh (vector bool short, vector signed short); +vector signed short vec_vminsh (vector signed short, vector bool short); +vector signed short vec_vminsh (vector signed short, vector signed short); + +vector signed int vec_vminsw (vector bool int, vector signed int); +vector signed int vec_vminsw (vector signed int, vector bool int); +vector signed int vec_vminsw (vector signed int, vector signed int); + +vector unsigned char vec_vminub (vector bool char, vector unsigned char); +vector unsigned char vec_vminub (vector unsigned char, vector bool char); +vector unsigned char vec_vminub (vector unsigned char, vector unsigned char); + +vector unsigned short vec_vminuh (vector bool short, vector unsigned short); +vector unsigned short vec_vminuh (vector unsigned short, vector bool short); +vector unsigned short vec_vminuh (vector unsigned short, vector unsigned short); + +vector unsigned int vec_vminuw (vector bool int, vector unsigned int); +vector unsigned int vec_vminuw (vector unsigned int, vector bool int); +vector unsigned int vec_vminuw (vector unsigned int, vector unsigned int); + +vector bool char vec_vmrghb (vector bool char, vector bool char); +vector signed char vec_vmrghb (vector signed char, vector signed char); +vector unsigned char vec_vmrghb (vector unsigned char, vector unsigned char); + +vector bool short vec_vmrghh (vector bool short, vector bool short); +vector signed short vec_vmrghh (vector signed short, vector signed short); +vector unsigned short vec_vmrghh (vector unsigned short, vector unsigned short); +vector pixel vec_vmrghh (vector pixel, vector pixel); + +vector float vec_vmrghw (vector float, vector float); +vector bool int vec_vmrghw (vector bool int, vector bool int); +vector signed int vec_vmrghw (vector signed int, vector signed int); +vector unsigned int vec_vmrghw (vector unsigned int, vector unsigned int); + +vector bool char vec_vmrglb (vector bool char, vector bool char); +vector signed char vec_vmrglb (vector signed char, vector signed char); +vector unsigned char vec_vmrglb (vector unsigned char, vector unsigned char); + +vector bool short vec_vmrglh (vector bool short, vector bool short); +vector signed short vec_vmrglh (vector signed short, vector signed short); +vector unsigned short vec_vmrglh (vector unsigned short, vector unsigned short); +vector pixel vec_vmrglh (vector pixel, vector pixel); + +vector float vec_vmrglw (vector float, vector float); +vector signed int vec_vmrglw (vector signed int, vector signed int); +vector unsigned int vec_vmrglw (vector unsigned int, vector unsigned int); +vector bool int vec_vmrglw (vector bool int, vector bool int); + +vector signed int vec_vmsummbm (vector signed char, vector unsigned char, + vector signed int); + +vector signed int vec_vmsumshm (vector signed short, vector signed short, + vector signed int); + +vector signed int vec_vmsumshs (vector signed short, vector signed short, + vector signed int); + +vector unsigned int vec_vmsumubm (vector unsigned char, vector unsigned char, + vector unsigned int); + +vector unsigned int vec_vmsumuhm (vector unsigned short, vector unsigned short, + vector unsigned int); + +vector unsigned int vec_vmsumuhs (vector unsigned short, vector unsigned short, + vector unsigned int); + +vector signed short vec_vmulesb (vector signed char, vector signed char); + +vector signed int vec_vmulesh (vector signed short, vector signed short); + +vector unsigned short vec_vmuleub (vector unsigned char, vector unsigned char); + +vector unsigned int vec_vmuleuh (vector unsigned short, vector unsigned short); + +vector signed short vec_vmulosb (vector signed char, vector signed char); + +vector signed int vec_vmulosh (vector signed short, vector signed short); + +vector unsigned short vec_vmuloub (vector unsigned char, vector unsigned char); + +vector unsigned int vec_vmulouh (vector unsigned short, vector unsigned short); + +vector signed char vec_vpkshss (vector signed short, vector signed short); + +vector unsigned char vec_vpkshus (vector signed short, vector signed short); + +vector signed short vec_vpkswss (vector signed int, vector signed int); + +vector unsigned short vec_vpkswus (vector signed int, vector signed int); + +vector bool char vec_vpkuhum (vector bool short, vector bool short); +vector signed char vec_vpkuhum (vector signed short, vector signed short); +vector unsigned char vec_vpkuhum (vector unsigned short, vector unsigned short); + +vector unsigned char vec_vpkuhus (vector unsigned short, vector unsigned short); + +vector bool short vec_vpkuwum (vector bool int, vector bool int); +vector signed short vec_vpkuwum (vector signed int, vector signed int); +vector unsigned short vec_vpkuwum (vector unsigned int, vector unsigned int); + +vector unsigned short vec_vpkuwus (vector unsigned int, vector unsigned int); + +vector signed char vec_vrlb (vector signed char, vector unsigned char); +vector unsigned char vec_vrlb (vector unsigned char, vector unsigned char); + +vector signed short vec_vrlh (vector signed short, vector unsigned short); +vector unsigned short vec_vrlh (vector unsigned short, vector unsigned short); + +vector signed int vec_vrlw (vector signed int, vector unsigned int); +vector unsigned int vec_vrlw (vector unsigned int, vector unsigned int); + +vector signed char vec_vslb (vector signed char, vector unsigned char); +vector unsigned char vec_vslb (vector unsigned char, vector unsigned char); + +vector signed short vec_vslh (vector signed short, vector unsigned short); +vector unsigned short vec_vslh (vector unsigned short, vector unsigned short); + +vector signed int vec_vslw (vector signed int, vector unsigned int); +vector unsigned int vec_vslw (vector unsigned int, vector unsigned int); + +vector signed char vec_vspltb (vector signed char, const int); +vector unsigned char vec_vspltb (vector unsigned char, const int); +vector bool char vec_vspltb (vector bool char, const int); + +vector bool short vec_vsplth (vector bool short, const int); +vector signed short vec_vsplth (vector signed short, const int); +vector unsigned short vec_vsplth (vector unsigned short, const int); +vector pixel vec_vsplth (vector pixel, const int); + +vector float vec_vspltw (vector float, const int); +vector signed int vec_vspltw (vector signed int, const int); +vector unsigned int vec_vspltw (vector unsigned int, const int); +vector bool int vec_vspltw (vector bool int, const int); + +vector signed char vec_vsrab (vector signed char, vector unsigned char); +vector unsigned char vec_vsrab (vector unsigned char, vector unsigned char); + +vector signed short vec_vsrah (vector signed short, vector unsigned short); +vector unsigned short vec_vsrah (vector unsigned short, vector unsigned short); + +vector signed int vec_vsraw (vector signed int, vector unsigned int); +vector unsigned int vec_vsraw (vector unsigned int, vector unsigned int); + +vector signed char vec_vsrb (vector signed char, vector unsigned char); +vector unsigned char vec_vsrb (vector unsigned char, vector unsigned char); + +vector signed short vec_vsrh (vector signed short, vector unsigned short); +vector unsigned short vec_vsrh (vector unsigned short, vector unsigned short); + +vector signed int vec_vsrw (vector signed int, vector unsigned int); +vector unsigned int vec_vsrw (vector unsigned int, vector unsigned int); + +vector float vec_vsubfp (vector float, vector float); + +vector signed char vec_vsubsbs (vector bool char, vector signed char); +vector signed char vec_vsubsbs (vector signed char, vector bool char); +vector signed char vec_vsubsbs (vector signed char, vector signed char); + +vector signed short vec_vsubshs (vector bool short, vector signed short); +vector signed short vec_vsubshs (vector signed short, vector bool short); +vector signed short vec_vsubshs (vector signed short, vector signed short); + +vector signed int vec_vsubsws (vector bool int, vector signed int); +vector signed int vec_vsubsws (vector signed int, vector bool int); +vector signed int vec_vsubsws (vector signed int, vector signed int); + +vector signed char vec_vsububm (vector bool char, vector signed char); +vector signed char vec_vsububm (vector signed char, vector bool char); +vector signed char vec_vsububm (vector signed char, vector signed char); +vector unsigned char vec_vsububm (vector bool char, vector unsigned char); +vector unsigned char vec_vsububm (vector unsigned char, vector bool char); +vector unsigned char vec_vsububm (vector unsigned char, vector unsigned char); + +vector unsigned char vec_vsububs (vector bool char, vector unsigned char); +vector unsigned char vec_vsububs (vector unsigned char, vector bool char); +vector unsigned char vec_vsububs (vector unsigned char, vector unsigned char); + +vector signed short vec_vsubuhm (vector bool short, vector signed short); +vector signed short vec_vsubuhm (vector signed short, vector bool short); +vector signed short vec_vsubuhm (vector signed short, vector signed short); +vector unsigned short vec_vsubuhm (vector bool short, vector unsigned short); +vector unsigned short vec_vsubuhm (vector unsigned short, vector bool short); +vector unsigned short vec_vsubuhm (vector unsigned short, vector unsigned short); + +vector unsigned short vec_vsubuhs (vector bool short, vector unsigned short); +vector unsigned short vec_vsubuhs (vector unsigned short, vector bool short); +vector unsigned short vec_vsubuhs (vector unsigned short, vector unsigned short); + +vector signed int vec_vsubuwm (vector bool int, vector signed int); +vector signed int vec_vsubuwm (vector signed int, vector bool int); +vector signed int vec_vsubuwm (vector signed int, vector signed int); +vector unsigned int vec_vsubuwm (vector bool int, vector unsigned int); +vector unsigned int vec_vsubuwm (vector unsigned int, vector bool int); +vector unsigned int vec_vsubuwm (vector unsigned int, vector unsigned int); + +vector unsigned int vec_vsubuws (vector bool int, vector unsigned int); +vector unsigned int vec_vsubuws (vector unsigned int, vector bool int); +vector unsigned int vec_vsubuws (vector unsigned int, vector unsigned int); + +vector signed int vec_vsum4sbs (vector signed char, vector signed int); + +vector signed int vec_vsum4shs (vector signed short, vector signed int); + +vector unsigned int vec_vsum4ubs (vector unsigned char, vector unsigned int); + +vector unsigned int vec_vupkhpx (vector pixel); + +vector bool short vec_vupkhsb (vector bool char); +vector signed short vec_vupkhsb (vector signed char); + +vector bool int vec_vupkhsh (vector bool short); +vector signed int vec_vupkhsh (vector signed short); + +vector unsigned int vec_vupklpx (vector pixel); + +vector bool short vec_vupklsb (vector bool char); +vector signed short vec_vupklsb (vector signed char); + +vector bool int vec_vupklsh (vector bool short); +vector signed int vec_vupklsh (vector signed short);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e06">PowerPC AltiVec Built-in Functions Available on ISA 2.06</a>, Up: <a href="powerpc-altivec_002fvsx-built-in-functions">PowerPC AltiVec/VSX Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-on-ISA-2_002e05.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec-Built-in-Functions-on-ISA-2_002e05.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-altivec_002fvsx-built-in-functions.html b/devdocs/gcc~13/powerpc-altivec_002fvsx-built-in-functions.html new file mode 100644 index 00000000..29a8c900 --- /dev/null +++ b/devdocs/gcc~13/powerpc-altivec_002fvsx-built-in-functions.html @@ -0,0 +1,291 @@ +<div class="subsection-level-extent" id="PowerPC-AltiVec_002fVSX-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="powerpc-hardware-transactional-memory-built-in-functions" accesskey="n" rel="next">PowerPC Hardware Transactional Memory Built-in Functions</a>, Previous: <a href="basic-powerpc-built-in-functions" accesskey="p" rel="prev">Basic PowerPC Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PowerPC-AltiVec_002fVSX-Built-in-Functions-1"><span>6.60.23 PowerPC AltiVec/VSX Built-in Functions<a class="copiable-link" href="#PowerPC-AltiVec_002fVSX-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC provides an interface for the PowerPC family of processors to access the AltiVec operations described in Motorola’s AltiVec Programming Interface Manual. The interface is made available by including <code class="code"><altivec.h></code> and using <samp class="option">-maltivec</samp> and <samp class="option">-mabi=altivec</samp>. The interface supports the following vector types. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vector unsigned char +vector signed char +vector bool char + +vector unsigned short +vector signed short +vector bool short +vector pixel + +vector unsigned int +vector signed int +vector bool int +vector float</pre> +</div> <p>GCC’s implementation of the high-level language interface available from C and C++ code differs from Motorola’s documentation in several ways. </p> <ul class="itemize mark-bullet"> <li>A vector constant is a list of constant expressions within curly braces. </li> +<li>A vector initializer requires no cast if the vector constant is of the same type as the variable it is initializing. </li> +<li>If <code class="code">signed</code> or <code class="code">unsigned</code> is omitted, the signedness of the vector type is the default signedness of the base type. The default varies depending on the operating system, so a portable program should always specify the signedness. </li> +<li>Compiling with <samp class="option">-maltivec</samp> adds keywords <code class="code">__vector</code>, <code class="code">vector</code>, <code class="code">__pixel</code>, <code class="code">pixel</code>, <code class="code">__bool</code> and <code class="code">bool</code>. When compiling ISO C, the context-sensitive substitution of the keywords <code class="code">vector</code>, <code class="code">pixel</code> and <code class="code">bool</code> is disabled. To use them, you must include <code class="code"><altivec.h></code> instead. </li> +<li>GCC allows using a <code class="code">typedef</code> name as the type specifier for a vector type, but only under the following circumstances: <ul class="itemize mark-bullet"> <li>When using <code class="code">__vector</code> instead of <code class="code">vector</code>; for example, <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef signed short int16; +__vector int16 data;</pre> +</div> </li> +<li>When using <code class="code">vector</code> in keyword-and-predefine mode; for example, <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef signed short int16; +vector int16 data;</pre> +</div> <p>Note that keyword-and-predefine mode is enabled by disabling GNU extensions (e.g., by using <code class="code">-std=c11</code>) and including <code class="code"><altivec.h></code>. </p> +</li> +</ul> </li> +<li>For C, overloaded functions are implemented with macros so the following does not work: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">vec_add ((vector signed int){1, 2, 3, 4}, foo);</pre> +</div> <p>Since <code class="code">vec_add</code> is a macro, the vector constant in the example is treated as four separate arguments. Wrap the entire argument in parentheses for this to work. </p> +</li> +</ul> <p><em class="emph">Note:</em> Only the <code class="code"><altivec.h></code> interface is supported. Internally, GCC uses built-in functions to achieve the functionality in the aforementioned header file, but they are not supported and are subject to change without notice. </p> <p>GCC complies with the Power Vector Intrinsic Programming Reference (PVIPR), which may be found at <a class="uref" href="https://openpowerfoundation.org/?resource_lib=power-vector-intrinsic-programming-reference">https://openpowerfoundation.org/?resource_lib=power-vector-intrinsic-programming-reference</a>. Chapter 4 of this document fully documents the vector API interfaces that must be provided by compliant compilers. Programmers should preferentially use the interfaces described therein. However, historically GCC has provided additional interfaces for access to vector instructions. These are briefly described below. Where the PVIPR provides a portable interface, other functions in GCC that provide the same capabilities should be considered deprecated. </p> <p>The PVIPR documents the following overloaded functions: </p> <table class="multitable"> <tbody> +<tr> +<td width="33%"><code class="code">vec_abs</code></td> +<td width="33%"><code class="code">vec_absd</code></td> +<td width="33%"><code class="code">vec_abss</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_add</code></td> +<td width="33%"><code class="code">vec_addc</code></td> +<td width="33%"><code class="code">vec_adde</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_addec</code></td> +<td width="33%"><code class="code">vec_adds</code></td> +<td width="33%"><code class="code">vec_all_eq</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_all_ge</code></td> +<td width="33%"><code class="code">vec_all_gt</code></td> +<td width="33%"><code class="code">vec_all_in</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_all_le</code></td> +<td width="33%"><code class="code">vec_all_lt</code></td> +<td width="33%"><code class="code">vec_all_nan</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_all_ne</code></td> +<td width="33%"><code class="code">vec_all_nge</code></td> +<td width="33%"><code class="code">vec_all_ngt</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_all_nle</code></td> +<td width="33%"><code class="code">vec_all_nlt</code></td> +<td width="33%"><code class="code">vec_all_numeric</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_and</code></td> +<td width="33%"><code class="code">vec_andc</code></td> +<td width="33%"><code class="code">vec_any_eq</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_any_ge</code></td> +<td width="33%"><code class="code">vec_any_gt</code></td> +<td width="33%"><code class="code">vec_any_le</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_any_lt</code></td> +<td width="33%"><code class="code">vec_any_nan</code></td> +<td width="33%"><code class="code">vec_any_ne</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_any_nge</code></td> +<td width="33%"><code class="code">vec_any_ngt</code></td> +<td width="33%"><code class="code">vec_any_nle</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_any_nlt</code></td> +<td width="33%"><code class="code">vec_any_numeric</code></td> +<td width="33%"><code class="code">vec_any_out</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_avg</code></td> +<td width="33%"><code class="code">vec_bperm</code></td> +<td width="33%"><code class="code">vec_ceil</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_cipher_be</code></td> +<td width="33%"><code class="code">vec_cipherlast_be</code></td> +<td width="33%"><code class="code">vec_cmpb</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_cmpeq</code></td> +<td width="33%"><code class="code">vec_cmpge</code></td> +<td width="33%"><code class="code">vec_cmpgt</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_cmple</code></td> +<td width="33%"><code class="code">vec_cmplt</code></td> +<td width="33%"><code class="code">vec_cmpne</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_cmpnez</code></td> +<td width="33%"><code class="code">vec_cntlz</code></td> +<td width="33%"><code class="code">vec_cntlz_lsbb</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_cnttz</code></td> +<td width="33%"><code class="code">vec_cnttz_lsbb</code></td> +<td width="33%"><code class="code">vec_cpsgn</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_ctf</code></td> +<td width="33%"><code class="code">vec_cts</code></td> +<td width="33%"><code class="code">vec_ctu</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_div</code></td> +<td width="33%"><code class="code">vec_double</code></td> +<td width="33%"><code class="code">vec_doublee</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_doubleh</code></td> +<td width="33%"><code class="code">vec_doublel</code></td> +<td width="33%"><code class="code">vec_doubleo</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_eqv</code></td> +<td width="33%"><code class="code">vec_expte</code></td> +<td width="33%"><code class="code">vec_extract</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_extract_exp</code></td> +<td width="33%"><code class="code">vec_extract_fp32_from_shorth</code></td> +<td width="33%"><code class="code">vec_extract_fp32_from_shortl</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_extract_sig</code></td> +<td width="33%"><code class="code">vec_extract_4b</code></td> +<td width="33%"><code class="code">vec_first_match_index</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_first_match_or_eos_index</code></td> +<td width="33%"><code class="code">vec_first_mismatch_index</code></td> +<td width="33%"><code class="code">vec_first_mismatch_or_eos_index</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_float</code></td> +<td width="33%"><code class="code">vec_float2</code></td> +<td width="33%"><code class="code">vec_floate</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_floato</code></td> +<td width="33%"><code class="code">vec_floor</code></td> +<td width="33%"><code class="code">vec_gb</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_insert</code></td> +<td width="33%"><code class="code">vec_insert_exp</code></td> +<td width="33%"><code class="code">vec_insert4b</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_ld</code></td> +<td width="33%"><code class="code">vec_lde</code></td> +<td width="33%"><code class="code">vec_ldl</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_loge</code></td> +<td width="33%"><code class="code">vec_madd</code></td> +<td width="33%"><code class="code">vec_madds</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_max</code></td> +<td width="33%"><code class="code">vec_mergee</code></td> +<td width="33%"><code class="code">vec_mergeh</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_mergel</code></td> +<td width="33%"><code class="code">vec_mergeo</code></td> +<td width="33%"><code class="code">vec_mfvscr</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_min</code></td> +<td width="33%"><code class="code">vec_mradds</code></td> +<td width="33%"><code class="code">vec_msub</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_msum</code></td> +<td width="33%"><code class="code">vec_msums</code></td> +<td width="33%"><code class="code">vec_mtvscr</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_mul</code></td> +<td width="33%"><code class="code">vec_mule</code></td> +<td width="33%"><code class="code">vec_mulo</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_nabs</code></td> +<td width="33%"><code class="code">vec_nand</code></td> +<td width="33%"><code class="code">vec_ncipher_be</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_ncipherlast_be</code></td> +<td width="33%"><code class="code">vec_nearbyint</code></td> +<td width="33%"><code class="code">vec_neg</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_nmadd</code></td> +<td width="33%"><code class="code">vec_nmsub</code></td> +<td width="33%"><code class="code">vec_nor</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_or</code></td> +<td width="33%"><code class="code">vec_orc</code></td> +<td width="33%"><code class="code">vec_pack</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_pack_to_short_fp32</code></td> +<td width="33%"><code class="code">vec_packpx</code></td> +<td width="33%"><code class="code">vec_packs</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_packsu</code></td> +<td width="33%"><code class="code">vec_parity_lsbb</code></td> +<td width="33%"><code class="code">vec_perm</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_permxor</code></td> +<td width="33%"><code class="code">vec_pmsum_be</code></td> +<td width="33%"><code class="code">vec_popcnt</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_re</code></td> +<td width="33%"><code class="code">vec_recipdiv</code></td> +<td width="33%"><code class="code">vec_revb</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_reve</code></td> +<td width="33%"><code class="code">vec_rint</code></td> +<td width="33%"><code class="code">vec_rl</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_rlmi</code></td> +<td width="33%"><code class="code">vec_rlnm</code></td> +<td width="33%"><code class="code">vec_round</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_rsqrt</code></td> +<td width="33%"><code class="code">vec_rsqrte</code></td> +<td width="33%"><code class="code">vec_sbox_be</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_sel</code></td> +<td width="33%"><code class="code">vec_shasigma_be</code></td> +<td width="33%"><code class="code">vec_signed</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_signed2</code></td> +<td width="33%"><code class="code">vec_signede</code></td> +<td width="33%"><code class="code">vec_signedo</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_sl</code></td> +<td width="33%"><code class="code">vec_sld</code></td> +<td width="33%"><code class="code">vec_sldw</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_sll</code></td> +<td width="33%"><code class="code">vec_slo</code></td> +<td width="33%"><code class="code">vec_slv</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_splat</code></td> +<td width="33%"><code class="code">vec_splat_s8</code></td> +<td width="33%"><code class="code">vec_splat_s16</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_splat_s32</code></td> +<td width="33%"><code class="code">vec_splat_u8</code></td> +<td width="33%"><code class="code">vec_splat_u16</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_splat_u32</code></td> +<td width="33%"><code class="code">vec_splats</code></td> +<td width="33%"><code class="code">vec_sqrt</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_sr</code></td> +<td width="33%"><code class="code">vec_sra</code></td> +<td width="33%"><code class="code">vec_srl</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_sro</code></td> +<td width="33%"><code class="code">vec_srv</code></td> +<td width="33%"><code class="code">vec_st</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_ste</code></td> +<td width="33%"><code class="code">vec_stl</code></td> +<td width="33%"><code class="code">vec_sub</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_subc</code></td> +<td width="33%"><code class="code">vec_sube</code></td> +<td width="33%"><code class="code">vec_subec</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_subs</code></td> +<td width="33%"><code class="code">vec_sum2s</code></td> +<td width="33%"><code class="code">vec_sum4s</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_sums</code></td> +<td width="33%"><code class="code">vec_test_data_class</code></td> +<td width="33%"><code class="code">vec_trunc</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_unpackh</code></td> +<td width="33%"><code class="code">vec_unpackl</code></td> +<td width="33%"><code class="code">vec_unsigned</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_unsigned2</code></td> +<td width="33%"><code class="code">vec_unsignede</code></td> +<td width="33%"><code class="code">vec_unsignedo</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_xl</code></td> +<td width="33%"><code class="code">vec_xl_be</code></td> +<td width="33%"><code class="code">vec_xl_len</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_xl_len_r</code></td> +<td width="33%"><code class="code">vec_xor</code></td> +<td width="33%"><code class="code">vec_xst</code></td> +</tr> <tr> +<td width="33%"><code class="code">vec_xst_be</code></td> +<td width="33%"><code class="code">vec_xst_len</code></td> +<td width="33%"><code class="code">vec_xst_len_r</code></td> +</tr> </tbody> </table> <ul class="mini-toc"> <li><a href="powerpc-altivec-built-in-functions-on-isa-2_002e05" accesskey="1">PowerPC AltiVec Built-in Functions on ISA 2.05</a></li> <li><a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e06" accesskey="2">PowerPC AltiVec Built-in Functions Available on ISA 2.06</a></li> <li><a href="powerpc-altivec-built-in-functions-available-on-isa-2_002e07" accesskey="3">PowerPC AltiVec Built-in Functions Available on ISA 2.07</a></li> <li><a href="powerpc-altivec-built-in-functions-available-on-isa-3_002e0" accesskey="4">PowerPC AltiVec Built-in Functions Available on ISA 3.0</a></li> <li><a href="powerpc-altivec-built-in-functions-available-on-isa-3_002e1" accesskey="5">PowerPC AltiVec Built-in Functions Available on ISA 3.1</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="powerpc-hardware-transactional-memory-built-in-functions">PowerPC Hardware Transactional Memory Built-in Functions</a>, Previous: <a href="basic-powerpc-built-in-functions">Basic PowerPC Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec_002fVSX-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-AltiVec_002fVSX-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-atomic-memory-operation-functions.html b/devdocs/gcc~13/powerpc-atomic-memory-operation-functions.html new file mode 100644 index 00000000..ace5a3f7 --- /dev/null +++ b/devdocs/gcc~13/powerpc-atomic-memory-operation-functions.html @@ -0,0 +1,55 @@ +<div class="subsection-level-extent" id="PowerPC-Atomic-Memory-Operation-Functions"> <div class="nav-panel"> <p> Next: <a href="powerpc-matrix-multiply-assist-built-in-functions" accesskey="n" rel="next">PowerPC Matrix-Multiply Assist Built-in Functions</a>, Previous: <a href="powerpc-hardware-transactional-memory-built-in-functions" accesskey="p" rel="prev">PowerPC Hardware Transactional Memory Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PowerPC-Atomic-Memory-Operation-Functions-1"><span>6.60.25 PowerPC Atomic Memory Operation Functions<a class="copiable-link" href="#PowerPC-Atomic-Memory-Operation-Functions-1"> ¶</a></span></h1> <p>ISA 3.0 of the PowerPC added new atomic memory operation (amo) instructions. GCC provides support for these instructions in 64-bit environments. All of the functions are declared in the include file <code class="code">amo.h</code>. </p> <p>The functions supported are: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <amo.h> + +uint32_t amo_lwat_add (uint32_t *, uint32_t); +uint32_t amo_lwat_xor (uint32_t *, uint32_t); +uint32_t amo_lwat_ior (uint32_t *, uint32_t); +uint32_t amo_lwat_and (uint32_t *, uint32_t); +uint32_t amo_lwat_umax (uint32_t *, uint32_t); +uint32_t amo_lwat_umin (uint32_t *, uint32_t); +uint32_t amo_lwat_swap (uint32_t *, uint32_t); + +int32_t amo_lwat_sadd (int32_t *, int32_t); +int32_t amo_lwat_smax (int32_t *, int32_t); +int32_t amo_lwat_smin (int32_t *, int32_t); +int32_t amo_lwat_sswap (int32_t *, int32_t); + +uint64_t amo_ldat_add (uint64_t *, uint64_t); +uint64_t amo_ldat_xor (uint64_t *, uint64_t); +uint64_t amo_ldat_ior (uint64_t *, uint64_t); +uint64_t amo_ldat_and (uint64_t *, uint64_t); +uint64_t amo_ldat_umax (uint64_t *, uint64_t); +uint64_t amo_ldat_umin (uint64_t *, uint64_t); +uint64_t amo_ldat_swap (uint64_t *, uint64_t); + +int64_t amo_ldat_sadd (int64_t *, int64_t); +int64_t amo_ldat_smax (int64_t *, int64_t); +int64_t amo_ldat_smin (int64_t *, int64_t); +int64_t amo_ldat_sswap (int64_t *, int64_t); + +void amo_stwat_add (uint32_t *, uint32_t); +void amo_stwat_xor (uint32_t *, uint32_t); +void amo_stwat_ior (uint32_t *, uint32_t); +void amo_stwat_and (uint32_t *, uint32_t); +void amo_stwat_umax (uint32_t *, uint32_t); +void amo_stwat_umin (uint32_t *, uint32_t); + +void amo_stwat_sadd (int32_t *, int32_t); +void amo_stwat_smax (int32_t *, int32_t); +void amo_stwat_smin (int32_t *, int32_t); + +void amo_stdat_add (uint64_t *, uint64_t); +void amo_stdat_xor (uint64_t *, uint64_t); +void amo_stdat_ior (uint64_t *, uint64_t); +void amo_stdat_and (uint64_t *, uint64_t); +void amo_stdat_umax (uint64_t *, uint64_t); +void amo_stdat_umin (uint64_t *, uint64_t); + +void amo_stdat_sadd (int64_t *, int64_t); +void amo_stdat_smax (int64_t *, int64_t); +void amo_stdat_smin (int64_t *, int64_t);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Atomic-Memory-Operation-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Atomic-Memory-Operation-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-function-attributes.html b/devdocs/gcc~13/powerpc-function-attributes.html new file mode 100644 index 00000000..dfead296 --- /dev/null +++ b/devdocs/gcc~13/powerpc-function-attributes.html @@ -0,0 +1,81 @@ +<div class="subsection-level-extent" id="PowerPC-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="risc-v-function-attributes" accesskey="n" rel="next">RISC-V Function Attributes</a>, Previous: <a href="nvidia-ptx-function-attributes" accesskey="p" rel="prev">Nvidia PTX Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PowerPC-Function-Attributes-1"><span>6.33.24 PowerPC Function Attributes<a class="copiable-link" href="#PowerPC-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the PowerPC back end: </p> <dl class="table"> <dt> + <span><code class="code">longcall</code><a class="copiable-link" href="#index-indirect-calls_002c-PowerPC"> ¶</a></span> +</dt> <dt><code class="code">shortcall</code></dt> <dd> +<p>The <code class="code">longcall</code> attribute indicates that the function might be far away from the call site and require a different (more expensive) calling sequence. The <code class="code">shortcall</code> attribute indicates that the function is always close enough for the shorter calling sequence to be used. These attributes override both the <samp class="option">-mlongcall</samp> switch and the <code class="code">#pragma longcall</code> setting. </p> <p>See <a class="xref" href="rs_002f6000-and-powerpc-options">IBM RS/6000 and PowerPC Options</a>, for more information on whether long calls are necessary. </p> </dd> <dt> +<span><code class="code">target (<var class="var">options</var>)</code><a class="copiable-link" href="#index-target-function-attribute-3"> ¶</a></span> +</dt> <dd> +<p>As discussed in <a class="ref" href="common-function-attributes">Common Function Attributes</a>, this attribute allows specification of target-specific compilation options. </p> <p>On the PowerPC, the following options are allowed: </p> <dl class="table"> <dt> +<span>‘<samp class="samp">altivec</samp>’<a class="copiable-link" href="#index-target_0028_0022altivec_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-altivec</samp>’</dt> <dd> +<p>Generate code that uses (does not use) AltiVec instructions. In 32-bit code, you cannot enable AltiVec instructions unless <samp class="option">-mabi=altivec</samp> is used on the command line. </p> </dd> <dt> +<span>‘<samp class="samp">cmpb</samp>’<a class="copiable-link" href="#index-target_0028_0022cmpb_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-cmpb</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the compare bytes instruction implemented on the POWER6 processor and other processors that support the PowerPC V2.05 architecture. </p> </dd> <dt> +<span>‘<samp class="samp">dlmzb</samp>’<a class="copiable-link" href="#index-target_0028_0022dlmzb_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-dlmzb</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the string-search ‘<samp class="samp">dlmzb</samp>’ instruction on the IBM 405, 440, 464 and 476 processors. This instruction is generated by default when targeting those processors. </p> </dd> <dt> +<span>‘<samp class="samp">fprnd</samp>’<a class="copiable-link" href="#index-target_0028_0022fprnd_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-fprnd</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the FP round to integer instructions implemented on the POWER5+ processor and other processors that support the PowerPC V2.03 architecture. </p> </dd> <dt> +<span>‘<samp class="samp">hard-dfp</samp>’<a class="copiable-link" href="#index-target_0028_0022hard-dfp_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-hard-dfp</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the decimal floating-point instructions implemented on some POWER processors. </p> </dd> <dt> +<span>‘<samp class="samp">isel</samp>’<a class="copiable-link" href="#index-target_0028_0022isel_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-isel</samp>’</dt> <dd> +<p>Generate code that uses (does not use) ISEL instruction. </p> </dd> <dt> +<span>‘<samp class="samp">mfcrf</samp>’<a class="copiable-link" href="#index-target_0028_0022mfcrf_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-mfcrf</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the move from condition register field instruction implemented on the POWER4 processor and other processors that support the PowerPC V2.01 architecture. </p> </dd> <dt> +<span>‘<samp class="samp">mulhw</samp>’<a class="copiable-link" href="#index-target_0028_0022mulhw_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-mulhw</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the half-word multiply and multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. These instructions are generated by default when targeting those processors. </p> </dd> <dt> +<span>‘<samp class="samp">multiple</samp>’<a class="copiable-link" href="#index-target_0028_0022multiple_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-multiple</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the load multiple word instructions and the store multiple word instructions. </p> </dd> <dt> +<span>‘<samp class="samp">update</samp>’<a class="copiable-link" href="#index-target_0028_0022update_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-update</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the load or store instructions that update the base register to the address of the calculated memory location. </p> </dd> <dt> +<span>‘<samp class="samp">popcntb</samp>’<a class="copiable-link" href="#index-target_0028_0022popcntb_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-popcntb</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the popcount and double-precision FP reciprocal estimate instruction implemented on the POWER5 processor and other processors that support the PowerPC V2.02 architecture. </p> </dd> <dt> +<span>‘<samp class="samp">popcntd</samp>’<a class="copiable-link" href="#index-target_0028_0022popcntd_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-popcntd</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the popcount instruction implemented on the POWER7 processor and other processors that support the PowerPC V2.06 architecture. </p> </dd> <dt> +<span>‘<samp class="samp">powerpc-gfxopt</samp>’<a class="copiable-link" href="#index-target_0028_0022powerpc-gfxopt_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-powerpc-gfxopt</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the optional PowerPC architecture instructions in the Graphics group, including floating-point select. </p> </dd> <dt> +<span>‘<samp class="samp">powerpc-gpopt</samp>’<a class="copiable-link" href="#index-target_0028_0022powerpc-gpopt_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-powerpc-gpopt</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the optional PowerPC architecture instructions in the General Purpose group, including floating-point square root. </p> </dd> <dt> +<span>‘<samp class="samp">recip-precision</samp>’<a class="copiable-link" href="#index-target_0028_0022recip-precision_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-recip-precision</samp>’</dt> <dd> +<p>Assume (do not assume) that the reciprocal estimate instructions provide higher-precision estimates than is mandated by the PowerPC ABI. </p> </dd> <dt> +<span>‘<samp class="samp">string</samp>’<a class="copiable-link" href="#index-target_0028_0022string_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-string</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the load string instructions and the store string word instructions to save multiple registers and do small block moves. </p> </dd> <dt> +<span>‘<samp class="samp">vsx</samp>’<a class="copiable-link" href="#index-target_0028_0022vsx_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-vsx</samp>’</dt> <dd> +<p>Generate code that uses (does not use) vector/scalar (VSX) instructions, and also enable the use of built-in functions that allow more direct access to the VSX instruction set. In 32-bit code, you cannot enable VSX or AltiVec instructions unless <samp class="option">-mabi=altivec</samp> is used on the command line. </p> </dd> <dt> +<span>‘<samp class="samp">friz</samp>’<a class="copiable-link" href="#index-target_0028_0022friz_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-friz</samp>’</dt> <dd> +<p>Generate (do not generate) the <code class="code">friz</code> instruction when the <samp class="option">-funsafe-math-optimizations</samp> option is used to optimize rounding a floating-point value to 64-bit integer and back to floating point. The <code class="code">friz</code> instruction does not return the same value if the floating-point number is too large to fit in an integer. </p> </dd> <dt> +<span>‘<samp class="samp">avoid-indexed-addresses</samp>’<a class="copiable-link" href="#index-target_0028_0022avoid-indexed-addresses_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avoid-indexed-addresses</samp>’</dt> <dd> +<p>Generate code that tries to avoid (not avoid) the use of indexed load or store instructions. </p> </dd> <dt> +<span>‘<samp class="samp">paired</samp>’<a class="copiable-link" href="#index-target_0028_0022paired_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-paired</samp>’</dt> <dd> +<p>Generate code that uses (does not use) the generation of PAIRED simd instructions. </p> </dd> <dt> +<span>‘<samp class="samp">longcall</samp>’<a class="copiable-link" href="#index-target_0028_0022longcall_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-longcall</samp>’</dt> <dd> +<p>Generate code that assumes (does not assume) that all calls are far away so that a longer more expensive calling sequence is required. </p> </dd> <dt> +<span>‘<samp class="samp">cpu=<var class="var">CPU</var></samp>’<a class="copiable-link" href="#index-target_0028_0022cpu_003dCPU_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dd> +<p>Specify the architecture to generate code for when compiling the function. If you select the <code class="code">target("cpu=power7")</code> attribute when generating 32-bit code, VSX and AltiVec instructions are not generated unless you use the <samp class="option">-mabi=altivec</samp> option on the command line. </p> </dd> <dt> +<span>‘<samp class="samp">tune=<var class="var">TUNE</var></samp>’<a class="copiable-link" href="#index-target_0028_0022tune_003dTUNE_0022_0029-function-attribute_002c-PowerPC"> ¶</a></span> +</dt> <dd><p>Specify the architecture to tune for when compiling the function. If you do not specify the <code class="code">target("tune=<var class="var">TUNE</var>")</code> attribute and you do specify the <code class="code">target("cpu=<var class="var">CPU</var>")</code> attribute, compilation tunes for the <var class="var">CPU</var> architecture, and not the default tuning specified on the command line. </p></dd> </dl> <p>On the PowerPC, the inliner does not inline a function that has different target options than the caller, unless the callee has a subset of the target options of the caller. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="risc-v-function-attributes">RISC-V Function Attributes</a>, Previous: <a href="nvidia-ptx-function-attributes">Nvidia PTX Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-hardware-transactional-memory-built-in-functions.html b/devdocs/gcc~13/powerpc-hardware-transactional-memory-built-in-functions.html new file mode 100644 index 00000000..5c34ceb5 --- /dev/null +++ b/devdocs/gcc~13/powerpc-hardware-transactional-memory-built-in-functions.html @@ -0,0 +1,125 @@ +<div class="subsection-level-extent" id="PowerPC-Hardware-Transactional-Memory-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="powerpc-atomic-memory-operation-functions" accesskey="n" rel="next">PowerPC Atomic Memory Operation Functions</a>, Previous: <a href="powerpc-altivec_002fvsx-built-in-functions" accesskey="p" rel="prev">PowerPC AltiVec/VSX Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PowerPC-Hardware-Transactional-Memory-Built-in-Functions-1"><span>6.60.24 PowerPC Hardware Transactional Memory Built-in Functions<a class="copiable-link" href="#PowerPC-Hardware-Transactional-Memory-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC provides two interfaces for accessing the Hardware Transactional Memory (HTM) instructions available on some of the PowerPC family of processors (eg, POWER8). The two interfaces come in a low level interface, consisting of built-in functions specific to PowerPC and a higher level interface consisting of inline functions that are common between PowerPC and S/390. </p> <ul class="mini-toc"> <li><a href="#PowerPC-HTM-Low-Level-Built-in-Functions" accesskey="1">PowerPC HTM Low Level Built-in Functions</a></li> <li><a href="#PowerPC-HTM-High-Level-Inline-Functions" accesskey="2">PowerPC HTM High Level Inline Functions</a></li> </ul> <div class="subsubsection-level-extent" id="PowerPC-HTM-Low-Level-Built-in-Functions"> <h1 class="subsubsection"><span>6.60.24.1 PowerPC HTM Low Level Built-in Functions<a class="copiable-link" href="#PowerPC-HTM-Low-Level-Built-in-Functions"> ¶</a></span></h1> <p>The following low level built-in functions are available with <samp class="option">-mhtm</samp> or <samp class="option">-mcpu=CPU</samp> where CPU is ‘power8’ or later. They all generate the machine instruction that is part of the name. </p> <p>The HTM builtins (with the exception of <code class="code">__builtin_tbegin</code>) return the full 4-bit condition register value set by their associated hardware instruction. The header file <code class="code">htmintrin.h</code> defines some macros that can be used to decipher the return value. The <code class="code">__builtin_tbegin</code> builtin returns a simple <code class="code">true</code> or <code class="code">false</code> value depending on whether a transaction was successfully started or not. The arguments of the builtins match exactly the type and order of the associated hardware instruction’s operands, except for the <code class="code">__builtin_tcheck</code> builtin, which does not take any input arguments. Refer to the ISA manual for a description of each instruction’s operands. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_tbegin (unsigned int); +unsigned int __builtin_tend (unsigned int); + +unsigned int __builtin_tabort (unsigned int); +unsigned int __builtin_tabortdc (unsigned int, unsigned int, unsigned int); +unsigned int __builtin_tabortdci (unsigned int, unsigned int, int); +unsigned int __builtin_tabortwc (unsigned int, unsigned int, unsigned int); +unsigned int __builtin_tabortwci (unsigned int, unsigned int, int); + +unsigned int __builtin_tcheck (void); +unsigned int __builtin_treclaim (unsigned int); +unsigned int __builtin_trechkpt (void); +unsigned int __builtin_tsr (unsigned int);</pre> +</div> <p>In addition to the above HTM built-ins, we have added built-ins for some common extended mnemonics of the HTM instructions: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_tendall (void); +unsigned int __builtin_tresume (void); +unsigned int __builtin_tsuspend (void);</pre> +</div> <p>Note that the semantics of the above HTM builtins are required to mimic the locking semantics used for critical sections. Builtins that are used to create a new transaction or restart a suspended transaction must have lock acquisition like semantics while those builtins that end or suspend a transaction must have lock release like semantics. Specifically, this must mimic lock semantics as specified by C++11, for example: Lock acquisition is as-if an execution of __atomic_exchange_n(&globallock,1,__ATOMIC_ACQUIRE) that returns 0, and lock release is as-if an execution of __atomic_store(&globallock,0,__ATOMIC_RELEASE), with globallock being an implicit implementation-defined lock used for all transactions. The HTM instructions associated with with the builtins inherently provide the correct acquisition and release hardware barriers required. However, the compiler must also be prohibited from moving loads and stores across the builtins in a way that would violate their semantics. This has been accomplished by adding memory barriers to the associated HTM instructions (which is a conservative approach to provide acquire and release semantics). Earlier versions of the compiler did not treat the HTM instructions as memory barriers. A <code class="code">__TM_FENCE__</code> macro has been added, which can be used to determine whether the current compiler treats HTM instructions as memory barriers or not. This allows the user to explicitly add memory barriers to their code when using an older version of the compiler. </p> <p>The following set of built-in functions are available to gain access to the HTM specific special purpose registers. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned long __builtin_get_texasr (void); +unsigned long __builtin_get_texasru (void); +unsigned long __builtin_get_tfhar (void); +unsigned long __builtin_get_tfiar (void); + +void __builtin_set_texasr (unsigned long); +void __builtin_set_texasru (unsigned long); +void __builtin_set_tfhar (unsigned long); +void __builtin_set_tfiar (unsigned long);</pre> +</div> <p>Example usage of these low level built-in functions may look like: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <htmintrin.h> + +int num_retries = 10; + +while (1) + { + if (__builtin_tbegin (0)) + { + /* Transaction State Initiated. */ + if (is_locked (lock)) + __builtin_tabort (0); + ... transaction code... + __builtin_tend (0); + break; + } + else + { + /* Transaction State Failed. Use locks if the transaction + failure is "persistent" or we've tried too many times. */ + if (num_retries-- <= 0 + || _TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ())) + { + acquire_lock (lock); + ... non transactional fallback path... + release_lock (lock); + break; + } + } + }</pre> +</div> <p>One final built-in function has been added that returns the value of the 2-bit Transaction State field of the Machine Status Register (MSR) as stored in <code class="code">CR0</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned long __builtin_ttest (void)</pre> +</div> <p>This built-in can be used to determine the current transaction state using the following code example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <htmintrin.h> + +unsigned char tx_state = _HTM_STATE (__builtin_ttest ()); + +if (tx_state == _HTM_TRANSACTIONAL) + { + /* Code to use in transactional state. */ + } +else if (tx_state == _HTM_NONTRANSACTIONAL) + { + /* Code to use in non-transactional state. */ + } +else if (tx_state == _HTM_SUSPENDED) + { + /* Code to use in transaction suspended state. */ + }</pre> +</div> </div> <div class="subsubsection-level-extent" id="PowerPC-HTM-High-Level-Inline-Functions"> <h1 class="subsubsection"><span>6.60.24.2 PowerPC HTM High Level Inline Functions<a class="copiable-link" href="#PowerPC-HTM-High-Level-Inline-Functions"> ¶</a></span></h1> <p>The following high level HTM interface is made available by including <code class="code"><htmxlintrin.h></code> and using <samp class="option">-mhtm</samp> or <samp class="option">-mcpu=CPU</samp> where CPU is ‘power8’ or later. This interface is common between PowerPC and S/390, allowing users to write one HTM source implementation that can be compiled and executed on either system. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">long __TM_simple_begin (void); +long __TM_begin (void* const TM_buff); +long __TM_end (void); +void __TM_abort (void); +void __TM_named_abort (unsigned char const code); +void __TM_resume (void); +void __TM_suspend (void); + +long __TM_is_user_abort (void* const TM_buff); +long __TM_is_named_user_abort (void* const TM_buff, unsigned char *code); +long __TM_is_illegal (void* const TM_buff); +long __TM_is_footprint_exceeded (void* const TM_buff); +long __TM_nesting_depth (void* const TM_buff); +long __TM_is_nested_too_deep(void* const TM_buff); +long __TM_is_conflict(void* const TM_buff); +long __TM_is_failure_persistent(void* const TM_buff); +long __TM_failure_address(void* const TM_buff); +long long __TM_failure_code(void* const TM_buff);</pre> +</div> <p>Using these common set of HTM inline functions, we can create a more portable version of the HTM example in the previous section that will work on either PowerPC or S/390: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <htmxlintrin.h> + +int num_retries = 10; +TM_buff_type TM_buff; + +while (1) + { + if (__TM_begin (TM_buff) == _HTM_TBEGIN_STARTED) + { + /* Transaction State Initiated. */ + if (is_locked (lock)) + __TM_abort (); + ... transaction code... + __TM_end (); + break; + } + else + { + /* Transaction State Failed. Use locks if the transaction + failure is "persistent" or we've tried too many times. */ + if (num_retries-- <= 0 + || __TM_is_failure_persistent (TM_buff)) + { + acquire_lock (lock); + ... non transactional fallback path... + release_lock (lock); + break; + } + } + }</pre> +</div> </div> </div> <div class="nav-panel"> <p> Next: <a href="powerpc-atomic-memory-operation-functions">PowerPC Atomic Memory Operation Functions</a>, Previous: <a href="powerpc-altivec_002fvsx-built-in-functions">PowerPC AltiVec/VSX Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-matrix-multiply-assist-built-in-functions.html b/devdocs/gcc~13/powerpc-matrix-multiply-assist-built-in-functions.html new file mode 100644 index 00000000..8ae66660 --- /dev/null +++ b/devdocs/gcc~13/powerpc-matrix-multiply-assist-built-in-functions.html @@ -0,0 +1,88 @@ +<div class="subsection-level-extent" id="PowerPC-Matrix-Multiply-Assist-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="pru-built-in-functions" accesskey="n" rel="next">PRU Built-in Functions</a>, Previous: <a href="powerpc-atomic-memory-operation-functions" accesskey="p" rel="prev">PowerPC Atomic Memory Operation Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PowerPC-Matrix-Multiply-Assist-Built-in-Functions-1"><span>6.60.26 PowerPC Matrix-Multiply Assist Built-in Functions<a class="copiable-link" href="#PowerPC-Matrix-Multiply-Assist-Built-in-Functions-1"> ¶</a></span></h1> <p>ISA 3.1 of the PowerPC added new Matrix-Multiply Assist (MMA) instructions. GCC provides support for these instructions through the following built-in functions which are enabled with the <code class="code">-mmma</code> option. The vec_t type below is defined to be a normal vector unsigned char type. The uint2, uint4 and uint8 parameters are 2-bit, 4-bit and 8-bit unsigned integer constants respectively. The compiler will verify that they are constants and that their values are within range. </p> <p>The built-in functions supported are: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_mma_xvi4ger8 (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvi8ger4 (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvi16ger2 (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvi16ger2s (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf16ger2 (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvbf16ger2 (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf32ger (__vector_quad *, vec_t, vec_t); + +void __builtin_mma_xvi4ger8pp (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvi8ger4pp (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvi8ger4spp(__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvi16ger2pp (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvi16ger2spp (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf16ger2pp (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf16ger2pn (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf16ger2np (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf16ger2nn (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvbf16ger2pp (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvbf16ger2pn (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvbf16ger2np (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvbf16ger2nn (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf32gerpp (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf32gerpn (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf32gernp (__vector_quad *, vec_t, vec_t); +void __builtin_mma_xvf32gernn (__vector_quad *, vec_t, vec_t); + +void __builtin_mma_pmxvi4ger8 (__vector_quad *, vec_t, vec_t, uint4, uint4, uint8); +void __builtin_mma_pmxvi4ger8pp (__vector_quad *, vec_t, vec_t, uint4, uint4, uint8); + +void __builtin_mma_pmxvi8ger4 (__vector_quad *, vec_t, vec_t, uint4, uint4, uint4); +void __builtin_mma_pmxvi8ger4pp (__vector_quad *, vec_t, vec_t, uint4, uint4, uint4); +void __builtin_mma_pmxvi8ger4spp(__vector_quad *, vec_t, vec_t, uint4, uint4, uint4); + +void __builtin_mma_pmxvi16ger2 (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvi16ger2s (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvf16ger2 (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvbf16ger2 (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); + +void __builtin_mma_pmxvi16ger2pp (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvi16ger2spp (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvf16ger2pp (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvf16ger2pn (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvf16ger2np (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvf16ger2nn (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvbf16ger2pp (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvbf16ger2pn (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvbf16ger2np (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); +void __builtin_mma_pmxvbf16ger2nn (__vector_quad *, vec_t, vec_t, uint4, uint4, uint2); + +void __builtin_mma_pmxvf32ger (__vector_quad *, vec_t, vec_t, uint4, uint4); +void __builtin_mma_pmxvf32gerpp (__vector_quad *, vec_t, vec_t, uint4, uint4); +void __builtin_mma_pmxvf32gerpn (__vector_quad *, vec_t, vec_t, uint4, uint4); +void __builtin_mma_pmxvf32gernp (__vector_quad *, vec_t, vec_t, uint4, uint4); +void __builtin_mma_pmxvf32gernn (__vector_quad *, vec_t, vec_t, uint4, uint4); + +void __builtin_mma_xvf64ger (__vector_quad *, __vector_pair, vec_t); +void __builtin_mma_xvf64gerpp (__vector_quad *, __vector_pair, vec_t); +void __builtin_mma_xvf64gerpn (__vector_quad *, __vector_pair, vec_t); +void __builtin_mma_xvf64gernp (__vector_quad *, __vector_pair, vec_t); +void __builtin_mma_xvf64gernn (__vector_quad *, __vector_pair, vec_t); + +void __builtin_mma_pmxvf64ger (__vector_quad *, __vector_pair, vec_t, uint4, uint2); +void __builtin_mma_pmxvf64gerpp (__vector_quad *, __vector_pair, vec_t, uint4, uint2); +void __builtin_mma_pmxvf64gerpn (__vector_quad *, __vector_pair, vec_t, uint4, uint2); +void __builtin_mma_pmxvf64gernp (__vector_quad *, __vector_pair, vec_t, uint4, uint2); +void __builtin_mma_pmxvf64gernn (__vector_quad *, __vector_pair, vec_t, uint4, uint2); + +void __builtin_mma_xxmtacc (__vector_quad *); +void __builtin_mma_xxmfacc (__vector_quad *); +void __builtin_mma_xxsetaccz (__vector_quad *); + +void __builtin_mma_build_acc (__vector_quad *, vec_t, vec_t, vec_t, vec_t); +void __builtin_mma_disassemble_acc (void *, __vector_quad *); + +void __builtin_vsx_build_pair (__vector_pair *, vec_t, vec_t); +void __builtin_vsx_disassemble_pair (void *, __vector_pair *); + +vec_t __builtin_vsx_xvcvspbf16 (vec_t); +vec_t __builtin_vsx_xvcvbf16spn (vec_t); + +__vector_pair __builtin_vsx_lxvp (size_t, __vector_pair *); +void __builtin_vsx_stxvp (__vector_pair, size_t, __vector_pair *);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="pru-built-in-functions">PRU Built-in Functions</a>, Previous: <a href="powerpc-atomic-memory-operation-functions">PowerPC Atomic Memory Operation Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Matrix-Multiply-Assist-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Matrix-Multiply-Assist-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-options.html b/devdocs/gcc~13/powerpc-options.html new file mode 100644 index 00000000..e5a924db --- /dev/null +++ b/devdocs/gcc~13/powerpc-options.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="PowerPC-Options"> <div class="nav-panel"> <p> Next: <a href="pru-options" accesskey="n" rel="next">PRU Options</a>, Previous: <a href="pdp-11-options" accesskey="p" rel="prev">PDP-11 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PowerPC-Options-1"><span>3.19.38 PowerPC Options<a class="copiable-link" href="#PowerPC-Options-1"> ¶</a></span></h1> <p>These are listed under See <a class="xref" href="rs_002f6000-and-powerpc-options">IBM RS/6000 and PowerPC Options</a>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/powerpc-variable-attributes.html b/devdocs/gcc~13/powerpc-variable-attributes.html new file mode 100644 index 00000000..22a41f8b --- /dev/null +++ b/devdocs/gcc~13/powerpc-variable-attributes.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="PowerPC-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="rl78-variable-attributes" accesskey="n" rel="next">RL78 Variable Attributes</a>, Previous: <a href="nvidia-ptx-variable-attributes" accesskey="p" rel="prev">Nvidia PTX Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PowerPC-Variable-Attributes-1"><span>6.34.12 PowerPC Variable Attributes<a class="copiable-link" href="#PowerPC-Variable-Attributes-1"> ¶</a></span></h1> <p>Three attributes currently are defined for PowerPC configurations: <code class="code">altivec</code>, <code class="code">ms_struct</code> and <code class="code">gcc_struct</code>. </p> <p>For full documentation of the struct attributes please see the documentation in <a class="ref" href="variable-attributes">x86 Variable Attributes</a>. </p> <p>For documentation of <code class="code">altivec</code> attribute please see the documentation in <a class="ref" href="type-attributes">PowerPC Type Attributes</a>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PowerPC-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/pragmas.html b/devdocs/gcc~13/pragmas.html new file mode 100644 index 00000000..ff4422cf --- /dev/null +++ b/devdocs/gcc~13/pragmas.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Pragmas"> <div class="nav-panel"> <p> Next: <a href="unnamed-fields" accesskey="n" rel="next">Unnamed Structure and Union Fields</a>, Previous: <a href="target-format-checks" accesskey="p" rel="prev">Format Checks Specific to Particular Target Machines</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Pragmas-Accepted-by-GCC"><span>6.62 Pragmas Accepted by GCC<a class="copiable-link" href="#Pragmas-Accepted-by-GCC"> ¶</a></span></h1> <p>GCC supports several types of pragmas, primarily in order to compile code originally written for other compilers. Note that in general we do not recommend the use of pragmas; See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>, for further explanation. </p> <p>The GNU C preprocessor recognizes several pragmas in addition to the compiler pragmas documented here. Refer to the CPP manual for more information. </p> <ul class="mini-toc"> <li><a href="aarch64-pragmas" accesskey="1">AArch64 Pragmas</a></li> <li><a href="arm-pragmas" accesskey="2">ARM Pragmas</a></li> <li><a href="m32c-pragmas" accesskey="3">M32C Pragmas</a></li> <li><a href="pru-pragmas" accesskey="4">PRU Pragmas</a></li> <li><a href="rs_002f6000-and-powerpc-pragmas" accesskey="5">RS/6000 and PowerPC Pragmas</a></li> <li><a href="s_002f390-pragmas" accesskey="6">S/390 Pragmas</a></li> <li><a href="darwin-pragmas" accesskey="7">Darwin Pragmas</a></li> <li><a href="solaris-pragmas" accesskey="8">Solaris Pragmas</a></li> <li><a href="symbol-renaming-pragmas" accesskey="9">Symbol-Renaming Pragmas</a></li> <li><a href="structure-layout-pragmas">Structure-Layout Pragmas</a></li> <li><a href="weak-pragmas">Weak Pragmas</a></li> <li><a href="diagnostic-pragmas">Diagnostic Pragmas</a></li> <li><a href="visibility-pragmas">Visibility Pragmas</a></li> <li><a href="push_002fpop-macro-pragmas">Push/Pop Macro Pragmas</a></li> <li><a href="function-specific-option-pragmas">Function Specific Option Pragmas</a></li> <li><a href="loop-specific-pragmas">Loop-Specific Pragmas</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/precompiled-headers.html b/devdocs/gcc~13/precompiled-headers.html new file mode 100644 index 00000000..5f4cf0a6 --- /dev/null +++ b/devdocs/gcc~13/precompiled-headers.html @@ -0,0 +1,21 @@ +<div class="section-level-extent" id="Precompiled-Headers"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-modules" accesskey="n" rel="next">C++ Modules</a>, Previous: <a href="environment-variables" accesskey="p" rel="prev">Environment Variables Affecting GCC</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Using-Precompiled-Headers"><span>3.22 Using Precompiled Headers<a class="copiable-link" href="#Using-Precompiled-Headers"> ¶</a></span></h1> <p>Often large projects have many header files that are included in every source file. The time the compiler takes to process these header files over and over again can account for nearly all of the time required to build the project. To make builds faster, GCC allows you to <em class="dfn">precompile</em> a header file. </p> <p>To create a precompiled header file, simply compile it as you would any other file, if necessary using the <samp class="option">-x</samp> option to make the driver treat it as a C or C++ header file. You may want to use a tool like <code class="command">make</code> to keep the precompiled header up-to-date when the headers it contains change. </p> <p>A precompiled header file is searched for when <code class="code">#include</code> is seen in the compilation. As it searches for the included file (see <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html#Search-Path">Search Path</a> in The C Preprocessor) the compiler looks for a precompiled header in each directory just before it looks for the include file in that directory. The name searched for is the name specified in the <code class="code">#include</code> with ‘<samp class="samp">.gch</samp>’ appended. If the precompiled header file cannot be used, it is ignored. </p> <p>For instance, if you have <code class="code">#include "all.h"</code>, and you have <samp class="file">all.h.gch</samp> in the same directory as <samp class="file">all.h</samp>, then the precompiled header file is used if possible, and the original header is used otherwise. </p> <p>Alternatively, you might decide to put the precompiled header file in a directory and use <samp class="option">-I</samp> to ensure that directory is searched before (or instead of) the directory containing the original header. Then, if you want to check that the precompiled header file is always used, you can put a file of the same name as the original header in this directory containing an <code class="code">#error</code> command. </p> <p>This also works with <samp class="option">-include</samp>. So yet another way to use precompiled headers, good for projects not designed with precompiled header files in mind, is to simply take most of the header files used by a project, include them from another header file, precompile that header file, and <samp class="option">-include</samp> the precompiled header. If the header files have guards against multiple inclusion, they are skipped because they’ve already been included (in the precompiled header). </p> <p>If you need to precompile the same header file for different languages, targets, or compiler options, you can instead make a <em class="emph">directory</em> named like <samp class="file">all.h.gch</samp>, and put each precompiled header in the directory, perhaps using <samp class="option">-o</samp>. It doesn’t matter what you call the files in the directory; every precompiled header in the directory is considered. The first precompiled header encountered in the directory that is valid for this compilation is used; they’re searched in no particular order. </p> <p>There are many other possibilities, limited only by your imagination, good sense, and the constraints of your build system. </p> <p>A precompiled header file can be used only when these conditions apply: </p> <ul class="itemize mark-bullet"> <li>Only one precompiled header can be used in a particular compilation. </li> +<li>A precompiled header cannot be used once the first C token is seen. You can have preprocessor directives before a precompiled header; you cannot include a precompiled header from inside another header. </li> +<li>The precompiled header file must be produced for the same language as the current compilation. You cannot use a C precompiled header for a C++ compilation. </li> +<li>The precompiled header file must have been produced by the same compiler binary as the current compilation is using. </li> +<li>Any macros defined before the precompiled header is included must either be defined in the same way as when the precompiled header was generated, or must not affect the precompiled header, which usually means that they don’t appear in the precompiled header at all. <p>The <samp class="option">-D</samp> option is one way to define a macro before a precompiled header is included; using a <code class="code">#define</code> can also do it. There are also some options that define macros implicitly, like <samp class="option">-O</samp> and <samp class="option">-Wdeprecated</samp>; the same rule applies to macros defined this way. </p> </li> +<li>If debugging information is output when using the precompiled header, using <samp class="option">-g</samp> or similar, the same kind of debugging information must have been output when building the precompiled header. However, a precompiled header built using <samp class="option">-g</samp> can be used in a compilation when no debugging information is being output. </li> +<li>The same <samp class="option">-m</samp> options must generally be used when building and using the precompiled header. See <a class="xref" href="submodel-options">Machine-Dependent Options</a>, for any cases where this rule is relaxed. </li> +<li>Each of the following options must be the same when building and using the precompiled header: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fexceptions</pre> +</div> </li> +<li>Some other command-line options starting with <samp class="option">-f</samp>, <samp class="option">-p</samp>, or <samp class="option">-O</samp> must be defined in the same way as when the precompiled header was generated. At present, it’s not clear which options are safe to change and which are not; the safest choice is to use exactly the same options when generating and using the precompiled header. The following are known to be safe: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-fmessage-length= -fpreprocessed -fsched-interblock +-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous +-fsched-verbose=<var class="var">number</var> -fschedule-insns -fvisibility= +-pedantic-errors</pre> +</div> </li> +<li>Address space layout randomization (ASLR) can lead to not binary identical PCH files. If you rely on stable PCH file contents disable ASLR when generating PCH files. </li> +</ul> <p>For all of these except the last, the compiler automatically ignores the precompiled header if the conditions aren’t met. If you find an option combination that doesn’t work and doesn’t cause the precompiled header to be ignored, please consider filing a bug report, see <a class="ref" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Bugs.html">Reporting Bugs</a>. </p> <p>If you do use differing options when generating and using the precompiled header, the actual behavior is a mixture of the behavior for the options. For instance, if you use <samp class="option">-g</samp> to generate the precompiled header but not when using it, you may or may not get debugging information for routines in the precompiled header. </p> </div> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-modules">C++ Modules</a>, Previous: <a href="environment-variables">Environment Variables Affecting GCC</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Precompiled-Headers.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Precompiled-Headers.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/preprocessing-directives-implementation.html b/devdocs/gcc~13/preprocessing-directives-implementation.html new file mode 100644 index 00000000..24213566 --- /dev/null +++ b/devdocs/gcc~13/preprocessing-directives-implementation.html @@ -0,0 +1,17 @@ +<div class="section-level-extent" id="Preprocessing-directives-implementation"> <div class="nav-panel"> <p> Next: <a href="library-functions-implementation" accesskey="n" rel="next">Library Functions</a>, Previous: <a href="statements-implementation" accesskey="p" rel="prev">Statements</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Preprocessing-Directives"><span>4.13 Preprocessing Directives<a class="copiable-link" href="#Preprocessing-Directives"> ¶</a></span></h1> <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor, for details of these aspects of implementation-defined behavior. </p> <ul class="itemize mark-bullet"> <li>The locations within <code class="code">#pragma</code> directives where header name preprocessing tokens are recognized (C11 6.4, C11 6.4.7). </li> +<li>How sequences in both forms of header names are mapped to headers or external source file names (C90 6.1.7, C99 and C11 6.4.7). </li> +<li>Whether the value of a character constant in a constant expression that controls conditional inclusion matches the value of the same character constant in the execution character set (C90 6.8.1, C99 and C11 6.10.1). </li> +<li>Whether the value of a single-character character constant in a constant expression that controls conditional inclusion may have a negative value (C90 6.8.1, C99 and C11 6.10.1). </li> +<li>The places that are searched for an included ‘<samp class="samp"><></samp>’ delimited header, and how the places are specified or the header is identified (C90 6.8.2, C99 and C11 6.10.2). </li> +<li>How the named source file is searched for in an included ‘<samp class="samp">""</samp>’ delimited header (C90 6.8.2, C99 and C11 6.10.2). </li> +<li>The method by which preprocessing tokens (possibly resulting from macro expansion) in a <code class="code">#include</code> directive are combined into a header name (C90 6.8.2, C99 and C11 6.10.2). </li> +<li>The nesting limit for <code class="code">#include</code> processing (C90 6.8.2, C99 and C11 6.10.2). </li> +<li>Whether the ‘<samp class="samp">#</samp>’ operator inserts a ‘<samp class="samp">\</samp>’ character before the ‘<samp class="samp">\</samp>’ character that begins a universal character name in a character constant or string literal (C99 and C11 6.10.3.2). </li> +<li>The behavior on each recognized non-<code class="code">STDC #pragma</code> directive (C90 6.8.6, C99 and C11 6.10.6). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html#Pragmas">Pragmas</a> in The C Preprocessor, for details of pragmas accepted by GCC on all targets. See <a class="xref" href="pragmas">Pragmas Accepted by GCC</a>, for details of target-specific pragmas. </p> </li> +<li>The definitions for <code class="code">__DATE__</code> and <code class="code">__TIME__</code> when respectively, the date and time of translation are not available (C90 6.8.8, C99 6.10.8, C11 6.10.8.1). </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="library-functions-implementation">Library Functions</a>, Previous: <a href="statements-implementation">Statements</a>, Up: <a href="c-implementation">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Preprocessing-directives-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Preprocessing-directives-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/preprocessor-options.html b/devdocs/gcc~13/preprocessor-options.html new file mode 100644 index 00000000..98dad9ff --- /dev/null +++ b/devdocs/gcc~13/preprocessor-options.html @@ -0,0 +1,163 @@ +<div class="section-level-extent" id="Preprocessor-Options"> <div class="nav-panel"> <p> Next: <a href="assembler-options" accesskey="n" rel="next">Passing Options to the Assembler</a>, Previous: <a href="instrumentation-options" accesskey="p" rel="prev">Program Instrumentation Options</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-Controlling-the-Preprocessor"><span>3.13 Options Controlling the Preprocessor<a class="copiable-link" href="#Options-Controlling-the-Preprocessor"> ¶</a></span></h1> <p>These options control the C preprocessor, which is run on each C source file before actual compilation. </p> <p>If you use the <samp class="option">-E</samp> option, nothing is done except preprocessing. Some of these options make sense only together with <samp class="option">-E</samp> because they cause the preprocessor output to be unsuitable for actual compilation. </p> <p>In addition to the options listed here, there are a number of options to control search paths for include files documented in <a class="ref" href="directory-options">Options for Directory Search</a>. Options to control preprocessor diagnostics are listed in <a class="ref" href="warning-options">Options to Request or Suppress Warnings</a>. </p> <dl class="table"> <dt> +<span><code class="code">-D <var class="var">name</var></code><a class="copiable-link" href="#index-D-1"> ¶</a></span> +</dt> <dd> +<p>Predefine <var class="var">name</var> as a macro, with definition <code class="code">1</code>. </p> </dd> <dt><code class="code">-D <var class="var">name</var>=<var class="var">definition</var></code></dt> <dd> +<p>The contents of <var class="var">definition</var> are tokenized and processed as if they appeared during translation phase three in a ‘<samp class="samp">#define</samp>’ directive. In particular, the definition is truncated by embedded newline characters. </p> <p>If you are invoking the preprocessor from a shell or shell-like program you may need to use the shell’s quoting syntax to protect characters such as spaces that have a meaning in the shell syntax. </p> <p>If you wish to define a function-like macro on the command line, write its argument list with surrounding parentheses before the equals sign (if any). Parentheses are meaningful to most shells, so you should quote the option. With <code class="command">sh</code> and <code class="command">csh</code>, <samp class="option">-D'<var class="var">name</var>(<var class="var">args…</var>)=<var class="var">definition</var>'</samp> works. </p> <p><samp class="option">-D</samp> and <samp class="option">-U</samp> options are processed in the order they are given on the command line. All <samp class="option">-imacros <var class="var">file</var></samp> and <samp class="option">-include <var class="var">file</var></samp> options are processed after all <samp class="option">-D</samp> and <samp class="option">-U</samp> options. </p> </dd> <dt> +<span><code class="code">-U <var class="var">name</var></code><a class="copiable-link" href="#index-U"> ¶</a></span> +</dt> <dd> +<p>Cancel any previous definition of <var class="var">name</var>, either built in or provided with a <samp class="option">-D</samp> option. </p> </dd> <dt> +<span><code class="code">-include <var class="var">file</var></code><a class="copiable-link" href="#index-include"> ¶</a></span> +</dt> <dd> +<p>Process <var class="var">file</var> as if <code class="code">#include "file"</code> appeared as the first line of the primary source file. However, the first directory searched for <var class="var">file</var> is the preprocessor’s working directory <em class="emph">instead of</em> the directory containing the main source file. If not found there, it is searched for in the remainder of the <code class="code">#include "…"</code> search chain as normal. </p> <p>If multiple <samp class="option">-include</samp> options are given, the files are included in the order they appear on the command line. </p> </dd> <dt> +<span><code class="code">-imacros <var class="var">file</var></code><a class="copiable-link" href="#index-imacros"> ¶</a></span> +</dt> <dd> +<p>Exactly like <samp class="option">-include</samp>, except that any output produced by scanning <var class="var">file</var> is thrown away. Macros it defines remain defined. This allows you to acquire all the macros from a header without also processing its declarations. </p> <p>All files specified by <samp class="option">-imacros</samp> are processed before all files specified by <samp class="option">-include</samp>. </p> </dd> <dt> +<span><code class="code">-undef</code><a class="copiable-link" href="#index-undef"> ¶</a></span> +</dt> <dd> +<p>Do not predefine any system-specific or GCC-specific macros. The standard predefined macros remain defined. </p> </dd> <dt> +<span><code class="code">-pthread</code><a class="copiable-link" href="#index-pthread"> ¶</a></span> +</dt> <dd> +<p>Define additional macros required for using the POSIX threads library. You should use this option consistently for both compilation and linking. This option is supported on GNU/Linux targets, most other Unix derivatives, and also on x86 Cygwin and MinGW targets. </p> </dd> <dt> + <span><code class="code">-M</code><a class="copiable-link" href="#index-M"> ¶</a></span> +</dt> <dd> +<p>Instead of outputting the result of preprocessing, output a rule suitable for <code class="command">make</code> describing the dependencies of the main source file. The preprocessor outputs one <code class="command">make</code> rule containing the object file name for that source file, a colon, and the names of all the included files, including those coming from <samp class="option">-include</samp> or <samp class="option">-imacros</samp> command-line options. </p> <p>Unless specified explicitly (with <samp class="option">-MT</samp> or <samp class="option">-MQ</samp>), the object file name consists of the name of the source file with any suffix replaced with object file suffix and with any leading directory parts removed. If there are many included files then the rule is split into several lines using ‘<samp class="samp">\</samp>’-newline. The rule has no commands. </p> <p>This option does not suppress the preprocessor’s debug output, such as <samp class="option">-dM</samp>. To avoid mixing such debug output with the dependency rules you should explicitly specify the dependency output file with <samp class="option">-MF</samp>, or use an environment variable like <code class="env">DEPENDENCIES_OUTPUT</code> (see <a class="pxref" href="environment-variables">Environment Variables Affecting GCC</a>). Debug output is still sent to the regular output stream as normal. </p> <p>Passing <samp class="option">-M</samp> to the driver implies <samp class="option">-E</samp>, and suppresses warnings with an implicit <samp class="option">-w</samp>. </p> </dd> <dt> +<span><code class="code">-MM</code><a class="copiable-link" href="#index-MM"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-M</samp> but do not mention header files that are found in system header directories, nor header files that are included, directly or indirectly, from such a header. </p> <p>This implies that the choice of angle brackets or double quotes in an ‘<samp class="samp">#include</samp>’ directive does not in itself determine whether that header appears in <samp class="option">-MM</samp> dependency output. </p> +</dd> <dt> +<span><code class="code">-MF <var class="var">file</var></code><a class="copiable-link" href="#index-MF"> ¶</a></span> +</dt> <dd> +<p>When used with <samp class="option">-M</samp> or <samp class="option">-MM</samp>, specifies a file to write the dependencies to. If no <samp class="option">-MF</samp> switch is given the preprocessor sends the rules to the same place it would send preprocessed output. </p> <p>When used with the driver options <samp class="option">-MD</samp> or <samp class="option">-MMD</samp>, <samp class="option">-MF</samp> overrides the default dependency output file. </p> <p>If <var class="var">file</var> is <samp class="file">-</samp>, then the dependencies are written to <samp class="file">stdout</samp>. </p> </dd> <dt> +<span><code class="code">-MG</code><a class="copiable-link" href="#index-MG"> ¶</a></span> +</dt> <dd> +<p>In conjunction with an option such as <samp class="option">-M</samp> requesting dependency generation, <samp class="option">-MG</samp> assumes missing header files are generated files and adds them to the dependency list without raising an error. The dependency filename is taken directly from the <code class="code">#include</code> directive without prepending any path. <samp class="option">-MG</samp> also suppresses preprocessed output, as a missing header file renders this useless. </p> <p>This feature is used in automatic updating of makefiles. </p> </dd> <dt> +<span><code class="code">-Mno-modules</code><a class="copiable-link" href="#index-Mno-modules"> ¶</a></span> +</dt> <dd> +<p>Disable dependency generation for compiled module interfaces. </p> </dd> <dt> +<span><code class="code">-MP</code><a class="copiable-link" href="#index-MP"> ¶</a></span> +</dt> <dd> +<p>This option instructs CPP to add a phony target for each dependency other than the main file, causing each to depend on nothing. These dummy rules work around errors <code class="command">make</code> gives if you remove header files without updating the <samp class="file">Makefile</samp> to match. </p> <p>This is typical output: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">test.o: test.c test.h + +test.h:</pre> +</div> </dd> <dt> +<span><code class="code">-MT <var class="var">target</var></code><a class="copiable-link" href="#index-MT"> ¶</a></span> +</dt> <dd> <p>Change the target of the rule emitted by dependency generation. By default CPP takes the name of the main input file, deletes any directory components and any file suffix such as ‘<samp class="samp">.c</samp>’, and appends the platform’s usual object suffix. The result is the target. </p> <p>An <samp class="option">-MT</samp> option sets the target to be exactly the string you specify. If you want multiple targets, you can specify them as a single argument to <samp class="option">-MT</samp>, or use multiple <samp class="option">-MT</samp> options. </p> <p>For example, <samp class="option">-MT '$(objpfx)foo.o'</samp> might give </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$(objpfx)foo.o: foo.c</pre> +</div> </dd> <dt> +<span><code class="code">-MQ <var class="var">target</var></code><a class="copiable-link" href="#index-MQ"> ¶</a></span> +</dt> <dd> <p>Same as <samp class="option">-MT</samp>, but it quotes any characters which are special to Make. <samp class="option">-MQ '$(objpfx)foo.o'</samp> gives </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$$(objpfx)foo.o: foo.c</pre> +</div> <p>The default target is automatically quoted, as if it were given with <samp class="option">-MQ</samp>. </p> </dd> <dt> +<span><code class="code">-MD</code><a class="copiable-link" href="#index-MD"> ¶</a></span> +</dt> <dd> +<p><samp class="option">-MD</samp> is equivalent to <samp class="option">-M -MF <var class="var">file</var></samp>, except that <samp class="option">-E</samp> is not implied. The driver determines <var class="var">file</var> based on whether an <samp class="option">-o</samp> option is given. If it is, the driver uses its argument but with a suffix of <samp class="file">.d</samp>, otherwise it takes the name of the input file, removes any directory components and suffix, and applies a <samp class="file">.d</samp> suffix. </p> <p>If <samp class="option">-MD</samp> is used in conjunction with <samp class="option">-E</samp>, any <samp class="option">-o</samp> switch is understood to specify the dependency output file (see <a class="pxref" href="#dashMF">-MF</a>), but if used without <samp class="option">-E</samp>, each <samp class="option">-o</samp> is understood to specify a target object file. </p> <p>Since <samp class="option">-E</samp> is not implied, <samp class="option">-MD</samp> can be used to generate a dependency output file as a side effect of the compilation process. </p> </dd> <dt> +<span><code class="code">-MMD</code><a class="copiable-link" href="#index-MMD"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-MD</samp> except mention only user header files, not system header files. </p> </dd> <dt> +<span><code class="code">-fpreprocessed</code><a class="copiable-link" href="#index-fpreprocessed"> ¶</a></span> +</dt> <dd> +<p>Indicate to the preprocessor that the input file has already been preprocessed. This suppresses things like macro expansion, trigraph conversion, escaped newline splicing, and processing of most directives. The preprocessor still recognizes and removes comments, so that you can pass a file preprocessed with <samp class="option">-C</samp> to the compiler without problems. In this mode the integrated preprocessor is little more than a tokenizer for the front ends. </p> <p><samp class="option">-fpreprocessed</samp> is implicit if the input file has one of the extensions ‘<samp class="samp">.i</samp>’, ‘<samp class="samp">.ii</samp>’ or ‘<samp class="samp">.mi</samp>’. These are the extensions that GCC uses for preprocessed files created by <samp class="option">-save-temps</samp>. </p> </dd> <dt> +<span><code class="code">-fdirectives-only</code><a class="copiable-link" href="#index-fdirectives-only"> ¶</a></span> +</dt> <dd> +<p>When preprocessing, handle directives, but do not expand macros. </p> <p>The option’s behavior depends on the <samp class="option">-E</samp> and <samp class="option">-fpreprocessed</samp> options. </p> <p>With <samp class="option">-E</samp>, preprocessing is limited to the handling of directives such as <code class="code">#define</code>, <code class="code">#ifdef</code>, and <code class="code">#error</code>. Other preprocessor operations, such as macro expansion and trigraph conversion are not performed. In addition, the <samp class="option">-dD</samp> option is implicitly enabled. </p> <p>With <samp class="option">-fpreprocessed</samp>, predefinition of command line and most builtin macros is disabled. Macros such as <code class="code">__LINE__</code>, which are contextually dependent, are handled normally. This enables compilation of files previously preprocessed with <code class="code">-E -fdirectives-only</code>. </p> <p>With both <samp class="option">-E</samp> and <samp class="option">-fpreprocessed</samp>, the rules for <samp class="option">-fpreprocessed</samp> take precedence. This enables full preprocessing of files previously preprocessed with <code class="code">-E -fdirectives-only</code>. </p> </dd> <dt> +<span><code class="code">-fdollars-in-identifiers</code><a class="copiable-link" href="#index-fdollars-in-identifiers"> ¶</a></span> +</dt> <dd> +<p>Accept ‘<samp class="samp">$</samp>’ in identifiers. </p> </dd> <dt> +<span><code class="code">-fextended-identifiers</code><a class="copiable-link" href="#index-fextended-identifiers"> ¶</a></span> +</dt> <dd> +<p>Accept universal character names and extended characters in identifiers. This option is enabled by default for C99 (and later C standard versions) and C++. </p> </dd> <dt> +<span><code class="code">-fno-canonical-system-headers</code><a class="copiable-link" href="#index-fno-canonical-system-headers"> ¶</a></span> +</dt> <dd> +<p>When preprocessing, do not shorten system header paths with canonicalization. </p> </dd> <dt> +<span><code class="code">-fmax-include-depth=<var class="var">depth</var></code><a class="copiable-link" href="#index-fmax-include-depth"> ¶</a></span> +</dt> <dd> +<p>Set the maximum depth of the nested #include. The default is 200. </p> </dd> <dt> +<span><code class="code">-ftabstop=<var class="var">width</var></code><a class="copiable-link" href="#index-ftabstop"> ¶</a></span> +</dt> <dd> +<p>Set the distance between tab stops. This helps the preprocessor report correct column numbers in warnings or errors, even if tabs appear on the line. If the value is less than 1 or greater than 100, the option is ignored. The default is 8. </p> </dd> <dt> +<span><code class="code">-ftrack-macro-expansion<span class="r">[</span>=<var class="var">level</var><span class="r">]</span></code><a class="copiable-link" href="#index-ftrack-macro-expansion"> ¶</a></span> +</dt> <dd> +<p>Track locations of tokens across macro expansions. This allows the compiler to emit diagnostic about the current macro expansion stack when a compilation error occurs in a macro expansion. Using this option makes the preprocessor and the compiler consume more memory. The <var class="var">level</var> parameter can be used to choose the level of precision of token location tracking thus decreasing the memory consumption if necessary. Value ‘<samp class="samp">0</samp>’ of <var class="var">level</var> de-activates this option. Value ‘<samp class="samp">1</samp>’ tracks tokens locations in a degraded mode for the sake of minimal memory overhead. In this mode all tokens resulting from the expansion of an argument of a function-like macro have the same location. Value ‘<samp class="samp">2</samp>’ tracks tokens locations completely. This value is the most memory hungry. When this option is given no argument, the default parameter value is ‘<samp class="samp">2</samp>’. </p> <p>Note that <code class="code">-ftrack-macro-expansion=2</code> is activated by default. </p> </dd> <dt> +<span><code class="code">-fmacro-prefix-map=<var class="var">old</var>=<var class="var">new</var></code><a class="copiable-link" href="#index-fmacro-prefix-map"> ¶</a></span> +</dt> <dd> +<p>When preprocessing files residing in directory <samp class="file"><var class="var">old</var></samp>, expand the <code class="code">__FILE__</code> and <code class="code">__BASE_FILE__</code> macros as if the files resided in directory <samp class="file"><var class="var">new</var></samp> instead. This can be used to change an absolute path to a relative path by using <samp class="file">.</samp> for <var class="var">new</var> which can result in more reproducible builds that are location independent. This option also affects <code class="code">__builtin_FILE()</code> during compilation. See also <samp class="option">-ffile-prefix-map</samp> and <samp class="option">-fcanon-prefix-map</samp>. </p> </dd> <dt> + <span><code class="code">-fexec-charset=<var class="var">charset</var></code><a class="copiable-link" href="#index-fexec-charset"> ¶</a></span> +</dt> <dd> +<p>Set the execution character set, used for string and character constants. The default is UTF-8. <var class="var">charset</var> can be any encoding supported by the system’s <code class="code">iconv</code> library routine. </p> </dd> <dt> + <span><code class="code">-fwide-exec-charset=<var class="var">charset</var></code><a class="copiable-link" href="#index-fwide-exec-charset"> ¶</a></span> +</dt> <dd> +<p>Set the wide execution character set, used for wide string and character constants. The default is one of UTF-32BE, UTF-32LE, UTF-16BE, or UTF-16LE, whichever corresponds to the width of <code class="code">wchar_t</code> and the big-endian or little-endian byte order being used for code generation. As with <samp class="option">-fexec-charset</samp>, <var class="var">charset</var> can be any encoding supported by the system’s <code class="code">iconv</code> library routine; however, you will have problems with encodings that do not fit exactly in <code class="code">wchar_t</code>. </p> </dd> <dt> + <span><code class="code">-finput-charset=<var class="var">charset</var></code><a class="copiable-link" href="#index-finput-charset"> ¶</a></span> +</dt> <dd> +<p>Set the input character set, used for translation from the character set of the input file to the source character set used by GCC. If the locale does not specify, or GCC cannot get this information from the locale, the default is UTF-8. This can be overridden by either the locale or this command-line option. Currently the command-line option takes precedence if there’s a conflict. <var class="var">charset</var> can be any encoding supported by the system’s <code class="code">iconv</code> library routine. </p> </dd> <dt> +<span><code class="code">-fpch-deps</code><a class="copiable-link" href="#index-fpch-deps"> ¶</a></span> +</dt> <dd> +<p>When using precompiled headers (see <a class="pxref" href="precompiled-headers">Using Precompiled Headers</a>), this flag causes the dependency-output flags to also list the files from the precompiled header’s dependencies. If not specified, only the precompiled header are listed and not the files that were used to create it, because those files are not consulted when a precompiled header is used. </p> </dd> <dt> +<span><code class="code">-fpch-preprocess</code><a class="copiable-link" href="#index-fpch-preprocess"> ¶</a></span> +</dt> <dd> +<p>This option allows use of a precompiled header (see <a class="pxref" href="precompiled-headers">Using Precompiled Headers</a>) together with <samp class="option">-E</samp>. It inserts a special <code class="code">#pragma</code>, <code class="code">#pragma GCC pch_preprocess "<var class="var">filename</var>"</code> in the output to mark the place where the precompiled header was found, and its <var class="var">filename</var>. When <samp class="option">-fpreprocessed</samp> is in use, GCC recognizes this <code class="code">#pragma</code> and loads the PCH. </p> <p>This option is off by default, because the resulting preprocessed output is only really suitable as input to GCC. It is switched on by <samp class="option">-save-temps</samp>. </p> <p>You should not write this <code class="code">#pragma</code> in your own code, but it is safe to edit the filename if the PCH file is available in a different location. The filename may be absolute or it may be relative to GCC’s current directory. </p> </dd> <dt> + <span><code class="code">-fworking-directory</code><a class="copiable-link" href="#index-fworking-directory"> ¶</a></span> +</dt> <dd> +<p>Enable generation of linemarkers in the preprocessor output that let the compiler know the current working directory at the time of preprocessing. When this option is enabled, the preprocessor emits, after the initial linemarker, a second linemarker with the current working directory followed by two slashes. GCC uses this directory, when it’s present in the preprocessed input, as the directory emitted as the current working directory in some debugging information formats. This option is implicitly enabled if debugging information is enabled, but this can be inhibited with the negated form <samp class="option">-fno-working-directory</samp>. If the <samp class="option">-P</samp> flag is present in the command line, this option has no effect, since no <code class="code">#line</code> directives are emitted whatsoever. </p> </dd> <dt> +<span><code class="code">-A <var class="var">predicate</var>=<var class="var">answer</var></code><a class="copiable-link" href="#index-A"> ¶</a></span> +</dt> <dd> +<p>Make an assertion with the predicate <var class="var">predicate</var> and answer <var class="var">answer</var>. This form is preferred to the older form <samp class="option">-A <var class="var">predicate</var>(<var class="var">answer</var>)</samp>, which is still supported, because it does not use shell special characters. </p> </dd> <dt><code class="code">-A -<var class="var">predicate</var>=<var class="var">answer</var></code></dt> <dd> +<p>Cancel an assertion with the predicate <var class="var">predicate</var> and answer <var class="var">answer</var>. </p> </dd> <dt> +<span><code class="code">-C</code><a class="copiable-link" href="#index-C"> ¶</a></span> +</dt> <dd> +<p>Do not discard comments. All comments are passed through to the output file, except for comments in processed directives, which are deleted along with the directive. </p> <p>You should be prepared for side effects when using <samp class="option">-C</samp>; it causes the preprocessor to treat comments as tokens in their own right. For example, comments appearing at the start of what would be a directive line have the effect of turning that line into an ordinary source line, since the first token on the line is no longer a ‘<samp class="samp">#</samp>’. </p> </dd> <dt> +<span><code class="code">-CC</code><a class="copiable-link" href="#index-CC"> ¶</a></span> +</dt> <dd> +<p>Do not discard comments, including during macro expansion. This is like <samp class="option">-C</samp>, except that comments contained within macros are also passed through to the output file where the macro is expanded. </p> <p>In addition to the side effects of the <samp class="option">-C</samp> option, the <samp class="option">-CC</samp> option causes all C++-style comments inside a macro to be converted to C-style comments. This is to prevent later use of that macro from inadvertently commenting out the remainder of the source line. </p> <p>The <samp class="option">-CC</samp> option is generally used to support lint comments. </p> </dd> <dt> +<span><code class="code">-P</code><a class="copiable-link" href="#index-P"> ¶</a></span> +</dt> <dd> +<p>Inhibit generation of linemarkers in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code, and will be sent to a program which might be confused by the linemarkers. </p> </dd> <dt> + <span><code class="code">-traditional</code><a class="copiable-link" href="#index-traditional-C-language"> ¶</a></span> +</dt> <dt><code class="code">-traditional-cpp</code></dt> <dd> <p>Try to imitate the behavior of pre-standard C preprocessors, as opposed to ISO C preprocessors. See the GNU CPP manual for details. </p> <p>Note that GCC does not otherwise attempt to emulate a pre-standard C compiler, and these options are only supported with the <samp class="option">-E</samp> switch, or when invoking CPP explicitly. </p> </dd> <dt> +<span><code class="code">-trigraphs</code><a class="copiable-link" href="#index-trigraphs"> ¶</a></span> +</dt> <dd> +<p>Support ISO C trigraphs. These are three-character sequences, all starting with ‘<samp class="samp">??</samp>’, that are defined by ISO C to stand for single characters. For example, ‘<samp class="samp">??/</samp>’ stands for ‘<samp class="samp">\</samp>’, so ‘<samp class="samp">'??/n'</samp>’ is a character constant for a newline. </p> <p>The nine trigraphs and their replacements are </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??- +Replacement: [ ] { } # \ ^ | ~</pre> +</div> <p>By default, GCC ignores trigraphs, but in standard-conforming modes it converts them. See the <samp class="option">-std</samp> and <samp class="option">-ansi</samp> options. </p> </dd> <dt> +<span><code class="code">-remap</code><a class="copiable-link" href="#index-remap"> ¶</a></span> +</dt> <dd> +<p>Enable special code to work around file systems which only permit very short file names, such as MS-DOS. </p> </dd> <dt> +<span><code class="code">-H</code><a class="copiable-link" href="#index-H"> ¶</a></span> +</dt> <dd> +<p>Print the name of each header file used, in addition to other normal activities. Each name is indented to show how deep in the ‘<samp class="samp">#include</samp>’ stack it is. Precompiled header files are also printed, even if they are found to be invalid; an invalid precompiled header file is printed with ‘<samp class="samp">...x</samp>’ and a valid one with ‘<samp class="samp">...!</samp>’ . </p> </dd> <dt> +<span><code class="code">-d<var class="var">letters</var></code><a class="copiable-link" href="#index-d"> ¶</a></span> +</dt> <dd> +<p>Says to make debugging dumps during compilation as specified by <var class="var">letters</var>. The flags documented here are those relevant to the preprocessor. Other <var class="var">letters</var> are interpreted by the compiler proper, or reserved for future versions of GCC, and so are silently ignored. If you specify <var class="var">letters</var> whose behavior conflicts, the result is undefined. See <a class="xref" href="developer-options">GCC Developer Options</a>, for more information. </p> <dl class="table"> <dt> +<span><code class="code">-dM</code><a class="copiable-link" href="#index-dM"> ¶</a></span> +</dt> <dd> +<p>Instead of the normal output, generate a list of ‘<samp class="samp">#define</samp>’ directives for all the macros defined during the execution of the preprocessor, including predefined macros. This gives you a way of finding out what is predefined in your version of the preprocessor. Assuming you have no file <samp class="file">foo.h</samp>, the command </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">touch foo.h; cpp -dM foo.h</pre> +</div> <p>shows all the predefined macros. </p> <p>If you use <samp class="option">-dM</samp> without the <samp class="option">-E</samp> option, <samp class="option">-dM</samp> is interpreted as a synonym for <samp class="option">-fdump-rtl-mach</samp>. See <a data-manual="gcc" href="https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html#Developer-Options">(gcc)Developer Options</a>. </p> </dd> <dt> +<span><code class="code">-dD</code><a class="copiable-link" href="#index-dD"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-dM</samp> except in two respects: it does <em class="emph">not</em> include the predefined macros, and it outputs <em class="emph">both</em> the ‘<samp class="samp">#define</samp>’ directives and the result of preprocessing. Both kinds of output go to the standard output file. </p> </dd> <dt> +<span><code class="code">-dN</code><a class="copiable-link" href="#index-dN"> ¶</a></span> +</dt> <dd> +<p>Like <samp class="option">-dD</samp>, but emit only the macro names, not their expansions. </p> </dd> <dt> +<span><code class="code">-dI</code><a class="copiable-link" href="#index-dI"> ¶</a></span> +</dt> <dd> +<p>Output ‘<samp class="samp">#include</samp>’ directives in addition to the result of preprocessing. </p> </dd> <dt> +<span><code class="code">-dU</code><a class="copiable-link" href="#index-dU"> ¶</a></span> +</dt> <dd><p>Like <samp class="option">-dD</samp> except that only macros that are expanded, or whose definedness is tested in preprocessor directives, are output; the output is delayed until the use or test of the macro; and ‘<samp class="samp">#undef</samp>’ directives are also output for macros tested but undefined at the time. </p></dd> </dl> </dd> <dt> +<span><code class="code">-fdebug-cpp</code><a class="copiable-link" href="#index-fdebug-cpp"> ¶</a></span> +</dt> <dd> +<p>This option is only useful for debugging GCC. When used from CPP or with <samp class="option">-E</samp>, it dumps debugging information about location maps. Every token in the output is preceded by the dump of the map its location belongs to. </p> <p>When used from GCC without <samp class="option">-E</samp>, this option has no effect. </p> </dd> <dt> +<span><code class="code">-Wp,<var class="var">option</var></code><a class="copiable-link" href="#index-Wp"> ¶</a></span> +</dt> <dd> +<p>You can use <samp class="option">-Wp,<var class="var">option</var></samp> to bypass the compiler driver and pass <var class="var">option</var> directly through to the preprocessor. If <var class="var">option</var> contains commas, it is split into multiple options at the commas. However, many options are modified, translated or interpreted by the compiler driver before being passed to the preprocessor, and <samp class="option">-Wp</samp> forcibly bypasses this phase. The preprocessor’s direct interface is undocumented and subject to change, so whenever possible you should avoid using <samp class="option">-Wp</samp> and let the driver handle the options instead. </p> </dd> <dt> +<span><code class="code">-Xpreprocessor <var class="var">option</var></code><a class="copiable-link" href="#index-Xpreprocessor"> ¶</a></span> +</dt> <dd> +<p>Pass <var class="var">option</var> as an option to the preprocessor. You can use this to supply system-specific preprocessor options that GCC does not recognize. </p> <p>If you want to pass an option that takes an argument, you must use <samp class="option">-Xpreprocessor</samp> twice, once for the option and once for the argument. </p> </dd> <dt> +<span><code class="code">-no-integrated-cpp</code><a class="copiable-link" href="#index-no-integrated-cpp"> ¶</a></span> +</dt> <dd> +<p>Perform preprocessing as a separate pass before compilation. By default, GCC performs preprocessing as an integrated part of input tokenization and parsing. If this option is provided, the appropriate language front end (<code class="command">cc1</code>, <code class="command">cc1plus</code>, or <code class="command">cc1obj</code> for C, C++, and Objective-C, respectively) is instead invoked twice, once for preprocessing only and once for actual compilation of the preprocessed input. This option may be useful in conjunction with the <samp class="option">-B</samp> or <samp class="option">-wrapper</samp> options to specify an alternate preprocessor or perform additional processing of the program source between normal preprocessing and compilation. </p> </dd> <dt> +<span><code class="code">-flarge-source-files</code><a class="copiable-link" href="#index-flarge-source-files"> ¶</a></span> +</dt> <dd> +<p>Adjust GCC to expect large source files, at the expense of slower compilation and higher memory usage. </p> <p>Specifically, GCC normally tracks both column numbers and line numbers within source files and it normally prints both of these numbers in diagnostics. However, once it has processed a certain number of source lines, it stops tracking column numbers and only tracks line numbers. This means that diagnostics for later lines do not include column numbers. It also means that options like <samp class="option">-Wmisleading-indentation</samp> cease to work at that point, although the compiler prints a note if this happens. Passing <samp class="option">-flarge-source-files</samp> significantly increases the number of source lines that GCC can process before it stops tracking columns. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="assembler-options">Passing Options to the Assembler</a>, Previous: <a href="instrumentation-options">Program Instrumentation Options</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Preprocessor-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Preprocessor-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/pru-built-in-functions.html b/devdocs/gcc~13/pru-built-in-functions.html new file mode 100644 index 00000000..cbf046d0 --- /dev/null +++ b/devdocs/gcc~13/pru-built-in-functions.html @@ -0,0 +1,15 @@ +<div class="subsection-level-extent" id="PRU-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="risc-v-built-in-functions" accesskey="n" rel="next">RISC-V Built-in Functions</a>, Previous: <a href="powerpc-matrix-multiply-assist-built-in-functions" accesskey="p" rel="prev">PowerPC Matrix-Multiply Assist Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PRU-Built-in-Functions-1"><span>6.60.27 PRU Built-in Functions<a class="copiable-link" href="#PRU-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC provides a couple of special builtin functions to aid in utilizing special PRU instructions. </p> <p>The built-in functions supported are: </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fdelay_005fcycles"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__delay_cycles</strong> <code class="def-code-arguments">(constant long long <var class="var">cycles</var>)</code><a class="copiable-link" href="#index-_005f_005fdelay_005fcycles"> ¶</a></span> +</dt> <dd><p>This inserts an instruction sequence that takes exactly <var class="var">cycles</var> cycles (between 0 and 0xffffffff) to complete. The inserted sequence may use jumps, loops, or no-ops, and does not interfere with any other instructions. Note that <var class="var">cycles</var> must be a compile-time constant integer - that is, you must pass a number, not a variable that may be optimized to a constant later. The number of cycles delayed by this builtin is exact. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fhalt"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__halt</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fhalt"> ¶</a></span> +</dt> <dd><p>This inserts a HALT instruction to stop processor execution. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005flmbd"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">__lmbd</strong> <code class="def-code-arguments">(unsigned int <var class="var">wordval</var>, unsigned int <var class="var">bitval</var>)</code><a class="copiable-link" href="#index-_005f_005flmbd"> ¶</a></span> +</dt> <dd><p>This inserts LMBD instruction to calculate the left-most bit with value <var class="var">bitval</var> in value <var class="var">wordval</var>. Only the least significant bit of <var class="var">bitval</var> is taken into account. </p></dd> +</dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PRU-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PRU-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/pru-options.html b/devdocs/gcc~13/pru-options.html new file mode 100644 index 00000000..6e1868ab --- /dev/null +++ b/devdocs/gcc~13/pru-options.html @@ -0,0 +1,23 @@ +<div class="subsection-level-extent" id="PRU-Options"> <div class="nav-panel"> <p> Next: <a href="risc-v-options" accesskey="n" rel="next">RISC-V Options</a>, Previous: <a href="powerpc-options" accesskey="p" rel="prev">PowerPC Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PRU-Options-1"><span>3.19.39 PRU Options<a class="copiable-link" href="#PRU-Options-1"> ¶</a></span></h1> <p>These command-line options are defined for PRU target: </p> <dl class="table"> <dt> +<span><code class="code">-minrt</code><a class="copiable-link" href="#index-minrt-1"> ¶</a></span> +</dt> <dd> +<p>Link with a minimum runtime environment, with no support for static initializers and constructors. Using this option can significantly reduce the size of the final ELF binary. Beware that the compiler could still generate code with static initializers and constructors. It is up to the programmer to ensure that the source program will not use those features. </p> </dd> <dt> +<span><code class="code">-mmcu=<var class="var">mcu</var></code><a class="copiable-link" href="#index-mmcu-2"> ¶</a></span> +</dt> <dd> +<p>Specify the PRU MCU variant to use. Check Newlib for the exact list of supported MCUs. </p> </dd> <dt> +<span><code class="code">-mno-relax</code><a class="copiable-link" href="#index-mno-relax"> ¶</a></span> +</dt> <dd> +<p>Make GCC pass the <samp class="option">--no-relax</samp> command-line option to the linker instead of the <samp class="option">--relax</samp> option. </p> </dd> <dt> +<span><code class="code">-mloop</code><a class="copiable-link" href="#index-mloop"> ¶</a></span> +</dt> <dd> +<p>Allow (or do not allow) GCC to use the LOOP instruction. </p> </dd> <dt> +<span><code class="code">-mabi=<var class="var">variant</var></code><a class="copiable-link" href="#index-mabi-3"> ¶</a></span> +</dt> <dd> +<p>Specify the ABI variant to output code for. <samp class="option">-mabi=ti</samp> selects the unmodified TI ABI while <samp class="option">-mabi=gnu</samp> selects a GNU variant that copes more naturally with certain GCC assumptions. These are the differences: </p> <dl class="table"> <dt>‘<samp class="samp">Function Pointer Size</samp>’</dt> <dd> +<p>TI ABI specifies that function (code) pointers are 16-bit, whereas GNU supports only 32-bit data and code pointers. </p> </dd> <dt>‘<samp class="samp">Optional Return Value Pointer</samp>’</dt> <dd> +<p>Function return values larger than 64 bits are passed by using a hidden pointer as the first argument of the function. TI ABI, though, mandates that the pointer can be NULL in case the caller is not using the returned value. GNU always passes and expects a valid return value pointer. </p> </dd> </dl> <p>The current <samp class="option">-mabi=ti</samp> implementation simply raises a compile error when any of the above code constructs is detected. As a consequence the standard C library cannot be built and it is omitted when linking with <samp class="option">-mabi=ti</samp>. </p> <p>Relaxation is a GNU feature and for safety reasons is disabled when using <samp class="option">-mabi=ti</samp>. The TI toolchain does not emit relocations for QBBx instructions, so the GNU linker cannot adjust them when shortening adjacent LDI32 pseudo instructions. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="risc-v-options">RISC-V Options</a>, Previous: <a href="powerpc-options">PowerPC Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PRU-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PRU-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/pru-pragmas.html b/devdocs/gcc~13/pru-pragmas.html new file mode 100644 index 00000000..adf7b2a3 --- /dev/null +++ b/devdocs/gcc~13/pru-pragmas.html @@ -0,0 +1,12 @@ +<div class="subsection-level-extent" id="PRU-Pragmas"> <div class="nav-panel"> <p> Next: <a href="rs_002f6000-and-powerpc-pragmas" accesskey="n" rel="next">RS/6000 and PowerPC Pragmas</a>, Previous: <a href="m32c-pragmas" accesskey="p" rel="prev">M32C Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="PRU-Pragmas-1"><span>6.62.4 PRU Pragmas<a class="copiable-link" href="#PRU-Pragmas-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">ctable_entry <var class="var">index</var> <var class="var">constant_address</var></code><a class="copiable-link" href="#index-pragma_002c-ctable_005fentry"> ¶</a></span> +</dt> <dd> +<p>Specifies that the PRU CTABLE entry given by <var class="var">index</var> has the value <var class="var">constant_address</var>. This enables GCC to emit LBCO/SBCO instructions when the load/store address is known and can be addressed with some CTABLE entry. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">/* will compile to "sbco Rx, 2, 0x10, 4" */ +#pragma ctable_entry 2 0x4802a000 +*(unsigned int *)0x4802a010 = val;</pre> +</div> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PRU-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/PRU-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/push_002fpop-macro-pragmas.html b/devdocs/gcc~13/push_002fpop-macro-pragmas.html new file mode 100644 index 00000000..6b48387a --- /dev/null +++ b/devdocs/gcc~13/push_002fpop-macro-pragmas.html @@ -0,0 +1,18 @@ +<div class="subsection-level-extent" id="Push_002fPop-Macro-Pragmas"> <div class="nav-panel"> <p> Next: <a href="function-specific-option-pragmas" accesskey="n" rel="next">Function Specific Option Pragmas</a>, Previous: <a href="visibility-pragmas" accesskey="p" rel="prev">Visibility Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Push_002fPop-Macro-Pragmas-1"><span>6.62.14 Push/Pop Macro Pragmas<a class="copiable-link" href="#Push_002fPop-Macro-Pragmas-1"> ¶</a></span></h1> <p>For compatibility with Microsoft Windows compilers, GCC supports ‘<samp class="samp">#pragma push_macro(<var class="var">"macro_name"</var>)</samp>’ and ‘<samp class="samp">#pragma pop_macro(<var class="var">"macro_name"</var>)</samp>’. </p> <dl class="table"> <dt> +<span><code class="code">#pragma push_macro(<var class="var">"macro_name"</var>)</code><a class="copiable-link" href="#index-pragma_002c-push_005fmacro"> ¶</a></span> +</dt> <dd> +<p>This pragma saves the value of the macro named as <var class="var">macro_name</var> to the top of the stack for this macro. </p> </dd> <dt> +<span><code class="code">#pragma pop_macro(<var class="var">"macro_name"</var>)</code><a class="copiable-link" href="#index-pragma_002c-pop_005fmacro"> ¶</a></span> +</dt> <dd><p>This pragma sets the value of the macro named as <var class="var">macro_name</var> to the value on top of the stack for this macro. If the stack for <var class="var">macro_name</var> is empty, the value of the macro remains unchanged. </p></dd> </dl> <p>For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define X 1 +#pragma push_macro("X") +#undef X +#define X -1 +#pragma pop_macro("X") +int x [X];</pre> +</div> <p>In this example, the definition of X as 1 is saved by <code class="code">#pragma +push_macro</code> and restored by <code class="code">#pragma pop_macro</code>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Push_002fPop-Macro-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Push_002fPop-Macro-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/qualifiers-implementation.html b/devdocs/gcc~13/qualifiers-implementation.html new file mode 100644 index 00000000..971c61b3 --- /dev/null +++ b/devdocs/gcc~13/qualifiers-implementation.html @@ -0,0 +1,12 @@ +<div class="section-level-extent" id="Qualifiers-implementation"> <div class="nav-panel"> <p> Next: <a href="declarators-implementation" accesskey="n" rel="next">Declarators</a>, Previous: <a href="structures-unions-enumerations-and-bit-fields-implementation" accesskey="p" rel="prev">Structures, Unions, Enumerations, and Bit-Fields</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Qualifiers"><span>4.10 Qualifiers<a class="copiable-link" href="#Qualifiers"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>What constitutes an access to an object that has volatile-qualified type (C90 6.5.3, C99 and C11 6.7.3). <p>Such an object is normally accessed by pointers and used for accessing hardware. In most expressions, it is intuitively obvious what is a read and what is a write. For example </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">volatile int *dst = <var class="var">somevalue</var>; +volatile int *src = <var class="var">someothervalue</var>; +*dst = *src;</pre> +</div> <p>will cause a read of the volatile object pointed to by <var class="var">src</var> and store the value into the volatile object pointed to by <var class="var">dst</var>. There is no guarantee that these reads and writes are atomic, especially for objects larger than <code class="code">int</code>. </p> <p>However, if the volatile storage is not being modified, and the value of the volatile storage is not used, then the situation is less obvious. For example </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">volatile int *src = <var class="var">somevalue</var>; +*src;</pre> +</div> <p>According to the C standard, such an expression is an rvalue whose type is the unqualified version of its original type, i.e. <code class="code">int</code>. Whether GCC interprets this as a read of the volatile object being pointed to or only as a request to evaluate the expression for its side effects depends on this type. </p> <p>If it is a scalar type, or on most targets an aggregate type whose only member object is of a scalar type, or a union type whose member objects are of scalar types, the expression is interpreted by GCC as a read of the volatile object; in the other cases, the expression is only evaluated for its side effects. </p> <p>When an object of an aggregate type, with the same size and alignment as a scalar type <code class="code">S</code>, is the subject of a volatile access by an assignment expression or an atomic function, the access to it is performed as if the object’s declared type were <code class="code">volatile S</code>. </p> </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="declarators-implementation">Declarators</a>, Previous: <a href="structures-unions-enumerations-and-bit-fields-implementation">Structures, Unions, Enumerations, and Bit-Fields</a>, Up: <a href="c-implementation">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Qualifiers-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Qualifiers-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/raw-read_002fwrite-functions.html b/devdocs/gcc~13/raw-read_002fwrite-functions.html new file mode 100644 index 00000000..0b32ab21 --- /dev/null +++ b/devdocs/gcc~13/raw-read_002fwrite-functions.html @@ -0,0 +1,6 @@ +<div class="subsubsection-level-extent" id="Raw-read_002fwrite-Functions"> <div class="nav-panel"> <p> Next: <a href="other-built-in-functions" accesskey="n" rel="next">Other Built-in Functions</a>, Previous: <a href="directly-mapped-media-functions" accesskey="p" rel="prev">Directly-Mapped Media Functions</a>, Up: <a href="fr-v-built-in-functions" accesskey="u" rel="up">FR-V Built-in Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection" id="Raw-Read_002fWrite-Functions"><span>6.60.13.4 Raw Read/Write Functions<a class="copiable-link" href="#Raw-Read_002fWrite-Functions"> ¶</a></span></h1> <p>This sections describes built-in functions related to read and write instructions to access memory. These functions generate <code class="code">membar</code> instructions to flush the I/O load and stores where appropriate, as described in Fujitsu’s manual described above. </p> <dl class="table"> <dt><code class="code">unsigned char __builtin_read8 (void *<var class="var">data</var>)</code></dt> <dt><code class="code">unsigned short __builtin_read16 (void *<var class="var">data</var>)</code></dt> <dt><code class="code">unsigned long __builtin_read32 (void *<var class="var">data</var>)</code></dt> <dt><code class="code">unsigned long long __builtin_read64 (void *<var class="var">data</var>)</code></dt> <dt><code class="code">void __builtin_write8 (void *<var class="var">data</var>, unsigned char <var class="var">datum</var>)</code></dt> <dt><code class="code">void __builtin_write16 (void *<var class="var">data</var>, unsigned short <var class="var">datum</var>)</code></dt> <dt><code class="code">void __builtin_write32 (void *<var class="var">data</var>, unsigned long <var class="var">datum</var>)</code></dt> <dt><code class="code">void __builtin_write64 (void *<var class="var">data</var>, unsigned long long <var class="var">datum</var>)</code></dt> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Raw-read_002fwrite-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Raw-read_002fwrite-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/restricted-pointers.html b/devdocs/gcc~13/restricted-pointers.html new file mode 100644 index 00000000..93dff916 --- /dev/null +++ b/devdocs/gcc~13/restricted-pointers.html @@ -0,0 +1,14 @@ +<div class="section-level-extent" id="Restricted-Pointers"> <div class="nav-panel"> <p> Next: <a href="vague-linkage" accesskey="n" rel="next">Vague Linkage</a>, Previous: <a href="c_002b_002b-volatiles" accesskey="p" rel="prev">When is a Volatile C++ Object Accessed?</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Restricting-Pointer-Aliasing"><span>7.2 Restricting Pointer Aliasing<a class="copiable-link" href="#Restricting-Pointer-Aliasing"> ¶</a></span></h1> <p>As with the C front end, G++ understands the C99 feature of restricted pointers, specified with the <code class="code">__restrict__</code>, or <code class="code">__restrict</code> type qualifier. Because you cannot compile C++ by specifying the <samp class="option">-std=c99</samp> language flag, <code class="code">restrict</code> is not a keyword in C++. </p> <p>In addition to allowing restricted pointers, you can specify restricted references, which indicate that the reference is not aliased in the local context. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void fn (int *__restrict__ rptr, int &__restrict__ rref) +{ + /* <span class="r">…</span> */ +}</pre> +</div> <p>In the body of <code class="code">fn</code>, <var class="var">rptr</var> points to an unaliased integer and <var class="var">rref</var> refers to a (different) unaliased integer. </p> <p>You may also specify whether a member function’s <var class="var">this</var> pointer is unaliased by using <code class="code">__restrict__</code> as a member function qualifier. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void T::fn () __restrict__ +{ + /* <span class="r">…</span> */ +}</pre> +</div> <p>Within the body of <code class="code">T::fn</code>, <var class="var">this</var> has the effective definition <code class="code">T *__restrict__ const this</code>. Notice that the interpretation of a <code class="code">__restrict__</code> member function qualifier is different to that of <code class="code">const</code> or <code class="code">volatile</code> qualifier, in that it is applied to the pointer rather than the object. This is consistent with other compilers that implement restricted pointers. </p> <p>As with all outermost parameter qualifiers, <code class="code">__restrict__</code> is ignored in function definition matching. This means you only need to specify <code class="code">__restrict__</code> in a function definition, rather than in a function prototype as well. </p> </div> <div class="nav-panel"> <p> Next: <a href="vague-linkage">Vague Linkage</a>, Previous: <a href="c_002b_002b-volatiles">When is a Volatile C++ Object Accessed?</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Restricted-Pointers.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Restricted-Pointers.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/return-address.html b/devdocs/gcc~13/return-address.html new file mode 100644 index 00000000..43d5a5aa --- /dev/null +++ b/devdocs/gcc~13/return-address.html @@ -0,0 +1,26 @@ +<div class="section-level-extent" id="Return-Address"> <div class="nav-panel"> <p> Next: <a href="vector-extensions" accesskey="n" rel="next">Using Vector Instructions through Built-in Functions</a>, Previous: <a href="function-names" accesskey="p" rel="prev">Function Names as Strings</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Getting-the-Return-or-Frame-Address-of-a-Function"><span>6.51 Getting the Return or Frame Address of a Function<a class="copiable-link" href="#Getting-the-Return-or-Frame-Address-of-a-Function"> ¶</a></span></h1> <p>These functions may be used to get information about the callers of a function. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005freturn_005faddress"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_return_address</strong> <code class="def-code-arguments">(unsigned int <var class="var">level</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005freturn_005faddress"> ¶</a></span> +</dt> <dd> +<p>This function returns the return address of the current function, or of one of its callers. The <var class="var">level</var> argument is number of frames to scan up the call stack. A value of <code class="code">0</code> yields the return address of the current function, a value of <code class="code">1</code> yields the return address of the caller of the current function, and so forth. When inlining the expected behavior is that the function returns the address of the function that is returned to. To work around this behavior use the <code class="code">noinline</code> function attribute. </p> <p>The <var class="var">level</var> argument must be a constant integer. </p> <p>On some machines it may be impossible to determine the return address of any function other than the current one; in such cases, or when the top of the stack has been reached, this function returns an unspecified value. In addition, <code class="code">__builtin_frame_address</code> may be used to determine if the top of the stack has been reached. </p> <p>Additional post-processing of the returned value may be needed, see <code class="code">__builtin_extract_return_addr</code>. </p> <p>The stored representation of the return address in memory may be different from the address returned by <code class="code">__builtin_return_address</code>. For example, on AArch64 the stored address may be mangled with return address signing whereas the address returned by <code class="code">__builtin_return_address</code> is not. </p> <p>Calling this function with a nonzero argument can have unpredictable effects, including crashing the calling program. As a result, calls that are considered unsafe are diagnosed when the <samp class="option">-Wframe-address</samp> option is in effect. Such calls should only be made in debugging situations. </p> <p>On targets where code addresses are representable as <code class="code">void *</code>, </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void *addr = __builtin_extract_return_addr (__builtin_return_address (0));</pre> +</div> <p>gives the code address where the current function would return. For example, such an address may be used with <code class="code">dladdr</code> or other interfaces that work with code addresses. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fextract_005freturn_005faddr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_extract_return_addr</strong> <code class="def-code-arguments">(void *<var class="var">addr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fextract_005freturn_005faddr"> ¶</a></span> +</dt> <dd> +<p>The address as returned by <code class="code">__builtin_return_address</code> may have to be fed through this function to get the actual encoded address. For example, on the 31-bit S/390 platform the highest bit has to be masked out, or on SPARC platforms an offset has to be added for the true next instruction to be executed. </p> <p>If no fixup is needed, this function simply passes through <var class="var">addr</var>. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ffrob_005freturn_005faddr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_frob_return_addr</strong> <code class="def-code-arguments">(void *<var class="var">addr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ffrob_005freturn_005faddr"> ¶</a></span> +</dt> <dd><p>This function does the reverse of <code class="code">__builtin_extract_return_addr</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fframe_005faddress"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_frame_address</strong> <code class="def-code-arguments">(unsigned int <var class="var">level</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fframe_005faddress"> ¶</a></span> +</dt> <dd> +<p>This function is similar to <code class="code">__builtin_return_address</code>, but it returns the address of the function frame rather than the return address of the function. Calling <code class="code">__builtin_frame_address</code> with a value of <code class="code">0</code> yields the frame address of the current function, a value of <code class="code">1</code> yields the frame address of the caller of the current function, and so forth. </p> <p>The frame is the area on the stack that holds local variables and saved registers. The frame address is normally the address of the first word pushed on to the stack by the function. However, the exact definition depends upon the processor and the calling convention. If the processor has a dedicated frame pointer register, and the function has a frame, then <code class="code">__builtin_frame_address</code> returns the value of the frame pointer register. </p> <p>On some machines it may be impossible to determine the frame address of any function other than the current one; in such cases, or when the top of the stack has been reached, this function returns <code class="code">0</code> if the first frame pointer is properly initialized by the startup code. </p> <p>Calling this function with a nonzero argument can have unpredictable effects, including crashing the calling program. As a result, calls that are considered unsafe are diagnosed when the <samp class="option">-Wframe-address</samp> option is in effect. Such calls should only be made in debugging situations. </p> +</dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="vector-extensions">Using Vector Instructions through Built-in Functions</a>, Previous: <a href="function-names">Function Names as Strings</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Return-Address.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Return-Address.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/risc-v-built-in-functions.html b/devdocs/gcc~13/risc-v-built-in-functions.html new file mode 100644 index 00000000..a3ddc773 --- /dev/null +++ b/devdocs/gcc~13/risc-v-built-in-functions.html @@ -0,0 +1,12 @@ +<div class="subsection-level-extent" id="RISC-V-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="risc-v-vector-intrinsics" accesskey="n" rel="next">RISC-V Vector Intrinsics</a>, Previous: <a href="pru-built-in-functions" accesskey="p" rel="prev">PRU Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RISC-V-Built-in-Functions-1"><span>6.60.28 RISC-V Built-in Functions<a class="copiable-link" href="#RISC-V-Built-in-Functions-1"> ¶</a></span></h1> <p>These built-in functions are available for the RISC-V family of processors. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fthread_005fpointer"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_thread_pointer</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fthread_005fpointer"> ¶</a></span> +</dt> <dd><p>Returns the value that is currently set in the ‘<samp class="samp">tp</samp>’ register. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005friscv_005fpause"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_riscv_pause</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005friscv_005fpause"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">pause</code> (hint) machine instruction. This implies the Xgnuzihintpausestate extension, which redefines the <code class="code">pause</code> instruction to change architectural state. </p></dd> +</dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RISC-V-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RISC-V-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/risc-v-function-attributes.html b/devdocs/gcc~13/risc-v-function-attributes.html new file mode 100644 index 00000000..449d159c --- /dev/null +++ b/devdocs/gcc~13/risc-v-function-attributes.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="RISC-V-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="rl78-function-attributes" accesskey="n" rel="next">RL78 Function Attributes</a>, Previous: <a href="powerpc-function-attributes" accesskey="p" rel="prev">PowerPC Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RISC-V-Function-Attributes-1"><span>6.33.25 RISC-V Function Attributes<a class="copiable-link" href="#RISC-V-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the RISC-V back end: </p> <dl class="table"> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-RISC-V"> ¶</a></span> +</dt> <dd> +<p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p> </dd> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-RISC-V"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> <p>You can specify the kind of interrupt to be handled by adding an optional parameter to the interrupt attribute like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (void) __attribute__ ((interrupt ("user")));</pre> +</div> <p>Permissible values for this parameter are <code class="code">user</code>, <code class="code">supervisor</code>, and <code class="code">machine</code>. If there is no parameter, then it defaults to <code class="code">machine</code>. </p> +</dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RISC-V-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RISC-V-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/risc-v-options.html b/devdocs/gcc~13/risc-v-options.html new file mode 100644 index 00000000..33089f3b --- /dev/null +++ b/devdocs/gcc~13/risc-v-options.html @@ -0,0 +1,78 @@ +<div class="subsection-level-extent" id="RISC-V-Options"> <div class="nav-panel"> <p> Next: <a href="rl78-options" accesskey="n" rel="next">RL78 Options</a>, Previous: <a href="pru-options" accesskey="p" rel="prev">PRU Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RISC-V-Options-1"><span>3.19.40 RISC-V Options<a class="copiable-link" href="#RISC-V-Options-1"> ¶</a></span></h1> <p>These command-line options are defined for RISC-V targets: </p> <dl class="table"> <dt> +<span><code class="code">-mbranch-cost=<var class="var">n</var></code><a class="copiable-link" href="#index-mbranch-cost-4"> ¶</a></span> +</dt> <dd> +<p>Set the cost of branches to roughly <var class="var">n</var> instructions. </p> </dd> <dt> +<span><code class="code">-mplt</code><a class="copiable-link" href="#index-plt"> ¶</a></span> +</dt> <dt><code class="code">-mno-plt</code></dt> <dd> +<p>When generating PIC code, do or don’t allow the use of PLTs. Ignored for non-PIC. The default is <samp class="option">-mplt</samp>. </p> </dd> <dt> +<span><code class="code">-mabi=<var class="var">ABI-string</var></code><a class="copiable-link" href="#index-mabi-4"> ¶</a></span> +</dt> <dd> +<p>Specify integer and floating-point calling convention. <var class="var">ABI-string</var> contains two parts: the size of integer types and the registers used for floating-point types. For example ‘<samp class="samp">-march=rv64ifd -mabi=lp64d</samp>’ means that ‘<samp class="samp">long</samp>’ and pointers are 64-bit (implicitly defining ‘<samp class="samp">int</samp>’ to be 32-bit), and that floating-point values up to 64 bits wide are passed in F registers. Contrast this with ‘<samp class="samp">-march=rv64ifd -mabi=lp64f</samp>’, which still allows the compiler to generate code that uses the F and D extensions but only allows floating-point values up to 32 bits long to be passed in registers; or ‘<samp class="samp">-march=rv64ifd -mabi=lp64</samp>’, in which no floating-point arguments will be passed in registers. </p> <p>The default for this argument is system dependent, users who want a specific calling convention should specify one explicitly. The valid calling conventions are: ‘<samp class="samp">ilp32</samp>’, ‘<samp class="samp">ilp32f</samp>’, ‘<samp class="samp">ilp32d</samp>’, ‘<samp class="samp">lp64</samp>’, ‘<samp class="samp">lp64f</samp>’, and ‘<samp class="samp">lp64d</samp>’. Some calling conventions are impossible to implement on some ISAs: for example, ‘<samp class="samp">-march=rv32if -mabi=ilp32d</samp>’ is invalid because the ABI requires 64-bit values be passed in F registers, but F registers are only 32 bits wide. There is also the ‘<samp class="samp">ilp32e</samp>’ ABI that can only be used with the ‘<samp class="samp">rv32e</samp>’ architecture. This ABI is not well specified at present, and is subject to change. </p> </dd> <dt> +<span><code class="code">-mfdiv</code><a class="copiable-link" href="#index-mfdiv"> ¶</a></span> +</dt> <dt><code class="code">-mno-fdiv</code></dt> <dd> +<p>Do or don’t use hardware floating-point divide and square root instructions. This requires the F or D extensions for floating-point registers. The default is to use them if the specified architecture has these instructions. </p> </dd> <dt> +<span><code class="code">-mdiv</code><a class="copiable-link" href="#index-mdiv-3"> ¶</a></span> +</dt> <dt><code class="code">-mno-div</code></dt> <dd> +<p>Do or don’t use hardware instructions for integer division. This requires the M extension. The default is to use them if the specified architecture has these instructions. </p> </dd> <dt> +<span><code class="code">-misa-spec=<var class="var">ISA-spec-string</var></code><a class="copiable-link" href="#index-misa-spec"> ¶</a></span> +</dt> <dd> +<p>Specify the version of the RISC-V Unprivileged (formerly User-Level) ISA specification to produce code conforming to. The possibilities for <var class="var">ISA-spec-string</var> are: </p> +<dl class="table"> <dt><code class="code">2.2</code></dt> <dd><p>Produce code conforming to version 2.2. </p></dd> <dt><code class="code">20190608</code></dt> <dd><p>Produce code conforming to version 20190608. </p></dd> <dt><code class="code">20191213</code></dt> <dd><p>Produce code conforming to version 20191213. </p></dd> </dl> <p>The default is <samp class="option">-misa-spec=20191213</samp> unless GCC has been configured with <samp class="option">--with-isa-spec=</samp> specifying a different default version. </p> </dd> <dt> +<span><code class="code">-march=<var class="var">ISA-string</var></code><a class="copiable-link" href="#index-march-14"> ¶</a></span> +</dt> <dd> +<p>Generate code for given RISC-V ISA (e.g. ‘<samp class="samp">rv64im</samp>’). ISA strings must be lower-case. Examples include ‘<samp class="samp">rv64i</samp>’, ‘<samp class="samp">rv32g</samp>’, ‘<samp class="samp">rv32e</samp>’, and ‘<samp class="samp">rv32imaf</samp>’. </p> <p>When <samp class="option">-march=</samp> is not specified, use the setting from <samp class="option">-mcpu</samp>. </p> <p>If both <samp class="option">-march</samp> and <samp class="option">-mcpu=</samp> are not specified, the default for this argument is system dependent, users who want a specific architecture extensions should specify one explicitly. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">processor-string</var></code><a class="copiable-link" href="#index-mcpu-8"> ¶</a></span> +</dt> <dd> +<p>Use architecture of and optimize the output for the given processor, specified by particular CPU name. Permissible values for this option are: ‘<samp class="samp">sifive-e20</samp>’, ‘<samp class="samp">sifive-e21</samp>’, ‘<samp class="samp">sifive-e24</samp>’, ‘<samp class="samp">sifive-e31</samp>’, ‘<samp class="samp">sifive-e34</samp>’, ‘<samp class="samp">sifive-e76</samp>’, ‘<samp class="samp">sifive-s21</samp>’, ‘<samp class="samp">sifive-s51</samp>’, ‘<samp class="samp">sifive-s54</samp>’, ‘<samp class="samp">sifive-s76</samp>’, ‘<samp class="samp">sifive-u54</samp>’, and ‘<samp class="samp">sifive-u74</samp>’. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">processor-string</var></code><a class="copiable-link" href="#index-mtune-12"> ¶</a></span> +</dt> <dd> +<p>Optimize the output for the given processor, specified by microarchitecture or particular CPU name. Permissible values for this option are: ‘<samp class="samp">rocket</samp>’, ‘<samp class="samp">sifive-3-series</samp>’, ‘<samp class="samp">sifive-5-series</samp>’, ‘<samp class="samp">sifive-7-series</samp>’, ‘<samp class="samp">thead-c906</samp>’, ‘<samp class="samp">size</samp>’, and all valid options for <samp class="option">-mcpu=</samp>. </p> <p>When <samp class="option">-mtune=</samp> is not specified, use the setting from <samp class="option">-mcpu</samp>, the default is ‘<samp class="samp">rocket</samp>’ if both are not specified. </p> <p>The ‘<samp class="samp">size</samp>’ choice is not intended for use by end-users. This is used when <samp class="option">-Os</samp> is specified. It overrides the instruction cost info provided by <samp class="option">-mtune=</samp>, but does not override the pipeline info. This helps reduce code size while still giving good performance. </p> </dd> <dt> +<span><code class="code">-mpreferred-stack-boundary=<var class="var">num</var></code><a class="copiable-link" href="#index-mpreferred-stack-boundary"> ¶</a></span> +</dt> <dd> +<p>Attempt to keep the stack boundary aligned to a 2 raised to <var class="var">num</var> byte boundary. If <samp class="option">-mpreferred-stack-boundary</samp> is not specified, the default is 4 (16 bytes or 128-bits). </p> <p><strong class="strong">Warning:</strong> If you use this switch, then you must build all modules with the same value, including any libraries. This includes the system libraries and startup modules. </p> </dd> <dt> +<span><code class="code">-msmall-data-limit=<var class="var">n</var></code><a class="copiable-link" href="#index-msmall-data-limit-1"> ¶</a></span> +</dt> <dd> +<p>Put global and static data smaller than <var class="var">n</var> bytes into a special section (on some targets). </p> </dd> <dt> +<span><code class="code">-msave-restore</code><a class="copiable-link" href="#index-msave-restore"> ¶</a></span> +</dt> <dt><code class="code">-mno-save-restore</code></dt> <dd> +<p>Do or don’t use smaller but slower prologue and epilogue code that uses library function calls. The default is to use fast inline prologues and epilogues. </p> </dd> <dt> +<span><code class="code">-mshorten-memrefs</code><a class="copiable-link" href="#index-mshorten-memrefs"> ¶</a></span> +</dt> <dt><code class="code">-mno-shorten-memrefs</code></dt> <dd> +<p>Do or do not attempt to make more use of compressed load/store instructions by replacing a load/store of ’base register + large offset’ with a new load/store of ’new base + small offset’. If the new base gets stored in a compressed register, then the new load/store can be compressed. Currently targets 32-bit integer load/stores only. </p> </dd> <dt> +<span><code class="code">-mstrict-align</code><a class="copiable-link" href="#index-mstrict-align-3"> ¶</a></span> +</dt> <dt><code class="code">-mno-strict-align</code></dt> <dd> +<p>Do not or do generate unaligned memory accesses. The default is set depending on whether the processor we are optimizing for supports fast unaligned access or not. </p> </dd> <dt> +<span><code class="code">-mcmodel=medlow</code><a class="copiable-link" href="#index-mcmodel_003dmedlow"> ¶</a></span> +</dt> <dd> +<p>Generate code for the medium-low code model. The program and its statically defined symbols must lie within a single 2 GiB address range and must lie between absolute addresses −2 GiB and +2 GiB. Programs can be statically or dynamically linked. This is the default code model. </p> </dd> <dt> +<span><code class="code">-mcmodel=medany</code><a class="copiable-link" href="#index-mcmodel_003dmedany"> ¶</a></span> +</dt> <dd> +<p>Generate code for the medium-any code model. The program and its statically defined symbols must be within any single 2 GiB address range. Programs can be statically or dynamically linked. </p> <p>The code generated by the medium-any code model is position-independent, but is not guaranteed to function correctly when linked into position-independent executables or libraries. </p> </dd> <dt><code class="code">-mexplicit-relocs</code></dt> <dt><code class="code">-mno-exlicit-relocs</code></dt> <dd> +<p>Use or do not use assembler relocation operators when dealing with symbolic addresses. The alternative is to use assembler macros instead, which may limit optimization. </p> </dd> <dt> +<span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax-5"> ¶</a></span> +</dt> <dt><code class="code">-mno-relax</code></dt> <dd> +<p>Take advantage of linker relaxations to reduce the number of instructions required to materialize symbol addresses. The default is to take advantage of linker relaxations. </p> </dd> <dt> +<span><code class="code">-mriscv-attribute</code><a class="copiable-link" href="#index-mriscv-attribute"> ¶</a></span> +</dt> <dt><code class="code">-mno-riscv-attribute</code></dt> <dd> +<p>Emit (do not emit) RISC-V attribute to record extra information into ELF objects. This feature requires at least binutils 2.32. </p> </dd> <dt> +<span><code class="code">-mcsr-check</code><a class="copiable-link" href="#index-mcsr-check"> ¶</a></span> +</dt> <dt><code class="code">-mno-csr-check</code></dt> <dd> +<p>Enables or disables the CSR checking. </p> </dd> <dt> +<span><code class="code">-malign-data=<var class="var">type</var></code><a class="copiable-link" href="#index-malign-data"> ¶</a></span> +</dt> <dd> +<p>Control how GCC aligns variables and constants of array, structure, or union types. Supported values for <var class="var">type</var> are ‘<samp class="samp">xlen</samp>’ which uses x register width as the alignment value, and ‘<samp class="samp">natural</samp>’ which uses natural alignment. ‘<samp class="samp">xlen</samp>’ is the default. </p> </dd> <dt> +<span><code class="code">-mbig-endian</code><a class="copiable-link" href="#index-mbig-endian-10"> ¶</a></span> +</dt> <dd> +<p>Generate big-endian code. This is the default when GCC is configured for a ‘<samp class="samp">riscv64be-*-*</samp>’ or ‘<samp class="samp">riscv32be-*-*</samp>’ target. </p> </dd> <dt> +<span><code class="code">-mlittle-endian</code><a class="copiable-link" href="#index-mlittle-endian-10"> ¶</a></span> +</dt> <dd> +<p>Generate little-endian code. This is the default when GCC is configured for a ‘<samp class="samp">riscv64-*-*</samp>’ or ‘<samp class="samp">riscv32-*-*</samp>’ but not a ‘<samp class="samp">riscv64be-*-*</samp>’ or ‘<samp class="samp">riscv32be-*-*</samp>’ target. </p> </dd> <dt> + <span><code class="code">-mstack-protector-guard=<var class="var">guard</var></code><a class="copiable-link" href="#index-mstack-protector-guard-2"> ¶</a></span> +</dt> <dt><code class="code">-mstack-protector-guard-reg=<var class="var">reg</var></code></dt> <dt><code class="code">-mstack-protector-guard-offset=<var class="var">offset</var></code></dt> <dd> +<p>Generate stack protection code using canary at <var class="var">guard</var>. Supported locations are ‘<samp class="samp">global</samp>’ for a global canary or ‘<samp class="samp">tls</samp>’ for per-thread canary in the TLS block. </p> <p>With the latter choice the options <samp class="option">-mstack-protector-guard-reg=<var class="var">reg</var></samp> and <samp class="option">-mstack-protector-guard-offset=<var class="var">offset</var></samp> furthermore specify which register to use as base register for reading the canary, and from what offset from that base register. There is no default register or offset as this is entirely for use within the Linux kernel. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="rl78-options">RL78 Options</a>, Previous: <a href="pru-options">PRU Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RISC-V-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RISC-V-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/risc-v-vector-intrinsics.html b/devdocs/gcc~13/risc-v-vector-intrinsics.html new file mode 100644 index 00000000..ccde949f --- /dev/null +++ b/devdocs/gcc~13/risc-v-vector-intrinsics.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="RISC-V-Vector-Intrinsics"> <div class="nav-panel"> <p> Next: <a href="rx-built-in-functions" accesskey="n" rel="next">RX Built-in Functions</a>, Previous: <a href="risc-v-built-in-functions" accesskey="p" rel="prev">RISC-V Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RISC-V-Vector-Intrinsics-1"><span>6.60.29 RISC-V Vector Intrinsics<a class="copiable-link" href="#RISC-V-Vector-Intrinsics-1"> ¶</a></span></h1> <p>GCC supports vector intrinsics as specified in version 0.11 of the RISC-V vector intrinsic specification, which is available at the following link: <a class="uref" href="https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/v0.11.x">https://github.com/riscv-non-isa/rvv-intrinsic-doc/tree/v0.11.x</a>. All of these functions are declared in the include file <samp class="file">riscv_vector.h</samp>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RISC-V-Vector-Intrinsics.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RISC-V-Vector-Intrinsics.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/rl78-function-attributes.html b/devdocs/gcc~13/rl78-function-attributes.html new file mode 100644 index 00000000..15b37d99 --- /dev/null +++ b/devdocs/gcc~13/rl78-function-attributes.html @@ -0,0 +1,11 @@ +<div class="subsection-level-extent" id="RL78-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="rx-function-attributes" accesskey="n" rel="next">RX Function Attributes</a>, Previous: <a href="risc-v-function-attributes" accesskey="p" rel="prev">RISC-V Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RL78-Function-Attributes-1"><span>6.33.26 RL78 Function Attributes<a class="copiable-link" href="#RL78-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the RL78 back end: </p> <dl class="table"> <dt> + <span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-RL78"> ¶</a></span> +</dt> <dt><code class="code">brk_interrupt</code></dt> <dd> +<p>These attributes indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> <p>Use <code class="code">brk_interrupt</code> instead of <code class="code">interrupt</code> for handlers intended to be used with the <code class="code">BRK</code> opcode (i.e. those that must end with <code class="code">RETB</code> instead of <code class="code">RETI</code>). </p> </dd> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-RL78"> ¶</a></span> +</dt> <dd><p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RL78-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RL78-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/rl78-options.html b/devdocs/gcc~13/rl78-options.html new file mode 100644 index 00000000..5f1b2523 --- /dev/null +++ b/devdocs/gcc~13/rl78-options.html @@ -0,0 +1,27 @@ +<div class="subsection-level-extent" id="RL78-Options"> <div class="nav-panel"> <p> Next: <a href="rs_002f6000-and-powerpc-options" accesskey="n" rel="next">IBM RS/6000 and PowerPC Options</a>, Previous: <a href="risc-v-options" accesskey="p" rel="prev">RISC-V Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RL78-Options-1"><span>3.19.41 RL78 Options<a class="copiable-link" href="#RL78-Options-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-6"> ¶</a></span> +</dt> <dd> +<p>Links in additional target libraries to support operation within a simulator. </p> </dd> <dt> +<span><code class="code">-mmul=none</code><a class="copiable-link" href="#index-mmul"> ¶</a></span> +</dt> <dt><code class="code">-mmul=g10</code></dt> <dt><code class="code">-mmul=g13</code></dt> <dt><code class="code">-mmul=g14</code></dt> <dt><code class="code">-mmul=rl78</code></dt> <dd> +<p>Specifies the type of hardware multiplication and division support to be used. The simplest is <code class="code">none</code>, which uses software for both multiplication and division. This is the default. The <code class="code">g13</code> value is for the hardware multiply/divide peripheral found on the RL78/G13 (S2 core) targets. The <code class="code">g14</code> value selects the use of the multiplication and division instructions supported by the RL78/G14 (S3 core) parts. The value <code class="code">rl78</code> is an alias for <code class="code">g14</code> and the value <code class="code">mg10</code> is an alias for <code class="code">none</code>. </p> <p>In addition a C preprocessor macro is defined, based upon the setting of this option. Possible values are: <code class="code">__RL78_MUL_NONE__</code>, <code class="code">__RL78_MUL_G13__</code> or <code class="code">__RL78_MUL_G14__</code>. </p> </dd> <dt> +<span><code class="code">-mcpu=g10</code><a class="copiable-link" href="#index-mcpu-9"> ¶</a></span> +</dt> <dt><code class="code">-mcpu=g13</code></dt> <dt><code class="code">-mcpu=g14</code></dt> <dt><code class="code">-mcpu=rl78</code></dt> <dd> +<p>Specifies the RL78 core to target. The default is the G14 core, also known as an S3 core or just RL78. The G13 or S2 core does not have multiply or divide instructions, instead it uses a hardware peripheral for these operations. The G10 or S1 core does not have register banks, so it uses a different calling convention. </p> <p>If this option is set it also selects the type of hardware multiply support to use, unless this is overridden by an explicit <samp class="option">-mmul=none</samp> option on the command line. Thus specifying <samp class="option">-mcpu=g13</samp> enables the use of the G13 hardware multiply peripheral and specifying <samp class="option">-mcpu=g10</samp> disables the use of hardware multiplications altogether. </p> <p>Note, although the RL78/G14 core is the default target, specifying <samp class="option">-mcpu=g14</samp> or <samp class="option">-mcpu=rl78</samp> on the command line does change the behavior of the toolchain since it also enables G14 hardware multiply support. If these options are not specified on the command line then software multiplication routines will be used even though the code targets the RL78 core. This is for backwards compatibility with older toolchains which did not have hardware multiply and divide support. </p> <p>In addition a C preprocessor macro is defined, based upon the setting of this option. Possible values are: <code class="code">__RL78_G10__</code>, <code class="code">__RL78_G13__</code> or <code class="code">__RL78_G14__</code>. </p> </dd> <dt> + <span><code class="code">-mg10</code><a class="copiable-link" href="#index-mg10"> ¶</a></span> +</dt> <dt><code class="code">-mg13</code></dt> <dt><code class="code">-mg14</code></dt> <dt><code class="code">-mrl78</code></dt> <dd> +<p>These are aliases for the corresponding <samp class="option">-mcpu=</samp> option. They are provided for backwards compatibility. </p> </dd> <dt> +<span><code class="code">-mallregs</code><a class="copiable-link" href="#index-mallregs"> ¶</a></span> +</dt> <dd> +<p>Allow the compiler to use all of the available registers. By default registers <code class="code">r24..r31</code> are reserved for use in interrupt handlers. With this option enabled these registers can be used in ordinary functions as well. </p> </dd> <dt> + <span><code class="code">-m64bit-doubles</code><a class="copiable-link" href="#index-m64bit-doubles"> ¶</a></span> +</dt> <dt><code class="code">-m32bit-doubles</code></dt> <dd> +<p>Make the <code class="code">double</code> data type be 64 bits (<samp class="option">-m64bit-doubles</samp>) or 32 bits (<samp class="option">-m32bit-doubles</samp>) in size. The default is <samp class="option">-m32bit-doubles</samp>. </p> </dd> <dt> + <span><code class="code">-msave-mduc-in-interrupts</code><a class="copiable-link" href="#index-msave-mduc-in-interrupts"> ¶</a></span> +</dt> <dt><code class="code">-mno-save-mduc-in-interrupts</code></dt> <dd> +<p>Specifies that interrupt handler functions should preserve the MDUC registers. This is only necessary if normal code might use the MDUC registers, for example because it performs multiplication and division operations. The default is to ignore the MDUC registers as this makes the interrupt handlers faster. The target option -mg13 needs to be passed for this to work as this feature is only available on the G13 target (S2 core). The MDUC registers will only be saved if the interrupt handler performs a multiplication or division operation or it calls another function. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="rs_002f6000-and-powerpc-options">IBM RS/6000 and PowerPC Options</a>, Previous: <a href="risc-v-options">RISC-V Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RL78-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RL78-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/rl78-variable-attributes.html b/devdocs/gcc~13/rl78-variable-attributes.html new file mode 100644 index 00000000..d7bac666 --- /dev/null +++ b/devdocs/gcc~13/rl78-variable-attributes.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="RL78-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="v850-variable-attributes" accesskey="n" rel="next">V850 Variable Attributes</a>, Previous: <a href="powerpc-variable-attributes" accesskey="p" rel="prev">PowerPC Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RL78-Variable-Attributes-1"><span>6.34.13 RL78 Variable Attributes<a class="copiable-link" href="#RL78-Variable-Attributes-1"> ¶</a></span></h1> <p>The RL78 back end supports the <code class="code">saddr</code> variable attribute. This specifies placement of the corresponding variable in the SADDR area, which can be accessed more efficiently than the default memory region. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RL78-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RL78-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/rs_002f6000-and-powerpc-options.html b/devdocs/gcc~13/rs_002f6000-and-powerpc-options.html new file mode 100644 index 00000000..ad627ca4 --- /dev/null +++ b/devdocs/gcc~13/rs_002f6000-and-powerpc-options.html @@ -0,0 +1,335 @@ +<div class="subsection-level-extent" id="RS_002f6000-and-PowerPC-Options"> <div class="nav-panel"> <p> Next: <a href="rx-options" accesskey="n" rel="next">RX Options</a>, Previous: <a href="rl78-options" accesskey="p" rel="prev">RL78 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="IBM-RS_002f6000-and-PowerPC-Options"><span>3.19.42 IBM RS/6000 and PowerPC Options<a class="copiable-link" href="#IBM-RS_002f6000-and-PowerPC-Options"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for the IBM RS/6000 and PowerPC: </p> +<dl class="table"> <dt> +<span><code class="code">-mpowerpc-gpopt</code><a class="copiable-link" href="#index-mpowerpc-gpopt"> ¶</a></span> +</dt> <dt><code class="code">-mno-powerpc-gpopt</code></dt> <dt><code class="code">-mpowerpc-gfxopt</code></dt> <dt><code class="code">-mno-powerpc-gfxopt</code></dt> <dt><code class="code">-mpowerpc64</code></dt> <dt><code class="code">-mno-powerpc64</code></dt> <dt><code class="code">-mmfcrf</code></dt> <dt><code class="code">-mno-mfcrf</code></dt> <dt><code class="code">-mpopcntb</code></dt> <dt><code class="code">-mno-popcntb</code></dt> <dt><code class="code">-mpopcntd</code></dt> <dt><code class="code">-mno-popcntd</code></dt> <dt><code class="code">-mfprnd</code></dt> <dt><code class="code">-mno-fprnd</code></dt> <dt><code class="code">-mcmpb</code></dt> <dt><code class="code">-mno-cmpb</code></dt> <dt><code class="code">-mhard-dfp</code></dt> <dt><code class="code">-mno-hard-dfp</code></dt> <dd> +<p>You use these options to specify which instructions are available on the processor you are using. The default value of these options is determined when configuring GCC. Specifying the <samp class="option">-mcpu=<var class="var">cpu_type</var></samp> overrides the specification of these options. We recommend you use the <samp class="option">-mcpu=<var class="var">cpu_type</var></samp> option rather than the options listed above. </p> <p>Specifying <samp class="option">-mpowerpc-gpopt</samp> allows GCC to use the optional PowerPC architecture instructions in the General Purpose group, including floating-point square root. Specifying <samp class="option">-mpowerpc-gfxopt</samp> allows GCC to use the optional PowerPC architecture instructions in the Graphics group, including floating-point select. </p> <p>The <samp class="option">-mmfcrf</samp> option allows GCC to generate the move from condition register field instruction implemented on the POWER4 processor and other processors that support the PowerPC V2.01 architecture. The <samp class="option">-mpopcntb</samp> option allows GCC to generate the popcount and double-precision FP reciprocal estimate instruction implemented on the POWER5 processor and other processors that support the PowerPC V2.02 architecture. The <samp class="option">-mpopcntd</samp> option allows GCC to generate the popcount instruction implemented on the POWER7 processor and other processors that support the PowerPC V2.06 architecture. The <samp class="option">-mfprnd</samp> option allows GCC to generate the FP round to integer instructions implemented on the POWER5+ processor and other processors that support the PowerPC V2.03 architecture. The <samp class="option">-mcmpb</samp> option allows GCC to generate the compare bytes instruction implemented on the POWER6 processor and other processors that support the PowerPC V2.05 architecture. The <samp class="option">-mhard-dfp</samp> option allows GCC to generate the decimal floating-point instructions implemented on some POWER processors. </p> <p>The <samp class="option">-mpowerpc64</samp> option allows GCC to generate the additional 64-bit instructions that are found in the full PowerPC64 architecture and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to <samp class="option">-mno-powerpc64</samp>. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu_type</var></code><a class="copiable-link" href="#index-mcpu-10"> ¶</a></span> +</dt> <dd> +<p>Set architecture type, register usage, and instruction scheduling parameters for machine type <var class="var">cpu_type</var>. Supported values for <var class="var">cpu_type</var> are ‘<samp class="samp">401</samp>’, ‘<samp class="samp">403</samp>’, ‘<samp class="samp">405</samp>’, ‘<samp class="samp">405fp</samp>’, ‘<samp class="samp">440</samp>’, ‘<samp class="samp">440fp</samp>’, ‘<samp class="samp">464</samp>’, ‘<samp class="samp">464fp</samp>’, ‘<samp class="samp">476</samp>’, ‘<samp class="samp">476fp</samp>’, ‘<samp class="samp">505</samp>’, ‘<samp class="samp">601</samp>’, ‘<samp class="samp">602</samp>’, ‘<samp class="samp">603</samp>’, ‘<samp class="samp">603e</samp>’, ‘<samp class="samp">604</samp>’, ‘<samp class="samp">604e</samp>’, ‘<samp class="samp">620</samp>’, ‘<samp class="samp">630</samp>’, ‘<samp class="samp">740</samp>’, ‘<samp class="samp">7400</samp>’, ‘<samp class="samp">7450</samp>’, ‘<samp class="samp">750</samp>’, ‘<samp class="samp">801</samp>’, ‘<samp class="samp">821</samp>’, ‘<samp class="samp">823</samp>’, ‘<samp class="samp">860</samp>’, ‘<samp class="samp">970</samp>’, ‘<samp class="samp">8540</samp>’, ‘<samp class="samp">a2</samp>’, ‘<samp class="samp">e300c2</samp>’, ‘<samp class="samp">e300c3</samp>’, ‘<samp class="samp">e500mc</samp>’, ‘<samp class="samp">e500mc64</samp>’, ‘<samp class="samp">e5500</samp>’, ‘<samp class="samp">e6500</samp>’, ‘<samp class="samp">ec603e</samp>’, ‘<samp class="samp">G3</samp>’, ‘<samp class="samp">G4</samp>’, ‘<samp class="samp">G5</samp>’, ‘<samp class="samp">titan</samp>’, ‘<samp class="samp">power3</samp>’, ‘<samp class="samp">power4</samp>’, ‘<samp class="samp">power5</samp>’, ‘<samp class="samp">power5+</samp>’, ‘<samp class="samp">power6</samp>’, ‘<samp class="samp">power6x</samp>’, ‘<samp class="samp">power7</samp>’, ‘<samp class="samp">power8</samp>’, ‘<samp class="samp">power9</samp>’, ‘<samp class="samp">power10</samp>’, ‘<samp class="samp">powerpc</samp>’, ‘<samp class="samp">powerpc64</samp>’, ‘<samp class="samp">powerpc64le</samp>’, ‘<samp class="samp">rs64</samp>’, and ‘<samp class="samp">native</samp>’. </p> <p><samp class="option">-mcpu=powerpc</samp>, <samp class="option">-mcpu=powerpc64</samp>, and <samp class="option">-mcpu=powerpc64le</samp> specify pure 32-bit PowerPC (either endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC architecture machine types, with an appropriate, generic processor model assumed for scheduling purposes. </p> <p>Specifying ‘<samp class="samp">native</samp>’ as cpu type detects and selects the architecture option that corresponds to the host processor of the system performing the compilation. <samp class="option">-mcpu=native</samp> has no effect if GCC does not recognize the processor. </p> <p>The other options specify a specific processor. Code generated under those options runs best on that processor, and may not run at all on others. </p> <p>The <samp class="option">-mcpu</samp> options automatically enable or disable the following options: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple +-mpopcntb -mpopcntd -mpowerpc64 +-mpowerpc-gpopt -mpowerpc-gfxopt +-mmulhw -mdlmzb -mmfpgpr -mvsx +-mcrypto -mhtm -mpower8-fusion -mpower8-vector +-mquad-memory -mquad-memory-atomic -mfloat128 +-mfloat128-hardware -mprefixed -mpcrel -mmma +-mrop-protect</pre> +</div> <p>The particular options set for any particular CPU varies between compiler versions, depending on what setting seems to produce optimal code for that CPU; it doesn’t necessarily reflect the actual hardware’s capabilities. If you wish to set an individual option to a particular value, you may specify it after the <samp class="option">-mcpu</samp> option, like <samp class="option">-mcpu=970 -mno-altivec</samp>. </p> <p>On AIX, the <samp class="option">-maltivec</samp> and <samp class="option">-mpowerpc64</samp> options are not enabled or disabled by the <samp class="option">-mcpu</samp> option at present because AIX does not have full support for these options. You may still enable or disable them individually if you’re sure it’ll work in your environment. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu_type</var></code><a class="copiable-link" href="#index-mtune-13"> ¶</a></span> +</dt> <dd> +<p>Set the instruction scheduling parameters for machine type <var class="var">cpu_type</var>, but do not set the architecture type or register usage, as <samp class="option">-mcpu=<var class="var">cpu_type</var></samp> does. The same values for <var class="var">cpu_type</var> are used for <samp class="option">-mtune</samp> as for <samp class="option">-mcpu</samp>. If both are specified, the code generated uses the architecture and registers set by <samp class="option">-mcpu</samp>, but the scheduling parameters set by <samp class="option">-mtune</samp>. </p> </dd> <dt> +<span><code class="code">-mcmodel=small</code><a class="copiable-link" href="#index-mcmodel_003dsmall-2"> ¶</a></span> +</dt> <dd> +<p>Generate PowerPC64 code for the small model: The TOC is limited to 64k. </p> </dd> <dt> +<span><code class="code">-mcmodel=medium</code><a class="copiable-link" href="#index-mcmodel_003dmedium"> ¶</a></span> +</dt> <dd> +<p>Generate PowerPC64 code for the medium model: The TOC and other static data may be up to a total of 4G in size. This is the default for 64-bit Linux. </p> </dd> <dt> +<span><code class="code">-mcmodel=large</code><a class="copiable-link" href="#index-mcmodel_003dlarge-2"> ¶</a></span> +</dt> <dd> +<p>Generate PowerPC64 code for the large model: The TOC may be up to 4G in size. Other data and code is only limited by the 64-bit address space. </p> </dd> <dt> + <span><code class="code">-maltivec</code><a class="copiable-link" href="#index-maltivec"> ¶</a></span> +</dt> <dt><code class="code">-mno-altivec</code></dt> <dd> +<p>Generate code that uses (does not use) AltiVec instructions, and also enable the use of built-in functions that allow more direct access to the AltiVec instruction set. You may also need to set <samp class="option">-mabi=altivec</samp> to adjust the current ABI with AltiVec ABI enhancements. </p> <p>When <samp class="option">-maltivec</samp> is used, the element order for AltiVec intrinsics such as <code class="code">vec_splat</code>, <code class="code">vec_extract</code>, and <code class="code">vec_insert</code> match array element order corresponding to the endianness of the target. That is, element zero identifies the leftmost element in a vector register when targeting a big-endian platform, and identifies the rightmost element in a vector register when targeting a little-endian platform. </p> </dd> <dt> + <span><code class="code">-mvrsave</code><a class="copiable-link" href="#index-mvrsave"> ¶</a></span> +</dt> <dt><code class="code">-mno-vrsave</code></dt> <dd> +<p>Generate VRSAVE instructions when generating AltiVec code. </p> </dd> <dt> +<span><code class="code">-msecure-plt</code><a class="copiable-link" href="#index-msecure-plt"> ¶</a></span> +</dt> <dd> +<p>Generate code that allows <code class="command">ld</code> and <code class="command">ld.so</code> to build executables and shared libraries with non-executable <code class="code">.plt</code> and <code class="code">.got</code> sections. This is a PowerPC 32-bit SYSV ABI option. </p> </dd> <dt> +<span><code class="code">-mbss-plt</code><a class="copiable-link" href="#index-mbss-plt"> ¶</a></span> +</dt> <dd> +<p>Generate code that uses a BSS <code class="code">.plt</code> section that <code class="command">ld.so</code> fills in, and requires <code class="code">.plt</code> and <code class="code">.got</code> sections that are both writable and executable. This is a PowerPC 32-bit SYSV ABI option. </p> </dd> <dt> + <span><code class="code">-misel</code><a class="copiable-link" href="#index-misel"> ¶</a></span> +</dt> <dt><code class="code">-mno-isel</code></dt> <dd> +<p>This switch enables or disables the generation of ISEL instructions. </p> </dd> <dt> + <span><code class="code">-mvsx</code><a class="copiable-link" href="#index-mvsx"> ¶</a></span> +</dt> <dt><code class="code">-mno-vsx</code></dt> <dd> +<p>Generate code that uses (does not use) vector/scalar (VSX) instructions, and also enable the use of built-in functions that allow more direct access to the VSX instruction set. </p> </dd> <dt> + <span><code class="code">-mcrypto</code><a class="copiable-link" href="#index-mcrypto"> ¶</a></span> +</dt> <dt><code class="code">-mno-crypto</code></dt> <dd> +<p>Enable the use (disable) of the built-in functions that allow direct access to the cryptographic instructions that were added in version 2.07 of the PowerPC ISA. </p> </dd> <dt> + <span><code class="code">-mhtm</code><a class="copiable-link" href="#index-mhtm"> ¶</a></span> +</dt> <dt><code class="code">-mno-htm</code></dt> <dd> +<p>Enable (disable) the use of the built-in functions that allow direct access to the Hardware Transactional Memory (HTM) instructions that were added in version 2.07 of the PowerPC ISA. </p> </dd> <dt> + <span><code class="code">-mpower8-fusion</code><a class="copiable-link" href="#index-mpower8-fusion"> ¶</a></span> +</dt> <dt><code class="code">-mno-power8-fusion</code></dt> <dd> +<p>Generate code that keeps (does not keeps) some integer operations adjacent so that the instructions can be fused together on power8 and later processors. </p> </dd> <dt> + <span><code class="code">-mpower8-vector</code><a class="copiable-link" href="#index-mpower8-vector"> ¶</a></span> +</dt> <dt><code class="code">-mno-power8-vector</code></dt> <dd> +<p>Generate code that uses (does not use) the vector and scalar instructions that were added in version 2.07 of the PowerPC ISA. Also enable the use of built-in functions that allow more direct access to the vector instructions. </p> </dd> <dt> + <span><code class="code">-mquad-memory</code><a class="copiable-link" href="#index-mquad-memory"> ¶</a></span> +</dt> <dt><code class="code">-mno-quad-memory</code></dt> <dd> +<p>Generate code that uses (does not use) the non-atomic quad word memory instructions. The <samp class="option">-mquad-memory</samp> option requires use of 64-bit mode. </p> </dd> <dt> + <span><code class="code">-mquad-memory-atomic</code><a class="copiable-link" href="#index-mquad-memory-atomic"> ¶</a></span> +</dt> <dt><code class="code">-mno-quad-memory-atomic</code></dt> <dd> +<p>Generate code that uses (does not use) the atomic quad word memory instructions. The <samp class="option">-mquad-memory-atomic</samp> option requires use of 64-bit mode. </p> </dd> <dt> + <span><code class="code">-mfloat128</code><a class="copiable-link" href="#index-mfloat128"> ¶</a></span> +</dt> <dt><code class="code">-mno-float128</code></dt> <dd> +<p>Enable/disable the <var class="var">__float128</var> keyword for IEEE 128-bit floating point and use either software emulation for IEEE 128-bit floating point or hardware instructions. </p> <p>The VSX instruction set (<samp class="option">-mvsx</samp>) must be enabled to use the IEEE 128-bit floating point support. The IEEE 128-bit floating point is only supported on Linux. </p> <p>The default for <samp class="option">-mfloat128</samp> is enabled on PowerPC Linux systems using the VSX instruction set, and disabled on other systems. </p> <p>If you use the ISA 3.0 instruction set (<samp class="option">-mpower9-vector</samp> or <samp class="option">-mcpu=power9</samp>) on a 64-bit system, the IEEE 128-bit floating point support will also enable the generation of ISA 3.0 IEEE 128-bit floating point instructions. Otherwise, if you do not specify to generate ISA 3.0 instructions or you are targeting a 32-bit big endian system, IEEE 128-bit floating point will be done with software emulation. </p> </dd> <dt> + <span><code class="code">-mfloat128-hardware</code><a class="copiable-link" href="#index-mfloat128-hardware"> ¶</a></span> +</dt> <dt><code class="code">-mno-float128-hardware</code></dt> <dd> +<p>Enable/disable using ISA 3.0 hardware instructions to support the <var class="var">__float128</var> data type. </p> <p>The default for <samp class="option">-mfloat128-hardware</samp> is enabled on PowerPC Linux systems using the ISA 3.0 instruction set, and disabled on other systems. </p> </dd> <dt> + <span><code class="code">-m32</code><a class="copiable-link" href="#index-m32"> ¶</a></span> +</dt> <dt><code class="code">-m64</code></dt> <dd> +<p>Generate code for 32-bit or 64-bit environments of Darwin and SVR4 targets (including GNU/Linux). The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any PowerPC variant. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits, and generates code for PowerPC64, as for <samp class="option">-mpowerpc64</samp>. </p> </dd> <dt> + <span><code class="code">-mfull-toc</code><a class="copiable-link" href="#index-mfull-toc"> ¶</a></span> +</dt> <dt><code class="code">-mno-fp-in-toc</code></dt> <dt><code class="code">-mno-sum-in-toc</code></dt> <dt><code class="code">-mminimal-toc</code></dt> <dd> +<p>Modify generation of the TOC (Table Of Contents), which is created for every executable file. The <samp class="option">-mfull-toc</samp> option is selected by default. In that case, GCC allocates at least one TOC entry for each unique non-automatic variable reference in your program. GCC also places floating-point constants in the TOC. However, only 16,384 entries are available in the TOC. </p> <p>If you receive a linker error message that saying you have overflowed the available TOC space, you can reduce the amount of TOC space used with the <samp class="option">-mno-fp-in-toc</samp> and <samp class="option">-mno-sum-in-toc</samp> options. <samp class="option">-mno-fp-in-toc</samp> prevents GCC from putting floating-point constants in the TOC and <samp class="option">-mno-sum-in-toc</samp> forces GCC to generate code to calculate the sum of an address and a constant at run time instead of putting that sum into the TOC. You may specify one or both of these options. Each causes GCC to produce very slightly slower and larger code at the expense of conserving TOC space. </p> <p>If you still run out of space in the TOC even when you specify both of these options, specify <samp class="option">-mminimal-toc</samp> instead. This option causes GCC to make only one TOC entry for every file. When you specify this option, GCC produces code that is slower and larger but which uses extremely little TOC space. You may wish to use this option only on files that contain less frequently-executed code. </p> </dd> <dt> + <span><code class="code">-maix64</code><a class="copiable-link" href="#index-maix64"> ¶</a></span> +</dt> <dt><code class="code">-maix32</code></dt> <dd> +<p>Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit <code class="code">long</code> type, and the infrastructure needed to support them. Specifying <samp class="option">-maix64</samp> implies <samp class="option">-mpowerpc64</samp>, while <samp class="option">-maix32</samp> disables the 64-bit ABI and implies <samp class="option">-mno-powerpc64</samp>. GCC defaults to <samp class="option">-maix32</samp>. </p> </dd> <dt> + <span><code class="code">-mxl-compat</code><a class="copiable-link" href="#index-mxl-compat"> ¶</a></span> +</dt> <dt><code class="code">-mno-xl-compat</code></dt> <dd> +<p>Produce code that conforms more closely to IBM XL compiler semantics when using AIX-compatible ABI. Pass floating-point arguments to prototyped functions beyond the register save area (RSA) on the stack in addition to argument FPRs. Do not assume that most significant double in 128-bit long double value is properly rounded when comparing values and converting to double. Use XL symbol names for long double support routines. </p> <p>The AIX calling convention was extended but not initially documented to handle an obscure K&R C case of calling a function that takes the address of its arguments with fewer arguments than declared. IBM XL compilers access floating-point arguments that do not fit in the RSA from the stack when a subroutine is compiled without optimization. Because always storing floating-point arguments on the stack is inefficient and rarely needed, this option is not enabled by default and only is necessary when calling subroutines compiled by IBM XL compilers without optimization. </p> </dd> <dt> +<span><code class="code">-mpe</code><a class="copiable-link" href="#index-mpe"> ¶</a></span> +</dt> <dd> +<p>Support <em class="dfn">IBM RS/6000 SP</em> <em class="dfn">Parallel Environment</em> (PE). Link an application written to use message passing with special startup code to enable the application to run. The system must have PE installed in the standard location (<samp class="file">/usr/lpp/ppe.poe/</samp>), or the <samp class="file">specs</samp> file must be overridden with the <samp class="option">-specs=</samp> option to specify the appropriate directory location. The Parallel Environment does not support threads, so the <samp class="option">-mpe</samp> option and the <samp class="option">-pthread</samp> option are incompatible. </p> </dd> <dt> + <span><code class="code">-malign-natural</code><a class="copiable-link" href="#index-malign-natural"> ¶</a></span> +</dt> <dt><code class="code">-malign-power</code></dt> <dd> +<p>On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option <samp class="option">-malign-natural</samp> overrides the ABI-defined alignment of larger types, such as floating-point doubles, on their natural size-based boundary. The option <samp class="option">-malign-power</samp> instructs GCC to follow the ABI-specified alignment rules. GCC defaults to the standard alignment defined in the ABI. </p> <p>On 64-bit Darwin, natural alignment is the default, and <samp class="option">-malign-power</samp> is not supported. </p> </dd> <dt> + <span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-11"> ¶</a></span> +</dt> <dt><code class="code">-mhard-float</code></dt> <dd> +<p>Generate code that does not use (uses) the floating-point register set. Software floating-point emulation is provided if you use the <samp class="option">-msoft-float</samp> option, and pass the option to GCC when linking. </p> </dd> <dt> + <span><code class="code">-mmultiple</code><a class="copiable-link" href="#index-mmultiple"> ¶</a></span> +</dt> <dt><code class="code">-mno-multiple</code></dt> <dd> +<p>Generate code that uses (does not use) the load multiple word instructions and the store multiple word instructions. These instructions are generated by default on POWER systems, and not generated on PowerPC systems. Do not use <samp class="option">-mmultiple</samp> on little-endian PowerPC systems, since those instructions do not work when the processor is in little-endian mode. The exceptions are PPC740 and PPC750 which permit these instructions in little-endian mode. </p> </dd> <dt> + <span><code class="code">-mupdate</code><a class="copiable-link" href="#index-mupdate"> ¶</a></span> +</dt> <dt><code class="code">-mno-update</code></dt> <dd> +<p>Generate code that uses (does not use) the load or store instructions that update the base register to the address of the calculated memory location. These instructions are generated by default. If you use <samp class="option">-mno-update</samp>, there is a small window between the time that the stack pointer is updated and the address of the previous frame is stored, which means code that walks the stack frame across interrupts or signals may get corrupted data. </p> </dd> <dt> + <span><code class="code">-mavoid-indexed-addresses</code><a class="copiable-link" href="#index-mavoid-indexed-addresses"> ¶</a></span> +</dt> <dt><code class="code">-mno-avoid-indexed-addresses</code></dt> <dd> +<p>Generate code that tries to avoid (not avoid) the use of indexed load or store instructions. These instructions can incur a performance penalty on Power6 processors in certain situations, such as when stepping through large arrays that cross a 16M boundary. This option is enabled by default when targeting Power6 and disabled otherwise. </p> </dd> <dt> + <span><code class="code">-mfused-madd</code><a class="copiable-link" href="#index-mfused-madd-2"> ¶</a></span> +</dt> <dt><code class="code">-mno-fused-madd</code></dt> <dd> +<p>Generate code that uses (does not use) the floating-point multiply and accumulate instructions. These instructions are generated by default if hardware floating point is used. The machine-dependent <samp class="option">-mfused-madd</samp> option is now mapped to the machine-independent <samp class="option">-ffp-contract=fast</samp> option, and <samp class="option">-mno-fused-madd</samp> is mapped to <samp class="option">-ffp-contract=off</samp>. </p> </dd> <dt> + <span><code class="code">-mmulhw</code><a class="copiable-link" href="#index-mmulhw"> ¶</a></span> +</dt> <dt><code class="code">-mno-mulhw</code></dt> <dd> +<p>Generate code that uses (does not use) the half-word multiply and multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors. These instructions are generated by default when targeting those processors. </p> </dd> <dt> + <span><code class="code">-mdlmzb</code><a class="copiable-link" href="#index-mdlmzb"> ¶</a></span> +</dt> <dt><code class="code">-mno-dlmzb</code></dt> <dd> +<p>Generate code that uses (does not use) the string-search ‘<samp class="samp">dlmzb</samp>’ instruction on the IBM 405, 440, 464 and 476 processors. This instruction is generated by default when targeting those processors. </p> </dd> <dt> + <span><code class="code">-mno-bit-align</code><a class="copiable-link" href="#index-mno-bit-align"> ¶</a></span> +</dt> <dt><code class="code">-mbit-align</code></dt> <dd> +<p>On System V.4 and embedded PowerPC systems do not (do) force structures and unions that contain bit-fields to be aligned to the base type of the bit-field. </p> <p>For example, by default a structure containing nothing but 8 <code class="code">unsigned</code> bit-fields of length 1 is aligned to a 4-byte boundary and has a size of 4 bytes. By using <samp class="option">-mno-bit-align</samp>, the structure is aligned to a 1-byte boundary and is 1 byte in size. </p> </dd> <dt> + <span><code class="code">-mno-strict-align</code><a class="copiable-link" href="#index-mno-strict-align-2"> ¶</a></span> +</dt> <dt><code class="code">-mstrict-align</code></dt> <dd> +<p>On System V.4 and embedded PowerPC systems do not (do) assume that unaligned memory references are handled by the system. </p> </dd> <dt> + <span><code class="code">-mrelocatable</code><a class="copiable-link" href="#index-mrelocatable"> ¶</a></span> +</dt> <dt><code class="code">-mno-relocatable</code></dt> <dd> +<p>Generate code that allows (does not allow) a static executable to be relocated to a different address at run time. A simple embedded PowerPC system loader should relocate the entire contents of <code class="code">.got2</code> and 4-byte locations listed in the <code class="code">.fixup</code> section, a table of 32-bit addresses generated by this option. For this to work, all objects linked together must be compiled with <samp class="option">-mrelocatable</samp> or <samp class="option">-mrelocatable-lib</samp>. <samp class="option">-mrelocatable</samp> code aligns the stack to an 8-byte boundary. </p> </dd> <dt> + <span><code class="code">-mrelocatable-lib</code><a class="copiable-link" href="#index-mrelocatable-lib"> ¶</a></span> +</dt> <dt><code class="code">-mno-relocatable-lib</code></dt> <dd> +<p>Like <samp class="option">-mrelocatable</samp>, <samp class="option">-mrelocatable-lib</samp> generates a <code class="code">.fixup</code> section to allow static executables to be relocated at run time, but <samp class="option">-mrelocatable-lib</samp> does not use the smaller stack alignment of <samp class="option">-mrelocatable</samp>. Objects compiled with <samp class="option">-mrelocatable-lib</samp> may be linked with objects compiled with any combination of the <samp class="option">-mrelocatable</samp> options. </p> </dd> <dt> + <span><code class="code">-mno-toc</code><a class="copiable-link" href="#index-mno-toc"> ¶</a></span> +</dt> <dt><code class="code">-mtoc</code></dt> <dd> +<p>On System V.4 and embedded PowerPC systems do not (do) assume that register 2 contains a pointer to a global area pointing to the addresses used in the program. </p> </dd> <dt> + <span><code class="code">-mlittle</code><a class="copiable-link" href="#index-mlittle"> ¶</a></span> +</dt> <dt><code class="code">-mlittle-endian</code></dt> <dd> +<p>On System V.4 and embedded PowerPC systems compile code for the processor in little-endian mode. The <samp class="option">-mlittle-endian</samp> option is the same as <samp class="option">-mlittle</samp>. </p> </dd> <dt> + <span><code class="code">-mbig</code><a class="copiable-link" href="#index-mbig"> ¶</a></span> +</dt> <dt><code class="code">-mbig-endian</code></dt> <dd> +<p>On System V.4 and embedded PowerPC systems compile code for the processor in big-endian mode. The <samp class="option">-mbig-endian</samp> option is the same as <samp class="option">-mbig</samp>. </p> </dd> <dt> +<span><code class="code">-mdynamic-no-pic</code><a class="copiable-link" href="#index-mdynamic-no-pic"> ¶</a></span> +</dt> <dd> +<p>On Darwin and Mac OS X systems, compile code so that it is not relocatable, but that its external references are relocatable. The resulting code is suitable for applications, but not shared libraries. </p> </dd> <dt> +<span><code class="code">-msingle-pic-base</code><a class="copiable-link" href="#index-msingle-pic-base-1"> ¶</a></span> +</dt> <dd> +<p>Treat the register used for PIC addressing as read-only, rather than loading it in the prologue for each function. The runtime system is responsible for initializing this register with an appropriate value before execution begins. </p> </dd> <dt> +<span><code class="code">-mprioritize-restricted-insns=<var class="var">priority</var></code><a class="copiable-link" href="#index-mprioritize-restricted-insns"> ¶</a></span> +</dt> <dd> +<p>This option controls the priority that is assigned to dispatch-slot restricted instructions during the second scheduling pass. The argument <var class="var">priority</var> takes the value ‘<samp class="samp">0</samp>’, ‘<samp class="samp">1</samp>’, or ‘<samp class="samp">2</samp>’ to assign no, highest, or second-highest (respectively) priority to dispatch-slot restricted instructions. </p> </dd> <dt> +<span><code class="code">-msched-costly-dep=<var class="var">dependence_type</var></code><a class="copiable-link" href="#index-msched-costly-dep"> ¶</a></span> +</dt> <dd> +<p>This option controls which dependences are considered costly by the target during instruction scheduling. The argument <var class="var">dependence_type</var> takes one of the following values: </p> <dl class="table"> <dt>‘<samp class="samp">no</samp>’</dt> <dd> +<p>No dependence is costly. </p> </dd> <dt>‘<samp class="samp">all</samp>’</dt> <dd> +<p>All dependences are costly. </p> </dd> <dt>‘<samp class="samp">true_store_to_load</samp>’</dt> <dd> +<p>A true dependence from store to load is costly. </p> </dd> <dt>‘<samp class="samp">store_to_load</samp>’</dt> <dd> +<p>Any dependence from store to load is costly. </p> </dd> <dt><var class="var">number</var></dt> <dd><p>Any dependence for which the latency is greater than or equal to <var class="var">number</var> is costly. </p></dd> </dl> </dd> <dt> +<span><code class="code">-minsert-sched-nops=<var class="var">scheme</var></code><a class="copiable-link" href="#index-minsert-sched-nops"> ¶</a></span> +</dt> <dd> +<p>This option controls which NOP insertion scheme is used during the second scheduling pass. The argument <var class="var">scheme</var> takes one of the following values: </p> <dl class="table"> <dt>‘<samp class="samp">no</samp>’</dt> <dd> +<p>Don’t insert NOPs. </p> </dd> <dt>‘<samp class="samp">pad</samp>’</dt> <dd> +<p>Pad with NOPs any dispatch group that has vacant issue slots, according to the scheduler’s grouping. </p> </dd> <dt>‘<samp class="samp">regroup_exact</samp>’</dt> <dd> +<p>Insert NOPs to force costly dependent insns into separate groups. Insert exactly as many NOPs as needed to force an insn to a new group, according to the estimated processor grouping. </p> </dd> <dt><var class="var">number</var></dt> <dd><p>Insert NOPs to force costly dependent insns into separate groups. Insert <var class="var">number</var> NOPs to force an insn to a new group. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mcall-sysv</code><a class="copiable-link" href="#index-mcall-sysv"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems compile code using calling conventions that adhere to the March 1995 draft of the System V Application Binary Interface, PowerPC processor supplement. This is the default unless you configured GCC using ‘<samp class="samp">powerpc-*-eabiaix</samp>’. </p> </dd> <dt> + <span><code class="code">-mcall-sysv-eabi</code><a class="copiable-link" href="#index-mcall-sysv-eabi"> ¶</a></span> +</dt> <dt><code class="code">-mcall-eabi</code></dt> <dd> +<p>Specify both <samp class="option">-mcall-sysv</samp> and <samp class="option">-meabi</samp> options. </p> </dd> <dt> +<span><code class="code">-mcall-sysv-noeabi</code><a class="copiable-link" href="#index-mcall-sysv-noeabi"> ¶</a></span> +</dt> <dd> +<p>Specify both <samp class="option">-mcall-sysv</samp> and <samp class="option">-mno-eabi</samp> options. </p> </dd> <dt> +<span><code class="code">-mcall-aixdesc</code><a class="copiable-link" href="#index-mcall-aixdesc"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems compile code for the AIX operating system. </p> </dd> <dt> +<span><code class="code">-mcall-linux</code><a class="copiable-link" href="#index-mcall-linux"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems compile code for the Linux-based GNU system. </p> </dd> <dt> +<span><code class="code">-mcall-freebsd</code><a class="copiable-link" href="#index-mcall-freebsd"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems compile code for the FreeBSD operating system. </p> </dd> <dt> +<span><code class="code">-mcall-netbsd</code><a class="copiable-link" href="#index-mcall-netbsd"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems compile code for the NetBSD operating system. </p> </dd> <dt> +<span><code class="code">-mcall-openbsd</code><a class="copiable-link" href="#index-mcall-openbsd"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems compile code for the OpenBSD operating system. </p> </dd> <dt> +<span><code class="code">-mtraceback=<var class="var">traceback_type</var></code><a class="copiable-link" href="#index-mtraceback"> ¶</a></span> +</dt> <dd> +<p>Select the type of traceback table. Valid values for <var class="var">traceback_type</var> are ‘<samp class="samp">full</samp>’, ‘<samp class="samp">part</samp>’, and ‘<samp class="samp">no</samp>’. </p> </dd> <dt> +<span><code class="code">-maix-struct-return</code><a class="copiable-link" href="#index-maix-struct-return"> ¶</a></span> +</dt> <dd> +<p>Return all structures in memory (as specified by the AIX ABI). </p> </dd> <dt> +<span><code class="code">-msvr4-struct-return</code><a class="copiable-link" href="#index-msvr4-struct-return"> ¶</a></span> +</dt> <dd> +<p>Return structures smaller than 8 bytes in registers (as specified by the SVR4 ABI). </p> </dd> <dt> +<span><code class="code">-mabi=<var class="var">abi-type</var></code><a class="copiable-link" href="#index-mabi-5"> ¶</a></span> +</dt> <dd> +<p>Extend the current ABI with a particular extension, or remove such extension. Valid values are: ‘<samp class="samp">altivec</samp>’, ‘<samp class="samp">no-altivec</samp>’, ‘<samp class="samp">ibmlongdouble</samp>’, ‘<samp class="samp">ieeelongdouble</samp>’, ‘<samp class="samp">elfv1</samp>’, ‘<samp class="samp">elfv2</samp>’, and for AIX: ‘<samp class="samp">vec-extabi</samp>’, ‘<samp class="samp">vec-default</samp>’. </p> </dd> <dt> +<span><code class="code">-mabi=ibmlongdouble</code><a class="copiable-link" href="#index-mabi_003dibmlongdouble"> ¶</a></span> +</dt> <dd> +<p>Change the current ABI to use IBM extended-precision long double. This is not likely to work if your system defaults to using IEEE extended-precision long double. If you change the long double type from IEEE extended-precision, the compiler will issue a warning unless you use the <samp class="option">-Wno-psabi</samp> option. Requires <samp class="option">-mlong-double-128</samp> to be enabled. </p> </dd> <dt> +<span><code class="code">-mabi=ieeelongdouble</code><a class="copiable-link" href="#index-mabi_003dieeelongdouble"> ¶</a></span> +</dt> <dd> +<p>Change the current ABI to use IEEE extended-precision long double. This is not likely to work if your system defaults to using IBM extended-precision long double. If you change the long double type from IBM extended-precision, the compiler will issue a warning unless you use the <samp class="option">-Wno-psabi</samp> option. Requires <samp class="option">-mlong-double-128</samp> to be enabled. </p> </dd> <dt> +<span><code class="code">-mabi=elfv1</code><a class="copiable-link" href="#index-mabi_003delfv1"> ¶</a></span> +</dt> <dd> +<p>Change the current ABI to use the ELFv1 ABI. This is the default ABI for big-endian PowerPC 64-bit Linux. Overriding the default ABI requires special system support and is likely to fail in spectacular ways. </p> </dd> <dt> +<span><code class="code">-mabi=elfv2</code><a class="copiable-link" href="#index-mabi_003delfv2"> ¶</a></span> +</dt> <dd> +<p>Change the current ABI to use the ELFv2 ABI. This is the default ABI for little-endian PowerPC 64-bit Linux. Overriding the default ABI requires special system support and is likely to fail in spectacular ways. </p> </dd> <dt> + <span><code class="code">-mgnu-attribute</code><a class="copiable-link" href="#index-mgnu-attribute"> ¶</a></span> +</dt> <dt><code class="code">-mno-gnu-attribute</code></dt> <dd> +<p>Emit .gnu_attribute assembly directives to set tag/value pairs in a .gnu.attributes section that specify ABI variations in function parameters or return values. </p> </dd> <dt> + <span><code class="code">-mprototype</code><a class="copiable-link" href="#index-mprototype"> ¶</a></span> +</dt> <dt><code class="code">-mno-prototype</code></dt> <dd> +<p>On System V.4 and embedded PowerPC systems assume that all calls to variable argument functions are properly prototyped. Otherwise, the compiler must insert an instruction before every non-prototyped call to set or clear bit 6 of the condition code register (<code class="code">CR</code>) to indicate whether floating-point values are passed in the floating-point registers in case the function takes variable arguments. With <samp class="option">-mprototype</samp>, only calls to prototyped variable argument functions set or clear the bit. </p> </dd> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-7"> ¶</a></span> +</dt> <dd> +<p>On embedded PowerPC systems, assume that the startup module is called <samp class="file">sim-crt0.o</samp> and that the standard C libraries are <samp class="file">libsim.a</samp> and <samp class="file">libc.a</samp>. This is the default for ‘<samp class="samp">powerpc-*-eabisim</samp>’ configurations. </p> </dd> <dt> +<span><code class="code">-mmvme</code><a class="copiable-link" href="#index-mmvme"> ¶</a></span> +</dt> <dd> +<p>On embedded PowerPC systems, assume that the startup module is called <samp class="file">crt0.o</samp> and the standard C libraries are <samp class="file">libmvme.a</samp> and <samp class="file">libc.a</samp>. </p> </dd> <dt> +<span><code class="code">-mads</code><a class="copiable-link" href="#index-mads"> ¶</a></span> +</dt> <dd> +<p>On embedded PowerPC systems, assume that the startup module is called <samp class="file">crt0.o</samp> and the standard C libraries are <samp class="file">libads.a</samp> and <samp class="file">libc.a</samp>. </p> </dd> <dt> +<span><code class="code">-myellowknife</code><a class="copiable-link" href="#index-myellowknife"> ¶</a></span> +</dt> <dd> +<p>On embedded PowerPC systems, assume that the startup module is called <samp class="file">crt0.o</samp> and the standard C libraries are <samp class="file">libyk.a</samp> and <samp class="file">libc.a</samp>. </p> </dd> <dt> +<span><code class="code">-mvxworks</code><a class="copiable-link" href="#index-mvxworks"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems, specify that you are compiling for a VxWorks system. </p> </dd> <dt> +<span><code class="code">-memb</code><a class="copiable-link" href="#index-memb"> ¶</a></span> +</dt> <dd> +<p>On embedded PowerPC systems, set the <code class="code">PPC_EMB</code> bit in the ELF flags header to indicate that ‘<samp class="samp">eabi</samp>’ extended relocations are used. </p> </dd> <dt> + <span><code class="code">-meabi</code><a class="copiable-link" href="#index-meabi"> ¶</a></span> +</dt> <dt><code class="code">-mno-eabi</code></dt> <dd> +<p>On System V.4 and embedded PowerPC systems do (do not) adhere to the Embedded Applications Binary Interface (EABI), which is a set of modifications to the System V.4 specifications. Selecting <samp class="option">-meabi</samp> means that the stack is aligned to an 8-byte boundary, a function <code class="code">__eabi</code> is called from <code class="code">main</code> to set up the EABI environment, and the <samp class="option">-msdata</samp> option can use both <code class="code">r2</code> and <code class="code">r13</code> to point to two separate small data areas. Selecting <samp class="option">-mno-eabi</samp> means that the stack is aligned to a 16-byte boundary, no EABI initialization function is called from <code class="code">main</code>, and the <samp class="option">-msdata</samp> option only uses <code class="code">r13</code> to point to a single small data area. The <samp class="option">-meabi</samp> option is on by default if you configured GCC using one of the ‘<samp class="samp">powerpc*-*-eabi*</samp>’ options. </p> </dd> <dt> +<span><code class="code">-msdata=eabi</code><a class="copiable-link" href="#index-msdata_003deabi"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems, put small initialized <code class="code">const</code> global and static data in the <code class="code">.sdata2</code> section, which is pointed to by register <code class="code">r2</code>. Put small initialized non-<code class="code">const</code> global and static data in the <code class="code">.sdata</code> section, which is pointed to by register <code class="code">r13</code>. Put small uninitialized global and static data in the <code class="code">.sbss</code> section, which is adjacent to the <code class="code">.sdata</code> section. The <samp class="option">-msdata=eabi</samp> option is incompatible with the <samp class="option">-mrelocatable</samp> option. The <samp class="option">-msdata=eabi</samp> option also sets the <samp class="option">-memb</samp> option. </p> </dd> <dt> +<span><code class="code">-msdata=sysv</code><a class="copiable-link" href="#index-msdata_003dsysv"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems, put small global and static data in the <code class="code">.sdata</code> section, which is pointed to by register <code class="code">r13</code>. Put small uninitialized global and static data in the <code class="code">.sbss</code> section, which is adjacent to the <code class="code">.sdata</code> section. The <samp class="option">-msdata=sysv</samp> option is incompatible with the <samp class="option">-mrelocatable</samp> option. </p> </dd> <dt> + <span><code class="code">-msdata=default</code><a class="copiable-link" href="#index-msdata_003ddefault-1"> ¶</a></span> +</dt> <dt><code class="code">-msdata</code></dt> <dd> +<p>On System V.4 and embedded PowerPC systems, if <samp class="option">-meabi</samp> is used, compile code the same as <samp class="option">-msdata=eabi</samp>, otherwise compile code the same as <samp class="option">-msdata=sysv</samp>. </p> </dd> <dt> +<span><code class="code">-msdata=data</code><a class="copiable-link" href="#index-msdata_003ddata"> ¶</a></span> +</dt> <dd> +<p>On System V.4 and embedded PowerPC systems, put small global data in the <code class="code">.sdata</code> section. Put small uninitialized global data in the <code class="code">.sbss</code> section. Do not use register <code class="code">r13</code> to address small data however. This is the default behavior unless other <samp class="option">-msdata</samp> options are used. </p> </dd> <dt> + <span><code class="code">-msdata=none</code><a class="copiable-link" href="#index-msdata_003dnone-2"> ¶</a></span> +</dt> <dt><code class="code">-mno-sdata</code></dt> <dd> +<p>On embedded PowerPC systems, put all initialized global and static data in the <code class="code">.data</code> section, and all uninitialized data in the <code class="code">.bss</code> section. </p> </dd> <dt> + <span><code class="code">-mreadonly-in-sdata</code><a class="copiable-link" href="#index-mreadonly-in-sdata"> ¶</a></span> +</dt> <dd> +<p>Put read-only objects in the <code class="code">.sdata</code> section as well. This is the default. </p> </dd> <dt> +<span><code class="code">-mblock-move-inline-limit=<var class="var">num</var></code><a class="copiable-link" href="#index-mblock-move-inline-limit"> ¶</a></span> +</dt> <dd> +<p>Inline all block moves (such as calls to <code class="code">memcpy</code> or structure copies) less than or equal to <var class="var">num</var> bytes. The minimum value for <var class="var">num</var> is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The default value is target-specific. </p> </dd> <dt> +<span><code class="code">-mblock-compare-inline-limit=<var class="var">num</var></code><a class="copiable-link" href="#index-mblock-compare-inline-limit"> ¶</a></span> +</dt> <dd> +<p>Generate non-looping inline code for all block compares (such as calls to <code class="code">memcmp</code> or structure compares) less than or equal to <var class="var">num</var> bytes. If <var class="var">num</var> is 0, all inline expansion (non-loop and loop) of block compare is disabled. The default value is target-specific. </p> </dd> <dt> +<span><code class="code">-mblock-compare-inline-loop-limit=<var class="var">num</var></code><a class="copiable-link" href="#index-mblock-compare-inline-loop-limit"> ¶</a></span> +</dt> <dd> +<p>Generate an inline expansion using loop code for all block compares that are less than or equal to <var class="var">num</var> bytes, but greater than the limit for non-loop inline block compare expansion. If the block length is not constant, at most <var class="var">num</var> bytes will be compared before <code class="code">memcmp</code> is called to compare the remainder of the block. The default value is target-specific. </p> </dd> <dt> +<span><code class="code">-mstring-compare-inline-limit=<var class="var">num</var></code><a class="copiable-link" href="#index-mstring-compare-inline-limit"> ¶</a></span> +</dt> <dd> +<p>Compare at most <var class="var">num</var> string bytes with inline code. If the difference or end of string is not found at the end of the inline compare a call to <code class="code">strcmp</code> or <code class="code">strncmp</code> will take care of the rest of the comparison. The default is 64 bytes. </p> </dd> <dt> + <span><code class="code">-G <var class="var">num</var></code><a class="copiable-link" href="#index-G-4"> ¶</a></span> +</dt> <dd> +<p>On embedded PowerPC systems, put global and static items less than or equal to <var class="var">num</var> bytes into the small data or BSS sections instead of the normal data or BSS section. By default, <var class="var">num</var> is 8. The <samp class="option">-G <var class="var">num</var></samp> switch is also passed to the linker. All modules should be compiled with the same <samp class="option">-G <var class="var">num</var></samp> value. </p> </dd> <dt> + <span><code class="code">-mregnames</code><a class="copiable-link" href="#index-mregnames"> ¶</a></span> +</dt> <dt><code class="code">-mno-regnames</code></dt> <dd> +<p>On System V.4 and embedded PowerPC systems do (do not) emit register names in the assembly language output using symbolic forms. </p> </dd> <dt> + <span><code class="code">-mlongcall</code><a class="copiable-link" href="#index-mlongcall"> ¶</a></span> +</dt> <dt><code class="code">-mno-longcall</code></dt> <dd> +<p>By default assume that all calls are far away so that a longer and more expensive calling sequence is required. This is required for calls farther than 32 megabytes (33,554,432 bytes) from the current location. A short call is generated if the compiler knows the call cannot be that far away. This setting can be overridden by the <code class="code">shortcall</code> function attribute, or by <code class="code">#pragma +longcall(0)</code>. </p> <p>Some linkers are capable of detecting out-of-range calls and generating glue code on the fly. On these systems, long calls are unnecessary and generate slower code. As of this writing, the AIX linker can do this, as can the GNU linker for PowerPC/64. It is planned to add this feature to the GNU linker for 32-bit PowerPC systems as well. </p> <p>On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers, GCC can generate long calls using an inline PLT call sequence (see <samp class="option">-mpltseq</samp>). PowerPC with <samp class="option">-mbss-plt</samp> and PowerPC64 ELFv1 (big-endian) do not support inline PLT calls. </p> <p>On Darwin/PPC systems, <code class="code">#pragma longcall</code> generates <code class="code">jbsr +callee, L42</code>, plus a <em class="dfn">branch island</em> (glue code). The two target addresses represent the callee and the branch island. The Darwin/PPC linker prefers the first address and generates a <code class="code">bl +callee</code> if the PPC <code class="code">bl</code> instruction reaches the callee directly; otherwise, the linker generates <code class="code">bl L42</code> to call the branch island. The branch island is appended to the body of the calling function; it computes the full 32-bit address of the callee and jumps to it. </p> <p>On Mach-O (Darwin) systems, this option directs the compiler emit to the glue for every direct call, and the Darwin linker decides whether to use or discard it. </p> <p>In the future, GCC may ignore all longcall specifications when the linker is known to generate glue. </p> </dd> <dt> + <span><code class="code">-mpltseq</code><a class="copiable-link" href="#index-mpltseq"> ¶</a></span> +</dt> <dt><code class="code">-mno-pltseq</code></dt> <dd> +<p>Implement (do not implement) -fno-plt and long calls using an inline PLT call sequence that supports lazy linking and long calls to functions in dlopen’d shared libraries. Inline PLT calls are only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers, and are enabled by default if the support is detected when configuring GCC, and, in the case of 32-bit PowerPC, if GCC is configured with <samp class="option">--enable-secureplt</samp>. <samp class="option">-mpltseq</samp> code and <samp class="option">-mbss-plt</samp> 32-bit PowerPC relocatable objects may not be linked together. </p> </dd> <dt> + <span><code class="code">-mtls-markers</code><a class="copiable-link" href="#index-mtls-markers"> ¶</a></span> +</dt> <dt><code class="code">-mno-tls-markers</code></dt> <dd> +<p>Mark (do not mark) calls to <code class="code">__tls_get_addr</code> with a relocation specifying the function argument. The relocation allows the linker to reliably associate function call with argument setup instructions for TLS optimization, which in turn allows GCC to better schedule the sequence. </p> </dd> <dt> +<span><code class="code">-mrecip</code><a class="copiable-link" href="#index-mrecip"> ¶</a></span> +</dt> <dt><code class="code">-mno-recip</code></dt> <dd> +<p>This option enables use of the reciprocal estimate and reciprocal square root estimate instructions with additional Newton-Raphson steps to increase precision instead of doing a divide or square root and divide for floating-point arguments. You should use the <samp class="option">-ffast-math</samp> option when using <samp class="option">-mrecip</samp> (or at least <samp class="option">-funsafe-math-optimizations</samp>, <samp class="option">-ffinite-math-only</samp>, <samp class="option">-freciprocal-math</samp> and <samp class="option">-fno-trapping-math</samp>). Note that while the throughput of the sequence is generally higher than the throughput of the non-reciprocal instruction, the precision of the sequence can be decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994) for reciprocal square roots. </p> </dd> <dt> +<span><code class="code">-mrecip=<var class="var">opt</var></code><a class="copiable-link" href="#index-mrecip_003dopt"> ¶</a></span> +</dt> <dd> +<p>This option controls which reciprocal estimate instructions may be used. <var class="var">opt</var> is a comma-separated list of options, which may be preceded by a <code class="code">!</code> to invert the option: </p> <dl class="table"> <dt>‘<samp class="samp">all</samp>’</dt> <dd> +<p>Enable all estimate instructions. </p> </dd> <dt>‘<samp class="samp">default</samp>’</dt> <dd> +<p>Enable the default instructions, equivalent to <samp class="option">-mrecip</samp>. </p> </dd> <dt>‘<samp class="samp">none</samp>’</dt> <dd> +<p>Disable all estimate instructions, equivalent to <samp class="option">-mno-recip</samp>. </p> </dd> <dt>‘<samp class="samp">div</samp>’</dt> <dd> +<p>Enable the reciprocal approximation instructions for both single and double precision. </p> </dd> <dt>‘<samp class="samp">divf</samp>’</dt> <dd> +<p>Enable the single-precision reciprocal approximation instructions. </p> </dd> <dt>‘<samp class="samp">divd</samp>’</dt> <dd> +<p>Enable the double-precision reciprocal approximation instructions. </p> </dd> <dt>‘<samp class="samp">rsqrt</samp>’</dt> <dd> +<p>Enable the reciprocal square root approximation instructions for both single and double precision. </p> </dd> <dt>‘<samp class="samp">rsqrtf</samp>’</dt> <dd> +<p>Enable the single-precision reciprocal square root approximation instructions. </p> </dd> <dt>‘<samp class="samp">rsqrtd</samp>’</dt> <dd> +<p>Enable the double-precision reciprocal square root approximation instructions. </p> </dd> </dl> <p>So, for example, <samp class="option">-mrecip=all,!rsqrtd</samp> enables all of the reciprocal estimate instructions, except for the <code class="code">FRSQRTE</code>, <code class="code">XSRSQRTEDP</code>, and <code class="code">XVRSQRTEDP</code> instructions which handle the double-precision reciprocal square root calculations. </p> </dd> <dt> +<span><code class="code">-mrecip-precision</code><a class="copiable-link" href="#index-mrecip-precision"> ¶</a></span> +</dt> <dt><code class="code">-mno-recip-precision</code></dt> <dd> +<p>Assume (do not assume) that the reciprocal estimate instructions provide higher-precision estimates than is mandated by the PowerPC ABI. Selecting <samp class="option">-mcpu=power6</samp>, <samp class="option">-mcpu=power7</samp> or <samp class="option">-mcpu=power8</samp> automatically selects <samp class="option">-mrecip-precision</samp>. The double-precision square root estimate instructions are not generated by default on low-precision machines, since they do not provide an estimate that converges after three steps. </p> </dd> <dt> +<span><code class="code">-mveclibabi=<var class="var">type</var></code><a class="copiable-link" href="#index-mveclibabi"> ¶</a></span> +</dt> <dd> +<p>Specifies the ABI type to use for vectorizing intrinsics using an external library. The only type supported at present is ‘<samp class="samp">mass</samp>’, which specifies to use IBM’s Mathematical Acceleration Subsystem (MASS) libraries for vectorizing intrinsics using external libraries. GCC currently emits calls to <code class="code">acosd2</code>, <code class="code">acosf4</code>, <code class="code">acoshd2</code>, <code class="code">acoshf4</code>, <code class="code">asind2</code>, <code class="code">asinf4</code>, <code class="code">asinhd2</code>, <code class="code">asinhf4</code>, <code class="code">atan2d2</code>, <code class="code">atan2f4</code>, <code class="code">atand2</code>, <code class="code">atanf4</code>, <code class="code">atanhd2</code>, <code class="code">atanhf4</code>, <code class="code">cbrtd2</code>, <code class="code">cbrtf4</code>, <code class="code">cosd2</code>, <code class="code">cosf4</code>, <code class="code">coshd2</code>, <code class="code">coshf4</code>, <code class="code">erfcd2</code>, <code class="code">erfcf4</code>, <code class="code">erfd2</code>, <code class="code">erff4</code>, <code class="code">exp2d2</code>, <code class="code">exp2f4</code>, <code class="code">expd2</code>, <code class="code">expf4</code>, <code class="code">expm1d2</code>, <code class="code">expm1f4</code>, <code class="code">hypotd2</code>, <code class="code">hypotf4</code>, <code class="code">lgammad2</code>, <code class="code">lgammaf4</code>, <code class="code">log10d2</code>, <code class="code">log10f4</code>, <code class="code">log1pd2</code>, <code class="code">log1pf4</code>, <code class="code">log2d2</code>, <code class="code">log2f4</code>, <code class="code">logd2</code>, <code class="code">logf4</code>, <code class="code">powd2</code>, <code class="code">powf4</code>, <code class="code">sind2</code>, <code class="code">sinf4</code>, <code class="code">sinhd2</code>, <code class="code">sinhf4</code>, <code class="code">sqrtd2</code>, <code class="code">sqrtf4</code>, <code class="code">tand2</code>, <code class="code">tanf4</code>, <code class="code">tanhd2</code>, and <code class="code">tanhf4</code> when generating code for power7. Both <samp class="option">-ftree-vectorize</samp> and <samp class="option">-funsafe-math-optimizations</samp> must also be enabled. The MASS libraries must be specified at link time. </p> </dd> <dt> +<span><code class="code">-mfriz</code><a class="copiable-link" href="#index-mfriz"> ¶</a></span> +</dt> <dt><code class="code">-mno-friz</code></dt> <dd> +<p>Generate (do not generate) the <code class="code">friz</code> instruction when the <samp class="option">-funsafe-math-optimizations</samp> option is used to optimize rounding of floating-point values to 64-bit integer and back to floating point. The <code class="code">friz</code> instruction does not return the same value if the floating-point number is too large to fit in an integer. </p> </dd> <dt> +<span><code class="code">-mpointers-to-nested-functions</code><a class="copiable-link" href="#index-mpointers-to-nested-functions"> ¶</a></span> +</dt> <dt><code class="code">-mno-pointers-to-nested-functions</code></dt> <dd> +<p>Generate (do not generate) code to load up the static chain register (<code class="code">r11</code>) when calling through a pointer on AIX and 64-bit Linux systems where a function pointer points to a 3-word descriptor giving the function address, TOC value to be loaded in register <code class="code">r2</code>, and static chain value to be loaded in register <code class="code">r11</code>. The <samp class="option">-mpointers-to-nested-functions</samp> is on by default. You cannot call through pointers to nested functions or pointers to functions compiled in other languages that use the static chain if you use <samp class="option">-mno-pointers-to-nested-functions</samp>. </p> </dd> <dt> +<span><code class="code">-msave-toc-indirect</code><a class="copiable-link" href="#index-msave-toc-indirect"> ¶</a></span> +</dt> <dt><code class="code">-mno-save-toc-indirect</code></dt> <dd> +<p>Generate (do not generate) code to save the TOC value in the reserved stack location in the function prologue if the function calls through a pointer on AIX and 64-bit Linux systems. If the TOC value is not saved in the prologue, it is saved just before the call through the pointer. The <samp class="option">-mno-save-toc-indirect</samp> option is the default. </p> </dd> <dt> +<span><code class="code">-mcompat-align-parm</code><a class="copiable-link" href="#index-mcompat-align-parm"> ¶</a></span> +</dt> <dt><code class="code">-mno-compat-align-parm</code></dt> <dd> +<p>Generate (do not generate) code to pass structure parameters with a maximum alignment of 64 bits, for compatibility with older versions of GCC. </p> <p>Older versions of GCC (prior to 4.9.0) incorrectly did not align a structure parameter on a 128-bit boundary when that structure contained a member requiring 128-bit alignment. This is corrected in more recent versions of GCC. This option may be used to generate code that is compatible with functions compiled with older versions of GCC. </p> <p>The <samp class="option">-mno-compat-align-parm</samp> option is the default. </p> </dd> <dt> + <span><code class="code">-mstack-protector-guard=<var class="var">guard</var></code><a class="copiable-link" href="#index-mstack-protector-guard-3"> ¶</a></span> +</dt> <dt><code class="code">-mstack-protector-guard-reg=<var class="var">reg</var></code></dt> <dt><code class="code">-mstack-protector-guard-offset=<var class="var">offset</var></code></dt> <dt><code class="code">-mstack-protector-guard-symbol=<var class="var">symbol</var></code></dt> <dd> +<p>Generate stack protection code using canary at <var class="var">guard</var>. Supported locations are ‘<samp class="samp">global</samp>’ for global canary or ‘<samp class="samp">tls</samp>’ for per-thread canary in the TLS block (the default with GNU libc version 2.4 or later). </p> <p>With the latter choice the options <samp class="option">-mstack-protector-guard-reg=<var class="var">reg</var></samp> and <samp class="option">-mstack-protector-guard-offset=<var class="var">offset</var></samp> furthermore specify which register to use as base register for reading the canary, and from what offset from that base register. The default for those is as specified in the relevant ABI. <samp class="option">-mstack-protector-guard-symbol=<var class="var">symbol</var></samp> overrides the offset with a symbol reference to a canary in the TLS block. </p> </dd> <dt> + <span><code class="code">-mpcrel</code><a class="copiable-link" href="#index-mpcrel-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-pcrel</code></dt> <dd> +<p>Generate (do not generate) pc-relative addressing. The <samp class="option">-mpcrel</samp> option requires that the medium code model (<samp class="option">-mcmodel=medium</samp>) and prefixed addressing (<samp class="option">-mprefixed</samp>) options are enabled. </p> </dd> <dt> + <span><code class="code">-mprefixed</code><a class="copiable-link" href="#index-mprefixed"> ¶</a></span> +</dt> <dt><code class="code">-mno-prefixed</code></dt> <dd> +<p>Generate (do not generate) addressing modes using prefixed load and store instructions. The <samp class="option">-mprefixed</samp> option requires that the option <samp class="option">-mcpu=power10</samp> (or later) is enabled. </p> </dd> <dt> + <span><code class="code">-mmma</code><a class="copiable-link" href="#index-mmma"> ¶</a></span> +</dt> <dt><code class="code">-mno-mma</code></dt> <dd> +<p>Generate (do not generate) the MMA instructions. The <samp class="option">-mma</samp> option requires that the option <samp class="option">-mcpu=power10</samp> (or later) is enabled. </p> </dd> <dt> + <span><code class="code">-mrop-protect</code><a class="copiable-link" href="#index-mrop-protect"> ¶</a></span> +</dt> <dt><code class="code">-mno-rop-protect</code></dt> <dd> +<p>Generate (do not generate) ROP protection instructions when the target processor supports them. Currently this option disables the shrink-wrap optimization (<samp class="option">-fshrink-wrap</samp>). </p> </dd> <dt> + <span><code class="code">-mprivileged</code><a class="copiable-link" href="#index-mprivileged"> ¶</a></span> +</dt> <dt><code class="code">-mno-privileged</code></dt> <dd> +<p>Generate (do not generate) code that will run in privileged state. </p> </dd> <dt> + <span><code class="code">-mblock-ops-unaligned-vsx</code><a class="copiable-link" href="#index-block-ops-unaligned-vsx"> ¶</a></span> +</dt> <dt><code class="code">-mno-block-ops-unaligned-vsx</code></dt> <dd> +<p>Generate (do not generate) unaligned vsx loads and stores for inline expansion of <code class="code">memcpy</code> and <code class="code">memmove</code>. </p> </dd> <dt><code class="code">--param rs6000-vect-unroll-limit=</code></dt> <dd> +<p>The vectorizer will check with target information to determine whether it would be beneficial to unroll the main vectorized loop and by how much. This parameter sets the upper bound of how much the vectorizer will unroll the main loop. The default value is four. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="rx-options">RX Options</a>, Previous: <a href="rl78-options">RL78 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RS_002f6000-and-PowerPC-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RS_002f6000-and-PowerPC-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/rs_002f6000-and-powerpc-pragmas.html b/devdocs/gcc~13/rs_002f6000-and-powerpc-pragmas.html new file mode 100644 index 00000000..fcdcaccd --- /dev/null +++ b/devdocs/gcc~13/rs_002f6000-and-powerpc-pragmas.html @@ -0,0 +1,9 @@ +<div class="subsection-level-extent" id="RS_002f6000-and-PowerPC-Pragmas"> <div class="nav-panel"> <p> Next: <a href="s_002f390-pragmas" accesskey="n" rel="next">S/390 Pragmas</a>, Previous: <a href="pru-pragmas" accesskey="p" rel="prev">PRU Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RS_002f6000-and-PowerPC-Pragmas-1"><span>6.62.5 RS/6000 and PowerPC Pragmas<a class="copiable-link" href="#RS_002f6000-and-PowerPC-Pragmas-1"> ¶</a></span></h1> <p>The RS/6000 and PowerPC targets define one pragma for controlling whether or not the <code class="code">longcall</code> attribute is added to function declarations by default. This pragma overrides the <samp class="option">-mlongcall</samp> option, but not the <code class="code">longcall</code> and <code class="code">shortcall</code> attributes. See <a class="xref" href="rs_002f6000-and-powerpc-options">IBM RS/6000 and PowerPC Options</a>, for more information about when long calls are and are not necessary. </p> <dl class="table"> <dt> +<span><code class="code">longcall (1)</code><a class="copiable-link" href="#index-pragma_002c-longcall"> ¶</a></span> +</dt> <dd> +<p>Apply the <code class="code">longcall</code> attribute to all subsequent function declarations. </p> </dd> <dt><code class="code">longcall (0)</code></dt> <dd><p>Do not apply the <code class="code">longcall</code> attribute to subsequent function declarations. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RS_002f6000-and-PowerPC-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RS_002f6000-and-PowerPC-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/rx-built-in-functions.html b/devdocs/gcc~13/rx-built-in-functions.html new file mode 100644 index 00000000..1d6bce8e --- /dev/null +++ b/devdocs/gcc~13/rx-built-in-functions.html @@ -0,0 +1,69 @@ +<div class="subsection-level-extent" id="RX-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="s_002f390-system-z-built-in-functions" accesskey="n" rel="next">S/390 System z Built-in Functions</a>, Previous: <a href="risc-v-vector-intrinsics" accesskey="p" rel="prev">RISC-V Vector Intrinsics</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RX-Built-in-Functions-1"><span>6.60.30 RX Built-in Functions<a class="copiable-link" href="#RX-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC supports some of the RX instructions which cannot be expressed in the C programming language via the use of built-in functions. The following functions are supported: </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fbrk"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_brk</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fbrk"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">brk</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fclrpsw"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_clrpsw</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fclrpsw"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">clrpsw</code> machine instruction to clear the specified bit in the processor status word. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fint"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_int</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fint"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">int</code> machine instruction to generate an interrupt with the specified value. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmachi"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_machi</strong> <code class="def-code-arguments">(int, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmachi"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">machi</code> machine instruction to add the result of multiplying the top 16 bits of the two arguments into the accumulator. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmaclo"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_maclo</strong> <code class="def-code-arguments">(int, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmaclo"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">maclo</code> machine instruction to add the result of multiplying the bottom 16 bits of the two arguments into the accumulator. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmulhi"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_mulhi</strong> <code class="def-code-arguments">(int, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmulhi"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">mulhi</code> machine instruction to place the result of multiplying the top 16 bits of the two arguments into the accumulator. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmullo"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_mullo</strong> <code class="def-code-arguments">(int, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmullo"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">mullo</code> machine instruction to place the result of multiplying the bottom 16 bits of the two arguments into the accumulator. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmvfachi"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_rx_mvfachi</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmvfachi"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">mvfachi</code> machine instruction to read the top 32 bits of the accumulator. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmvfacmi"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_rx_mvfacmi</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmvfacmi"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">mvfacmi</code> machine instruction to read the middle 32 bits of the accumulator. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmvfc"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_rx_mvfc</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmvfc"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">mvfc</code> machine instruction which reads the control register specified in its argument and returns its value. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmvtachi"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_mvtachi</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmvtachi"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">mvtachi</code> machine instruction to set the top 32 bits of the accumulator. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmvtaclo"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_mvtaclo</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmvtaclo"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">mvtaclo</code> machine instruction to set the bottom 32 bits of the accumulator. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmvtc"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_mvtc</strong> <code class="def-code-arguments">(int reg, int val)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmvtc"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">mvtc</code> machine instruction which sets control register number <code class="code">reg</code> to <code class="code">val</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fmvtipl"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_mvtipl</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fmvtipl"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">mvtipl</code> machine instruction set the interrupt priority level. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fracw"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_racw</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fracw"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">racw</code> machine instruction to round the accumulator according to the specified mode. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005frevw"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_rx_revw</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005frevw"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">revw</code> machine instruction which swaps the bytes in the argument so that bits 0–7 now occupy bits 8–15 and vice versa, and also bits 16–23 occupy bits 24–31 and vice versa. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005frmpa"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_rmpa</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005frmpa"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">rmpa</code> machine instruction which initiates a repeated multiply and accumulate sequence. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fround"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_round</strong> <code class="def-code-arguments">(float)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fround"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">round</code> machine instruction which returns the floating-point argument rounded according to the current rounding mode set in the floating-point status word register. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fsat"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_rx_sat</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fsat"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">sat</code> machine instruction which returns the saturated value of the argument. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fsetpsw"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_setpsw</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fsetpsw"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">setpsw</code> machine instruction to set the specified bit in the processor status word. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005frx_005fwait"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_rx_wait</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005frx_005fwait"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">wait</code> machine instruction. </p></dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="s_002f390-system-z-built-in-functions">S/390 System z Built-in Functions</a>, Previous: <a href="risc-v-vector-intrinsics">RISC-V Vector Intrinsics</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RX-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RX-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/rx-function-attributes.html b/devdocs/gcc~13/rx-function-attributes.html new file mode 100644 index 00000000..8dae3a55 --- /dev/null +++ b/devdocs/gcc~13/rx-function-attributes.html @@ -0,0 +1,22 @@ +<div class="subsection-level-extent" id="RX-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="s_002f390-function-attributes" accesskey="n" rel="next">S/390 Function Attributes</a>, Previous: <a href="rl78-function-attributes" accesskey="p" rel="prev">RL78 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RX-Function-Attributes-1"><span>6.33.27 RX Function Attributes<a class="copiable-link" href="#RX-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the RX back end: </p> <dl class="table"> <dt> +<span><code class="code">fast_interrupt</code><a class="copiable-link" href="#index-fast_005finterrupt-function-attribute_002c-RX"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the RX port to indicate that the specified function is a fast interrupt handler. This is just like the <code class="code">interrupt</code> attribute, except that <code class="code">freit</code> is used to return instead of <code class="code">reit</code>. </p> </dd> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-RX"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> <p>On RX and RL78 targets, you may specify one or more vector numbers as arguments to the attribute, as well as naming an alternate table name. Parameters are handled sequentially, so one handler can be assigned to multiple entries in multiple tables. One may also pass the magic string <code class="code">"$default"</code> which causes the function to be used for any unfilled slots in the current table. </p> <p>This example shows a simple assignment of a function to one vector in the default table (note that preprocessor macros may be used for chip-specific symbolic vector names): </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __attribute__ ((interrupt (5))) txd1_handler ();</pre> +</div> <p>This example assigns a function to two slots in the default table (using preprocessor macros defined elsewhere) and makes it the default for the <code class="code">dct</code> table: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __attribute__ ((interrupt (RXD1_VECT,RXD2_VECT,"dct","$default"))) + txd1_handler ();</pre> +</div> </dd> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-RX"> ¶</a></span> +</dt> <dd> +<p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p> </dd> <dt> +<span><code class="code">vector</code><a class="copiable-link" href="#index-vector-function-attribute_002c-RX"> ¶</a></span> +</dt> <dd><p>This RX attribute is similar to the <code class="code">interrupt</code> attribute, including its parameters, but does not make the function an interrupt-handler type function (i.e. it retains the normal C function calling ABI). See the <code class="code">interrupt</code> attribute for a description of its arguments. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="s_002f390-function-attributes">S/390 Function Attributes</a>, Previous: <a href="rl78-function-attributes">RL78 Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RX-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RX-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/rx-options.html b/devdocs/gcc~13/rx-options.html new file mode 100644 index 00000000..38aa9c27 --- /dev/null +++ b/devdocs/gcc~13/rx-options.html @@ -0,0 +1,50 @@ +<div class="subsection-level-extent" id="RX-Options"> <div class="nav-panel"> <p> Next: <a href="s_002f390-and-zseries-options" accesskey="n" rel="next">S/390 and zSeries Options</a>, Previous: <a href="rs_002f6000-and-powerpc-options" accesskey="p" rel="prev">IBM RS/6000 and PowerPC Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="RX-Options-1"><span>3.19.43 RX Options<a class="copiable-link" href="#RX-Options-1"> ¶</a></span></h1> <p>These command-line options are defined for RX targets: </p> <dl class="table"> <dt> + <span><code class="code">-m64bit-doubles</code><a class="copiable-link" href="#index-m64bit-doubles-1"> ¶</a></span> +</dt> <dt><code class="code">-m32bit-doubles</code></dt> <dd> +<p>Make the <code class="code">double</code> data type be 64 bits (<samp class="option">-m64bit-doubles</samp>) or 32 bits (<samp class="option">-m32bit-doubles</samp>) in size. The default is <samp class="option">-m32bit-doubles</samp>. <em class="emph">Note</em> RX floating-point hardware only works on 32-bit values, which is why the default is <samp class="option">-m32bit-doubles</samp>. </p> </dd> <dt> + <span><code class="code">-fpu</code><a class="copiable-link" href="#index-fpu"> ¶</a></span> +</dt> <dt><code class="code">-nofpu</code></dt> <dd> +<p>Enables (<samp class="option">-fpu</samp>) or disables (<samp class="option">-nofpu</samp>) the use of RX floating-point hardware. The default is enabled for the RX600 series and disabled for the RX200 series. </p> <p>Floating-point instructions are only generated for 32-bit floating-point values, however, so the FPU hardware is not used for doubles if the <samp class="option">-m64bit-doubles</samp> option is used. </p> <p><em class="emph">Note</em> If the <samp class="option">-fpu</samp> option is enabled then <samp class="option">-funsafe-math-optimizations</samp> is also enabled automatically. This is because the RX FPU instructions are themselves unsafe. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">name</var></code><a class="copiable-link" href="#index-mcpu-11"> ¶</a></span> +</dt> <dd> +<p>Selects the type of RX CPU to be targeted. Currently three types are supported, the generic ‘<samp class="samp">RX600</samp>’ and ‘<samp class="samp">RX200</samp>’ series hardware and the specific ‘<samp class="samp">RX610</samp>’ CPU. The default is ‘<samp class="samp">RX600</samp>’. </p> <p>The only difference between ‘<samp class="samp">RX600</samp>’ and ‘<samp class="samp">RX610</samp>’ is that the ‘<samp class="samp">RX610</samp>’ does not support the <code class="code">MVTIPL</code> instruction. </p> <p>The ‘<samp class="samp">RX200</samp>’ series does not have a hardware floating-point unit and so <samp class="option">-nofpu</samp> is enabled by default when this type is selected. </p> </dd> <dt> + <span><code class="code">-mbig-endian-data</code><a class="copiable-link" href="#index-mbig-endian-data"> ¶</a></span> +</dt> <dt><code class="code">-mlittle-endian-data</code></dt> <dd> +<p>Store data (but not code) in the big-endian format. The default is <samp class="option">-mlittle-endian-data</samp>, i.e. to store data in the little-endian format. </p> </dd> <dt> +<span><code class="code">-msmall-data-limit=<var class="var">N</var></code><a class="copiable-link" href="#index-msmall-data-limit-2"> ¶</a></span> +</dt> <dd> +<p>Specifies the maximum size in bytes of global and static variables which can be placed into the small data area. Using the small data area can lead to smaller and faster code, but the size of area is limited and it is up to the programmer to ensure that the area does not overflow. Also when the small data area is used one of the RX’s registers (usually <code class="code">r13</code>) is reserved for use pointing to this area, so it is no longer available for use by the compiler. This could result in slower and/or larger code if variables are pushed onto the stack instead of being held in this register. </p> <p>Note, common variables (variables that have not been initialized) and constants are not placed into the small data area as they are assigned to other sections in the output executable. </p> <p>The default value is zero, which disables this feature. Note, this feature is not enabled by default with higher optimization levels (<samp class="option">-O2</samp> etc) because of the potentially detrimental effects of reserving a register. It is up to the programmer to experiment and discover whether this feature is of benefit to their program. See the description of the <samp class="option">-mpid</samp> option for a description of how the actual register to hold the small data area pointer is chosen. </p> </dd> <dt> + <span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-8"> ¶</a></span> +</dt> <dt><code class="code">-mno-sim</code></dt> <dd> +<p>Use the simulator runtime. The default is to use the libgloss board-specific runtime. </p> </dd> <dt> + <span><code class="code">-mas100-syntax</code><a class="copiable-link" href="#index-mas100-syntax"> ¶</a></span> +</dt> <dt><code class="code">-mno-as100-syntax</code></dt> <dd> +<p>When generating assembler output use a syntax that is compatible with Renesas’s AS100 assembler. This syntax can also be handled by the GAS assembler, but it has some restrictions so it is not generated by default. </p> </dd> <dt> +<span><code class="code">-mmax-constant-size=<var class="var">N</var></code><a class="copiable-link" href="#index-mmax-constant-size"> ¶</a></span> +</dt> <dd> +<p>Specifies the maximum size, in bytes, of a constant that can be used as an operand in a RX instruction. Although the RX instruction set does allow constants of up to 4 bytes in length to be used in instructions, a longer value equates to a longer instruction. Thus in some circumstances it can be beneficial to restrict the size of constants that are used in instructions. Constants that are too big are instead placed into a constant pool and referenced via register indirection. </p> <p>The value <var class="var">N</var> can be between 0 and 4. A value of 0 (the default) or 4 means that constants of any size are allowed. </p> </dd> <dt> +<span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax-6"> ¶</a></span> +</dt> <dd> +<p>Enable linker relaxation. Linker relaxation is a process whereby the linker attempts to reduce the size of a program by finding shorter versions of various instructions. Disabled by default. </p> </dd> <dt> +<span><code class="code">-mint-register=<var class="var">N</var></code><a class="copiable-link" href="#index-mint-register"> ¶</a></span> +</dt> <dd> +<p>Specify the number of registers to reserve for fast interrupt handler functions. The value <var class="var">N</var> can be between 0 and 4. A value of 1 means that register <code class="code">r13</code> is reserved for the exclusive use of fast interrupt handlers. A value of 2 reserves <code class="code">r13</code> and <code class="code">r12</code>. A value of 3 reserves <code class="code">r13</code>, <code class="code">r12</code> and <code class="code">r11</code>, and a value of 4 reserves <code class="code">r13</code> through <code class="code">r10</code>. A value of 0, the default, does not reserve any registers. </p> </dd> <dt> +<span><code class="code">-msave-acc-in-interrupts</code><a class="copiable-link" href="#index-msave-acc-in-interrupts"> ¶</a></span> +</dt> <dd> +<p>Specifies that interrupt handler functions should preserve the accumulator register. This is only necessary if normal code might use the accumulator register, for example because it performs 64-bit multiplications. The default is to ignore the accumulator as this makes the interrupt handlers faster. </p> </dd> <dt> + <span><code class="code">-mpid</code><a class="copiable-link" href="#index-mpid"> ¶</a></span> +</dt> <dt><code class="code">-mno-pid</code></dt> <dd> +<p>Enables the generation of position independent data. When enabled any access to constant data is done via an offset from a base address held in a register. This allows the location of constant data to be determined at run time without requiring the executable to be relocated, which is a benefit to embedded applications with tight memory constraints. Data that can be modified is not affected by this option. </p> <p>Note, using this feature reserves a register, usually <code class="code">r13</code>, for the constant data base address. This can result in slower and/or larger code, especially in complicated functions. </p> <p>The actual register chosen to hold the constant data base address depends upon whether the <samp class="option">-msmall-data-limit</samp> and/or the <samp class="option">-mint-register</samp> command-line options are enabled. Starting with register <code class="code">r13</code> and proceeding downwards, registers are allocated first to satisfy the requirements of <samp class="option">-mint-register</samp>, then <samp class="option">-mpid</samp> and finally <samp class="option">-msmall-data-limit</samp>. Thus it is possible for the small data area register to be <code class="code">r8</code> if both <samp class="option">-mint-register=4</samp> and <samp class="option">-mpid</samp> are specified on the command line. </p> <p>By default this feature is not enabled. The default can be restored via the <samp class="option">-mno-pid</samp> command-line option. </p> </dd> <dt> + <span><code class="code">-mno-warn-multiple-fast-interrupts</code><a class="copiable-link" href="#index-mno-warn-multiple-fast-interrupts"> ¶</a></span> +</dt> <dt><code class="code">-mwarn-multiple-fast-interrupts</code></dt> <dd> +<p>Prevents GCC from issuing a warning message if it finds more than one fast interrupt handler when it is compiling a file. The default is to issue a warning for each extra fast interrupt handler found, as the RX only supports one such interrupt. </p> </dd> <dt> + <span><code class="code">-mallow-string-insns</code><a class="copiable-link" href="#index-mallow-string-insns"> ¶</a></span> +</dt> <dt><code class="code">-mno-allow-string-insns</code></dt> <dd> +<p>Enables or disables the use of the string manipulation instructions <code class="code">SMOVF</code>, <code class="code">SCMPU</code>, <code class="code">SMOVB</code>, <code class="code">SMOVU</code>, <code class="code">SUNTIL</code> <code class="code">SWHILE</code> and also the <code class="code">RMPA</code> instruction. These instructions may prefetch data, which is not safe to do if accessing an I/O register. (See section 12.2.7 of the RX62N Group User’s Manual for more information). </p> <p>The default is to allow these instructions, but it is not possible for GCC to reliably detect all circumstances where a string instruction might be used to access an I/O register, so their use cannot be disabled automatically. Instead it is reliant upon the programmer to use the <samp class="option">-mno-allow-string-insns</samp> option if their program accesses I/O space. </p> <p>When the instructions are enabled GCC defines the C preprocessor symbol <code class="code">__RX_ALLOW_STRING_INSNS__</code>, otherwise it defines the symbol <code class="code">__RX_DISALLOW_STRING_INSNS__</code>. </p> </dd> <dt> + <span><code class="code">-mjsr</code><a class="copiable-link" href="#index-mjsr"> ¶</a></span> +</dt> <dt><code class="code">-mno-jsr</code></dt> <dd><p>Use only (or not only) <code class="code">JSR</code> instructions to access functions. This option can be used when code size exceeds the range of <code class="code">BSR</code> instructions. Note that <samp class="option">-mno-jsr</samp> does not mean to not use <code class="code">JSR</code> but instead means that any type of branch may be used. </p></dd> </dl> <p><em class="emph">Note:</em> The generic GCC command-line option <samp class="option">-ffixed-<var class="var">reg</var></samp> has special significance to the RX port when used with the <code class="code">interrupt</code> function attribute. This attribute indicates a function intended to process fast interrupts. GCC ensures that it only uses the registers <code class="code">r10</code>, <code class="code">r11</code>, <code class="code">r12</code> and/or <code class="code">r13</code> and only provided that the normal use of the corresponding registers have been restricted via the <samp class="option">-ffixed-<var class="var">reg</var></samp> or <samp class="option">-mint-register</samp> command-line options. </p> </div> <div class="nav-panel"> <p> Next: <a href="s_002f390-and-zseries-options">S/390 and zSeries Options</a>, Previous: <a href="rs_002f6000-and-powerpc-options">IBM RS/6000 and PowerPC Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RX-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/RX-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/s_002f390-and-zseries-options.html b/devdocs/gcc~13/s_002f390-and-zseries-options.html new file mode 100644 index 00000000..4a23e493 --- /dev/null +++ b/devdocs/gcc~13/s_002f390-and-zseries-options.html @@ -0,0 +1,73 @@ +<div class="subsection-level-extent" id="S_002f390-and-zSeries-Options"> <div class="nav-panel"> <p> Next: <a href="sh-options" accesskey="n" rel="next">SH Options</a>, Previous: <a href="rx-options" accesskey="p" rel="prev">RX Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="S_002f390-and-zSeries-Options-1"><span>3.19.44 S/390 and zSeries Options<a class="copiable-link" href="#S_002f390-and-zSeries-Options-1"> ¶</a></span></h1> <p>These are the ‘<samp class="samp">-m</samp>’ options defined for the S/390 and zSeries architecture. </p> <dl class="table"> <dt> + <span><code class="code">-mhard-float</code><a class="copiable-link" href="#index-mhard-float-7"> ¶</a></span> +</dt> <dt><code class="code">-msoft-float</code></dt> <dd> +<p>Use (do not use) the hardware floating-point instructions and registers for floating-point operations. When <samp class="option">-msoft-float</samp> is specified, functions in <samp class="file">libgcc.a</samp> are used to perform floating-point operations. When <samp class="option">-mhard-float</samp> is specified, the compiler generates IEEE floating-point instructions. This is the default. </p> </dd> <dt> + <span><code class="code">-mhard-dfp</code><a class="copiable-link" href="#index-mhard-dfp-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-hard-dfp</code></dt> <dd> +<p>Use (do not use) the hardware decimal-floating-point instructions for decimal-floating-point operations. When <samp class="option">-mno-hard-dfp</samp> is specified, functions in <samp class="file">libgcc.a</samp> are used to perform decimal-floating-point operations. When <samp class="option">-mhard-dfp</samp> is specified, the compiler generates decimal-floating-point hardware instructions. This is the default for <samp class="option">-march=z9-ec</samp> or higher. </p> </dd> <dt> + <span><code class="code">-mlong-double-64</code><a class="copiable-link" href="#index-mlong-double-64"> ¶</a></span> +</dt> <dt><code class="code">-mlong-double-128</code></dt> <dd> +<p>These switches control the size of <code class="code">long double</code> type. A size of 64 bits makes the <code class="code">long double</code> type equivalent to the <code class="code">double</code> type. This is the default. </p> </dd> <dt> + <span><code class="code">-mbackchain</code><a class="copiable-link" href="#index-mbackchain"> ¶</a></span> +</dt> <dt><code class="code">-mno-backchain</code></dt> <dd> +<p>Store (do not store) the address of the caller’s frame as backchain pointer into the callee’s stack frame. A backchain may be needed to allow debugging using tools that do not understand DWARF call frame information. When <samp class="option">-mno-packed-stack</samp> is in effect, the backchain pointer is stored at the bottom of the stack frame; when <samp class="option">-mpacked-stack</samp> is in effect, the backchain is placed into the topmost word of the 96/160 byte register save area. </p> <p>In general, code compiled with <samp class="option">-mbackchain</samp> is call-compatible with code compiled with <samp class="option">-mno-backchain</samp>; however, use of the backchain for debugging purposes usually requires that the whole binary is built with <samp class="option">-mbackchain</samp>. Note that the combination of <samp class="option">-mbackchain</samp>, <samp class="option">-mpacked-stack</samp> and <samp class="option">-mhard-float</samp> is not supported. In order to build a linux kernel use <samp class="option">-msoft-float</samp>. </p> <p>The default is to not maintain the backchain. </p> </dd> <dt> + <span><code class="code">-mpacked-stack</code><a class="copiable-link" href="#index-mpacked-stack"> ¶</a></span> +</dt> <dt><code class="code">-mno-packed-stack</code></dt> <dd> +<p>Use (do not use) the packed stack layout. When <samp class="option">-mno-packed-stack</samp> is specified, the compiler uses the all fields of the 96/160 byte register save area only for their default purpose; unused fields still take up stack space. When <samp class="option">-mpacked-stack</samp> is specified, register save slots are densely packed at the top of the register save area; unused space is reused for other purposes, allowing for more efficient use of the available stack space. However, when <samp class="option">-mbackchain</samp> is also in effect, the topmost word of the save area is always used to store the backchain, and the return address register is always saved two words below the backchain. </p> <p>As long as the stack frame backchain is not used, code generated with <samp class="option">-mpacked-stack</samp> is call-compatible with code generated with <samp class="option">-mno-packed-stack</samp>. Note that some non-FSF releases of GCC 2.95 for S/390 or zSeries generated code that uses the stack frame backchain at run time, not just for debugging purposes. Such code is not call-compatible with code compiled with <samp class="option">-mpacked-stack</samp>. Also, note that the combination of <samp class="option">-mbackchain</samp>, <samp class="option">-mpacked-stack</samp> and <samp class="option">-mhard-float</samp> is not supported. In order to build a linux kernel use <samp class="option">-msoft-float</samp>. </p> <p>The default is to not use the packed stack layout. </p> </dd> <dt> + <span><code class="code">-msmall-exec</code><a class="copiable-link" href="#index-msmall-exec"> ¶</a></span> +</dt> <dt><code class="code">-mno-small-exec</code></dt> <dd> +<p>Generate (or do not generate) code using the <code class="code">bras</code> instruction to do subroutine calls. This only works reliably if the total executable size does not exceed 64k. The default is to use the <code class="code">basr</code> instruction instead, which does not have this limitation. </p> </dd> <dt> + <span><code class="code">-m64</code><a class="copiable-link" href="#index-m64-2"> ¶</a></span> +</dt> <dt><code class="code">-m31</code></dt> <dd> +<p>When <samp class="option">-m31</samp> is specified, generate code compliant to the GNU/Linux for S/390 ABI. When <samp class="option">-m64</samp> is specified, generate code compliant to the GNU/Linux for zSeries ABI. This allows GCC in particular to generate 64-bit instructions. For the ‘<samp class="samp">s390</samp>’ targets, the default is <samp class="option">-m31</samp>, while the ‘<samp class="samp">s390x</samp>’ targets default to <samp class="option">-m64</samp>. </p> </dd> <dt> + <span><code class="code">-mzarch</code><a class="copiable-link" href="#index-mzarch"> ¶</a></span> +</dt> <dt><code class="code">-mesa</code></dt> <dd> +<p>When <samp class="option">-mzarch</samp> is specified, generate code using the instructions available on z/Architecture. When <samp class="option">-mesa</samp> is specified, generate code using the instructions available on ESA/390. Note that <samp class="option">-mesa</samp> is not possible with <samp class="option">-m64</samp>. When generating code compliant to the GNU/Linux for S/390 ABI, the default is <samp class="option">-mesa</samp>. When generating code compliant to the GNU/Linux for zSeries ABI, the default is <samp class="option">-mzarch</samp>. </p> </dd> <dt> + <span><code class="code">-mhtm</code><a class="copiable-link" href="#index-mhtm-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-htm</code></dt> <dd> +<p>The <samp class="option">-mhtm</samp> option enables a set of builtins making use of instructions available with the transactional execution facility introduced with the IBM zEnterprise EC12 machine generation <a class="ref" href="s_002f390-system-z-built-in-functions">S/390 System z Built-in Functions</a>. <samp class="option">-mhtm</samp> is enabled by default when using <samp class="option">-march=zEC12</samp>. </p> </dd> <dt> + <span><code class="code">-mvx</code><a class="copiable-link" href="#index-mvx"> ¶</a></span> +</dt> <dt><code class="code">-mno-vx</code></dt> <dd> +<p>When <samp class="option">-mvx</samp> is specified, generate code using the instructions available with the vector extension facility introduced with the IBM z13 machine generation. This option changes the ABI for some vector type values with regard to alignment and calling conventions. In case vector type values are being used in an ABI-relevant context a GAS ‘<samp class="samp">.gnu_attribute</samp>’ command will be added to mark the resulting binary with the ABI used. <samp class="option">-mvx</samp> is enabled by default when using <samp class="option">-march=z13</samp>. </p> </dd> <dt> + <span><code class="code">-mzvector</code><a class="copiable-link" href="#index-mzvector"> ¶</a></span> +</dt> <dt><code class="code">-mno-zvector</code></dt> <dd> +<p>The <samp class="option">-mzvector</samp> option enables vector language extensions and builtins using instructions available with the vector extension facility introduced with the IBM z13 machine generation. This option adds support for ‘<samp class="samp">vector</samp>’ to be used as a keyword to define vector type variables and arguments. ‘<samp class="samp">vector</samp>’ is only available when GNU extensions are enabled. It will not be expanded when requesting strict standard compliance e.g. with <samp class="option">-std=c99</samp>. In addition to the GCC low-level builtins <samp class="option">-mzvector</samp> enables a set of builtins added for compatibility with AltiVec-style implementations like Power and Cell. In order to make use of these builtins the header file <samp class="file">vecintrin.h</samp> needs to be included. <samp class="option">-mzvector</samp> is disabled by default. </p> </dd> <dt> + <span><code class="code">-mmvcle</code><a class="copiable-link" href="#index-mmvcle"> ¶</a></span> +</dt> <dt><code class="code">-mno-mvcle</code></dt> <dd> +<p>Generate (or do not generate) code using the <code class="code">mvcle</code> instruction to perform block moves. When <samp class="option">-mno-mvcle</samp> is specified, use a <code class="code">mvc</code> loop instead. This is the default unless optimizing for size. </p> </dd> <dt> + <span><code class="code">-mdebug</code><a class="copiable-link" href="#index-mdebug-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-debug</code></dt> <dd> +<p>Print (or do not print) additional debug information when compiling. The default is to not print debug information. </p> </dd> <dt> +<span><code class="code">-march=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-march-15"> ¶</a></span> +</dt> <dd> +<p>Generate code that runs on <var class="var">cpu-type</var>, which is the name of a system representing a certain processor type. Possible values for <var class="var">cpu-type</var> are ‘<samp class="samp">z900</samp>’/‘<samp class="samp">arch5</samp>’, ‘<samp class="samp">z990</samp>’/‘<samp class="samp">arch6</samp>’, ‘<samp class="samp">z9-109</samp>’, ‘<samp class="samp">z9-ec</samp>’/‘<samp class="samp">arch7</samp>’, ‘<samp class="samp">z10</samp>’/‘<samp class="samp">arch8</samp>’, ‘<samp class="samp">z196</samp>’/‘<samp class="samp">arch9</samp>’, ‘<samp class="samp">zEC12</samp>’, ‘<samp class="samp">z13</samp>’/‘<samp class="samp">arch11</samp>’, ‘<samp class="samp">z14</samp>’/‘<samp class="samp">arch12</samp>’, ‘<samp class="samp">z15</samp>’/‘<samp class="samp">arch13</samp>’, ‘<samp class="samp">z16</samp>’/‘<samp class="samp">arch14</samp>’, and ‘<samp class="samp">native</samp>’. </p> <p>The default is <samp class="option">-march=z900</samp>. </p> <p>Specifying ‘<samp class="samp">native</samp>’ as cpu type can be used to select the best architecture option for the host processor. <samp class="option">-march=native</samp> has no effect if GCC does not recognize the processor. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-mtune-14"> ¶</a></span> +</dt> <dd> +<p>Tune to <var class="var">cpu-type</var> everything applicable about the generated code, except for the ABI and the set of available instructions. The list of <var class="var">cpu-type</var> values is the same as for <samp class="option">-march</samp>. The default is the value used for <samp class="option">-march</samp>. </p> </dd> <dt> + <span><code class="code">-mtpf-trace</code><a class="copiable-link" href="#index-mtpf-trace"> ¶</a></span> +</dt> <dt><code class="code">-mno-tpf-trace</code></dt> <dd> +<p>Generate code that adds (does not add) in TPF OS specific branches to trace routines in the operating system. This option is off by default, even when compiling for the TPF OS. </p> </dd> <dt> + <span><code class="code">-mtpf-trace-skip</code><a class="copiable-link" href="#index-mtpf-trace-skip"> ¶</a></span> +</dt> <dt><code class="code">-mno-tpf-trace-skip</code></dt> <dd> +<p>Generate code that changes (does not change) the default branch targets enabled by <samp class="option">-mtpf-trace</samp> to point to specialized trace routines providing the ability of selectively skipping function trace entries for the TPF OS. This option is off by default, even when compiling for the TPF OS and specifying <samp class="option">-mtpf-trace</samp>. </p> </dd> <dt> + <span><code class="code">-mfused-madd</code><a class="copiable-link" href="#index-mfused-madd-3"> ¶</a></span> +</dt> <dt><code class="code">-mno-fused-madd</code></dt> <dd> +<p>Generate code that uses (does not use) the floating-point multiply and accumulate instructions. These instructions are generated by default if hardware floating point is used. </p> </dd> <dt> +<span><code class="code">-mwarn-framesize=<var class="var">framesize</var></code><a class="copiable-link" href="#index-mwarn-framesize"> ¶</a></span> +</dt> <dd> +<p>Emit a warning if the current function exceeds the given frame size. Because this is a compile-time check it doesn’t need to be a real problem when the program runs. It is intended to identify functions that most probably cause a stack overflow. It is useful to be used in an environment with limited stack size e.g. the linux kernel. </p> </dd> <dt> +<span><code class="code">-mwarn-dynamicstack</code><a class="copiable-link" href="#index-mwarn-dynamicstack"> ¶</a></span> +</dt> <dd> +<p>Emit a warning if the function calls <code class="code">alloca</code> or uses dynamically-sized arrays. This is generally a bad idea with a limited stack size. </p> </dd> <dt> + <span><code class="code">-mstack-guard=<var class="var">stack-guard</var></code><a class="copiable-link" href="#index-mstack-guard"> ¶</a></span> +</dt> <dt><code class="code">-mstack-size=<var class="var">stack-size</var></code></dt> <dd> +<p>If these options are provided the S/390 back end emits additional instructions in the function prologue that trigger a trap if the stack size is <var class="var">stack-guard</var> bytes above the <var class="var">stack-size</var> (remember that the stack on S/390 grows downward). If the <var class="var">stack-guard</var> option is omitted the smallest power of 2 larger than the frame size of the compiled function is chosen. These options are intended to be used to help debugging stack overflow problems. The additionally emitted code causes only little overhead and hence can also be used in production-like systems without greater performance degradation. The given values have to be exact powers of 2 and <var class="var">stack-size</var> has to be greater than <var class="var">stack-guard</var> without exceeding 64k. In order to be efficient the extra code makes the assumption that the stack starts at an address aligned to the value given by <var class="var">stack-size</var>. The <var class="var">stack-guard</var> option can only be used in conjunction with <var class="var">stack-size</var>. </p> </dd> <dt> +<span><code class="code">-mhotpatch=<var class="var">pre-halfwords</var>,<var class="var">post-halfwords</var></code><a class="copiable-link" href="#index-mhotpatch"> ¶</a></span> +</dt> <dd> +<p>If the hotpatch option is enabled, a “hot-patching” function prologue is generated for all functions in the compilation unit. The funtion label is prepended with the given number of two-byte NOP instructions (<var class="var">pre-halfwords</var>, maximum 1000000). After the label, 2 * <var class="var">post-halfwords</var> bytes are appended, using the largest NOP like instructions the architecture allows (maximum 1000000). </p> <p>If both arguments are zero, hotpatching is disabled. </p> <p>This option can be overridden for individual functions with the <code class="code">hotpatch</code> attribute. </p> +</dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="sh-options">SH Options</a>, Previous: <a href="rx-options">RX Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/S_002f390-and-zSeries-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/S_002f390-and-zSeries-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/s_002f390-function-attributes.html b/devdocs/gcc~13/s_002f390-function-attributes.html new file mode 100644 index 00000000..60358e85 --- /dev/null +++ b/devdocs/gcc~13/s_002f390-function-attributes.html @@ -0,0 +1,13 @@ +<div class="subsection-level-extent" id="S_002f390-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="sh-function-attributes" accesskey="n" rel="next">SH Function Attributes</a>, Previous: <a href="rx-function-attributes" accesskey="p" rel="prev">RX Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="S_002f390-Function-Attributes-1"><span>6.33.28 S/390 Function Attributes<a class="copiable-link" href="#S_002f390-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported on the S/390: </p> <dl class="table"> <dt> +<span><code class="code">hotpatch (<var class="var">halfwords-before-function-label</var>,<var class="var">halfwords-after-function-label</var>)</code><a class="copiable-link" href="#index-hotpatch-function-attribute_002c-S_002f390"> ¶</a></span> +</dt> <dd> <p>On S/390 System z targets, you can use this function attribute to make GCC generate a “hot-patching” function prologue. If the <samp class="option">-mhotpatch=</samp> command-line option is used at the same time, the <code class="code">hotpatch</code> attribute takes precedence. The first of the two arguments specifies the number of halfwords to be added before the function label. A second argument can be used to specify the number of halfwords to be added after the function label. For both arguments the maximum allowed value is 1000000. </p> <p>If both arguments are zero, hotpatching is disabled. </p> </dd> <dt> +<span><code class="code">target (<var class="var">options</var>)</code><a class="copiable-link" href="#index-target-function-attribute-4"> ¶</a></span> +</dt> <dd> +<p>As discussed in <a class="ref" href="common-function-attributes">Common Function Attributes</a>, this attribute allows specification of target-specific compilation options. </p> <p>On S/390, the following options are supported: </p> <dl class="table"> <dt>‘<samp class="samp">arch=</samp>’</dt> <dt>‘<samp class="samp">tune=</samp>’</dt> <dt>‘<samp class="samp">stack-guard=</samp>’</dt> <dt>‘<samp class="samp">stack-size=</samp>’</dt> <dt>‘<samp class="samp">branch-cost=</samp>’</dt> <dt>‘<samp class="samp">warn-framesize=</samp>’</dt> <dt>‘<samp class="samp">backchain</samp>’</dt> <dt>‘<samp class="samp">no-backchain</samp>’</dt> <dt>‘<samp class="samp">hard-dfp</samp>’</dt> <dt>‘<samp class="samp">no-hard-dfp</samp>’</dt> <dt>‘<samp class="samp">hard-float</samp>’</dt> <dt>‘<samp class="samp">soft-float</samp>’</dt> <dt>‘<samp class="samp">htm</samp>’</dt> <dt>‘<samp class="samp">no-htm</samp>’</dt> <dt>‘<samp class="samp">vx</samp>’</dt> <dt>‘<samp class="samp">no-vx</samp>’</dt> <dt>‘<samp class="samp">packed-stack</samp>’</dt> <dt>‘<samp class="samp">no-packed-stack</samp>’</dt> <dt>‘<samp class="samp">small-exec</samp>’</dt> <dt>‘<samp class="samp">no-small-exec</samp>’</dt> <dt>‘<samp class="samp">mvcle</samp>’</dt> <dt>‘<samp class="samp">no-mvcle</samp>’</dt> <dt>‘<samp class="samp">warn-dynamicstack</samp>’</dt> <dt>‘<samp class="samp">no-warn-dynamicstack</samp>’</dt> </dl> <p>The options work exactly like the S/390 specific command line options (without the prefix <samp class="option">-m</samp>) except that they do not change any feature macros. For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp"><code class="code">target("no-vx")</code></pre> +</div> <p>does not undefine the <code class="code">__VEC__</code> macro. </p> +</dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/S_002f390-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/S_002f390-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/s_002f390-pragmas.html b/devdocs/gcc~13/s_002f390-pragmas.html new file mode 100644 index 00000000..4ed72f6f --- /dev/null +++ b/devdocs/gcc~13/s_002f390-pragmas.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="S_002f390-Pragmas"> <div class="nav-panel"> <p> Next: <a href="darwin-pragmas" accesskey="n" rel="next">Darwin Pragmas</a>, Previous: <a href="rs_002f6000-and-powerpc-pragmas" accesskey="p" rel="prev">RS/6000 and PowerPC Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="S_002f390-Pragmas-1"><span>6.62.6 S/390 Pragmas<a class="copiable-link" href="#S_002f390-Pragmas-1"> ¶</a></span></h1> <p>The pragmas defined by the S/390 target correspond to the S/390 target function attributes and some the additional options: </p> <dl class="table"> <dt>‘<samp class="samp">zvector</samp>’</dt> <dt>‘<samp class="samp">no-zvector</samp>’</dt> </dl> <p>Note that options of the pragma, unlike options of the target attribute, do change the value of preprocessor macros like <code class="code">__VEC__</code>. They can be specified as below: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#pragma GCC target("string[,string]...") +#pragma GCC target("string"[,"string"]...)</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/S_002f390-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/S_002f390-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/s_002f390-system-z-built-in-functions.html b/devdocs/gcc~13/s_002f390-system-z-built-in-functions.html new file mode 100644 index 00000000..e8972c8b --- /dev/null +++ b/devdocs/gcc~13/s_002f390-system-z-built-in-functions.html @@ -0,0 +1,55 @@ +<div class="subsection-level-extent" id="S_002f390-System-z-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="sh-built-in-functions" accesskey="n" rel="next">SH Built-in Functions</a>, Previous: <a href="rx-built-in-functions" accesskey="p" rel="prev">RX Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="S_002f390-System-z-Built-in-Functions-1"><span>6.60.31 S/390 System z Built-in Functions<a class="copiable-link" href="#S_002f390-System-z-Built-in-Functions-1"> ¶</a></span></h1> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbegin"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tbegin</strong> <code class="def-code-arguments">(void*)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbegin"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">tbegin</code> machine instruction starting a non-constrained hardware transaction. If the parameter is non-NULL the memory area is used to store the transaction diagnostic buffer and will be passed as first operand to <code class="code">tbegin</code>. This buffer can be defined using the <code class="code">struct __htm_tdb</code> C struct defined in <code class="code">htmintrin.h</code> and must reside on a double-word boundary. The second tbegin operand is set to <code class="code">0xff0c</code>. This enables save/restore of all GPRs and disables aborts for FPR and AR manipulations inside the transaction body. The condition code set by the tbegin instruction is returned as integer value. The tbegin instruction by definition overwrites the content of all FPRs. The compiler will generate code which saves and restores the FPRs. For soft-float code it is recommended to used the <code class="code">*_nofloat</code> variant. In order to prevent a TDB from being written it is required to pass a constant zero value as parameter. Passing a zero value through a variable is not sufficient. Although modifications of access registers inside the transaction will not trigger an transaction abort it is not supported to actually modify them. Access registers do not get saved when entering a transaction. They will have undefined state when reaching the abort code. </p></dd> +</dl> <p>Macros for the possible return codes of tbegin are defined in the <code class="code">htmintrin.h</code> header file: </p> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fTBEGIN_005fSTARTED"> +<span class="category-def">Macro: </span><span><strong class="def-name">_HTM_TBEGIN_STARTED</strong><a class="copiable-link" href="#index-_005fHTM_005fTBEGIN_005fSTARTED"> ¶</a></span> +</dt> <dd><p><code class="code">tbegin</code> has been executed as part of normal processing. The transaction body is supposed to be executed. </p></dd> +</dl> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fTBEGIN_005fINDETERMINATE"> +<span class="category-def">Macro: </span><span><strong class="def-name">_HTM_TBEGIN_INDETERMINATE</strong><a class="copiable-link" href="#index-_005fHTM_005fTBEGIN_005fINDETERMINATE"> ¶</a></span> +</dt> <dd><p>The transaction was aborted due to an indeterminate condition which might be persistent. </p></dd> +</dl> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fTBEGIN_005fTRANSIENT"> +<span class="category-def">Macro: </span><span><strong class="def-name">_HTM_TBEGIN_TRANSIENT</strong><a class="copiable-link" href="#index-_005fHTM_005fTBEGIN_005fTRANSIENT"> ¶</a></span> +</dt> <dd><p>The transaction aborted due to a transient failure. The transaction should be re-executed in that case. </p></dd> +</dl> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fTBEGIN_005fPERSISTENT"> +<span class="category-def">Macro: </span><span><strong class="def-name">_HTM_TBEGIN_PERSISTENT</strong><a class="copiable-link" href="#index-_005fHTM_005fTBEGIN_005fPERSISTENT"> ¶</a></span> +</dt> <dd><p>The transaction aborted due to a persistent failure. Re-execution under same circumstances will not be productive. </p></dd> +</dl> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fHTM_005fFIRST_005fUSER_005fABORT_005fCODE"> +<span class="category-def">Macro: </span><span><strong class="def-name">_HTM_FIRST_USER_ABORT_CODE</strong><a class="copiable-link" href="#index-_005fHTM_005fFIRST_005fUSER_005fABORT_005fCODE"> ¶</a></span> +</dt> <dd><p>The <code class="code">_HTM_FIRST_USER_ABORT_CODE</code> defined in <code class="code">htmintrin.h</code> specifies the first abort code which can be used for <code class="code">__builtin_tabort</code>. Values below this threshold are reserved for machine use. </p></dd> +</dl> <dl class="first-deftp"> <dt class="deftp" id="index-struct-_005f_005fhtm_005ftdb"> +<span class="category-def">Data type: </span><span><strong class="def-name">struct __htm_tdb</strong><a class="copiable-link" href="#index-struct-_005f_005fhtm_005ftdb"> ¶</a></span> +</dt> <dd><p>The <code class="code">struct __htm_tdb</code> defined in <code class="code">htmintrin.h</code> describes the structure of the transaction diagnostic block as specified in the Principles of Operation manual chapter 5-91. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbegin_005fnofloat"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tbegin_nofloat</strong> <code class="def-code-arguments">(void*)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbegin_005fnofloat"> ¶</a></span> +</dt> <dd><p>Same as <code class="code">__builtin_tbegin</code> but without FPR saves and restores. Using this variant in code making use of FPRs will leave the FPRs in undefined state when entering the transaction abort handler code. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbegin_005fretry"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tbegin_retry</strong> <code class="def-code-arguments">(void*, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbegin_005fretry"> ¶</a></span> +</dt> <dd><p>In addition to <code class="code">__builtin_tbegin</code> a loop for transient failures is generated. If tbegin returns a condition code of 2 the transaction will be retried as often as specified in the second argument. The perform processor assist instruction is used to tell the CPU about the number of fails so far. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbegin_005fretry_005fnofloat"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tbegin_retry_nofloat</strong> <code class="def-code-arguments">(void*, int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbegin_005fretry_005fnofloat"> ¶</a></span> +</dt> <dd><p>Same as <code class="code">__builtin_tbegin_retry</code> but without FPR saves and restores. Using this variant in code making use of FPRs will leave the FPRs in undefined state when entering the transaction abort handler code. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftbeginc"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_tbeginc</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftbeginc"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">tbeginc</code> machine instruction starting a constrained hardware transaction. The second operand is set to <code class="code">0xff08</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftend"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tend</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftend"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">tend</code> machine instruction finishing a transaction and making the changes visible to other threads. The condition code generated by tend is returned as integer value. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftabort"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_tabort</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftabort"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">tabort</code> machine instruction with the specified abort code. Abort codes from 0 through 255 are reserved and will result in an error message. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftx_005fassist"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_tx_assist</strong> <code class="def-code-arguments">(int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftx_005fassist"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">ppa rX,rY,1</code> machine instruction. Where the integer parameter is loaded into rX and a value of zero is loaded into rY. The integer parameter specifies the number of times the transaction repeatedly aborted. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ftx_005fnesting_005fdepth"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_tx_nesting_depth</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ftx_005fnesting_005fdepth"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">etnd</code> machine instruction. The current nesting depth is returned as integer value. For a nesting depth of 0 the code is not executed as part of an transaction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnon_005ftx_005fstore"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_non_tx_store</strong> <code class="def-code-arguments">(uint64_t *, uint64_t)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnon_005ftx_005fstore"> ¶</a></span> +</dt> <dd> <p>Generates the <code class="code">ntstg</code> machine instruction. The second argument is written to the first arguments location. The store operation will not be rolled-back in case of an transaction abort. </p> +</dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="sh-built-in-functions">SH Built-in Functions</a>, Previous: <a href="rx-built-in-functions">RX Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/S_002f390-System-z-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/S_002f390-System-z-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/sh-built-in-functions.html b/devdocs/gcc~13/sh-built-in-functions.html new file mode 100644 index 00000000..2edd1462 --- /dev/null +++ b/devdocs/gcc~13/sh-built-in-functions.html @@ -0,0 +1,31 @@ +<div class="subsection-level-extent" id="SH-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="sparc-vis-built-in-functions" accesskey="n" rel="next">SPARC VIS Built-in Functions</a>, Previous: <a href="s_002f390-system-z-built-in-functions" accesskey="p" rel="prev">S/390 System z Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="SH-Built-in-Functions-1"><span>6.60.32 SH Built-in Functions<a class="copiable-link" href="#SH-Built-in-Functions-1"> ¶</a></span></h1> <p>The following built-in functions are supported on the SH1, SH2, SH3 and SH4 families of processors: </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fset_005fthread_005fpointer"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_set_thread_pointer</strong> <code class="def-code-arguments">(void *<var class="var">ptr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fset_005fthread_005fpointer"> ¶</a></span> +</dt> <dd> +<p>Sets the ‘<samp class="samp">GBR</samp>’ register to the specified value <var class="var">ptr</var>. This is usually used by system code that manages threads and execution contexts. The compiler normally does not generate code that modifies the contents of ‘<samp class="samp">GBR</samp>’ and thus the value is preserved across function calls. Changing the ‘<samp class="samp">GBR</samp>’ value in user code must be done with caution, since the compiler might use ‘<samp class="samp">GBR</samp>’ in order to access thread local variables. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fthread_005fpointer-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_thread_pointer</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fthread_005fpointer-1"> ¶</a></span> +</dt> <dd> +<p>Returns the value that is currently set in the ‘<samp class="samp">GBR</samp>’ register. Memory loads and stores that use the thread pointer as a base address are turned into ‘<samp class="samp">GBR</samp>’ based displacement loads and stores, if possible. For example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct my_tcb +{ + int a, b, c, d, e; +}; + +int get_tcb_value (void) +{ + // Generate ‘<samp class="samp">mov.l @(8,gbr),r0</samp>’ instruction + return ((my_tcb*)__builtin_thread_pointer ())->c; +}</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fsh_005fget_005ffpscr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">__builtin_sh_get_fpscr</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsh_005fget_005ffpscr"> ¶</a></span> +</dt> <dd><p>Returns the value that is currently set in the ‘<samp class="samp">FPSCR</samp>’ register. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fsh_005fset_005ffpscr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_sh_set_fpscr</strong> <code class="def-code-arguments">(unsigned int <var class="var">val</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsh_005fset_005ffpscr"> ¶</a></span> +</dt> <dd><p>Sets the ‘<samp class="samp">FPSCR</samp>’ register to the specified value <var class="var">val</var>, while preserving the current values of the FR, SZ and PR bits. </p></dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="sparc-vis-built-in-functions">SPARC VIS Built-in Functions</a>, Previous: <a href="s_002f390-system-z-built-in-functions">S/390 System z Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SH-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SH-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/sh-function-attributes.html b/devdocs/gcc~13/sh-function-attributes.html new file mode 100644 index 00000000..6321a32a --- /dev/null +++ b/devdocs/gcc~13/sh-function-attributes.html @@ -0,0 +1,32 @@ +<div class="subsection-level-extent" id="SH-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="symbian-os-function-attributes" accesskey="n" rel="next">Symbian OS Function Attributes</a>, Previous: <a href="s_002f390-function-attributes" accesskey="p" rel="prev">S/390 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="SH-Function-Attributes-1"><span>6.33.29 SH Function Attributes<a class="copiable-link" href="#SH-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported on the SH family of processors: </p> <dl class="table"> <dt> + <span><code class="code">function_vector</code><a class="copiable-link" href="#index-function_005fvector-function-attribute_002c-SH"> ¶</a></span> +</dt> <dd> +<p>On SH2A targets, this attribute declares a function to be called using the TBR relative addressing mode. The argument to this attribute is the entry number of the same function in a vector table containing all the TBR relative addressable functions. For correct operation the TBR must be setup accordingly to point to the start of the vector table before any functions with this attribute are invoked. Usually a good place to do the initialization is the startup routine. The TBR relative vector table can have at max 256 function entries. The jumps to these functions are generated using a SH2A specific, non delayed branch instruction JSR/N @(disp8,TBR). You must use GAS and GLD from GNU binutils version 2.7 or later for this attribute to work correctly. </p> <p>In an application, for a function being called once, this attribute saves at least 8 bytes of code; and if other successive calls are being made to the same function, it saves 2 bytes of code per each of these calls. </p> </dd> <dt> +<span><code class="code">interrupt_handler</code><a class="copiable-link" href="#index-interrupt_005fhandler-function-attribute_002c-SH"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> </dd> <dt> +<span><code class="code">nosave_low_regs</code><a class="copiable-link" href="#index-nosave_005flow_005fregs-function-attribute_002c-SH"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on SH targets to indicate that an <code class="code">interrupt_handler</code> function should not save and restore registers R0..R7. This can be used on SH3* and SH4* targets that have a second R0..R7 register bank for non-reentrant interrupt handlers. </p> </dd> <dt> +<span><code class="code">renesas</code><a class="copiable-link" href="#index-renesas-function-attribute_002c-SH"> ¶</a></span> +</dt> <dd> +<p>On SH targets this attribute specifies that the function or struct follows the Renesas ABI. </p> </dd> <dt> +<span><code class="code">resbank</code><a class="copiable-link" href="#index-resbank-function-attribute_002c-SH"> ¶</a></span> +</dt> <dd> +<p>On the SH2A target, this attribute enables the high-speed register saving and restoration using a register bank for <code class="code">interrupt_handler</code> routines. Saving to the bank is performed automatically after the CPU accepts an interrupt that uses a register bank. </p> <p>The nineteen 32-bit registers comprising general register R0 to R14, control register GBR, and system registers MACH, MACL, and PR and the vector table address offset are saved into a register bank. Register banks are stacked in first-in last-out (FILO) sequence. Restoration from the bank is executed by issuing a RESBANK instruction. </p> </dd> <dt> +<span><code class="code">sp_switch</code><a class="copiable-link" href="#index-sp_005fswitch-function-attribute_002c-SH"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the SH to indicate an <code class="code">interrupt_handler</code> function should switch to an alternate stack. It expects a string argument that names a global variable holding the address of the alternate stack. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void *alt_stack; +void f () __attribute__ ((interrupt_handler, + sp_switch ("alt_stack")));</pre> +</div> </dd> <dt> +<span><code class="code">trap_exit</code><a class="copiable-link" href="#index-trap_005fexit-function-attribute_002c-SH"> ¶</a></span> +</dt> <dd> +<p>Use this attribute on the SH for an <code class="code">interrupt_handler</code> to return using <code class="code">trapa</code> instead of <code class="code">rte</code>. This attribute expects an integer argument specifying the trap number to be used. </p> </dd> <dt> +<span><code class="code">trapa_handler</code><a class="copiable-link" href="#index-trapa_005fhandler-function-attribute_002c-SH"> ¶</a></span> +</dt> <dd><p>On SH targets this function attribute is similar to <code class="code">interrupt_handler</code> but it does not save and restore all registers. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="symbian-os-function-attributes">Symbian OS Function Attributes</a>, Previous: <a href="s_002f390-function-attributes">S/390 Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SH-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SH-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/sh-options.html b/devdocs/gcc~13/sh-options.html new file mode 100644 index 00000000..6f2b3b09 --- /dev/null +++ b/devdocs/gcc~13/sh-options.html @@ -0,0 +1,203 @@ +<div class="subsection-level-extent" id="SH-Options"> <div class="nav-panel"> <p> Next: <a href="solaris-2-options" accesskey="n" rel="next">Solaris 2 Options</a>, Previous: <a href="s_002f390-and-zseries-options" accesskey="p" rel="prev">S/390 and zSeries Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="SH-Options-1"><span>3.19.45 SH Options<a class="copiable-link" href="#SH-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for the SH implementations: </p> <dl class="table"> <dt> +<span><code class="code">-m1</code><a class="copiable-link" href="#index-m1"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH1. </p> </dd> <dt> +<span><code class="code">-m2</code><a class="copiable-link" href="#index-m2"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH2. </p> </dd> <dt><code class="code">-m2e</code></dt> <dd> +<p>Generate code for the SH2e. </p> </dd> <dt> +<span><code class="code">-m2a-nofpu</code><a class="copiable-link" href="#index-m2a-nofpu"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way that the floating-point unit is not used. </p> </dd> <dt> +<span><code class="code">-m2a-single-only</code><a class="copiable-link" href="#index-m2a-single-only"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH2a-FPU, in such a way that no double-precision floating-point operations are used. </p> </dd> <dt> +<span><code class="code">-m2a-single</code><a class="copiable-link" href="#index-m2a-single"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH2a-FPU assuming the floating-point unit is in single-precision mode by default. </p> </dd> <dt> +<span><code class="code">-m2a</code><a class="copiable-link" href="#index-m2a"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH2a-FPU assuming the floating-point unit is in double-precision mode by default. </p> </dd> <dt> +<span><code class="code">-m3</code><a class="copiable-link" href="#index-m3"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH3. </p> </dd> <dt> +<span><code class="code">-m3e</code><a class="copiable-link" href="#index-m3e"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH3e. </p> </dd> <dt> +<span><code class="code">-m4-nofpu</code><a class="copiable-link" href="#index-m4-nofpu"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH4 without a floating-point unit. </p> </dd> <dt> +<span><code class="code">-m4-single-only</code><a class="copiable-link" href="#index-m4-single-only"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH4 with a floating-point unit that only supports single-precision arithmetic. </p> </dd> <dt> +<span><code class="code">-m4-single</code><a class="copiable-link" href="#index-m4-single"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH4 assuming the floating-point unit is in single-precision mode by default. </p> </dd> <dt> +<span><code class="code">-m4</code><a class="copiable-link" href="#index-m4"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH4. </p> </dd> <dt> +<span><code class="code">-m4-100</code><a class="copiable-link" href="#index-m4-100"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-100. </p> </dd> <dt> +<span><code class="code">-m4-100-nofpu</code><a class="copiable-link" href="#index-m4-100-nofpu"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-100 in such a way that the floating-point unit is not used. </p> </dd> <dt> +<span><code class="code">-m4-100-single</code><a class="copiable-link" href="#index-m4-100-single"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-100 assuming the floating-point unit is in single-precision mode by default. </p> </dd> <dt> +<span><code class="code">-m4-100-single-only</code><a class="copiable-link" href="#index-m4-100-single-only"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-100 in such a way that no double-precision floating-point operations are used. </p> </dd> <dt> +<span><code class="code">-m4-200</code><a class="copiable-link" href="#index-m4-200"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-200. </p> </dd> <dt> +<span><code class="code">-m4-200-nofpu</code><a class="copiable-link" href="#index-m4-200-nofpu"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-200 without in such a way that the floating-point unit is not used. </p> </dd> <dt> +<span><code class="code">-m4-200-single</code><a class="copiable-link" href="#index-m4-200-single"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-200 assuming the floating-point unit is in single-precision mode by default. </p> </dd> <dt> +<span><code class="code">-m4-200-single-only</code><a class="copiable-link" href="#index-m4-200-single-only"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-200 in such a way that no double-precision floating-point operations are used. </p> </dd> <dt> +<span><code class="code">-m4-300</code><a class="copiable-link" href="#index-m4-300"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-300. </p> </dd> <dt> +<span><code class="code">-m4-300-nofpu</code><a class="copiable-link" href="#index-m4-300-nofpu"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-300 without in such a way that the floating-point unit is not used. </p> </dd> <dt> +<span><code class="code">-m4-300-single</code><a class="copiable-link" href="#index-m4-300-single"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-300 in such a way that no double-precision floating-point operations are used. </p> </dd> <dt> +<span><code class="code">-m4-300-single-only</code><a class="copiable-link" href="#index-m4-300-single-only"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-300 in such a way that no double-precision floating-point operations are used. </p> </dd> <dt> +<span><code class="code">-m4-340</code><a class="copiable-link" href="#index-m4-340"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-340 (no MMU, no FPU). </p> </dd> <dt> +<span><code class="code">-m4-500</code><a class="copiable-link" href="#index-m4-500"> ¶</a></span> +</dt> <dd> +<p>Generate code for SH4-500 (no FPU). Passes <samp class="option">-isa=sh4-nofpu</samp> to the assembler. </p> </dd> <dt> +<span><code class="code">-m4a-nofpu</code><a class="copiable-link" href="#index-m4a-nofpu"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH4al-dsp, or for a SH4a in such a way that the floating-point unit is not used. </p> </dd> <dt> +<span><code class="code">-m4a-single-only</code><a class="copiable-link" href="#index-m4a-single-only"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH4a, in such a way that no double-precision floating-point operations are used. </p> </dd> <dt> +<span><code class="code">-m4a-single</code><a class="copiable-link" href="#index-m4a-single"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH4a assuming the floating-point unit is in single-precision mode by default. </p> </dd> <dt> +<span><code class="code">-m4a</code><a class="copiable-link" href="#index-m4a"> ¶</a></span> +</dt> <dd> +<p>Generate code for the SH4a. </p> </dd> <dt> +<span><code class="code">-m4al</code><a class="copiable-link" href="#index-m4al"> ¶</a></span> +</dt> <dd> +<p>Same as <samp class="option">-m4a-nofpu</samp>, except that it implicitly passes <samp class="option">-dsp</samp> to the assembler. GCC doesn’t generate any DSP instructions at the moment. </p> </dd> <dt> +<span><code class="code">-mb</code><a class="copiable-link" href="#index-mb"> ¶</a></span> +</dt> <dd> +<p>Compile code for the processor in big-endian mode. </p> </dd> <dt> +<span><code class="code">-ml</code><a class="copiable-link" href="#index-ml"> ¶</a></span> +</dt> <dd> +<p>Compile code for the processor in little-endian mode. </p> </dd> <dt> +<span><code class="code">-mdalign</code><a class="copiable-link" href="#index-mdalign"> ¶</a></span> +</dt> <dd> +<p>Align doubles at 64-bit boundaries. Note that this changes the calling conventions, and thus some functions from the standard C library do not work unless you recompile it first with <samp class="option">-mdalign</samp>. </p> </dd> <dt> +<span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax-7"> ¶</a></span> +</dt> <dd> +<p>Shorten some address references at link time, when possible; uses the linker option <samp class="option">-relax</samp>. </p> </dd> <dt> +<span><code class="code">-mbigtable</code><a class="copiable-link" href="#index-mbigtable"> ¶</a></span> +</dt> <dd> +<p>Use 32-bit offsets in <code class="code">switch</code> tables. The default is to use 16-bit offsets. </p> </dd> <dt> +<span><code class="code">-mbitops</code><a class="copiable-link" href="#index-mbitops"> ¶</a></span> +</dt> <dd> +<p>Enable the use of bit manipulation instructions on SH2A. </p> </dd> <dt> +<span><code class="code">-mfmovd</code><a class="copiable-link" href="#index-mfmovd"> ¶</a></span> +</dt> <dd> +<p>Enable the use of the instruction <code class="code">fmovd</code>. Check <samp class="option">-mdalign</samp> for alignment constraints. </p> </dd> <dt> +<span><code class="code">-mrenesas</code><a class="copiable-link" href="#index-mrenesas"> ¶</a></span> +</dt> <dd> +<p>Comply with the calling conventions defined by Renesas. </p> </dd> <dt> +<span><code class="code">-mno-renesas</code><a class="copiable-link" href="#index-mno-renesas"> ¶</a></span> +</dt> <dd> +<p>Comply with the calling conventions defined for GCC before the Renesas conventions were available. This option is the default for all targets of the SH toolchain. </p> </dd> <dt> +<span><code class="code">-mnomacsave</code><a class="copiable-link" href="#index-mnomacsave"> ¶</a></span> +</dt> <dd> +<p>Mark the <code class="code">MAC</code> register as call-clobbered, even if <samp class="option">-mrenesas</samp> is given. </p> </dd> <dt> + <span><code class="code">-mieee</code><a class="copiable-link" href="#index-mieee-1"> ¶</a></span> +</dt> <dt><code class="code">-mno-ieee</code></dt> <dd> +<p>Control the IEEE compliance of floating-point comparisons, which affects the handling of cases where the result of a comparison is unordered. By default <samp class="option">-mieee</samp> is implicitly enabled. If <samp class="option">-ffinite-math-only</samp> is enabled <samp class="option">-mno-ieee</samp> is implicitly set, which results in faster floating-point greater-equal and less-equal comparisons. The implicit settings can be overridden by specifying either <samp class="option">-mieee</samp> or <samp class="option">-mno-ieee</samp>. </p> </dd> <dt> +<span><code class="code">-minline-ic_invalidate</code><a class="copiable-link" href="#index-minline-ic_005finvalidate"> ¶</a></span> +</dt> <dd> +<p>Inline code to invalidate instruction cache entries after setting up nested function trampolines. This option has no effect if <samp class="option">-musermode</samp> is in effect and the selected code generation option (e.g. <samp class="option">-m4</samp>) does not allow the use of the <code class="code">icbi</code> instruction. If the selected code generation option does not allow the use of the <code class="code">icbi</code> instruction, and <samp class="option">-musermode</samp> is not in effect, the inlined code manipulates the instruction cache address array directly with an associative write. This not only requires privileged mode at run time, but it also fails if the cache line had been mapped via the TLB and has become unmapped. </p> </dd> <dt> +<span><code class="code">-misize</code><a class="copiable-link" href="#index-misize-1"> ¶</a></span> +</dt> <dd> +<p>Dump instruction size and location in the assembly code. </p> </dd> <dt> +<span><code class="code">-mpadstruct</code><a class="copiable-link" href="#index-mpadstruct"> ¶</a></span> +</dt> <dd> +<p>This option is deprecated. It pads structures to multiple of 4 bytes, which is incompatible with the SH ABI. </p> </dd> <dt> +<span><code class="code">-matomic-model=<var class="var">model</var></code><a class="copiable-link" href="#index-matomic-model_003dmodel"> ¶</a></span> +</dt> <dd> +<p>Sets the model of atomic operations and additional parameters as a comma separated list. For details on the atomic built-in functions see <a class="ref" href="_005f_005fatomic-builtins">Built-in Functions for Memory Model Aware Atomic Operations</a>. The following models and parameters are supported: </p> <dl class="table"> <dt>‘<samp class="samp">none</samp>’</dt> <dd> +<p>Disable compiler generated atomic sequences and emit library calls for atomic operations. This is the default if the target is not <code class="code">sh*-*-linux*</code>. </p> </dd> <dt>‘<samp class="samp">soft-gusa</samp>’</dt> <dd> +<p>Generate GNU/Linux compatible gUSA software atomic sequences for the atomic built-in functions. The generated atomic sequences require additional support from the interrupt/exception handling code of the system and are only suitable for SH3* and SH4* single-core systems. This option is enabled by default when the target is <code class="code">sh*-*-linux*</code> and SH3* or SH4*. When the target is SH4A, this option also partially utilizes the hardware atomic instructions <code class="code">movli.l</code> and <code class="code">movco.l</code> to create more efficient code, unless ‘<samp class="samp">strict</samp>’ is specified. </p> </dd> <dt>‘<samp class="samp">soft-tcb</samp>’</dt> <dd> +<p>Generate software atomic sequences that use a variable in the thread control block. This is a variation of the gUSA sequences which can also be used on SH1* and SH2* targets. The generated atomic sequences require additional support from the interrupt/exception handling code of the system and are only suitable for single-core systems. When using this model, the ‘<samp class="samp">gbr-offset=</samp>’ parameter has to be specified as well. </p> </dd> <dt>‘<samp class="samp">soft-imask</samp>’</dt> <dd> +<p>Generate software atomic sequences that temporarily disable interrupts by setting <code class="code">SR.IMASK = 1111</code>. This model works only when the program runs in privileged mode and is only suitable for single-core systems. Additional support from the interrupt/exception handling code of the system is not required. This model is enabled by default when the target is <code class="code">sh*-*-linux*</code> and SH1* or SH2*. </p> </dd> <dt>‘<samp class="samp">hard-llcs</samp>’</dt> <dd> +<p>Generate hardware atomic sequences using the <code class="code">movli.l</code> and <code class="code">movco.l</code> instructions only. This is only available on SH4A and is suitable for multi-core systems. Since the hardware instructions support only 32 bit atomic variables access to 8 or 16 bit variables is emulated with 32 bit accesses. Code compiled with this option is also compatible with other software atomic model interrupt/exception handling systems if executed on an SH4A system. Additional support from the interrupt/exception handling code of the system is not required for this model. </p> </dd> <dt>‘<samp class="samp">gbr-offset=</samp>’</dt> <dd> +<p>This parameter specifies the offset in bytes of the variable in the thread control block structure that should be used by the generated atomic sequences when the ‘<samp class="samp">soft-tcb</samp>’ model has been selected. For other models this parameter is ignored. The specified value must be an integer multiple of four and in the range 0-1020. </p> </dd> <dt>‘<samp class="samp">strict</samp>’</dt> <dd> +<p>This parameter prevents mixed usage of multiple atomic models, even if they are compatible, and makes the compiler generate atomic sequences of the specified model only. </p> </dd> </dl> </dd> <dt> +<span><code class="code">-mtas</code><a class="copiable-link" href="#index-mtas"> ¶</a></span> +</dt> <dd> +<p>Generate the <code class="code">tas.b</code> opcode for <code class="code">__atomic_test_and_set</code>. Notice that depending on the particular hardware and software configuration this can degrade overall performance due to the operand cache line flushes that are implied by the <code class="code">tas.b</code> instruction. On multi-core SH4A processors the <code class="code">tas.b</code> instruction must be used with caution since it can result in data corruption for certain cache configurations. </p> </dd> <dt> +<span><code class="code">-mprefergot</code><a class="copiable-link" href="#index-mprefergot"> ¶</a></span> +</dt> <dd> +<p>When generating position-independent code, emit function calls using the Global Offset Table instead of the Procedure Linkage Table. </p> </dd> <dt> + <span><code class="code">-musermode</code><a class="copiable-link" href="#index-musermode"> ¶</a></span> +</dt> <dt><code class="code">-mno-usermode</code></dt> <dd> +<p>Don’t allow (allow) the compiler generating privileged mode code. Specifying <samp class="option">-musermode</samp> also implies <samp class="option">-mno-inline-ic_invalidate</samp> if the inlined code would not work in user mode. <samp class="option">-musermode</samp> is the default when the target is <code class="code">sh*-*-linux*</code>. If the target is SH1* or SH2* <samp class="option">-musermode</samp> has no effect, since there is no user mode. </p> </dd> <dt> +<span><code class="code">-multcost=<var class="var">number</var></code><a class="copiable-link" href="#index-multcost_003dnumber"> ¶</a></span> +</dt> <dd> +<p>Set the cost to assume for a multiply insn. </p> </dd> <dt> +<span><code class="code">-mdiv=<var class="var">strategy</var></code><a class="copiable-link" href="#index-mdiv_003dstrategy"> ¶</a></span> +</dt> <dd> +<p>Set the division strategy to be used for integer division operations. <var class="var">strategy</var> can be one of: </p> <dl class="table"> <dt>‘<samp class="samp">call-div1</samp>’</dt> <dd> +<p>Calls a library function that uses the single-step division instruction <code class="code">div1</code> to perform the operation. Division by zero calculates an unspecified result and does not trap. This is the default except for SH4, SH2A and SHcompact. </p> </dd> <dt>‘<samp class="samp">call-fp</samp>’</dt> <dd> +<p>Calls a library function that performs the operation in double precision floating point. Division by zero causes a floating-point exception. This is the default for SHcompact with FPU. Specifying this for targets that do not have a double precision FPU defaults to <code class="code">call-div1</code>. </p> </dd> <dt>‘<samp class="samp">call-table</samp>’</dt> <dd> +<p>Calls a library function that uses a lookup table for small divisors and the <code class="code">div1</code> instruction with case distinction for larger divisors. Division by zero calculates an unspecified result and does not trap. This is the default for SH4. Specifying this for targets that do not have dynamic shift instructions defaults to <code class="code">call-div1</code>. </p> </dd> </dl> <p>When a division strategy has not been specified the default strategy is selected based on the current target. For SH2A the default strategy is to use the <code class="code">divs</code> and <code class="code">divu</code> instructions instead of library function calls. </p> </dd> <dt> +<span><code class="code">-maccumulate-outgoing-args</code><a class="copiable-link" href="#index-maccumulate-outgoing-args"> ¶</a></span> +</dt> <dd> +<p>Reserve space once for outgoing arguments in the function prologue rather than around each call. Generally beneficial for performance and size. Also needed for unwinding to avoid changing the stack frame around conditional code. </p> </dd> <dt> +<span><code class="code">-mdivsi3_libfunc=<var class="var">name</var></code><a class="copiable-link" href="#index-mdivsi3_005flibfunc_003dname"> ¶</a></span> +</dt> <dd> +<p>Set the name of the library function used for 32-bit signed division to <var class="var">name</var>. This only affects the name used in the ‘<samp class="samp">call</samp>’ division strategies, and the compiler still expects the same sets of input/output/clobbered registers as if this option were not present. </p> </dd> <dt> +<span><code class="code">-mfixed-range=<var class="var">register-range</var></code><a class="copiable-link" href="#index-mfixed-range-2"> ¶</a></span> +</dt> <dd> +<p>Generate code treating the given register range as fixed registers. A fixed register is one that the register allocator cannot use. This is useful when compiling kernel code. A register range is specified as two registers separated by a dash. Multiple register ranges can be specified separated by a comma. </p> </dd> <dt> +<span><code class="code">-mbranch-cost=<var class="var">num</var></code><a class="copiable-link" href="#index-mbranch-cost_003dnum"> ¶</a></span> +</dt> <dd> +<p>Assume <var class="var">num</var> to be the cost for a branch instruction. Higher numbers make the compiler try to generate more branch-free code if possible. If not specified the value is selected depending on the processor type that is being compiled for. </p> </dd> <dt> + <span><code class="code">-mzdcbranch</code><a class="copiable-link" href="#index-mzdcbranch"> ¶</a></span> +</dt> <dt><code class="code">-mno-zdcbranch</code></dt> <dd> +<p>Assume (do not assume) that zero displacement conditional branch instructions <code class="code">bt</code> and <code class="code">bf</code> are fast. If <samp class="option">-mzdcbranch</samp> is specified, the compiler prefers zero displacement branch code sequences. This is enabled by default when generating code for SH4 and SH4A. It can be explicitly disabled by specifying <samp class="option">-mno-zdcbranch</samp>. </p> </dd> <dt> +<span><code class="code">-mcbranch-force-delay-slot</code><a class="copiable-link" href="#index-mcbranch-force-delay-slot"> ¶</a></span> +</dt> <dd> +<p>Force the usage of delay slots for conditional branches, which stuffs the delay slot with a <code class="code">nop</code> if a suitable instruction cannot be found. By default this option is disabled. It can be enabled to work around hardware bugs as found in the original SH7055. </p> </dd> <dt> + <span><code class="code">-mfused-madd</code><a class="copiable-link" href="#index-mfused-madd-4"> ¶</a></span> +</dt> <dt><code class="code">-mno-fused-madd</code></dt> <dd> +<p>Generate code that uses (does not use) the floating-point multiply and accumulate instructions. These instructions are generated by default if hardware floating point is used. The machine-dependent <samp class="option">-mfused-madd</samp> option is now mapped to the machine-independent <samp class="option">-ffp-contract=fast</samp> option, and <samp class="option">-mno-fused-madd</samp> is mapped to <samp class="option">-ffp-contract=off</samp>. </p> </dd> <dt> + <span><code class="code">-mfsca</code><a class="copiable-link" href="#index-mfsca"> ¶</a></span> +</dt> <dt><code class="code">-mno-fsca</code></dt> <dd> +<p>Allow or disallow the compiler to emit the <code class="code">fsca</code> instruction for sine and cosine approximations. The option <samp class="option">-mfsca</samp> must be used in combination with <samp class="option">-funsafe-math-optimizations</samp>. It is enabled by default when generating code for SH4A. Using <samp class="option">-mno-fsca</samp> disables sine and cosine approximations even if <samp class="option">-funsafe-math-optimizations</samp> is in effect. </p> </dd> <dt> + <span><code class="code">-mfsrra</code><a class="copiable-link" href="#index-mfsrra"> ¶</a></span> +</dt> <dt><code class="code">-mno-fsrra</code></dt> <dd> +<p>Allow or disallow the compiler to emit the <code class="code">fsrra</code> instruction for reciprocal square root approximations. The option <samp class="option">-mfsrra</samp> must be used in combination with <samp class="option">-funsafe-math-optimizations</samp> and <samp class="option">-ffinite-math-only</samp>. It is enabled by default when generating code for SH4A. Using <samp class="option">-mno-fsrra</samp> disables reciprocal square root approximations even if <samp class="option">-funsafe-math-optimizations</samp> and <samp class="option">-ffinite-math-only</samp> are in effect. </p> </dd> <dt> +<span><code class="code">-mpretend-cmove</code><a class="copiable-link" href="#index-mpretend-cmove"> ¶</a></span> +</dt> <dd> +<p>Prefer zero-displacement conditional branches for conditional move instruction patterns. This can result in faster code on the SH4 processor. </p> </dd> <dt> +<span><code class="code">-mfdpic</code><a class="copiable-link" href="#index-fdpic"> ¶</a></span> +</dt> <dd> +<p>Generate code using the FDPIC ABI. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="solaris-2-options">Solaris 2 Options</a>, Previous: <a href="s_002f390-and-zseries-options">S/390 and zSeries Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SH-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SH-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/simple-constraints.html b/devdocs/gcc~13/simple-constraints.html new file mode 100644 index 00000000..f7c3233a --- /dev/null +++ b/devdocs/gcc~13/simple-constraints.html @@ -0,0 +1,61 @@ +<div class="subsubsection-level-extent" id="Simple-Constraints"> <div class="nav-panel"> <p> Next: <a href="multi-alternative" accesskey="n" rel="next">Multiple Alternative Constraints</a>, Up: <a href="constraints" accesskey="u" rel="up">Constraints for <code class="code">asm</code> Operands</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsubsection subsection-level-set-subsubsection" id="Simple-Constraints-1"><span>6.47.3.1 Simple Constraints<a class="copiable-link" href="#Simple-Constraints-1"> ¶</a></span></h1> <p>The simplest kind of constraint is a string full of letters, each of which describes one kind of operand that is permitted. Here are the letters that are allowed: </p> <dl class="table"> <dt>whitespace</dt> <dd> +<p>Whitespace characters are ignored and can be inserted at any position except the first. This enables each alternative for different operands to be visually aligned in the machine description even if they have different number of constraints and modifiers. </p> </dd> <dt> + <span>‘<samp class="samp">m</samp>’<a class="copiable-link" href="#index-m-in-constraint"> ¶</a></span> +</dt> <dd> +<p>A memory operand is allowed, with any kind of address that the machine supports in general. Note that the letter used for the general memory constraint can be re-defined by a back end using the <code class="code">TARGET_MEM_CONSTRAINT</code> macro. </p> </dd> <dt> + <span>‘<samp class="samp">o</samp>’<a class="copiable-link" href="#index-offsettable-address"> ¶</a></span> +</dt> <dd> +<p>A memory operand is allowed, but only if the address is <em class="dfn">offsettable</em>. This means that adding a small integer (actually, the width in bytes of the operand, as determined by its machine mode) may be added to the address and the result is also a valid memory address. </p> <p>For example, an address which is constant is offsettable; so is an address that is the sum of a register and a constant (as long as a slightly larger constant is also within the range of address-offsets supported by the machine); but an autoincrement or autodecrement address is not offsettable. More complicated indirect/indexed addresses may or may not be offsettable depending on the other addressing modes that the machine supports. </p> <p>Note that in an output operand which can be matched by another operand, the constraint letter ‘<samp class="samp">o</samp>’ is valid only when accompanied by both ‘<samp class="samp"><</samp>’ (if the target machine has predecrement addressing) and ‘<samp class="samp">></samp>’ (if the target machine has preincrement addressing). </p> </dd> <dt> +<span>‘<samp class="samp">V</samp>’<a class="copiable-link" href="#index-V-in-constraint"> ¶</a></span> +</dt> <dd> +<p>A memory operand that is not offsettable. In other words, anything that would fit the ‘<samp class="samp">m</samp>’ constraint but not the ‘<samp class="samp">o</samp>’ constraint. </p> </dd> <dt> +<span>‘<samp class="samp"><</samp>’<a class="copiable-link" href="#index-_003c-in-constraint"> ¶</a></span> +</dt> <dd> +<p>A memory operand with autodecrement addressing (either predecrement or postdecrement) is allowed. In inline <code class="code">asm</code> this constraint is only allowed if the operand is used exactly once in an instruction that can handle the side effects. Not using an operand with ‘<samp class="samp"><</samp>’ in constraint string in the inline <code class="code">asm</code> pattern at all or using it in multiple instructions isn’t valid, because the side effects wouldn’t be performed or would be performed more than once. Furthermore, on some targets the operand with ‘<samp class="samp"><</samp>’ in constraint string must be accompanied by special instruction suffixes like <code class="code">%U0</code> instruction suffix on PowerPC or <code class="code">%P0</code> on IA-64. </p> </dd> <dt> +<span>‘<samp class="samp">></samp>’<a class="copiable-link" href="#index-_003e-in-constraint"> ¶</a></span> +</dt> <dd> +<p>A memory operand with autoincrement addressing (either preincrement or postincrement) is allowed. In inline <code class="code">asm</code> the same restrictions as for ‘<samp class="samp"><</samp>’ apply. </p> </dd> <dt> + <span>‘<samp class="samp">r</samp>’<a class="copiable-link" href="#index-r-in-constraint"> ¶</a></span> +</dt> <dd> +<p>A register operand is allowed provided that it is in a general register. </p> </dd> <dt> + <span>‘<samp class="samp">i</samp>’<a class="copiable-link" href="#index-constants-in-constraints"> ¶</a></span> +</dt> <dd> +<p>An immediate integer operand (one with constant value) is allowed. This includes symbolic constants whose values will be known only at assembly time or later. </p> </dd> <dt> +<span>‘<samp class="samp">n</samp>’<a class="copiable-link" href="#index-n-in-constraint"> ¶</a></span> +</dt> <dd> +<p>An immediate integer operand with a known numeric value is allowed. Many systems cannot support assembly-time constants for operands less than a word wide. Constraints for these operands should use ‘<samp class="samp">n</samp>’ rather than ‘<samp class="samp">i</samp>’. </p> </dd> <dt> +<span>‘<samp class="samp">I</samp>’, ‘<samp class="samp">J</samp>’, ‘<samp class="samp">K</samp>’, … ‘<samp class="samp">P</samp>’<a class="copiable-link" href="#index-I-in-constraint"> ¶</a></span> +</dt> <dd> +<p>Other letters in the range ‘<samp class="samp">I</samp>’ through ‘<samp class="samp">P</samp>’ may be defined in a machine-dependent fashion to permit immediate integer operands with explicit integer values in specified ranges. For example, on the 68000, ‘<samp class="samp">I</samp>’ is defined to stand for the range of values 1 to 8. This is the range permitted as a shift count in the shift instructions. </p> </dd> <dt> +<span>‘<samp class="samp">E</samp>’<a class="copiable-link" href="#index-E-in-constraint"> ¶</a></span> +</dt> <dd> +<p>An immediate floating operand (expression code <code class="code">const_double</code>) is allowed, but only if the target floating point format is the same as that of the host machine (on which the compiler is running). </p> </dd> <dt> +<span>‘<samp class="samp">F</samp>’<a class="copiable-link" href="#index-F-in-constraint"> ¶</a></span> +</dt> <dd> +<p>An immediate floating operand (expression code <code class="code">const_double</code> or <code class="code">const_vector</code>) is allowed. </p> </dd> <dt> + <span>‘<samp class="samp">G</samp>’, ‘<samp class="samp">H</samp>’<a class="copiable-link" href="#index-G-in-constraint"> ¶</a></span> +</dt> <dd> +<p>‘<samp class="samp">G</samp>’ and ‘<samp class="samp">H</samp>’ may be defined in a machine-dependent fashion to permit immediate floating operands in particular ranges of values. </p> </dd> <dt> +<span>‘<samp class="samp">s</samp>’<a class="copiable-link" href="#index-s-in-constraint"> ¶</a></span> +</dt> <dd> +<p>An immediate integer operand whose value is not an explicit integer is allowed. </p> <p>This might appear strange; if an insn allows a constant operand with a value not known at compile time, it certainly must allow any known value. So why use ‘<samp class="samp">s</samp>’ instead of ‘<samp class="samp">i</samp>’? Sometimes it allows better code to be generated. </p> <p>For example, on the 68000 in a fullword instruction it is possible to use an immediate operand; but if the immediate value is between −128 and 127, better code results from loading the value into a register and using the register. This is because the load into the register can be done with a ‘<samp class="samp">moveq</samp>’ instruction. We arrange for this to happen by defining the letter ‘<samp class="samp">K</samp>’ to mean “any integer outside the range −128 to 127”, and then specifying ‘<samp class="samp">Ks</samp>’ in the operand constraints. </p> </dd> <dt> +<span>‘<samp class="samp">g</samp>’<a class="copiable-link" href="#index-g-in-constraint"> ¶</a></span> +</dt> <dd> +<p>Any register, memory or immediate integer operand is allowed, except for registers that are not general registers. </p> </dd> <dt> +<span>‘<samp class="samp">X</samp>’<a class="copiable-link" href="#index-X-in-constraint"> ¶</a></span> +</dt> <dd> +<p>Any operand whatsoever is allowed. </p> </dd> <dt> + <span>‘<samp class="samp">0</samp>’, ‘<samp class="samp">1</samp>’, ‘<samp class="samp">2</samp>’, … ‘<samp class="samp">9</samp>’<a class="copiable-link" href="#index-0-in-constraint"> ¶</a></span> +</dt> <dd> +<p>An operand that matches the specified operand number is allowed. If a digit is used together with letters within the same alternative, the digit should come last. </p> <p>This number is allowed to be more than a single digit. If multiple digits are encountered consecutively, they are interpreted as a single decimal integer. There is scant chance for ambiguity, since to-date it has never been desirable that ‘<samp class="samp">10</samp>’ be interpreted as matching either operand 1 <em class="emph">or</em> operand 0. Should this be desired, one can use multiple alternatives instead. </p> <p>This is called a <em class="dfn">matching constraint</em> and what it really means is that the assembler has only a single operand that fills two roles which <code class="code">asm</code> distinguishes. For example, an add instruction uses two input operands and an output operand, but on most CISC machines an add instruction really has only two operands, one of them an input-output operand: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">addl #35,r12</pre> +</div> <p>Matching constraints are used in these circumstances. More precisely, the two operands that match must include one input-only operand and one output-only operand. Moreover, the digit must be a smaller number than the number of the operand that uses it in the constraint. </p> </dd> <dt> + <span>‘<samp class="samp">p</samp>’<a class="copiable-link" href="#index-load-address-instruction"> ¶</a></span> +</dt> <dd> +<p>An operand that is a valid memory address is allowed. This is for “load address” and “push address” instructions. </p> <p>‘<samp class="samp">p</samp>’ in the constraint must be accompanied by <code class="code">address_operand</code> as the predicate in the <code class="code">match_operand</code>. This predicate interprets the mode specified in the <code class="code">match_operand</code> as the mode of the memory reference for which the address would be valid. </p> </dd> <dt> + <span><var class="var">other-letters</var><a class="copiable-link" href="#index-other-register-constraints"> ¶</a></span> +</dt> <dd><p>Other letters can be defined in machine-dependent fashion to stand for particular classes of registers or other arbitrary operand types. ‘<samp class="samp">d</samp>’, ‘<samp class="samp">a</samp>’ and ‘<samp class="samp">f</samp>’ are defined on the 68000/68020 to stand for data, address and floating point registers. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="multi-alternative">Multiple Alternative Constraints</a>, Up: <a href="constraints">Constraints for <code class="code">asm</code> Operands</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Simple-Constraints.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Simple-Constraints.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/size-of-an-asm.html b/devdocs/gcc~13/size-of-an-asm.html new file mode 100644 index 00000000..c3ad6514 --- /dev/null +++ b/devdocs/gcc~13/size-of-an-asm.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="Size-of-an-asm"> <div class="nav-panel"> <p> Previous: <a href="explicit-register-variables" accesskey="p" rel="prev">Variables in Specified Registers</a>, Up: <a href="using-assembly-language-with-c" accesskey="u" rel="up">How to Use Inline Assembly Language in C Code</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Size-of-an-asm-1"><span>6.47.6 Size of an asm<a class="copiable-link" href="#Size-of-an-asm-1"> ¶</a></span></h1> <p>Some targets require that GCC track the size of each instruction used in order to generate correct code. Because the final length of the code produced by an <code class="code">asm</code> statement is only known by the assembler, GCC must make an estimate as to how big it will be. It does this by counting the number of instructions in the pattern of the <code class="code">asm</code> and multiplying that by the length of the longest instruction supported by that processor. (When working out the number of instructions, it assumes that any occurrence of a newline or of whatever statement separator character is supported by the assembler — typically ‘<samp class="samp">;</samp>’ — indicates the end of an instruction.) </p> <p>Normally, GCC’s estimate is adequate to ensure that correct code is generated, but it is possible to confuse the compiler if you use pseudo instructions or assembler macros that expand into multiple real instructions, or if you use assembler directives that expand to more space in the object file than is needed for a single instruction. If this happens then the assembler may produce a diagnostic saying that a label is unreachable. </p> <p>This size is also used for inlining decisions. If you use <code class="code">asm inline</code> instead of just <code class="code">asm</code>, then for inlining purposes the size of the asm is taken as the minimum size, ignoring how many instructions GCC thinks it is. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Size-of-an-asm.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Size-of-an-asm.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/solaris-2-options.html b/devdocs/gcc~13/solaris-2-options.html new file mode 100644 index 00000000..4476f7da --- /dev/null +++ b/devdocs/gcc~13/solaris-2-options.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="Solaris-2-Options"> <div class="nav-panel"> <p> Next: <a href="sparc-options" accesskey="n" rel="next">SPARC Options</a>, Previous: <a href="sh-options" accesskey="p" rel="prev">SH Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Solaris-2-Options-1"><span>3.19.46 Solaris 2 Options<a class="copiable-link" href="#Solaris-2-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are supported on Solaris 2: </p> <dl class="table"> <dt> +<span><code class="code">-mclear-hwcap</code><a class="copiable-link" href="#index-mclear-hwcap"> ¶</a></span> +</dt> <dd> +<p><samp class="option">-mclear-hwcap</samp> tells the compiler to remove the hardware capabilities generated by the Solaris assembler. This is only necessary when object files use ISA extensions not supported by the current machine, but check at runtime whether or not to use them. </p> </dd> <dt> +<span><code class="code">-mimpure-text</code><a class="copiable-link" href="#index-mimpure-text"> ¶</a></span> +</dt> <dd> +<p><samp class="option">-mimpure-text</samp>, used in addition to <samp class="option">-shared</samp>, tells the compiler to not pass <samp class="option">-z text</samp> to the linker when linking a shared object. Using this option, you can link position-dependent code into a shared object. </p> <p><samp class="option">-mimpure-text</samp> suppresses the “relocations remain against allocatable but non-writable sections” linker error message. However, the necessary relocations trigger copy-on-write, and the shared object is not actually shared across processes. Instead of using <samp class="option">-mimpure-text</samp>, you should compile all source code with <samp class="option">-fpic</samp> or <samp class="option">-fPIC</samp>. </p> </dd> </dl> <p>These switches are supported in addition to the above on Solaris 2: </p> <dl class="table"> <dt> +<span><code class="code">-pthreads</code><a class="copiable-link" href="#index-pthreads"> ¶</a></span> +</dt> <dd><p>This is a synonym for <samp class="option">-pthread</samp>. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Solaris-2-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Solaris-2-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/solaris-format-checks.html b/devdocs/gcc~13/solaris-format-checks.html new file mode 100644 index 00000000..863674df --- /dev/null +++ b/devdocs/gcc~13/solaris-format-checks.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="Solaris-Format-Checks"> <div class="nav-panel"> <p> Next: <a href="darwin-format-checks" accesskey="n" rel="next">Darwin Format Checks</a>, Up: <a href="target-format-checks" accesskey="u" rel="up">Format Checks Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Solaris-Format-Checks-1"><span>6.61.1 Solaris Format Checks<a class="copiable-link" href="#Solaris-Format-Checks-1"> ¶</a></span></h1> <p>Solaris targets support the <code class="code">cmn_err</code> (or <code class="code">__cmn_err__</code>) format check. <code class="code">cmn_err</code> accepts a subset of the standard <code class="code">printf</code> conversions, and the two-argument <code class="code">%b</code> conversion for displaying bit-fields. See the Solaris man page for <code class="code">cmn_err</code> for more information. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Solaris-Format-Checks.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Solaris-Format-Checks.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/solaris-pragmas.html b/devdocs/gcc~13/solaris-pragmas.html new file mode 100644 index 00000000..f9d82ddd --- /dev/null +++ b/devdocs/gcc~13/solaris-pragmas.html @@ -0,0 +1,12 @@ +<div class="subsection-level-extent" id="Solaris-Pragmas"> <div class="nav-panel"> <p> Next: <a href="symbol-renaming-pragmas" accesskey="n" rel="next">Symbol-Renaming Pragmas</a>, Previous: <a href="darwin-pragmas" accesskey="p" rel="prev">Darwin Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Solaris-Pragmas-1"><span>6.62.8 Solaris Pragmas<a class="copiable-link" href="#Solaris-Pragmas-1"> ¶</a></span></h1> <p>The Solaris target supports <code class="code">#pragma redefine_extname</code> (see <a class="pxref" href="symbol-renaming-pragmas">Symbol-Renaming Pragmas</a>). It also supports additional <code class="code">#pragma</code> directives for compatibility with the system compiler. </p> <dl class="table"> <dt> +<span><code class="code">align <var class="var">alignment</var> (<var class="var">variable</var> [, <var class="var">variable</var>]...)</code><a class="copiable-link" href="#index-pragma_002c-align"> ¶</a></span> +</dt> <dd> <p>Increase the minimum alignment of each <var class="var">variable</var> to <var class="var">alignment</var>. This is the same as GCC’s <code class="code">aligned</code> attribute see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). Macro expansion occurs on the arguments to this pragma when compiling C and Objective-C. It does not currently occur when compiling C++, but this is a bug which may be fixed in a future release. </p> </dd> <dt> +<span><code class="code">fini (<var class="var">function</var> [, <var class="var">function</var>]...)</code><a class="copiable-link" href="#index-pragma_002c-fini"> ¶</a></span> +</dt> <dd> <p>This pragma causes each listed <var class="var">function</var> to be called after main, or during shared module unloading, by adding a call to the <code class="code">.fini</code> section. </p> </dd> <dt> +<span><code class="code">init (<var class="var">function</var> [, <var class="var">function</var>]...)</code><a class="copiable-link" href="#index-pragma_002c-init"> ¶</a></span> +</dt> <dd> <p>This pragma causes each listed <var class="var">function</var> to be called during initialization (before <code class="code">main</code>) or during shared module loading, by adding a call to the <code class="code">.init</code> section. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Solaris-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Solaris-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/sparc-options.html b/devdocs/gcc~13/sparc-options.html new file mode 100644 index 00000000..cef92904 --- /dev/null +++ b/devdocs/gcc~13/sparc-options.html @@ -0,0 +1,111 @@ +<div class="subsection-level-extent" id="SPARC-Options"> <div class="nav-panel"> <p> Next: <a href="system-v-options" accesskey="n" rel="next">Options for System V</a>, Previous: <a href="solaris-2-options" accesskey="p" rel="prev">Solaris 2 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="SPARC-Options-1"><span>3.19.47 SPARC Options<a class="copiable-link" href="#SPARC-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are supported on the SPARC: </p> <dl class="table"> <dt> + <span><code class="code">-mno-app-regs</code><a class="copiable-link" href="#index-mno-app-regs"> ¶</a></span> +</dt> <dt><code class="code">-mapp-regs</code></dt> <dd> +<p>Specify <samp class="option">-mapp-regs</samp> to generate output using the global registers 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the global register 1, each global register 2 through 4 is then treated as an allocable register that is clobbered by function calls. This is the default. </p> <p>To be fully SVR4 ABI-compliant at the cost of some performance loss, specify <samp class="option">-mno-app-regs</samp>. You should compile libraries and system software with this option. </p> </dd> <dt> + <span><code class="code">-mflat</code><a class="copiable-link" href="#index-mflat"> ¶</a></span> +</dt> <dt><code class="code">-mno-flat</code></dt> <dd> +<p>With <samp class="option">-mflat</samp>, the compiler does not generate save/restore instructions and uses a “flat” or single register window model. This model is compatible with the regular register window model. The local registers and the input registers (0–5) are still treated as “call-saved” registers and are saved on the stack as needed. </p> <p>With <samp class="option">-mno-flat</samp> (the default), the compiler generates save/restore instructions (except for leaf functions). This is the normal operating mode. </p> </dd> <dt> + <span><code class="code">-mfpu</code><a class="copiable-link" href="#index-mfpu-4"> ¶</a></span> +</dt> <dt><code class="code">-mhard-float</code></dt> <dd> +<p>Generate output containing floating-point instructions. This is the default. </p> </dd> <dt> + <span><code class="code">-mno-fpu</code><a class="copiable-link" href="#index-mno-fpu"> ¶</a></span> +</dt> <dt><code class="code">-msoft-float</code></dt> <dd> +<p>Generate output containing library calls for floating point. <strong class="strong">Warning:</strong> the requisite libraries are not available for all SPARC targets. Normally the facilities of the machine’s usual C compiler are used, but this cannot be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for cross-compilation. The embedded targets ‘<samp class="samp">sparc-*-aout</samp>’ and ‘<samp class="samp">sparclite-*-*</samp>’ do provide software floating-point support. </p> <p><samp class="option">-msoft-float</samp> changes the calling convention in the output file; therefore, it is only useful if you compile <em class="emph">all</em> of a program with this option. In particular, you need to compile <samp class="file">libgcc.a</samp>, the library that comes with GCC, with <samp class="option">-msoft-float</samp> in order for this to work. </p> </dd> <dt> +<span><code class="code">-mhard-quad-float</code><a class="copiable-link" href="#index-mhard-quad-float"> ¶</a></span> +</dt> <dd> +<p>Generate output containing quad-word (long double) floating-point instructions. </p> </dd> <dt> +<span><code class="code">-msoft-quad-float</code><a class="copiable-link" href="#index-msoft-quad-float"> ¶</a></span> +</dt> <dd> +<p>Generate output containing library calls for quad-word (long double) floating-point instructions. The functions called are those specified in the SPARC ABI. This is the default. </p> <p>As of this writing, there are no SPARC implementations that have hardware support for the quad-word floating-point instructions. They all invoke a trap handler for one of these instructions, and then the trap handler emulates the effect of the instruction. Because of the trap handler overhead, this is much slower than calling the ABI library routines. Thus the <samp class="option">-msoft-quad-float</samp> option is the default. </p> </dd> <dt> + <span><code class="code">-mno-unaligned-doubles</code><a class="copiable-link" href="#index-mno-unaligned-doubles"> ¶</a></span> +</dt> <dt><code class="code">-munaligned-doubles</code></dt> <dd> +<p>Assume that doubles have 8-byte alignment. This is the default. </p> <p>With <samp class="option">-munaligned-doubles</samp>, GCC assumes that doubles have 8-byte alignment only if they are contained in another type, or if they have an absolute address. Otherwise, it assumes they have 4-byte alignment. Specifying this option avoids some rare compatibility problems with code generated by other compilers. It is not the default because it results in a performance loss, especially for floating-point code. </p> </dd> <dt> + <span><code class="code">-muser-mode</code><a class="copiable-link" href="#index-muser-mode"> ¶</a></span> +</dt> <dt><code class="code">-mno-user-mode</code></dt> <dd> +<p>Do not generate code that can only run in supervisor mode. This is relevant only for the <code class="code">casa</code> instruction emitted for the LEON3 processor. This is the default. </p> </dd> <dt> + <span><code class="code">-mfaster-structs</code><a class="copiable-link" href="#index-mfaster-structs"> ¶</a></span> +</dt> <dt><code class="code">-mno-faster-structs</code></dt> <dd> +<p>With <samp class="option">-mfaster-structs</samp>, the compiler assumes that structures should have 8-byte alignment. This enables the use of pairs of <code class="code">ldd</code> and <code class="code">std</code> instructions for copies in structure assignment, in place of twice as many <code class="code">ld</code> and <code class="code">st</code> pairs. However, the use of this changed alignment directly violates the SPARC ABI. Thus, it’s intended only for use on targets where the developer acknowledges that their resulting code is not directly in line with the rules of the ABI. </p> </dd> <dt> + <span><code class="code">-mstd-struct-return</code><a class="copiable-link" href="#index-mstd-struct-return"> ¶</a></span> +</dt> <dt><code class="code">-mno-std-struct-return</code></dt> <dd> +<p>With <samp class="option">-mstd-struct-return</samp>, the compiler generates checking code in functions returning structures or unions to detect size mismatches between the two sides of function calls, as per the 32-bit ABI. </p> <p>The default is <samp class="option">-mno-std-struct-return</samp>. This option has no effect in 64-bit mode. </p> </dd> <dt> + <span><code class="code">-mlra</code><a class="copiable-link" href="#index-mlra-3"> ¶</a></span> +</dt> <dt><code class="code">-mno-lra</code></dt> <dd> +<p>Enable Local Register Allocation. This is the default for SPARC since GCC 7 so <samp class="option">-mno-lra</samp> needs to be passed to get old Reload. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu_type</var></code><a class="copiable-link" href="#index-mcpu-12"> ¶</a></span> +</dt> <dd> +<p>Set the instruction set, register set, and instruction scheduling parameters for machine type <var class="var">cpu_type</var>. Supported values for <var class="var">cpu_type</var> are ‘<samp class="samp">v7</samp>’, ‘<samp class="samp">cypress</samp>’, ‘<samp class="samp">v8</samp>’, ‘<samp class="samp">supersparc</samp>’, ‘<samp class="samp">hypersparc</samp>’, ‘<samp class="samp">leon</samp>’, ‘<samp class="samp">leon3</samp>’, ‘<samp class="samp">leon3v7</samp>’, ‘<samp class="samp">leon5</samp>’, ‘<samp class="samp">sparclite</samp>’, ‘<samp class="samp">f930</samp>’, ‘<samp class="samp">f934</samp>’, ‘<samp class="samp">sparclite86x</samp>’, ‘<samp class="samp">sparclet</samp>’, ‘<samp class="samp">tsc701</samp>’, ‘<samp class="samp">v9</samp>’, ‘<samp class="samp">ultrasparc</samp>’, ‘<samp class="samp">ultrasparc3</samp>’, ‘<samp class="samp">niagara</samp>’, ‘<samp class="samp">niagara2</samp>’, ‘<samp class="samp">niagara3</samp>’, ‘<samp class="samp">niagara4</samp>’, ‘<samp class="samp">niagara7</samp>’ and ‘<samp class="samp">m8</samp>’. </p> <p>Native Solaris and GNU/Linux toolchains also support the value ‘<samp class="samp">native</samp>’, which selects the best architecture option for the host processor. <samp class="option">-mcpu=native</samp> has no effect if GCC does not recognize the processor. </p> <p>Default instruction scheduling parameters are used for values that select an architecture and not an implementation. These are ‘<samp class="samp">v7</samp>’, ‘<samp class="samp">v8</samp>’, ‘<samp class="samp">sparclite</samp>’, ‘<samp class="samp">sparclet</samp>’, ‘<samp class="samp">v9</samp>’. </p> <p>Here is a list of each supported architecture and their supported implementations. </p> <dl class="table"> <dt>v7</dt> <dd> +<p>cypress, leon3v7 </p> </dd> <dt>v8</dt> <dd> +<p>supersparc, hypersparc, leon, leon3, leon5 </p> </dd> <dt>sparclite</dt> <dd> +<p>f930, f934, sparclite86x </p> </dd> <dt>sparclet</dt> <dd> +<p>tsc701 </p> </dd> <dt>v9</dt> <dd><p>ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7, m8 </p></dd> </dl> <p>By default (unless configured otherwise), GCC generates code for the V7 variant of the SPARC architecture. With <samp class="option">-mcpu=cypress</samp>, the compiler additionally optimizes it for the Cypress CY7C602 chip, as used in the SPARCStation/SPARCServer 3xx series. This is also appropriate for the older SPARCStation 1, 2, IPX etc. </p> <p>With <samp class="option">-mcpu=v8</samp>, GCC generates code for the V8 variant of the SPARC architecture. The only difference from V7 code is that the compiler emits the integer multiply and integer divide instructions which exist in SPARC-V8 but not in SPARC-V7. With <samp class="option">-mcpu=supersparc</samp>, the compiler additionally optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000 series. </p> <p>With <samp class="option">-mcpu=sparclite</samp>, GCC generates code for the SPARClite variant of the SPARC architecture. This adds the integer multiply, integer divide step and scan (<code class="code">ffs</code>) instructions which exist in SPARClite but not in SPARC-V7. With <samp class="option">-mcpu=f930</samp>, the compiler additionally optimizes it for the Fujitsu MB86930 chip, which is the original SPARClite, with no FPU. With <samp class="option">-mcpu=f934</samp>, the compiler additionally optimizes it for the Fujitsu MB86934 chip, which is the more recent SPARClite with FPU. </p> <p>With <samp class="option">-mcpu=sparclet</samp>, GCC generates code for the SPARClet variant of the SPARC architecture. This adds the integer multiply, multiply/accumulate, integer divide step and scan (<code class="code">ffs</code>) instructions which exist in SPARClet but not in SPARC-V7. With <samp class="option">-mcpu=tsc701</samp>, the compiler additionally optimizes it for the TEMIC SPARClet chip. </p> <p>With <samp class="option">-mcpu=v9</samp>, GCC generates code for the V9 variant of the SPARC architecture. This adds 64-bit integer and floating-point move instructions, 3 additional floating-point condition code registers and conditional move instructions. With <samp class="option">-mcpu=ultrasparc</samp>, the compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi chips. With <samp class="option">-mcpu=ultrasparc3</samp>, the compiler additionally optimizes it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With <samp class="option">-mcpu=niagara</samp>, the compiler additionally optimizes it for Sun UltraSPARC T1 chips. With <samp class="option">-mcpu=niagara2</samp>, the compiler additionally optimizes it for Sun UltraSPARC T2 chips. With <samp class="option">-mcpu=niagara3</samp>, the compiler additionally optimizes it for Sun UltraSPARC T3 chips. With <samp class="option">-mcpu=niagara4</samp>, the compiler additionally optimizes it for Sun UltraSPARC T4 chips. With <samp class="option">-mcpu=niagara7</samp>, the compiler additionally optimizes it for Oracle SPARC M7 chips. With <samp class="option">-mcpu=m8</samp>, the compiler additionally optimizes it for Oracle M8 chips. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu_type</var></code><a class="copiable-link" href="#index-mtune-15"> ¶</a></span> +</dt> <dd> +<p>Set the instruction scheduling parameters for machine type <var class="var">cpu_type</var>, but do not set the instruction set or register set that the option <samp class="option">-mcpu=<var class="var">cpu_type</var></samp> does. </p> <p>The same values for <samp class="option">-mcpu=<var class="var">cpu_type</var></samp> can be used for <samp class="option">-mtune=<var class="var">cpu_type</var></samp>, but the only useful values are those that select a particular CPU implementation. Those are ‘<samp class="samp">cypress</samp>’, ‘<samp class="samp">supersparc</samp>’, ‘<samp class="samp">hypersparc</samp>’, ‘<samp class="samp">leon</samp>’, ‘<samp class="samp">leon3</samp>’, ‘<samp class="samp">leon3v7</samp>’, ‘<samp class="samp">leon5</samp>’, ‘<samp class="samp">f930</samp>’, ‘<samp class="samp">f934</samp>’, ‘<samp class="samp">sparclite86x</samp>’, ‘<samp class="samp">tsc701</samp>’, ‘<samp class="samp">ultrasparc</samp>’, ‘<samp class="samp">ultrasparc3</samp>’, ‘<samp class="samp">niagara</samp>’, ‘<samp class="samp">niagara2</samp>’, ‘<samp class="samp">niagara3</samp>’, ‘<samp class="samp">niagara4</samp>’, ‘<samp class="samp">niagara7</samp>’ and ‘<samp class="samp">m8</samp>’. With native Solaris and GNU/Linux toolchains, ‘<samp class="samp">native</samp>’ can also be used. </p> </dd> <dt> + <span><code class="code">-mv8plus</code><a class="copiable-link" href="#index-mv8plus"> ¶</a></span> +</dt> <dt><code class="code">-mno-v8plus</code></dt> <dd> +<p>With <samp class="option">-mv8plus</samp>, GCC generates code for the SPARC-V8+ ABI. The difference from the V8 ABI is that the global and out registers are considered 64 bits wide. This is enabled by default on Solaris in 32-bit mode for all SPARC-V9 processors. </p> </dd> <dt> + <span><code class="code">-mvis</code><a class="copiable-link" href="#index-mvis"> ¶</a></span> +</dt> <dt><code class="code">-mno-vis</code></dt> <dd> +<p>With <samp class="option">-mvis</samp>, GCC generates code that takes advantage of the UltraSPARC Visual Instruction Set extensions. The default is <samp class="option">-mno-vis</samp>. </p> </dd> <dt> + <span><code class="code">-mvis2</code><a class="copiable-link" href="#index-mvis2"> ¶</a></span> +</dt> <dt><code class="code">-mno-vis2</code></dt> <dd> +<p>With <samp class="option">-mvis2</samp>, GCC generates code that takes advantage of version 2.0 of the UltraSPARC Visual Instruction Set extensions. The default is <samp class="option">-mvis2</samp> when targeting a cpu that supports such instructions, such as UltraSPARC-III and later. Setting <samp class="option">-mvis2</samp> also sets <samp class="option">-mvis</samp>. </p> </dd> <dt> + <span><code class="code">-mvis3</code><a class="copiable-link" href="#index-mvis3"> ¶</a></span> +</dt> <dt><code class="code">-mno-vis3</code></dt> <dd> +<p>With <samp class="option">-mvis3</samp>, GCC generates code that takes advantage of version 3.0 of the UltraSPARC Visual Instruction Set extensions. The default is <samp class="option">-mvis3</samp> when targeting a cpu that supports such instructions, such as niagara-3 and later. Setting <samp class="option">-mvis3</samp> also sets <samp class="option">-mvis2</samp> and <samp class="option">-mvis</samp>. </p> </dd> <dt> + <span><code class="code">-mvis4</code><a class="copiable-link" href="#index-mvis4"> ¶</a></span> +</dt> <dt><code class="code">-mno-vis4</code></dt> <dd> +<p>With <samp class="option">-mvis4</samp>, GCC generates code that takes advantage of version 4.0 of the UltraSPARC Visual Instruction Set extensions. The default is <samp class="option">-mvis4</samp> when targeting a cpu that supports such instructions, such as niagara-7 and later. Setting <samp class="option">-mvis4</samp> also sets <samp class="option">-mvis3</samp>, <samp class="option">-mvis2</samp> and <samp class="option">-mvis</samp>. </p> </dd> <dt> + <span><code class="code">-mvis4b</code><a class="copiable-link" href="#index-mvis4b"> ¶</a></span> +</dt> <dt><code class="code">-mno-vis4b</code></dt> <dd> +<p>With <samp class="option">-mvis4b</samp>, GCC generates code that takes advantage of version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the additional VIS instructions introduced in the Oracle SPARC Architecture 2017. The default is <samp class="option">-mvis4b</samp> when targeting a cpu that supports such instructions, such as m8 and later. Setting <samp class="option">-mvis4b</samp> also sets <samp class="option">-mvis4</samp>, <samp class="option">-mvis3</samp>, <samp class="option">-mvis2</samp> and <samp class="option">-mvis</samp>. </p> </dd> <dt> + <span><code class="code">-mcbcond</code><a class="copiable-link" href="#index-mcbcond"> ¶</a></span> +</dt> <dt><code class="code">-mno-cbcond</code></dt> <dd> +<p>With <samp class="option">-mcbcond</samp>, GCC generates code that takes advantage of the UltraSPARC Compare-and-Branch-on-Condition instructions. The default is <samp class="option">-mcbcond</samp> when targeting a CPU that supports such instructions, such as Niagara-4 and later. </p> </dd> <dt> + <span><code class="code">-mfmaf</code><a class="copiable-link" href="#index-mfmaf"> ¶</a></span> +</dt> <dt><code class="code">-mno-fmaf</code></dt> <dd> +<p>With <samp class="option">-mfmaf</samp>, GCC generates code that takes advantage of the UltraSPARC Fused Multiply-Add Floating-point instructions. The default is <samp class="option">-mfmaf</samp> when targeting a CPU that supports such instructions, such as Niagara-3 and later. </p> </dd> <dt> + <span><code class="code">-mfsmuld</code><a class="copiable-link" href="#index-mfsmuld"> ¶</a></span> +</dt> <dt><code class="code">-mno-fsmuld</code></dt> <dd> +<p>With <samp class="option">-mfsmuld</samp>, GCC generates code that takes advantage of the Floating-point Multiply Single to Double (FsMULd) instruction. The default is <samp class="option">-mfsmuld</samp> when targeting a CPU supporting the architecture versions V8 or V9 with FPU except <samp class="option">-mcpu=leon</samp>. </p> </dd> <dt> + <span><code class="code">-mpopc</code><a class="copiable-link" href="#index-mpopc"> ¶</a></span> +</dt> <dt><code class="code">-mno-popc</code></dt> <dd> +<p>With <samp class="option">-mpopc</samp>, GCC generates code that takes advantage of the UltraSPARC Population Count instruction. The default is <samp class="option">-mpopc</samp> when targeting a CPU that supports such an instruction, such as Niagara-2 and later. </p> </dd> <dt> + <span><code class="code">-msubxc</code><a class="copiable-link" href="#index-msubxc"> ¶</a></span> +</dt> <dt><code class="code">-mno-subxc</code></dt> <dd> +<p>With <samp class="option">-msubxc</samp>, GCC generates code that takes advantage of the UltraSPARC Subtract-Extended-with-Carry instruction. The default is <samp class="option">-msubxc</samp> when targeting a CPU that supports such an instruction, such as Niagara-7 and later. </p> </dd> <dt> +<span><code class="code">-mfix-at697f</code><a class="copiable-link" href="#index-mfix-at697f"> ¶</a></span> +</dt> <dd> +<p>Enable the documented workaround for the single erratum of the Atmel AT697F processor (which corresponds to erratum #13 of the AT697E processor). </p> </dd> <dt> +<span><code class="code">-mfix-ut699</code><a class="copiable-link" href="#index-mfix-ut699"> ¶</a></span> +</dt> <dd> +<p>Enable the documented workarounds for the floating-point errata and the data cache nullify errata of the UT699 processor. </p> </dd> <dt> +<span><code class="code">-mfix-ut700</code><a class="copiable-link" href="#index-mfix-ut700"> ¶</a></span> +</dt> <dd> +<p>Enable the documented workaround for the back-to-back store errata of the UT699E/UT700 processor. </p> </dd> <dt> +<span><code class="code">-mfix-gr712rc</code><a class="copiable-link" href="#index-mfix-gr712rc"> ¶</a></span> +</dt> <dd><p>Enable the documented workaround for the back-to-back store errata of the GR712RC processor. </p></dd> </dl> <p>These ‘<samp class="samp">-m</samp>’ options are supported in addition to the above on SPARC-V9 processors in 64-bit environments: </p> <dl class="table"> <dt> + <span><code class="code">-m32</code><a class="copiable-link" href="#index-m32-1"> ¶</a></span> +</dt> <dt><code class="code">-m64</code></dt> <dd> +<p>Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits. </p> </dd> <dt> +<span><code class="code">-mcmodel=<var class="var">which</var></code><a class="copiable-link" href="#index-mcmodel-1"> ¶</a></span> +</dt> <dd> +<p>Set the code model to one of </p> <dl class="table"> <dt>‘<samp class="samp">medlow</samp>’</dt> <dd> +<p>The Medium/Low code model: 64-bit addresses, programs must be linked in the low 32 bits of memory. Programs can be statically or dynamically linked. </p> </dd> <dt>‘<samp class="samp">medmid</samp>’</dt> <dd> +<p>The Medium/Middle code model: 64-bit addresses, programs must be linked in the low 44 bits of memory, the text and data segments must be less than 2GB in size and the data segment must be located within 2GB of the text segment. </p> </dd> <dt>‘<samp class="samp">medany</samp>’</dt> <dd> +<p>The Medium/Anywhere code model: 64-bit addresses, programs may be linked anywhere in memory, the text and data segments must be less than 2GB in size and the data segment must be located within 2GB of the text segment. </p> </dd> <dt>‘<samp class="samp">embmedany</samp>’</dt> <dd><p>The Medium/Anywhere code model for embedded systems: 64-bit addresses, the text and data segments must be less than 2GB in size, both starting anywhere in memory (determined at link time). The global register %g4 points to the base of the data segment. Programs are statically linked and PIC is not supported. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mmemory-model=<var class="var">mem-model</var></code><a class="copiable-link" href="#index-mmemory-model"> ¶</a></span> +</dt> <dd> +<p>Set the memory model in force on the processor to one of </p> <dl class="table"> <dt>‘<samp class="samp">default</samp>’</dt> <dd> +<p>The default memory model for the processor and operating system. </p> </dd> <dt>‘<samp class="samp">rmo</samp>’</dt> <dd> +<p>Relaxed Memory Order </p> </dd> <dt>‘<samp class="samp">pso</samp>’</dt> <dd> +<p>Partial Store Order </p> </dd> <dt>‘<samp class="samp">tso</samp>’</dt> <dd> +<p>Total Store Order </p> </dd> <dt>‘<samp class="samp">sc</samp>’</dt> <dd><p>Sequential Consistency </p></dd> </dl> <p>These memory models are formally defined in Appendix D of the SPARC-V9 architecture manual, as set in the processor’s <code class="code">PSTATE.MM</code> field. </p> </dd> <dt> + <span><code class="code">-mstack-bias</code><a class="copiable-link" href="#index-mstack-bias"> ¶</a></span> +</dt> <dt><code class="code">-mno-stack-bias</code></dt> <dd><p>With <samp class="option">-mstack-bias</samp>, GCC assumes that the stack pointer, and frame pointer if present, are offset by −2047 which must be added back when making stack frame references. This is the default in 64-bit mode. Otherwise, assume no such offset is present. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="system-v-options">Options for System V</a>, Previous: <a href="solaris-2-options">Solaris 2 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SPARC-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SPARC-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/sparc-vis-built-in-functions.html b/devdocs/gcc~13/sparc-vis-built-in-functions.html new file mode 100644 index 00000000..93c4ee90 --- /dev/null +++ b/devdocs/gcc~13/sparc-vis-built-in-functions.html @@ -0,0 +1,191 @@ +<div class="subsection-level-extent" id="SPARC-VIS-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="ti-c6x-built-in-functions" accesskey="n" rel="next">TI C6X Built-in Functions</a>, Previous: <a href="sh-built-in-functions" accesskey="p" rel="prev">SH Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="SPARC-VIS-Built-in-Functions-1"><span>6.60.33 SPARC VIS Built-in Functions<a class="copiable-link" href="#SPARC-VIS-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC supports SIMD operations on the SPARC using both the generic vector extensions (see <a class="pxref" href="vector-extensions">Using Vector Instructions through Built-in Functions</a>) as well as built-in functions for the SPARC Visual Instruction Set (VIS). When you use the <samp class="option">-mvis</samp> switch, the VIS extension is exposed as the following built-in functions: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int v1si __attribute__ ((vector_size (4))); +typedef int v2si __attribute__ ((vector_size (8))); +typedef short v4hi __attribute__ ((vector_size (8))); +typedef short v2hi __attribute__ ((vector_size (4))); +typedef unsigned char v8qi __attribute__ ((vector_size (8))); +typedef unsigned char v4qi __attribute__ ((vector_size (4))); + +void __builtin_vis_write_gsr (int64_t); +int64_t __builtin_vis_read_gsr (void); + +void * __builtin_vis_alignaddr (void *, long); +void * __builtin_vis_alignaddrl (void *, long); +int64_t __builtin_vis_faligndatadi (int64_t, int64_t); +v2si __builtin_vis_faligndatav2si (v2si, v2si); +v4hi __builtin_vis_faligndatav4hi (v4si, v4si); +v8qi __builtin_vis_faligndatav8qi (v8qi, v8qi); + +v4hi __builtin_vis_fexpand (v4qi); + +v4hi __builtin_vis_fmul8x16 (v4qi, v4hi); +v4hi __builtin_vis_fmul8x16au (v4qi, v2hi); +v4hi __builtin_vis_fmul8x16al (v4qi, v2hi); +v4hi __builtin_vis_fmul8sux16 (v8qi, v4hi); +v4hi __builtin_vis_fmul8ulx16 (v8qi, v4hi); +v2si __builtin_vis_fmuld8sux16 (v4qi, v2hi); +v2si __builtin_vis_fmuld8ulx16 (v4qi, v2hi); + +v4qi __builtin_vis_fpack16 (v4hi); +v8qi __builtin_vis_fpack32 (v2si, v8qi); +v2hi __builtin_vis_fpackfix (v2si); +v8qi __builtin_vis_fpmerge (v4qi, v4qi); + +int64_t __builtin_vis_pdist (v8qi, v8qi, int64_t); + +long __builtin_vis_edge8 (void *, void *); +long __builtin_vis_edge8l (void *, void *); +long __builtin_vis_edge16 (void *, void *); +long __builtin_vis_edge16l (void *, void *); +long __builtin_vis_edge32 (void *, void *); +long __builtin_vis_edge32l (void *, void *); + +long __builtin_vis_fcmple16 (v4hi, v4hi); +long __builtin_vis_fcmple32 (v2si, v2si); +long __builtin_vis_fcmpne16 (v4hi, v4hi); +long __builtin_vis_fcmpne32 (v2si, v2si); +long __builtin_vis_fcmpgt16 (v4hi, v4hi); +long __builtin_vis_fcmpgt32 (v2si, v2si); +long __builtin_vis_fcmpeq16 (v4hi, v4hi); +long __builtin_vis_fcmpeq32 (v2si, v2si); + +v4hi __builtin_vis_fpadd16 (v4hi, v4hi); +v2hi __builtin_vis_fpadd16s (v2hi, v2hi); +v2si __builtin_vis_fpadd32 (v2si, v2si); +v1si __builtin_vis_fpadd32s (v1si, v1si); +v4hi __builtin_vis_fpsub16 (v4hi, v4hi); +v2hi __builtin_vis_fpsub16s (v2hi, v2hi); +v2si __builtin_vis_fpsub32 (v2si, v2si); +v1si __builtin_vis_fpsub32s (v1si, v1si); + +long __builtin_vis_array8 (long, long); +long __builtin_vis_array16 (long, long); +long __builtin_vis_array32 (long, long);</pre> +</div> <p>When you use the <samp class="option">-mvis2</samp> switch, the VIS version 2.0 built-in functions also become available: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">long __builtin_vis_bmask (long, long); +int64_t __builtin_vis_bshuffledi (int64_t, int64_t); +v2si __builtin_vis_bshufflev2si (v2si, v2si); +v4hi __builtin_vis_bshufflev2si (v4hi, v4hi); +v8qi __builtin_vis_bshufflev2si (v8qi, v8qi); + +long __builtin_vis_edge8n (void *, void *); +long __builtin_vis_edge8ln (void *, void *); +long __builtin_vis_edge16n (void *, void *); +long __builtin_vis_edge16ln (void *, void *); +long __builtin_vis_edge32n (void *, void *); +long __builtin_vis_edge32ln (void *, void *);</pre> +</div> <p>When you use the <samp class="option">-mvis3</samp> switch, the VIS version 3.0 built-in functions also become available: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_vis_cmask8 (long); +void __builtin_vis_cmask16 (long); +void __builtin_vis_cmask32 (long); + +v4hi __builtin_vis_fchksm16 (v4hi, v4hi); + +v4hi __builtin_vis_fsll16 (v4hi, v4hi); +v4hi __builtin_vis_fslas16 (v4hi, v4hi); +v4hi __builtin_vis_fsrl16 (v4hi, v4hi); +v4hi __builtin_vis_fsra16 (v4hi, v4hi); +v2si __builtin_vis_fsll16 (v2si, v2si); +v2si __builtin_vis_fslas16 (v2si, v2si); +v2si __builtin_vis_fsrl16 (v2si, v2si); +v2si __builtin_vis_fsra16 (v2si, v2si); + +long __builtin_vis_pdistn (v8qi, v8qi); + +v4hi __builtin_vis_fmean16 (v4hi, v4hi); + +int64_t __builtin_vis_fpadd64 (int64_t, int64_t); +int64_t __builtin_vis_fpsub64 (int64_t, int64_t); + +v4hi __builtin_vis_fpadds16 (v4hi, v4hi); +v2hi __builtin_vis_fpadds16s (v2hi, v2hi); +v4hi __builtin_vis_fpsubs16 (v4hi, v4hi); +v2hi __builtin_vis_fpsubs16s (v2hi, v2hi); +v2si __builtin_vis_fpadds32 (v2si, v2si); +v1si __builtin_vis_fpadds32s (v1si, v1si); +v2si __builtin_vis_fpsubs32 (v2si, v2si); +v1si __builtin_vis_fpsubs32s (v1si, v1si); + +long __builtin_vis_fucmple8 (v8qi, v8qi); +long __builtin_vis_fucmpne8 (v8qi, v8qi); +long __builtin_vis_fucmpgt8 (v8qi, v8qi); +long __builtin_vis_fucmpeq8 (v8qi, v8qi); + +float __builtin_vis_fhadds (float, float); +double __builtin_vis_fhaddd (double, double); +float __builtin_vis_fhsubs (float, float); +double __builtin_vis_fhsubd (double, double); +float __builtin_vis_fnhadds (float, float); +double __builtin_vis_fnhaddd (double, double); + +int64_t __builtin_vis_umulxhi (int64_t, int64_t); +int64_t __builtin_vis_xmulx (int64_t, int64_t); +int64_t __builtin_vis_xmulxhi (int64_t, int64_t);</pre> +</div> <p>When you use the <samp class="option">-mvis4</samp> switch, the VIS version 4.0 built-in functions also become available: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v8qi __builtin_vis_fpadd8 (v8qi, v8qi); +v8qi __builtin_vis_fpadds8 (v8qi, v8qi); +v8qi __builtin_vis_fpaddus8 (v8qi, v8qi); +v4hi __builtin_vis_fpaddus16 (v4hi, v4hi); + +v8qi __builtin_vis_fpsub8 (v8qi, v8qi); +v8qi __builtin_vis_fpsubs8 (v8qi, v8qi); +v8qi __builtin_vis_fpsubus8 (v8qi, v8qi); +v4hi __builtin_vis_fpsubus16 (v4hi, v4hi); + +long __builtin_vis_fpcmple8 (v8qi, v8qi); +long __builtin_vis_fpcmpgt8 (v8qi, v8qi); +long __builtin_vis_fpcmpule16 (v4hi, v4hi); +long __builtin_vis_fpcmpugt16 (v4hi, v4hi); +long __builtin_vis_fpcmpule32 (v2si, v2si); +long __builtin_vis_fpcmpugt32 (v2si, v2si); + +v8qi __builtin_vis_fpmax8 (v8qi, v8qi); +v4hi __builtin_vis_fpmax16 (v4hi, v4hi); +v2si __builtin_vis_fpmax32 (v2si, v2si); + +v8qi __builtin_vis_fpmaxu8 (v8qi, v8qi); +v4hi __builtin_vis_fpmaxu16 (v4hi, v4hi); +v2si __builtin_vis_fpmaxu32 (v2si, v2si); + +v8qi __builtin_vis_fpmin8 (v8qi, v8qi); +v4hi __builtin_vis_fpmin16 (v4hi, v4hi); +v2si __builtin_vis_fpmin32 (v2si, v2si); + +v8qi __builtin_vis_fpminu8 (v8qi, v8qi); +v4hi __builtin_vis_fpminu16 (v4hi, v4hi); +v2si __builtin_vis_fpminu32 (v2si, v2si);</pre> +</div> <p>When you use the <samp class="option">-mvis4b</samp> switch, the VIS version 4.0B built-in functions also become available: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v8qi __builtin_vis_dictunpack8 (double, int); +v4hi __builtin_vis_dictunpack16 (double, int); +v2si __builtin_vis_dictunpack32 (double, int); + +long __builtin_vis_fpcmple8shl (v8qi, v8qi, int); +long __builtin_vis_fpcmpgt8shl (v8qi, v8qi, int); +long __builtin_vis_fpcmpeq8shl (v8qi, v8qi, int); +long __builtin_vis_fpcmpne8shl (v8qi, v8qi, int); + +long __builtin_vis_fpcmple16shl (v4hi, v4hi, int); +long __builtin_vis_fpcmpgt16shl (v4hi, v4hi, int); +long __builtin_vis_fpcmpeq16shl (v4hi, v4hi, int); +long __builtin_vis_fpcmpne16shl (v4hi, v4hi, int); + +long __builtin_vis_fpcmple32shl (v2si, v2si, int); +long __builtin_vis_fpcmpgt32shl (v2si, v2si, int); +long __builtin_vis_fpcmpeq32shl (v2si, v2si, int); +long __builtin_vis_fpcmpne32shl (v2si, v2si, int); + +long __builtin_vis_fpcmpule8shl (v8qi, v8qi, int); +long __builtin_vis_fpcmpugt8shl (v8qi, v8qi, int); +long __builtin_vis_fpcmpule16shl (v4hi, v4hi, int); +long __builtin_vis_fpcmpugt16shl (v4hi, v4hi, int); +long __builtin_vis_fpcmpule32shl (v2si, v2si, int); +long __builtin_vis_fpcmpugt32shl (v2si, v2si, int); + +long __builtin_vis_fpcmpde8shl (v8qi, v8qi, int); +long __builtin_vis_fpcmpde16shl (v4hi, v4hi, int); +long __builtin_vis_fpcmpde32shl (v2si, v2si, int); + +long __builtin_vis_fpcmpur8shl (v8qi, v8qi, int); +long __builtin_vis_fpcmpur16shl (v4hi, v4hi, int); +long __builtin_vis_fpcmpur32shl (v2si, v2si, int);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="ti-c6x-built-in-functions">TI C6X Built-in Functions</a>, Previous: <a href="sh-built-in-functions">SH Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SPARC-VIS-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SPARC-VIS-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/spec-files.html b/devdocs/gcc~13/spec-files.html new file mode 100644 index 00000000..346159a1 --- /dev/null +++ b/devdocs/gcc~13/spec-files.html @@ -0,0 +1,145 @@ +<div class="section-level-extent" id="Spec-Files"> <div class="nav-panel"> <p> Next: <a href="environment-variables" accesskey="n" rel="next">Environment Variables Affecting GCC</a>, Previous: <a href="submodel-options" accesskey="p" rel="prev">Machine-Dependent Options</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Specifying-Subprocesses-and-the-Switches-to-Pass-to-Them"><span>3.20 Specifying Subprocesses and the Switches to Pass to Them<a class="copiable-link" href="#Specifying-Subprocesses-and-the-Switches-to-Pass-to-Them"> ¶</a></span></h1> <p><code class="command">gcc</code> is a driver program. It performs its job by invoking a sequence of other programs to do the work of compiling, assembling and linking. GCC interprets its command-line parameters and uses these to deduce which programs it should invoke, and which command-line options it ought to place on their command lines. This behavior is controlled by <em class="dfn">spec strings</em>. In most cases there is one spec string for each program that GCC can invoke, but a few programs have multiple spec strings to control their behavior. The spec strings built into GCC can be overridden by using the <samp class="option">-specs=</samp> command-line switch to specify a spec file. </p> <p><em class="dfn">Spec files</em> are plain-text files that are used to construct spec strings. They consist of a sequence of directives separated by blank lines. The type of directive is determined by the first non-whitespace character on the line, which can be one of the following: </p> <dl class="table"> <dt><code class="code">%<var class="var">command</var></code></dt> <dd> +<p>Issues a <var class="var">command</var> to the spec file processor. The commands that can appear here are: </p> <dl class="table"> <dt> +<span><code class="code">%include <<var class="var">file</var>></code><a class="copiable-link" href="#index-_0025include"> ¶</a></span> +</dt> <dd> +<p>Search for <var class="var">file</var> and insert its text at the current point in the specs file. </p> </dd> <dt> +<span><code class="code">%include_noerr <<var class="var">file</var>></code><a class="copiable-link" href="#index-_0025include_005fnoerr"> ¶</a></span> +</dt> <dd> +<p>Just like ‘<samp class="samp">%include</samp>’, but do not generate an error message if the include file cannot be found. </p> </dd> <dt> +<span><code class="code">%rename <var class="var">old_name</var> <var class="var">new_name</var></code><a class="copiable-link" href="#index-_0025rename"> ¶</a></span> +</dt> <dd> +<p>Rename the spec string <var class="var">old_name</var> to <var class="var">new_name</var>. </p> </dd> </dl> </dd> <dt><code class="code">*[<var class="var">spec_name</var>]:</code></dt> <dd> +<p>This tells the compiler to create, override or delete the named spec string. All lines after this directive up to the next directive or blank line are considered to be the text for the spec string. If this results in an empty string then the spec is deleted. (Or, if the spec did not exist, then nothing happens.) Otherwise, if the spec does not currently exist a new spec is created. If the spec does exist then its contents are overridden by the text of this directive, unless the first character of that text is the ‘<samp class="samp">+</samp>’ character, in which case the text is appended to the spec. </p> </dd> <dt><code class="code">[<var class="var">suffix</var>]:</code></dt> <dd> +<p>Creates a new ‘<samp class="samp">[<var class="var">suffix</var>] spec</samp>’ pair. All lines after this directive and up to the next directive or blank line are considered to make up the spec string for the indicated suffix. When the compiler encounters an input file with the named suffix, it processes the spec string in order to work out how to compile that file. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">.ZZ: +z-compile -input %i</pre> +</div> <p>This says that any input file whose name ends in ‘<samp class="samp">.ZZ</samp>’ should be passed to the program ‘<samp class="samp">z-compile</samp>’, which should be invoked with the command-line switch <samp class="option">-input</samp> and with the result of performing the ‘<samp class="samp">%i</samp>’ substitution. (See below.) </p> <p>As an alternative to providing a spec string, the text following a suffix directive can be one of the following: </p> <dl class="table"> <dt><code class="code">@<var class="var">language</var></code></dt> <dd> +<p>This says that the suffix is an alias for a known <var class="var">language</var>. This is similar to using the <samp class="option">-x</samp> command-line switch to GCC to specify a language explicitly. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">.ZZ: +@c++</pre> +</div> <p>Says that .ZZ files are, in fact, C++ source files. </p> </dd> <dt><code class="code">#<var class="var">name</var></code></dt> <dd> +<p>This causes an error messages saying: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp"><var class="var">name</var> compiler not installed on this system.</pre> +</div> </dd> </dl> <p>GCC already has an extensive list of suffixes built into it. This directive adds an entry to the end of the list of suffixes, but since the list is searched from the end backwards, it is effectively possible to override earlier entries using this technique. </p> </dd> </dl> <p>GCC has the following spec strings built into it. Spec files can override these strings or create their own. Note that individual targets can also add their own spec strings to this list. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">asm Options to pass to the assembler +asm_final Options to pass to the assembler post-processor +cpp Options to pass to the C preprocessor +cc1 Options to pass to the C compiler +cc1plus Options to pass to the C++ compiler +endfile Object files to include at the end of the link +link Options to pass to the linker +lib Libraries to include on the command line to the linker +libgcc Decides which GCC support library to pass to the linker +linker Sets the name of the linker +predefines Defines to be passed to the C preprocessor +signed_char Defines to pass to CPP to say whether <code class="code">char</code> is signed + by default +startfile Object files to include at the start of the link</pre> +</div> <p>Here is a small example of a spec file: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%rename lib old_lib + +*lib: +--start-group -lgcc -lc -leval1 --end-group %(old_lib)</pre> +</div> <p>This example renames the spec called ‘<samp class="samp">lib</samp>’ to ‘<samp class="samp">old_lib</samp>’ and then overrides the previous definition of ‘<samp class="samp">lib</samp>’ with a new one. The new definition adds in some extra command-line options before including the text of the old definition. </p> <p><em class="dfn">Spec strings</em> are a list of command-line options to be passed to their corresponding program. In addition, the spec strings can contain ‘<samp class="samp">%</samp>’-prefixed sequences to substitute variable text or to conditionally insert text into the command line. Using these constructs it is possible to generate quite complex command lines. </p> <p>Here is a table of all defined ‘<samp class="samp">%</samp>’-sequences for spec strings. Note that spaces are not generated automatically around the results of expanding these sequences. Therefore you can concatenate them together or combine them with constant text in a single argument. </p> <dl class="table"> <dt><code class="code">%%</code></dt> <dd> +<p>Substitute one ‘<samp class="samp">%</samp>’ into the program name or argument. </p> </dd> <dt><code class="code">%"</code></dt> <dd> +<p>Substitute an empty argument. </p> </dd> <dt><code class="code">%i</code></dt> <dd> +<p>Substitute the name of the input file being processed. </p> </dd> <dt><code class="code">%b</code></dt> <dd> +<p>Substitute the basename for outputs related with the input file being processed. This is often the substring up to (and not including) the last period and not including the directory but, unless %w is active, it expands to the basename for auxiliary outputs, which may be influenced by an explicit output name, and by various other options that control how auxiliary outputs are named. </p> </dd> <dt><code class="code">%B</code></dt> <dd> +<p>This is the same as ‘<samp class="samp">%b</samp>’, but include the file suffix (text after the last period). Without %w, it expands to the basename for dump outputs. </p> </dd> <dt><code class="code">%d</code></dt> <dd> +<p>Marks the argument containing or following the ‘<samp class="samp">%d</samp>’ as a temporary file name, so that that file is deleted if GCC exits successfully. Unlike ‘<samp class="samp">%g</samp>’, this contributes no text to the argument. </p> </dd> <dt><code class="code">%g<var class="var">suffix</var></code></dt> <dd> +<p>Substitute a file name that has suffix <var class="var">suffix</var> and is chosen once per compilation, and mark the argument in the same way as ‘<samp class="samp">%d</samp>’. To reduce exposure to denial-of-service attacks, the file name is now chosen in a way that is hard to predict even when previously chosen file names are known. For example, ‘<samp class="samp">%g.s … %g.o … %g.s</samp>’ might turn into ‘<samp class="samp">ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s</samp>’. <var class="var">suffix</var> matches the regexp ‘<samp class="samp">[.A-Za-z]*</samp>’ or the special string ‘<samp class="samp">%O</samp>’, which is treated exactly as if ‘<samp class="samp">%O</samp>’ had been preprocessed. Previously, ‘<samp class="samp">%g</samp>’ was simply substituted with a file name chosen once per compilation, without regard to any appended suffix (which was therefore treated just like ordinary text), making such attacks more likely to succeed. </p> </dd> <dt><code class="code">%u<var class="var">suffix</var></code></dt> <dd> +<p>Like ‘<samp class="samp">%g</samp>’, but generates a new temporary file name each time it appears instead of once per compilation. </p> </dd> <dt><code class="code">%U<var class="var">suffix</var></code></dt> <dd> +<p>Substitutes the last file name generated with ‘<samp class="samp">%u<var class="var">suffix</var></samp>’, generating a new one if there is no such last file name. In the absence of any ‘<samp class="samp">%u<var class="var">suffix</var></samp>’, this is just like ‘<samp class="samp">%g<var class="var">suffix</var></samp>’, except they don’t share the same suffix <em class="emph">space</em>, so ‘<samp class="samp">%g.s … %U.s … %g.s … %U.s</samp>’ involves the generation of two distinct file names, one for each ‘<samp class="samp">%g.s</samp>’ and another for each ‘<samp class="samp">%U.s</samp>’. Previously, ‘<samp class="samp">%U</samp>’ was simply substituted with a file name chosen for the previous ‘<samp class="samp">%u</samp>’, without regard to any appended suffix. </p> </dd> <dt><code class="code">%j<var class="var">suffix</var></code></dt> <dd> +<p>Substitutes the name of the <code class="code">HOST_BIT_BUCKET</code>, if any, and if it is writable, and if <samp class="option">-save-temps</samp> is not used; otherwise, substitute the name of a temporary file, just like ‘<samp class="samp">%u</samp>’. This temporary file is not meant for communication between processes, but rather as a junk disposal mechanism. </p> </dd> <dt><code class="code">%|<var class="var">suffix</var></code></dt> <dt><code class="code">%m<var class="var">suffix</var></code></dt> <dd> +<p>Like ‘<samp class="samp">%g</samp>’, except if <samp class="option">-pipe</samp> is in effect. In that case ‘<samp class="samp">%|</samp>’ substitutes a single dash and ‘<samp class="samp">%m</samp>’ substitutes nothing at all. These are the two most common ways to instruct a program that it should read from standard input or write to standard output. If you need something more elaborate you can use an ‘<samp class="samp">%{pipe:<code class="code">X</code>}</samp>’ construct: see for example <samp class="file">gcc/fortran/lang-specs.h</samp>. </p> </dd> <dt><code class="code">%.<var class="var">SUFFIX</var></code></dt> <dd> +<p>Substitutes <var class="var">.SUFFIX</var> for the suffixes of a matched switch’s args when it is subsequently output with ‘<samp class="samp">%*</samp>’. <var class="var">SUFFIX</var> is terminated by the next space or %. </p> </dd> <dt><code class="code">%w</code></dt> <dd> +<p>Marks the argument containing or following the ‘<samp class="samp">%w</samp>’ as the designated output file of this compilation. This puts the argument into the sequence of arguments that ‘<samp class="samp">%o</samp>’ substitutes. </p> </dd> <dt><code class="code">%V</code></dt> <dd> +<p>Indicates that this compilation produces no output file. </p> </dd> <dt><code class="code">%o</code></dt> <dd> +<p>Substitutes the names of all the output files, with spaces automatically placed around them. You should write spaces around the ‘<samp class="samp">%o</samp>’ as well or the results are undefined. ‘<samp class="samp">%o</samp>’ is for use in the specs for running the linker. Input files whose names have no recognized suffix are not compiled at all, but they are included among the output files, so they are linked. </p> </dd> <dt><code class="code">%O</code></dt> <dd> +<p>Substitutes the suffix for object files. Note that this is handled specially when it immediately follows ‘<samp class="samp">%g, %u, or %U</samp>’, because of the need for those to form complete file names. The handling is such that ‘<samp class="samp">%O</samp>’ is treated exactly as if it had already been substituted, except that ‘<samp class="samp">%g, %u, and %U</samp>’ do not currently support additional <var class="var">suffix</var> characters following ‘<samp class="samp">%O</samp>’ as they do following, for example, ‘<samp class="samp">.o</samp>’. </p> </dd> <dt><code class="code">%I</code></dt> <dd> +<p>Substitute any of <samp class="option">-iprefix</samp> (made from <code class="env">GCC_EXEC_PREFIX</code>), <samp class="option">-isysroot</samp> (made from <code class="env">TARGET_SYSTEM_ROOT</code>), <samp class="option">-isystem</samp> (made from <code class="env">COMPILER_PATH</code> and <samp class="option">-B</samp> options) and <samp class="option">-imultilib</samp> as necessary. </p> </dd> <dt><code class="code">%s</code></dt> <dd> +<p>Current argument is the name of a library or startup file of some sort. Search for that file in a standard list of directories and substitute the full name found. The current working directory is included in the list of directories scanned. </p> </dd> <dt><code class="code">%T</code></dt> <dd> +<p>Current argument is the name of a linker script. Search for that file in the current list of directories to scan for libraries. If the file is located insert a <samp class="option">--script</samp> option into the command line followed by the full path name found. If the file is not found then generate an error message. Note: the current working directory is not searched. </p> </dd> <dt><code class="code">%e<var class="var">str</var></code></dt> <dd> +<p>Print <var class="var">str</var> as an error message. <var class="var">str</var> is terminated by a newline. Use this when inconsistent options are detected. </p> </dd> <dt><code class="code">%n<var class="var">str</var></code></dt> <dd> +<p>Print <var class="var">str</var> as a notice. <var class="var">str</var> is terminated by a newline. </p> </dd> <dt><code class="code">%(<var class="var">name</var>)</code></dt> <dd> +<p>Substitute the contents of spec string <var class="var">name</var> at this point. </p> </dd> <dt><code class="code">%x{<var class="var">option</var>}</code></dt> <dd> +<p>Accumulate an option for ‘<samp class="samp">%X</samp>’. </p> </dd> <dt><code class="code">%X</code></dt> <dd> +<p>Output the accumulated linker options specified by a ‘<samp class="samp">%x</samp>’ spec string. </p> </dd> <dt><code class="code">%Y</code></dt> <dd> +<p>Output the accumulated assembler options specified by <samp class="option">-Wa</samp>. </p> </dd> <dt><code class="code">%Z</code></dt> <dd> +<p>Output the accumulated preprocessor options specified by <samp class="option">-Wp</samp>. </p> </dd> <dt><code class="code">%M</code></dt> <dd> +<p>Output <code class="code">multilib_os_dir</code>. </p> </dd> <dt><code class="code">%R</code></dt> <dd> +<p>Output the concatenation of <code class="code">target_system_root</code> and <code class="code">target_sysroot_suffix</code>. </p> </dd> <dt><code class="code">%a</code></dt> <dd> +<p>Process the <code class="code">asm</code> spec. This is used to compute the switches to be passed to the assembler. </p> </dd> <dt><code class="code">%A</code></dt> <dd> +<p>Process the <code class="code">asm_final</code> spec. This is a spec string for passing switches to an assembler post-processor, if such a program is needed. </p> </dd> <dt><code class="code">%l</code></dt> <dd> +<p>Process the <code class="code">link</code> spec. This is the spec for computing the command line passed to the linker. Typically it makes use of the ‘<samp class="samp">%L %G %S %D and %E</samp>’ sequences. </p> </dd> <dt><code class="code">%D</code></dt> <dd> +<p>Dump out a <samp class="option">-L</samp> option for each directory that GCC believes might contain startup files. If the target supports multilibs then the current multilib directory is prepended to each of these paths. </p> </dd> <dt><code class="code">%L</code></dt> <dd> +<p>Process the <code class="code">lib</code> spec. This is a spec string for deciding which libraries are included on the command line to the linker. </p> </dd> <dt><code class="code">%G</code></dt> <dd> +<p>Process the <code class="code">libgcc</code> spec. This is a spec string for deciding which GCC support library is included on the command line to the linker. </p> </dd> <dt><code class="code">%S</code></dt> <dd> +<p>Process the <code class="code">startfile</code> spec. This is a spec for deciding which object files are the first ones passed to the linker. Typically this might be a file named <samp class="file">crt0.o</samp>. </p> </dd> <dt><code class="code">%E</code></dt> <dd> +<p>Process the <code class="code">endfile</code> spec. This is a spec string that specifies the last object files that are passed to the linker. </p> </dd> <dt><code class="code">%C</code></dt> <dd> +<p>Process the <code class="code">cpp</code> spec. This is used to construct the arguments to be passed to the C preprocessor. </p> </dd> <dt><code class="code">%1</code></dt> <dd> +<p>Process the <code class="code">cc1</code> spec. This is used to construct the options to be passed to the actual C compiler (<code class="command">cc1</code>). </p> </dd> <dt><code class="code">%2</code></dt> <dd> +<p>Process the <code class="code">cc1plus</code> spec. This is used to construct the options to be passed to the actual C++ compiler (<code class="command">cc1plus</code>). </p> </dd> <dt><code class="code">%*</code></dt> <dd> +<p>Substitute the variable part of a matched option. See below. Note that each comma in the substituted string is replaced by a single space. </p> </dd> <dt><code class="code">%<S</code></dt> <dd> +<p>Remove all occurrences of <code class="code">-S</code> from the command line. Note—this command is position dependent. ‘<samp class="samp">%</samp>’ commands in the spec string before this one see <code class="code">-S</code>, ‘<samp class="samp">%</samp>’ commands in the spec string after this one do not. </p> </dd> <dt><code class="code">%<S*</code></dt> <dd> +<p>Similar to ‘<samp class="samp">%<S</samp>’, but match all switches beginning with <code class="code">-S</code>. </p> </dd> <dt><code class="code">%>S</code></dt> <dd> +<p>Similar to ‘<samp class="samp">%<S</samp>’, but keep <code class="code">-S</code> in the GCC command line. </p> </dd> <dt><code class="code">%:<var class="var">function</var>(<var class="var">args</var>)</code></dt> <dd> +<p>Call the named function <var class="var">function</var>, passing it <var class="var">args</var>. <var class="var">args</var> is first processed as a nested spec string, then split into an argument vector in the usual fashion. The function returns a string which is processed as if it had appeared literally as part of the current spec. </p> <p>The following built-in spec functions are provided: </p> <dl class="table"> <dt><code class="code"><code class="code">getenv</code></code></dt> <dd> +<p>The <code class="code">getenv</code> spec function takes two arguments: an environment variable name and a string. If the environment variable is not defined, a fatal error is issued. Otherwise, the return value is the value of the environment variable concatenated with the string. For example, if <code class="env">TOPDIR</code> is defined as <samp class="file">/path/to/top</samp>, then: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%:getenv(TOPDIR /include)</pre> +</div> <p>expands to <samp class="file">/path/to/top/include</samp>. </p> </dd> <dt><code class="code"><code class="code">if-exists</code></code></dt> <dd> +<p>The <code class="code">if-exists</code> spec function takes one argument, an absolute pathname to a file. If the file exists, <code class="code">if-exists</code> returns the pathname. Here is a small example of its usage: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">*startfile: +crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s</pre> +</div> </dd> <dt><code class="code"><code class="code">if-exists-else</code></code></dt> <dd> +<p>The <code class="code">if-exists-else</code> spec function is similar to the <code class="code">if-exists</code> spec function, except that it takes two arguments. The first argument is an absolute pathname to a file. If the file exists, <code class="code">if-exists-else</code> returns the pathname. If it does not exist, it returns the second argument. This way, <code class="code">if-exists-else</code> can be used to select one file or another, based on the existence of the first. Here is a small example of its usage: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">*startfile: +crt0%O%s %:if-exists(crti%O%s) \ +%:if-exists-else(crtbeginT%O%s crtbegin%O%s)</pre> +</div> </dd> <dt><code class="code"><code class="code">if-exists-then-else</code></code></dt> <dd> +<p>The <code class="code">if-exists-then-else</code> spec function takes at least two arguments and an optional third one. The first argument is an absolute pathname to a file. If the file exists, the function returns the second argument. If the file does not exist, the function returns the third argument if there is one, or NULL otherwise. This can be used to expand one text, or optionally another, based on the existence of a file. Here is a small example of its usage: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)</pre> +</div> </dd> <dt><code class="code"><code class="code">sanitize</code></code></dt> <dd> +<p>The <code class="code">sanitize</code> spec function takes no arguments. It returns non-NULL if any address, thread or undefined behavior sanitizers are active. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%{%:sanitize(address):-funwind-tables}</pre> +</div> </dd> <dt><code class="code"><code class="code">replace-outfile</code></code></dt> <dd> +<p>The <code class="code">replace-outfile</code> spec function takes two arguments. It looks for the first argument in the outfiles array and replaces it with the second argument. Here is a small example of its usage: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)}</pre> +</div> </dd> <dt><code class="code"><code class="code">remove-outfile</code></code></dt> <dd> +<p>The <code class="code">remove-outfile</code> spec function takes one argument. It looks for the first argument in the outfiles array and removes it. Here is a small example its usage: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%:remove-outfile(-lm)</pre> +</div> </dd> <dt><code class="code"><code class="code">version-compare</code></code></dt> <dd> +<p>The <code class="code">version-compare</code> spec function takes four or five arguments of the following form: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp"><comparison-op> <arg1> [<arg2>] <switch> <result></pre> +</div> <p>It returns <code class="code">result</code> if the comparison evaluates to true, and NULL if it doesn’t. The supported <code class="code">comparison-op</code> values are: </p> <dl class="table"> <dt><code class="code">>=</code></dt> <dd> +<p>True if <code class="code">switch</code> is a later (or same) version than <code class="code">arg1</code> </p> </dd> <dt><code class="code">!></code></dt> <dd> +<p>Opposite of <code class="code">>=</code> </p> </dd> <dt><code class="code"><</code></dt> <dd> +<p>True if <code class="code">switch</code> is an earlier version than <code class="code">arg1</code> </p> </dd> <dt><code class="code">!<</code></dt> <dd> +<p>Opposite of <code class="code"><</code> </p> </dd> <dt><code class="code">><</code></dt> <dd> +<p>True if <code class="code">switch</code> is <code class="code">arg1</code> or later, and earlier than <code class="code">arg2</code> </p> </dd> <dt><code class="code"><></code></dt> <dd><p>True if <code class="code">switch</code> is earlier than <code class="code">arg1</code>, or is <code class="code">arg2</code> or later </p></dd> </dl> <p>If the <code class="code">switch</code> is not present at all, the condition is false unless the first character of the <code class="code">comparison-op</code> is <code class="code">!</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%:version-compare(>= 10.3 mmacosx-version-min= -lmx)</pre> +</div> <p>The above example would add <samp class="option">-lmx</samp> if <samp class="option">-mmacosx-version-min=10.3.9</samp> was passed. </p> </dd> <dt><code class="code"><code class="code">include</code></code></dt> <dd> +<p>The <code class="code">include</code> spec function behaves much like <code class="code">%include</code>, with the advantage that it can be nested inside a spec and thus be conditionalized. It takes one argument, the filename, and looks for it in the startfile path. It always returns NULL. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)}</pre> +</div> </dd> <dt><code class="code"><code class="code">pass-through-libs</code></code></dt> <dd> +<p>The <code class="code">pass-through-libs</code> spec function takes any number of arguments. It finds any <samp class="option">-l</samp> options and any non-options ending in <samp class="file">.a</samp> (which it assumes are the names of linker input library archive files) and returns a result containing all the found arguments each prepended by <samp class="option">-plugin-opt=-pass-through=</samp> and joined by spaces. This list is intended to be passed to the LTO linker plugin. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%:pass-through-libs(%G %L %G)</pre> +</div> </dd> <dt><code class="code"><code class="code">print-asm-header</code></code></dt> <dd> +<p>The <code class="code">print-asm-header</code> function takes no arguments and simply prints a banner like: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">Assembler options +================= + +Use "-Wa,OPTION" to pass "OPTION" to the assembler.</pre> +</div> <p>It is used to separate compiler options from assembler options in the <samp class="option">--target-help</samp> output. </p> </dd> <dt><code class="code"><code class="code">gt</code></code></dt> <dd> +<p>The <code class="code">gt</code> spec function takes two or more arguments. It returns <code class="code">""</code> (the empty string) if the second-to-last argument is greater than the last argument, and NULL otherwise. The following example inserts the <code class="code">link_gomp</code> spec if the last <samp class="option">-ftree-parallelize-loops=</samp> option given on the command line is greater than 1: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%{%:gt(%{ftree-parallelize-loops=*:%*} 1):%:include(libgomp.spec)%(link_gomp)}</pre> +</div> </dd> <dt><code class="code"><code class="code">debug-level-gt</code></code></dt> <dd> +<p>The <code class="code">debug-level-gt</code> spec function takes one argument and returns <code class="code">""</code> (the empty string) if <code class="code">debug_info_level</code> is greater than the specified number, and NULL otherwise. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%{%:debug-level-gt(0):%{gdwarf*:--gdwarf2}}</pre> +</div> </dd> </dl> </dd> <dt><code class="code">%{S}</code></dt> <dd> +<p>Substitutes the <code class="code">-S</code> switch, if that switch is given to GCC. If that switch is not specified, this substitutes nothing. Note that the leading dash is omitted when specifying this option, and it is automatically inserted if the substitution is performed. Thus the spec string ‘<samp class="samp">%{foo}</samp>’ matches the command-line option <samp class="option">-foo</samp> and outputs the command-line option <samp class="option">-foo</samp>. </p> </dd> <dt><code class="code">%W{S}</code></dt> <dd> +<p>Like %{<code class="code">S</code>} but mark last argument supplied within as a file to be deleted on failure. </p> </dd> <dt><code class="code">%@{S}</code></dt> <dd> +<p>Like %{<code class="code">S</code>} but puts the result into a <code class="code">FILE</code> and substitutes <code class="code">@FILE</code> if an <code class="code">@file</code> argument has been supplied. </p> </dd> <dt><code class="code">%{S*}</code></dt> <dd> +<p>Substitutes all the switches specified to GCC whose names start with <code class="code">-S</code>, but which also take an argument. This is used for switches like <samp class="option">-o</samp>, <samp class="option">-D</samp>, <samp class="option">-I</samp>, etc. GCC considers <samp class="option">-o foo</samp> as being one switch whose name starts with ‘<samp class="samp">o</samp>’. %{o*} substitutes this text, including the space. Thus two arguments are generated. </p> </dd> <dt><code class="code">%{S*&T*}</code></dt> <dd> +<p>Like %{<code class="code">S</code>*}, but preserve order of <code class="code">S</code> and <code class="code">T</code> options (the order of <code class="code">S</code> and <code class="code">T</code> in the spec is not significant). There can be any number of ampersand-separated variables; for each the wild card is optional. Useful for CPP as ‘<samp class="samp">%{D*&U*&A*}</samp>’. </p> </dd> <dt><code class="code">%{S:X}</code></dt> <dd> +<p>Substitutes <code class="code">X</code>, if the <samp class="option">-S</samp> switch is given to GCC. </p> </dd> <dt><code class="code">%{!S:X}</code></dt> <dd> +<p>Substitutes <code class="code">X</code>, if the <samp class="option">-S</samp> switch is <em class="emph">not</em> given to GCC. </p> </dd> <dt><code class="code">%{S*:X}</code></dt> <dd> +<p>Substitutes <code class="code">X</code> if one or more switches whose names start with <code class="code">-S</code> are specified to GCC. Normally <code class="code">X</code> is substituted only once, no matter how many such switches appeared. However, if <code class="code">%*</code> appears somewhere in <code class="code">X</code>, then <code class="code">X</code> is substituted once for each matching switch, with the <code class="code">%*</code> replaced by the part of that switch matching the <code class="code">*</code>. </p> <p>If <code class="code">%*</code> appears as the last part of a spec sequence then a space is added after the end of the last substitution. If there is more text in the sequence, however, then a space is not generated. This allows the <code class="code">%*</code> substitution to be used as part of a larger string. For example, a spec string like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%{mcu=*:--script=%*/memory.ld}</pre> +</div> <p>when matching an option like <samp class="option">-mcu=newchip</samp> produces: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">--script=newchip/memory.ld</pre> +</div> </dd> <dt><code class="code">%{.S:X}</code></dt> <dd> +<p>Substitutes <code class="code">X</code>, if processing a file with suffix <code class="code">S</code>. </p> </dd> <dt><code class="code">%{!.S:X}</code></dt> <dd> +<p>Substitutes <code class="code">X</code>, if <em class="emph">not</em> processing a file with suffix <code class="code">S</code>. </p> </dd> <dt><code class="code">%{,S:X}</code></dt> <dd> +<p>Substitutes <code class="code">X</code>, if processing a file for language <code class="code">S</code>. </p> </dd> <dt><code class="code">%{!,S:X}</code></dt> <dd> +<p>Substitutes <code class="code">X</code>, if not processing a file for language <code class="code">S</code>. </p> </dd> <dt><code class="code">%{S|P:X}</code></dt> <dd> +<p>Substitutes <code class="code">X</code> if either <code class="code">-S</code> or <code class="code">-P</code> is given to GCC. This may be combined with ‘<samp class="samp">!</samp>’, ‘<samp class="samp">.</samp>’, ‘<samp class="samp">,</samp>’, and <code class="code">*</code> sequences as well, although they have a stronger binding than the ‘<samp class="samp">|</samp>’. If <code class="code">%*</code> appears in <code class="code">X</code>, all of the alternatives must be starred, and only the first matching alternative is substituted. </p> <p>For example, a spec string like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">%{.c:-foo} %{!.c:-bar} %{.c|d:-baz} %{!.c|d:-boggle}</pre> +</div> <p>outputs the following command-line options from the following input command-line options: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">fred.c -foo -baz +jim.d -bar -boggle +-d fred.c -foo -baz -boggle +-d jim.d -bar -baz -boggle</pre> +</div> </dd> <dt><code class="code">%{%:<var class="var">function</var>(<var class="var">args</var>):X}</code></dt> <dd> <p>Call function named <var class="var">function</var> with args <var class="var">args</var>. If the function returns non-NULL, then <code class="code">X</code> is substituted, if it returns NULL, it isn’t substituted. </p> </dd> <dt><code class="code">%{S:X; T:Y; :D}</code></dt> <dd> <p>If <code class="code">S</code> is given to GCC, substitutes <code class="code">X</code>; else if <code class="code">T</code> is given to GCC, substitutes <code class="code">Y</code>; else substitutes <code class="code">D</code>. There can be as many clauses as you need. This may be combined with <code class="code">.</code>, <code class="code">,</code>, <code class="code">!</code>, <code class="code">|</code>, and <code class="code">*</code> as needed. </p> </dd> </dl> <p>The switch matching text <code class="code">S</code> in a ‘<samp class="samp">%{S}</samp>’, ‘<samp class="samp">%{S:X}</samp>’ or similar construct can use a backslash to ignore the special meaning of the character following it, thus allowing literal matching of a character that is otherwise specially treated. For example, ‘<samp class="samp">%{std=iso9899\:1999:X}</samp>’ substitutes <code class="code">X</code> if the <samp class="option">-std=iso9899:1999</samp> option is given. </p> <p>The conditional text <code class="code">X</code> in a ‘<samp class="samp">%{S:X}</samp>’ or similar construct may contain other nested ‘<samp class="samp">%</samp>’ constructs or spaces, or even newlines. They are processed as usual, as described above. Trailing white space in <code class="code">X</code> is ignored. White space may also appear anywhere on the left side of the colon in these constructs, except between <code class="code">.</code> or <code class="code">*</code> and the corresponding word. </p> <p>The <samp class="option">-O</samp>, <samp class="option">-f</samp>, <samp class="option">-m</samp>, and <samp class="option">-W</samp> switches are handled specifically in these constructs. If another value of <samp class="option">-O</samp> or the negated form of a <samp class="option">-f</samp>, <samp class="option">-m</samp>, or <samp class="option">-W</samp> switch is found later in the command line, the earlier switch value is ignored, except with {<code class="code">S</code>*} where <code class="code">S</code> is just one letter, which passes all matching options. </p> <p>The character ‘<samp class="samp">|</samp>’ at the beginning of the predicate text is used to indicate that a command should be piped to the following command, but only if <samp class="option">-pipe</samp> is specified. </p> <p>It is built into GCC which switches take arguments and which do not. (You might think it would be useful to generalize this to allow each compiler’s spec to say which switches take arguments. But this cannot be done in a consistent fashion. GCC cannot even decide which input files have been specified without knowing which switches take arguments, and it must know which input files to compile in order to tell which compilers to run). </p> <p>GCC also knows implicitly that arguments starting in <samp class="option">-l</samp> are to be treated as compiler output files, and passed to the linker in their proper position among the other output files. </p> </div> <div class="nav-panel"> <p> Next: <a href="environment-variables">Environment Variables Affecting GCC</a>, Previous: <a href="submodel-options">Machine-Dependent Options</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Spec-Files.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Spec-Files.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/standard-libraries.html b/devdocs/gcc~13/standard-libraries.html new file mode 100644 index 00000000..ec7ab4be --- /dev/null +++ b/devdocs/gcc~13/standard-libraries.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Standard-Libraries"> <div class="nav-panel"> <p> Next: <a href="disappointments" accesskey="n" rel="next">Disappointments and Misunderstandings</a>, Previous: <a href="fixed-headers" accesskey="p" rel="prev">Fixed Header Files</a>, Up: <a href="trouble" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Standard-Libraries-1"><span>14.5 Standard Libraries<a class="copiable-link" href="#Standard-Libraries-1"> ¶</a></span></h1> <p>GCC by itself attempts to be a conforming freestanding implementation. See <a class="xref" href="standards">Language Standards Supported by GCC</a>, for details of what this means. Beyond the library facilities required of such an implementation, the rest of the C library is supplied by the vendor of the operating system. If that C library doesn’t conform to the C standards, then your programs might get warnings (especially when using <samp class="option">-Wall</samp>) that you don’t expect. </p> <p>For example, the <code class="code">sprintf</code> function on SunOS 4.1.3 returns <code class="code">char *</code> while the C standard says that <code class="code">sprintf</code> returns an <code class="code">int</code>. The <code class="code">fixincludes</code> program could make the prototype for this function match the Standard, but that would be wrong, since the function will still return <code class="code">char *</code>. </p> <p>If you need a Standard compliant library, then you need to find one, as GCC does not provide one. The GNU C library (called <code class="code">glibc</code>) provides ISO C, POSIX, BSD, SystemV and X/Open compatibility for GNU/Linux and HURD-based GNU systems; no recent version of it supports other systems, though some very old versions did. Version 2.2 of the GNU C library includes nearly complete C99 support. You could also ask your operating system vendor if newer libraries are available. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Standard-Libraries.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Standard-Libraries.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/standards.html b/devdocs/gcc~13/standards.html new file mode 100644 index 00000000..a547bf5c --- /dev/null +++ b/devdocs/gcc~13/standards.html @@ -0,0 +1,10 @@ +<div class="chapter-level-extent" id="Standards"> <div class="nav-panel"> <p> Next: <a href="invoking-gcc" accesskey="n" rel="next">GCC Command Options</a>, Previous: <a href="g_002b_002b-and-gcc" accesskey="p" rel="prev">Programming Languages Supported by GCC</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="Language-Standards-Supported-by-GCC"><span>2 Language Standards Supported by GCC<a class="copiable-link" href="#Language-Standards-Supported-by-GCC"> ¶</a></span></h1> <p>For each language compiled by GCC for which there is a standard, GCC attempts to follow one or more versions of that standard, possibly with some exceptions, and possibly with some extensions. </p> <ul class="mini-toc"> <li><a href="#C-Language" accesskey="1">C Language</a></li> <li><a href="#C_002b_002b-Language" accesskey="2">C++ Language</a></li> <li><a href="#Objective-C-and-Objective-C_002b_002b-Languages" accesskey="3">Objective-C and Objective-C++ Languages</a></li> <li><a href="#Go-Language" accesskey="4">Go Language</a></li> <li><a href="#D-language" accesskey="5">D language</a></li> <li><a href="#References-for-Other-Languages" accesskey="6">References for Other Languages</a></li> </ul> <div class="section-level-extent" id="C-Language"> <h2 class="section"><span>2.1 C Language<a class="copiable-link" href="#C-Language"> ¶</a></span></h2> <p>The original ANSI C standard (X3.159-1989) was ratified in 1989 and published in 1990. This standard was ratified as an ISO standard (ISO/IEC 9899:1990) later in 1990. There were no technical differences between these publications, although the sections of the ANSI standard were renumbered and became clauses in the ISO standard. The ANSI standard, but not the ISO standard, also came with a Rationale document. This standard, in both its forms, is commonly known as <em class="dfn">C89</em>, or occasionally as <em class="dfn">C90</em>, from the dates of ratification. To select this standard in GCC, use one of the options <samp class="option">-ansi</samp>, <samp class="option">-std=c90</samp> or <samp class="option">-std=iso9899:1990</samp>; to obtain all the diagnostics required by the standard, you should also specify <samp class="option">-pedantic</samp> (or <samp class="option">-pedantic-errors</samp> if you want them to be errors rather than warnings). See <a class="xref" href="c-dialect-options">Options Controlling C Dialect</a>. </p> <p>Errors in the 1990 ISO C standard were corrected in two Technical Corrigenda published in 1994 and 1996. GCC does not support the uncorrected version. </p> <p>An amendment to the 1990 standard was published in 1995. This amendment added digraphs and <code class="code">__STDC_VERSION__</code> to the language, but otherwise concerned the library. This amendment is commonly known as <em class="dfn">AMD1</em>; the amended standard is sometimes known as <em class="dfn">C94</em> or <em class="dfn">C95</em>. To select this standard in GCC, use the option <samp class="option">-std=iso9899:199409</samp> (with, as for other standard versions, <samp class="option">-pedantic</samp> to receive all required diagnostics). </p> <p>A new edition of the ISO C standard was published in 1999 as ISO/IEC 9899:1999, and is commonly known as <em class="dfn">C99</em>. (While in development, drafts of this standard version were referred to as <em class="dfn">C9X</em>.) GCC has substantially complete support for this standard version; see <a class="uref" href="https://gcc.gnu.org/c99status.html">https://gcc.gnu.org/c99status.html</a> for details. To select this standard, use <samp class="option">-std=c99</samp> or <samp class="option">-std=iso9899:1999</samp>. </p> <p>Errors in the 1999 ISO C standard were corrected in three Technical Corrigenda published in 2001, 2004 and 2007. GCC does not support the uncorrected version. </p> <p>A fourth version of the C standard, known as <em class="dfn">C11</em>, was published in 2011 as ISO/IEC 9899:2011. (While in development, drafts of this standard version were referred to as <em class="dfn">C1X</em>.) GCC has substantially complete support for this standard, enabled with <samp class="option">-std=c11</samp> or <samp class="option">-std=iso9899:2011</samp>. A version with corrections integrated was prepared in 2017 and published in 2018 as ISO/IEC 9899:2018; it is known as <em class="dfn">C17</em> and is supported with <samp class="option">-std=c17</samp> or <samp class="option">-std=iso9899:2017</samp>; the corrections are also applied with <samp class="option">-std=c11</samp>, and the only difference between the options is the value of <code class="code">__STDC_VERSION__</code>. </p> <p>A further version of the C standard, known as <em class="dfn">C2X</em>, is under development; experimental and incomplete support for this is enabled with <samp class="option">-std=c2x</samp>. </p> <p>By default, GCC provides some extensions to the C language that, on rare occasions conflict with the C standard. See <a class="xref" href="c-extensions">Extensions to the C Language Family</a>. Some features that are part of the C99 standard are accepted as extensions in C90 mode, and some features that are part of the C11 standard are accepted as extensions in C90 and C99 modes. Use of the <samp class="option">-std</samp> options listed above disables these extensions where they conflict with the C standard version selected. You may also select an extended version of the C language explicitly with <samp class="option">-std=gnu90</samp> (for C90 with GNU extensions), <samp class="option">-std=gnu99</samp> (for C99 with GNU extensions) or <samp class="option">-std=gnu11</samp> (for C11 with GNU extensions). </p> <p>The default, if no C language dialect options are given, is <samp class="option">-std=gnu17</samp>. </p> <p>The ISO C standard defines (in clause 4) two classes of conforming implementation. A <em class="dfn">conforming hosted implementation</em> supports the whole standard including all the library facilities; a <em class="dfn">conforming freestanding implementation</em> is only required to provide certain library facilities: those in <code class="code"><float.h></code>, <code class="code"><limits.h></code>, <code class="code"><stdarg.h></code>, and <code class="code"><stddef.h></code>; since AMD1, also those in <code class="code"><iso646.h></code>; since C99, also those in <code class="code"><stdbool.h></code> and <code class="code"><stdint.h></code>; and since C11, also those in <code class="code"><stdalign.h></code> and <code class="code"><stdnoreturn.h></code>. In addition, complex types, added in C99, are not required for freestanding implementations. </p> <p>The standard also defines two environments for programs, a <em class="dfn">freestanding environment</em>, required of all implementations and which may not have library facilities beyond those required of freestanding implementations, where the handling of program startup and termination are implementation-defined; and a <em class="dfn">hosted environment</em>, which is not required, in which all the library facilities are provided and startup is through a function <code class="code">int +main (void)</code> or <code class="code">int main (int, char *[])</code>. An OS kernel is an example of a program running in a freestanding environment; a program using the facilities of an operating system is an example of a program running in a hosted environment. </p> <p>GCC aims towards being usable as a conforming freestanding implementation, or as the compiler for a conforming hosted implementation. By default, it acts as the compiler for a hosted implementation, defining <code class="code">__STDC_HOSTED__</code> as <code class="code">1</code> and presuming that when the names of ISO C functions are used, they have the semantics defined in the standard. To make it act as a conforming freestanding implementation for a freestanding environment, use the option <samp class="option">-ffreestanding</samp>; it then defines <code class="code">__STDC_HOSTED__</code> to <code class="code">0</code> and does not make assumptions about the meanings of function names from the standard library, with exceptions noted below. To build an OS kernel, you may well still need to make your own arrangements for linking and startup. See <a class="xref" href="c-dialect-options">Options Controlling C Dialect</a>. </p> <p>GCC does not provide the library facilities required only of hosted implementations, nor yet all the facilities required by C99 of freestanding implementations on all platforms. To use the facilities of a hosted environment, you need to find them elsewhere (for example, in the GNU C library). See <a class="xref" href="standard-libraries">Standard Libraries</a>. </p> <p>Most of the compiler support routines used by GCC are present in <samp class="file">libgcc</samp>, but there are a few exceptions. GCC requires the freestanding environment provide <code class="code">memcpy</code>, <code class="code">memmove</code>, <code class="code">memset</code> and <code class="code">memcmp</code>. Finally, if <code class="code">__builtin_trap</code> is used, and the target does not implement the <code class="code">trap</code> pattern, then GCC emits a call to <code class="code">abort</code>. </p> <p>For references to Technical Corrigenda, Rationale documents and information concerning the history of C that is available online, see <a class="uref" href="https://gcc.gnu.org/readings.html">https://gcc.gnu.org/readings.html</a> </p> </div> <div class="section-level-extent" id="C_002b_002b-Language"> <h2 class="section"><span>2.2 C++ Language<a class="copiable-link" href="#C_002b_002b-Language"> ¶</a></span></h2> <p>GCC supports the original ISO C++ standard published in 1998, and the 2011, 2014, 2017 and mostly 2020 revisions. </p> <p>The original ISO C++ standard was published as the ISO standard (ISO/IEC 14882:1998) and amended by a Technical Corrigenda published in 2003 (ISO/IEC 14882:2003). These standards are referred to as C++98 and C++03, respectively. GCC implements the majority of C++98 (<code class="code">export</code> is a notable exception) and most of the changes in C++03. To select this standard in GCC, use one of the options <samp class="option">-ansi</samp>, <samp class="option">-std=c++98</samp>, or <samp class="option">-std=c++03</samp>; to obtain all the diagnostics required by the standard, you should also specify <samp class="option">-pedantic</samp> (or <samp class="option">-pedantic-errors</samp> if you want them to be errors rather than warnings). </p> <p>A revised ISO C++ standard was published in 2011 as ISO/IEC 14882:2011, and is referred to as C++11; before its publication it was commonly referred to as C++0x. C++11 contains several changes to the C++ language, all of which have been implemented in GCC. For details see <a class="uref" href="https://gcc.gnu.org/projects/cxx-status.html#cxx11">https://gcc.gnu.org/projects/cxx-status.html#cxx11</a>. To select this standard in GCC, use the option <samp class="option">-std=c++11</samp>. </p> <p>Another revised ISO C++ standard was published in 2014 as ISO/IEC 14882:2014, and is referred to as C++14; before its publication it was sometimes referred to as C++1y. C++14 contains several further changes to the C++ language, all of which have been implemented in GCC. For details see <a class="uref" href="https://gcc.gnu.org/projects/cxx-status.html#cxx14">https://gcc.gnu.org/projects/cxx-status.html#cxx14</a>. To select this standard in GCC, use the option <samp class="option">-std=c++14</samp>. </p> <p>The C++ language was further revised in 2017 and ISO/IEC 14882:2017 was published. This is referred to as C++17, and before publication was often referred to as C++1z. GCC supports all the changes in that specification. For further details see <a class="uref" href="https://gcc.gnu.org/projects/cxx-status.html#cxx17">https://gcc.gnu.org/projects/cxx-status.html#cxx17</a>. Use the option <samp class="option">-std=c++17</samp> to select this variant of C++. </p> <p>Another revised ISO C++ standard was published in 2020 as ISO/IEC 14882:2020, and is referred to as C++20; before its publication it was sometimes referred to as C++2a. GCC supports most of the changes in the new specification. For further details see <a class="uref" href="https://gcc.gnu.org/projects/cxx-status.html#cxx20">https://gcc.gnu.org/projects/cxx-status.html#cxx20</a>. To select this standard in GCC, use the option <samp class="option">-std=c++20</samp>. </p> <p>More information about the C++ standards is available on the ISO C++ committee’s web site at <a class="uref" href="http://www.open-std.org/jtc1/sc22/wg21/">http://www.open-std.org/jtc1/sc22/wg21/</a>. </p> <p>To obtain all the diagnostics required by any of the standard versions described above you should specify <samp class="option">-pedantic</samp> or <samp class="option">-pedantic-errors</samp>, otherwise GCC will allow some non-ISO C++ features as extensions. See <a class="xref" href="warning-options">Options to Request or Suppress Warnings</a>. </p> <p>By default, GCC also provides some additional extensions to the C++ language that on rare occasions conflict with the C++ standard. See <a class="xref" href="c_002b_002b-dialect-options">Options Controlling C++ Dialect</a>. Use of the <samp class="option">-std</samp> options listed above disables these extensions where they they conflict with the C++ standard version selected. You may also select an extended version of the C++ language explicitly with <samp class="option">-std=gnu++98</samp> (for C++98 with GNU extensions), or <samp class="option">-std=gnu++11</samp> (for C++11 with GNU extensions), or <samp class="option">-std=gnu++14</samp> (for C++14 with GNU extensions), or <samp class="option">-std=gnu++17</samp> (for C++17 with GNU extensions), or <samp class="option">-std=gnu++20</samp> (for C++20 with GNU extensions). </p> <p>The default, if no C++ language dialect options are given, is <samp class="option">-std=gnu++17</samp>. </p> </div> <div class="section-level-extent" id="Objective-C-and-Objective-C_002b_002b-Languages"> <h2 class="section"><span>2.3 Objective-C and Objective-C++ Languages<a class="copiable-link" href="#Objective-C-and-Objective-C_002b_002b-Languages"> ¶</a></span></h2> <p>GCC supports “traditional” Objective-C (also known as “Objective-C 1.0”) and contains support for the Objective-C exception and synchronization syntax. It has also support for a number of “Objective-C 2.0” language extensions, including properties, fast enumeration (only for Objective-C), method attributes and the @optional and @required keywords in protocols. GCC supports Objective-C++ and features available in Objective-C are also available in Objective-C++. </p> <p>GCC by default uses the GNU Objective-C runtime library, which is part of GCC and is not the same as the Apple/NeXT Objective-C runtime library used on Apple systems. There are a number of differences documented in this manual. The options <samp class="option">-fgnu-runtime</samp> and <samp class="option">-fnext-runtime</samp> allow you to switch between producing output that works with the GNU Objective-C runtime library and output that works with the Apple/NeXT Objective-C runtime library. </p> <p>There is no formal written standard for Objective-C or Objective-C++. The authoritative manual on traditional Objective-C (1.0) is “Object-Oriented Programming and the Objective-C Language”: <a class="uref" href="https://gnustep.github.io/resources/documentation/ObjectivCBook.pdf">https://gnustep.github.io/resources/documentation/ObjectivCBook.pdf</a> is the original NeXTstep document. </p> <p>The Objective-C exception and synchronization syntax (that is, the keywords <code class="code">@try</code>, <code class="code">@throw</code>, <code class="code">@catch</code>, <code class="code">@finally</code> and <code class="code">@synchronized</code>) is supported by GCC and is enabled with the option <samp class="option">-fobjc-exceptions</samp>. The syntax is briefly documented in this manual and in the Objective-C 2.0 manuals from Apple. </p> <p>The Objective-C 2.0 language extensions and features are automatically enabled; they include properties (via the <code class="code">@property</code>, <code class="code">@synthesize</code> and <code class="code">@dynamic keywords</code>), fast enumeration (not available in Objective-C++), attributes for methods (such as <code class="code">deprecated</code>, <code class="code">noreturn</code>, <code class="code">sentinel</code>, <code class="code">format</code>), the <code class="code">unused</code> attribute for method arguments, the <code class="code">@package</code> keyword for instance variables and the <code class="code">@optional</code> and <code class="code">@required</code> keywords in protocols. You can disable all these Objective-C 2.0 language extensions with the option <samp class="option">-fobjc-std=objc1</samp>, which causes the compiler to recognize the same Objective-C language syntax recognized by GCC 4.0, and to produce an error if one of the new features is used. </p> <p>GCC has currently no support for non-fragile instance variables. </p> <p>The authoritative manual on Objective-C 2.0 is available from Apple: </p> +<ul class="itemize mark-bullet"> <li> +<a class="uref" href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html">https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html</a> </li> +</ul> <p>For more information concerning the history of Objective-C that is available online, see <a class="uref" href="https://gcc.gnu.org/readings.html">https://gcc.gnu.org/readings.html</a> </p> </div> <div class="section-level-extent" id="Go-Language"> <h2 class="section"><span>2.4 Go Language<a class="copiable-link" href="#Go-Language"> ¶</a></span></h2> <p>As of the GCC 4.7.1 release, GCC supports the Go 1 language standard, described at <a class="uref" href="https://go.dev/doc/go1">https://go.dev/doc/go1</a>. </p> </div> <div class="section-level-extent" id="D-language"> <h2 class="section"><span>2.5 D language<a class="copiable-link" href="#D-language"> ¶</a></span></h2> <p>GCC supports the D 2.0 programming language. The D language itself is currently defined by its reference implementation and supporting language specification, described at <a class="uref" href="https://dlang.org/spec/spec.html">https://dlang.org/spec/spec.html</a>. </p> </div> <div class="section-level-extent" id="References-for-Other-Languages"> <h2 class="section"><span>2.6 References for Other Languages<a class="copiable-link" href="#References-for-Other-Languages"> ¶</a></span></h2> <p>See <a data-manual="gnat_rm" href="https://gcc.gnu.org/onlinedocs/gnat_rm/index.html#Top">About This Guide</a> in GNAT Reference Manual, for information on standard conformance and compatibility of the Ada compiler. </p> <p>See <a data-manual="gfortran" href="https://gcc.gnu.org/onlinedocs/gfortran/Standards.html#Standards">Standards</a> in The GNU Fortran Compiler, for details of standards supported by GNU Fortran. </p> </div> </div> <div class="nav-panel"> <p> Next: <a href="invoking-gcc">GCC Command Options</a>, Previous: <a href="g_002b_002b-and-gcc">Programming Languages Supported by GCC</a>, Up: <a href="index">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Standards.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Standards.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/statement-attributes.html b/devdocs/gcc~13/statement-attributes.html new file mode 100644 index 00000000..bf5ef5a8 --- /dev/null +++ b/devdocs/gcc~13/statement-attributes.html @@ -0,0 +1,27 @@ +<div class="section-level-extent" id="Statement-Attributes"> <div class="nav-panel"> <p> Next: <a href="attribute-syntax" accesskey="n" rel="next">Attribute Syntax</a>, Previous: <a href="enumerator-attributes" accesskey="p" rel="prev">Enumerator Attributes</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Statement-Attributes-1"><span>6.38 Statement Attributes<a class="copiable-link" href="#Statement-Attributes-1"> ¶</a></span></h1> <p>GCC allows attributes to be set on null statements. See <a class="xref" href="attribute-syntax">Attribute Syntax</a>, for details of the exact syntax for using attributes. Other attributes are available for functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>), variables (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>), labels (see <a class="pxref" href="label-attributes">Label Attributes</a>), enumerators (see <a class="pxref" href="enumerator-attributes">Enumerator Attributes</a>), and for types (see <a class="pxref" href="type-attributes">Specifying Attributes of Types</a>). </p> <dl class="table"> <dt> +<span><code class="code">fallthrough</code><a class="copiable-link" href="#index-fallthrough-statement-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">fallthrough</code> attribute with a null statement serves as a fallthrough statement. It hints to the compiler that a statement that falls through to another case label, or user-defined label in a switch statement is intentional and thus the <samp class="option">-Wimplicit-fallthrough</samp> warning must not trigger. The fallthrough attribute may appear at most once in each attribute list, and may not be mixed with other attributes. It can only be used in a switch statement (the compiler will issue an error otherwise), after a preceding statement and before a logically succeeding case label, or user-defined label. </p> <p>This example uses the <code class="code">fallthrough</code> statement attribute to indicate that the <samp class="option">-Wimplicit-fallthrough</samp> warning should not be emitted: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">switch (cond) + { + case 1: + bar (1); + __attribute__((fallthrough)); + case 2: + … + }</pre> +</div> </dd> <dt> +<span><code class="code">assume</code><a class="copiable-link" href="#index-assume-statement-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">assume</code> attribute with a null statement serves as portable assumption. It should have a single argument, a conditional expression, which is not evaluated. If the argument would evaluate to true at the point where it appears, it has no effect, otherwise there is undefined behavior. This is a GNU variant of the ISO C++23 standard <code class="code">assume</code> attribute, but it can be used in any version of both C and C++. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int +foo (int x, int y) +{ + __attribute__((assume(x == 42))); + __attribute__((assume(++y == 43))); + return x + y; +}</pre> +</div> <p><code class="code">y</code> is not actually incremented and the compiler can but does not have to optimize it to just <code class="code">return 42 + 42;</code>. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="attribute-syntax">Attribute Syntax</a>, Previous: <a href="enumerator-attributes">Enumerator Attributes</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Statement-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Statement-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/statement-exprs.html b/devdocs/gcc~13/statement-exprs.html new file mode 100644 index 00000000..bb229d7f --- /dev/null +++ b/devdocs/gcc~13/statement-exprs.html @@ -0,0 +1,33 @@ +<div class="section-level-extent" id="Statement-Exprs"> <div class="nav-panel"> <p> Next: <a href="local-labels" accesskey="n" rel="next">Locally Declared Labels</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Statements-and-Declarations-in-Expressions"><span>6.1 Statements and Declarations in Expressions<a class="copiable-link" href="#Statements-and-Declarations-in-Expressions"> ¶</a></span></h1> <p>A compound statement enclosed in parentheses may appear as an expression in GNU C. This allows you to use loops, switches, and local variables within an expression. </p> <p>Recall that a compound statement is a sequence of statements surrounded by braces; in this construct, parentheses go around the braces. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">({ int y = foo (); int z; + if (y > 0) z = y; + else z = - y; + z; })</pre> +</div> <p>is a valid (though slightly more complex than necessary) expression for the absolute value of <code class="code">foo ()</code>. </p> <p>The last thing in the compound statement should be an expression followed by a semicolon; the value of this subexpression serves as the value of the entire construct. (If you use some other kind of statement last within the braces, the construct has type <code class="code">void</code>, and thus effectively no value.) </p> <p>This feature is especially useful in making macro definitions “safe” (so that they evaluate each operand exactly once). For example, the “maximum” function is commonly defined as a macro in standard C as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define max(a,b) ((a) > (b) ? (a) : (b))</pre> +</div> <p>But this definition computes either <var class="var">a</var> or <var class="var">b</var> twice, with bad results if the operand has side effects. In GNU C, if you know the type of the operands (here taken as <code class="code">int</code>), you can avoid this problem by defining the macro as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define maxint(a,b) \ + ({int _a = (a), _b = (b); _a > _b ? _a : _b; })</pre> +</div> <p>Note that introducing variable declarations (as we do in <code class="code">maxint</code>) can cause variable shadowing, so while this example using the <code class="code">max</code> macro produces correct results: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int _a = 1, _b = 2, c; +c = max (_a, _b);</pre> +</div> <p>this example using maxint will not: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int _a = 1, _b = 2, c; +c = maxint (_a, _b);</pre> +</div> <p>This problem may for instance occur when we use this pattern recursively, like so: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define maxint3(a, b, c) \ + ({int _a = (a), _b = (b), _c = (c); maxint (maxint (_a, _b), _c); })</pre> +</div> <p>Embedded statements are not allowed in constant expressions, such as the value of an enumeration constant, the width of a bit-field, or the initial value of a static variable. </p> <p>If you don’t know the type of the operand, you can still do this, but you must use <code class="code">typeof</code> or <code class="code">__auto_type</code> (see <a class="pxref" href="typeof">Referring to a Type with <code class="code">typeof</code></a>). </p> <p>In G++, the result value of a statement expression undergoes array and function pointer decay, and is returned by value to the enclosing expression. For instance, if <code class="code">A</code> is a class, then </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">A a; + +({a;}).Foo ()</pre> +</div> <p>constructs a temporary <code class="code">A</code> object to hold the result of the statement expression, and that is used to invoke <code class="code">Foo</code>. Therefore the <code class="code">this</code> pointer observed by <code class="code">Foo</code> is not the address of <code class="code">a</code>. </p> <p>In a statement expression, any temporaries created within a statement are destroyed at that statement’s end. This makes statement expressions inside macros slightly different from function calls. In the latter case temporaries introduced during argument evaluation are destroyed at the end of the statement that includes the function call. In the statement expression case they are destroyed during the statement expression. For instance, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define macro(a) ({__typeof__(a) b = (a); b + 3; }) +template<typename T> T function(T a) { T b = a; return b + 3; } + +void foo () +{ + macro (X ()); + function (X ()); +}</pre> +</div> <p>has different places where temporaries are destroyed. For the <code class="code">macro</code> case, the temporary <code class="code">X</code> is destroyed just after the initialization of <code class="code">b</code>. In the <code class="code">function</code> case that temporary is destroyed when the function returns. </p> <p>These considerations mean that it is probably a bad idea to use statement expressions of this form in header files that are designed to work with C++. (Note that some versions of the GNU C Library contained header files using statement expressions that lead to precisely this bug.) </p> <p>Jumping into a statement expression with <code class="code">goto</code> or using a <code class="code">switch</code> statement outside the statement expression with a <code class="code">case</code> or <code class="code">default</code> label inside the statement expression is not permitted. Jumping into a statement expression with a computed <code class="code">goto</code> (see <a class="pxref" href="labels-as-values">Labels as Values</a>) has undefined behavior. Jumping out of a statement expression is permitted, but if the statement expression is part of a larger expression then it is unspecified which other subexpressions of that expression have been evaluated except where the language definition requires certain subexpressions to be evaluated before or after the statement expression. A <code class="code">break</code> or <code class="code">continue</code> statement inside of a statement expression used in <code class="code">while</code>, <code class="code">do</code> or <code class="code">for</code> loop or <code class="code">switch</code> statement condition or <code class="code">for</code> statement init or increment expressions jumps to an outer loop or <code class="code">switch</code> statement if any (otherwise it is an error), rather than to the loop or <code class="code">switch</code> statement in whose condition or init or increment expression it appears. In any case, as with a function call, the evaluation of a statement expression is not interleaved with the evaluation of other parts of the containing expression. For example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">foo (), (({ bar1 (); goto a; 0; }) + bar2 ()), baz();</pre> +</div> <p>calls <code class="code">foo</code> and <code class="code">bar1</code> and does not call <code class="code">baz</code> but may or may not call <code class="code">bar2</code>. If <code class="code">bar2</code> is called, it is called after <code class="code">foo</code> and before <code class="code">bar1</code>. </p> </div> <div class="nav-panel"> <p> Next: <a href="local-labels">Locally Declared Labels</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Statement-Exprs.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Statement-Exprs.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/statements-implementation.html b/devdocs/gcc~13/statements-implementation.html new file mode 100644 index 00000000..1a302359 --- /dev/null +++ b/devdocs/gcc~13/statements-implementation.html @@ -0,0 +1,7 @@ +<div class="section-level-extent" id="Statements-implementation"> <div class="nav-panel"> <p> Next: <a href="preprocessing-directives-implementation" accesskey="n" rel="next">Preprocessing Directives</a>, Previous: <a href="declarators-implementation" accesskey="p" rel="prev">Declarators</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Statements"><span>4.12 Statements<a class="copiable-link" href="#Statements"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>The maximum number of <code class="code">case</code> values in a <code class="code">switch</code> statement (C90 6.6.4.2). <p>GCC is only limited by available memory. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Statements-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Statements-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/static-analyzer-options.html b/devdocs/gcc~13/static-analyzer-options.html new file mode 100644 index 00000000..4d972946 --- /dev/null +++ b/devdocs/gcc~13/static-analyzer-options.html @@ -0,0 +1,404 @@ +<div class="section-level-extent" id="Static-Analyzer-Options"> <div class="nav-panel"> <p> Next: <a href="debugging-options" accesskey="n" rel="next">Options for Debugging Your Program</a>, Previous: <a href="warning-options" accesskey="p" rel="prev">Options to Request or Suppress Warnings</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-That-Control-Static-Analysis"><span>3.9 Options That Control Static Analysis<a class="copiable-link" href="#Options-That-Control-Static-Analysis"> ¶</a></span></h1> <dl class="table"> <dt> + <span><code class="code">-fanalyzer</code><a class="copiable-link" href="#index-analyzer"> ¶</a></span> +</dt> <dd> +<p>This option enables an static analysis of program flow which looks for “interesting” interprocedural paths through the code, and issues warnings for problems found on them. </p> <p>This analysis is much more expensive than other GCC warnings. </p> <p>In technical terms, it performs coverage-guided symbolic execution of the code being compiled. It is neither sound nor complete: it can have false positives and false negatives. It is a bug-finding tool, rather than a tool for proving program correctness. </p> <p>The analyzer is only suitable for use on C code in this release. </p> <p>Enabling this option effectively enables the following warnings: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-Wanalyzer-allocation-size +-Wanalyzer-deref-before-check +-Wanalyzer-double-fclose +-Wanalyzer-double-free +-Wanalyzer-exposure-through-output-file +-Wanalyzer-exposure-through-uninit-copy +-Wanalyzer-fd-access-mode-mismatch +-Wanalyzer-fd-double-close +-Wanalyzer-fd-leak +-Wanalyzer-fd-phase-mismatch +-Wanalyzer-fd-type-mismatch +-Wanalyzer-fd-use-after-close +-Wanalyzer-fd-use-without-check +-Wanalyzer-file-leak +-Wanalyzer-free-of-non-heap +-Wanalyzer-imprecise-fp-arithmetic +-Wanalyzer-infinite-recursion +-Wanalyzer-jump-through-null +-Wanalyzer-malloc-leak +-Wanalyzer-mismatching-deallocation +-Wanalyzer-null-argument +-Wanalyzer-null-dereference +-Wanalyzer-out-of-bounds +-Wanalyzer-possible-null-argument +-Wanalyzer-possible-null-dereference +-Wanalyzer-putenv-of-auto-var +-Wanalyzer-shift-count-negative +-Wanalyzer-shift-count-overflow +-Wanalyzer-stale-setjmp-buffer +-Wanalyzer-unsafe-call-within-signal-handler +-Wanalyzer-use-after-free +-Wanalyzer-use-of-pointer-in-stale-stack-frame +-Wanalyzer-use-of-uninitialized-value +-Wanalyzer-va-arg-type-mismatch +-Wanalyzer-va-list-exhausted +-Wanalyzer-va-list-leak +-Wanalyzer-va-list-use-after-va-end +-Wanalyzer-write-to-const +-Wanalyzer-write-to-string-literal</pre> +</div> <p>This option is only available if GCC was configured with analyzer support enabled. </p> </dd> <dt> + <span><code class="code">-Wanalyzer-too-complex</code><a class="copiable-link" href="#index-Wanalyzer-too-complex"> ¶</a></span> +</dt> <dd> +<p>If <samp class="option">-fanalyzer</samp> is enabled, the analyzer uses various heuristics to attempt to explore the control flow and data flow in the program, but these can be defeated by sufficiently complicated code. </p> <p>By default, the analysis silently stops if the code is too complicated for the analyzer to fully explore and it reaches an internal limit. The <samp class="option">-Wanalyzer-too-complex</samp> option warns if this occurs. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-allocation-size</code><a class="copiable-link" href="#index-Wanalyzer-allocation-size"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; to disable it, use <samp class="option">-Wno-analyzer-allocation-size</samp>. </p> <p>This diagnostic warns for paths through the code in which a pointer to a buffer is assigned to point at a buffer with a size that is not a multiple of <code class="code">sizeof (*pointer)</code>. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/131.html">CWE-131: Incorrect Calculation of Buffer Size</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-deref-before-check</code><a class="copiable-link" href="#index-Wanalyzer-deref-before-check"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-deref-before-check</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a pointer is checked for <code class="code">NULL</code> *after* it has already been dereferenced, suggesting that the pointer could have been NULL. Such cases suggest that the check for NULL is either redundant, or that it needs to be moved to before the pointer is dereferenced. </p> <p>This diagnostic also considers values passed to a function argument marked with <code class="code">__attribute__((nonnull))</code> as requiring a non-NULL value, and thus will complain if such values are checked for <code class="code">NULL</code> after returning from such a function call. </p> <p>This diagnostic is unlikely to be reported when any level of optimization is enabled, as GCC’s optimization logic will typically consider such checks for NULL as being redundant, and optimize them away before the analyzer "sees" them. Hence optimization should be disabled when attempting to trigger this diagnostic. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-double-fclose</code><a class="copiable-link" href="#index-Wanalyzer-double-fclose"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-double-fclose</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a <code class="code">FILE *</code> can have <code class="code">fclose</code> called on it more than once. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/1341.html">CWE-1341: Multiple Releases of Same Resource or Handle</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-double-free</code><a class="copiable-link" href="#index-Wanalyzer-double-free"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-double-free</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a pointer can have a deallocator called on it more than once, either <code class="code">free</code>, or a deallocator referenced by attribute <code class="code">malloc</code>. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/415.html">CWE-415: Double Free</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-exposure-through-output-file</code><a class="copiable-link" href="#index-Wanalyzer-exposure-through-output-file"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-exposure-through-output-file</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a security-sensitive value is written to an output file (such as writing a password to a log file). </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/532.html">CWE-532: Information Exposure Through Log Files</a>. </p> </dd> <dt> + <span><code class="code">-Wanalyzer-exposure-through-uninit-copy</code><a class="copiable-link" href="#index-Wanalyzer-exposure-through-uninit-copy"> ¶</a></span> +</dt> <dd> +<p>This warning requires both <samp class="option">-fanalyzer</samp> and the use of a plugin to specify a function that copies across a “trust boundary”. Use <samp class="option">-Wno-analyzer-exposure-through-uninit-copy</samp> to disable it. </p> <p>This diagnostic warns for “infoleaks” - paths through the code in which uninitialized values are copied across a security boundary (such as code within an OS kernel that copies a partially-initialized struct on the stack to user space). </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/200.html">CWE-200: Exposure of Sensitive Information to an Unauthorized Actor</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-fd-access-mode-mismatch</code><a class="copiable-link" href="#index-Wanalyzer-fd-access-mode-mismatch"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-fd-access-mode-mismatch</samp> to disable it. </p> <p>This diagnostic warns for paths through code in which a <code class="code">read</code> on a write-only file descriptor is attempted, or vice versa. </p> <p>This diagnostic also warns for code paths in a which a function with attribute <code class="code">fd_arg_read (N)</code> is called with a file descriptor opened with <code class="code">O_WRONLY</code> at referenced argument <code class="code">N</code> or a function with attribute <code class="code">fd_arg_write (N)</code> is called with a file descriptor opened with <code class="code">O_RDONLY</code> at referenced argument <var class="var">N</var>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-fd-double-close</code><a class="copiable-link" href="#index-Wanalyzer-fd-double-close"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-fd-double-close</samp> to disable it. </p> <p>This diagnostic warns for paths through code in which a file descriptor can be closed more than once. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/1341.html">CWE-1341: Multiple Releases of Same Resource or Handle</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-fd-leak</code><a class="copiable-link" href="#index-Wanalyzer-fd-leak"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-fd-leak</samp> to disable it. </p> <p>This diagnostic warns for paths through code in which an open file descriptor is leaked. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/775.html">CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-fd-phase-mismatch</code><a class="copiable-link" href="#index-Wanalyzer-fd-phase-mismatch"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-fd-phase-mismatch</samp> to disable it. </p> <p>This diagnostic warns for paths through code in which an operation is attempted in the wrong phase of a file descriptor’s lifetime. For example, it will warn on attempts to call <code class="code">accept</code> on a stream socket that has not yet had <code class="code">listen</code> successfully called on it. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/666.html">CWE-666: Operation on Resource in Wrong Phase of Lifetime</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-fd-type-mismatch</code><a class="copiable-link" href="#index-Wanalyzer-fd-type-mismatch"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-fd-type-mismatch</samp> to disable it. </p> <p>This diagnostic warns for paths through code in which an operation is attempted on the wrong type of file descriptor. For example, it will warn on attempts to use socket operations on a file descriptor obtained via <code class="code">open</code>, or when attempting to use a stream socket operation on a datagram socket. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-fd-use-after-close</code><a class="copiable-link" href="#index-Wanalyzer-fd-use-after-close"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-fd-use-after-close</samp> to disable it. </p> <p>This diagnostic warns for paths through code in which a read or write is called on a closed file descriptor. </p> <p>This diagnostic also warns for paths through code in which a function with attribute <code class="code">fd_arg (N)</code> or <code class="code">fd_arg_read (N)</code> or <code class="code">fd_arg_write (N)</code> is called with a closed file descriptor at referenced argument <code class="code">N</code>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-fd-use-without-check</code><a class="copiable-link" href="#index-Wanalyzer-fd-use-without-check"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-fd-use-without-check</samp> to disable it. </p> <p>This diagnostic warns for paths through code in which a file descriptor is used without being checked for validity. </p> <p>This diagnostic also warns for paths through code in which a function with attribute <code class="code">fd_arg (N)</code> or <code class="code">fd_arg_read (N)</code> or <code class="code">fd_arg_write (N)</code> is called with a file descriptor, at referenced argument <code class="code">N</code>, without being checked for validity. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-file-leak</code><a class="copiable-link" href="#index-Wanalyzer-file-leak"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-file-leak</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a <code class="code"><stdio.h></code> <code class="code">FILE *</code> stream object is leaked. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/775.html">CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-free-of-non-heap</code><a class="copiable-link" href="#index-Wanalyzer-free-of-non-heap"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-free-of-non-heap</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which <code class="code">free</code> is called on a non-heap pointer (e.g. an on-stack buffer, or a global). </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/590.html">CWE-590: Free of Memory not on the Heap</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-imprecise-fp-arithmetic</code><a class="copiable-link" href="#index-Wanalyzer-imprecise-fp-arithmetic"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-imprecise-fp-arithmetic</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which floating-point arithmetic is used in locations where precise computation is needed. This diagnostic only warns on use of floating-point operands inside the calculation of an allocation size at the moment. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-infinite-recursion</code><a class="copiable-link" href="#index-Wanalyzer-infinite-recursion"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-infinite-recursion</samp> to disable it. </p> <p>This diagnostics warns for paths through the code which appear to lead to infinite recursion. </p> <p>Specifically, when the analyzer "sees" a recursive call, it will compare the state of memory at the entry to the new frame with that at the entry to the previous frame of that function on the stack. The warning is issued if nothing in memory appears to be changing; any changes observed to parameters or globals are assumed to lead to termination of the recursion and thus suppress the warning. </p> <p>This diagnostic is likely to miss cases of infinite recursion that are convered to iteration by the optimizer before the analyzer "sees" them. Hence optimization should be disabled when attempting to trigger this diagnostic. </p> <p>Compare with <samp class="option">-Winfinite-recursion</samp>, which provides a similar diagnostic, but is implemented in a different way. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-jump-through-null</code><a class="copiable-link" href="#index-Wanalyzer-jump-through-null"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-jump-through-null</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a <code class="code">NULL</code> function pointer is called. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-malloc-leak</code><a class="copiable-link" href="#index-Wanalyzer-malloc-leak"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-malloc-leak</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a pointer allocated via an allocator is leaked: either <code class="code">malloc</code>, or a function marked with attribute <code class="code">malloc</code>. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/401.html">CWE-401: Missing Release of Memory after Effective Lifetime</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-mismatching-deallocation</code><a class="copiable-link" href="#index-Wanalyzer-mismatching-deallocation"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-mismatching-deallocation</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which the wrong deallocation function is called on a pointer value, based on which function was used to allocate the pointer value. The diagnostic will warn about mismatches between <code class="code">free</code>, scalar <code class="code">delete</code> and vector <code class="code">delete[]</code>, and those marked as allocator/deallocator pairs using attribute <code class="code">malloc</code>. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/762.html">CWE-762: Mismatched Memory Management Routines</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-out-of-bounds</code><a class="copiable-link" href="#index-Wanalyzer-out-of-bounds"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-out-of-bounds</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a buffer is definitely read or written out-of-bounds. The diagnostic applies for cases where the analyzer is able to determine a constant offset and for accesses past the end of a buffer, also a constant capacity. Further, the diagnostic does limited checking for accesses past the end when the offset as well as the capacity is symbolic. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/119.html">CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-possible-null-argument</code><a class="copiable-link" href="#index-Wanalyzer-possible-null-argument"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-possible-null-argument</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a possibly-NULL value is passed to a function argument marked with <code class="code">__attribute__((nonnull))</code> as requiring a non-NULL value. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/690.html">CWE-690: Unchecked Return Value to NULL Pointer Dereference</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-possible-null-dereference</code><a class="copiable-link" href="#index-Wanalyzer-possible-null-dereference"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-possible-null-dereference</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a possibly-NULL value is dereferenced. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/690.html">CWE-690: Unchecked Return Value to NULL Pointer Dereference</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-null-argument</code><a class="copiable-link" href="#index-Wanalyzer-null-argument"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-null-argument</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a value known to be NULL is passed to a function argument marked with <code class="code">__attribute__((nonnull))</code> as requiring a non-NULL value. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/476.html">CWE-476: NULL Pointer Dereference</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-null-dereference</code><a class="copiable-link" href="#index-Wanalyzer-null-dereference"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-null-dereference</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a value known to be NULL is dereferenced. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/476.html">CWE-476: NULL Pointer Dereference</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-putenv-of-auto-var</code><a class="copiable-link" href="#index-Wanalyzer-putenv-of-auto-var"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-putenv-of-auto-var</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a call to <code class="code">putenv</code> is passed a pointer to an automatic variable or an on-stack buffer. </p> <p>See <a class="uref" href="https://wiki.sei.cmu.edu/confluence/x/6NYxBQ">POS34-C. Do not call putenv() with a pointer to an automatic variable as the argument</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-shift-count-negative</code><a class="copiable-link" href="#index-Wanalyzer-shift-count-negative"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-shift-count-negative</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a shift is attempted with a negative count. It is analogous to the <samp class="option">-Wshift-count-negative</samp> diagnostic implemented in the C/C++ front ends, but is implemented based on analyzing interprocedural paths, rather than merely parsing the syntax tree. However, the analyzer does not prioritize detection of such paths, so false negatives are more likely relative to other warnings. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-shift-count-overflow</code><a class="copiable-link" href="#index-Wanalyzer-shift-count-overflow"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-shift-count-overflow</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a shift is attempted with a count greater than or equal to the precision of the operand’s type. It is analogous to the <samp class="option">-Wshift-count-overflow</samp> diagnostic implemented in the C/C++ front ends, but is implemented based on analyzing interprocedural paths, rather than merely parsing the syntax tree. However, the analyzer does not prioritize detection of such paths, so false negatives are more likely relative to other warnings. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-stale-setjmp-buffer</code><a class="copiable-link" href="#index-Wanalyzer-stale-setjmp-buffer"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-stale-setjmp-buffer</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which <code class="code">longjmp</code> is called to rewind to a <code class="code">jmp_buf</code> relating to a <code class="code">setjmp</code> call in a function that has returned. </p> <p>When <code class="code">setjmp</code> is called on a <code class="code">jmp_buf</code> to record a rewind location, it records the stack frame. The stack frame becomes invalid when the function containing the <code class="code">setjmp</code> call returns. Attempting to rewind to it via <code class="code">longjmp</code> would reference a stack frame that no longer exists, and likely lead to a crash (or worse). </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-tainted-allocation-size</code><a class="copiable-link" href="#index-Wanalyzer-tainted-allocation-size"> ¶</a></span> +</dt> <dd> +<p>This warning requires both <samp class="option">-fanalyzer</samp> and <samp class="option">-fanalyzer-checker=taint</samp> to enable it; use <samp class="option">-Wno-analyzer-tainted-allocation-size</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as the size of an allocation without being sanitized, so that an attacker could inject an excessively large allocation and potentially cause a denial of service attack. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/789.html">CWE-789: Memory Allocation with Excessive Size Value</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-tainted-assertion</code><a class="copiable-link" href="#index-Wanalyzer-tainted-assertion"> ¶</a></span> +</dt> <dd> <p>This warning requires both <samp class="option">-fanalyzer</samp> and <samp class="option">-fanalyzer-checker=taint</samp> to enable it; use <samp class="option">-Wno-analyzer-tainted-assertion</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as part of a condition without being first sanitized, and that condition guards a call to a function marked with attribute <code class="code">noreturn</code> (such as the function <code class="code">__builtin_unreachable</code>). Such functions typically indicate abnormal termination of the program, such as for assertion failure handlers. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">assert (some_tainted_value < SOME_LIMIT);</pre> +</div> <p>In such cases: </p> <ul class="itemize mark-bullet"> <li>when assertion-checking is enabled: an attacker could trigger a denial of service by injecting an assertion failure </li> +<li>when assertion-checking is disabled, such as by defining <code class="code">NDEBUG</code>, an attacker could inject data that subverts the process, since it presumably violates a precondition that is being assumed by the code. </li> +</ul> <p>Note that when assertion-checking is disabled, the assertions are typically removed by the preprocessor before the analyzer has a chance to "see" them, so this diagnostic can only generate warnings on builds in which assertion-checking is enabled. </p> <p>For the purpose of this warning, any function marked with attribute <code class="code">noreturn</code> is considered as a possible assertion failure handler, including <code class="code">__builtin_unreachable</code>. Note that these functions are sometimes removed by the optimizer before the analyzer "sees" them. Hence optimization should be disabled when attempting to trigger this diagnostic. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/617.html">CWE-617: Reachable Assertion</a>. </p> <p>The warning can also report problematic constructions such as </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">switch (some_tainted_value) { +case 0: + /* [...etc; various valid cases omitted...] */ + break; + +default: + __builtin_unreachable (); /* BUG: attacker can trigger this */ +}</pre> +</div> <p>despite the above not being an assertion failure, strictly speaking. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-tainted-array-index</code><a class="copiable-link" href="#index-Wanalyzer-tainted-array-index"> ¶</a></span> +</dt> <dd> +<p>This warning requires both <samp class="option">-fanalyzer</samp> and <samp class="option">-fanalyzer-checker=taint</samp> to enable it; use <samp class="option">-Wno-analyzer-tainted-array-index</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as the index of an array access without being sanitized, so that an attacker could inject an out-of-bounds access. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/129.html">CWE-129: Improper Validation of Array Index</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-tainted-divisor</code><a class="copiable-link" href="#index-Wanalyzer-tainted-divisor"> ¶</a></span> +</dt> <dd> +<p>This warning requires both <samp class="option">-fanalyzer</samp> and <samp class="option">-fanalyzer-checker=taint</samp> to enable it; use <samp class="option">-Wno-analyzer-tainted-divisor</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as the divisor in a division or modulus operation without being sanitized, so that an attacker could inject a division-by-zero. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/369.html">CWE-369: Divide By Zero</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-tainted-offset</code><a class="copiable-link" href="#index-Wanalyzer-tainted-offset"> ¶</a></span> +</dt> <dd> +<p>This warning requires both <samp class="option">-fanalyzer</samp> and <samp class="option">-fanalyzer-checker=taint</samp> to enable it; use <samp class="option">-Wno-analyzer-tainted-offset</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as a pointer offset without being sanitized, so that an attacker could inject an out-of-bounds access. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/823.html">CWE-823: Use of Out-of-range Pointer Offset</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-tainted-size</code><a class="copiable-link" href="#index-Wanalyzer-tainted-size"> ¶</a></span> +</dt> <dd> +<p>This warning requires both <samp class="option">-fanalyzer</samp> and <samp class="option">-fanalyzer-checker=taint</samp> to enable it; use <samp class="option">-Wno-analyzer-tainted-size</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as the size of an operation such as <code class="code">memset</code> without being sanitized, so that an attacker could inject an out-of-bounds access. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/129.html">CWE-129: Improper Validation of Array Index</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-unsafe-call-within-signal-handler</code><a class="copiable-link" href="#index-Wanalyzer-unsafe-call-within-signal-handler"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-unsafe-call-within-signal-handler</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a function known to be async-signal-unsafe (such as <code class="code">fprintf</code>) is called from a signal handler. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/479.html">CWE-479: Signal Handler Use of a Non-reentrant Function</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-use-after-free</code><a class="copiable-link" href="#index-Wanalyzer-use-after-free"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-use-after-free</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a pointer is used after a deallocator is called on it: either <code class="code">free</code>, or a deallocator referenced by attribute <code class="code">malloc</code>. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/416.html">CWE-416: Use After Free</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-use-of-pointer-in-stale-stack-frame</code><a class="copiable-link" href="#index-Wanalyzer-use-of-pointer-in-stale-stack-frame"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-use-of-pointer-in-stale-stack-frame</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which a pointer is dereferenced that points to a variable in a stale stack frame. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-va-arg-type-mismatch</code><a class="copiable-link" href="#index-Wanalyzer-va-arg-type-mismatch"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-va-arg-type-mismatch</samp> to disable it. </p> <p>This diagnostic warns for interprocedural paths through the code for which the analyzer detects an attempt to use <code class="code">va_arg</code> to extract a value passed to a variadic call, but uses a type that does not match that of the expression passed to the call. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/686.html">CWE-686: Function Call With Incorrect Argument Type</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-va-list-exhausted</code><a class="copiable-link" href="#index-Wanalyzer-va-list-exhausted"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-va-list-exhausted</samp> to disable it. </p> <p>This diagnostic warns for interprocedural paths through the code for which the analyzer detects an attempt to use <code class="code">va_arg</code> to access the next value passed to a variadic call, but all of the values in the <code class="code">va_list</code> have already been consumed. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/685.html">CWE-685: Function Call With Incorrect Number of Arguments</a>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-va-list-leak</code><a class="copiable-link" href="#index-Wanalyzer-va-list-leak"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-va-list-leak</samp> to disable it. </p> <p>This diagnostic warns for interprocedural paths through the code for which the analyzer detects that <code class="code">va_start</code> or <code class="code">va_copy</code> has been called on a <code class="code">va_list</code> without a corresponding call to <code class="code">va_end</code>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-va-list-use-after-va-end</code><a class="copiable-link" href="#index-Wanalyzer-va-list-use-after-va-end"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-va-list-use-after-va-end</samp> to disable it. </p> <p>This diagnostic warns for interprocedural paths through the code for which the analyzer detects an attempt to use a <code class="code">va_list</code> after <code class="code">va_end</code> has been called on it. <code class="code">va_list</code>. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-write-to-const</code><a class="copiable-link" href="#index-Wanalyzer-write-to-const"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-write-to-const</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which the analyzer detects an attempt to write through a pointer to a <code class="code">const</code> object. However, the analyzer does not prioritize detection of such paths, so false negatives are more likely relative to other warnings. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-write-to-string-literal</code><a class="copiable-link" href="#index-Wanalyzer-write-to-string-literal"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-write-to-string-literal</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which the analyzer detects an attempt to write through a pointer to a string literal. However, the analyzer does not prioritize detection of such paths, so false negatives are more likely relative to other warnings. </p> </dd> <dt> + <span><code class="code">-Wno-analyzer-use-of-uninitialized-value</code><a class="copiable-link" href="#index-Wanalyzer-use-of-uninitialized-value"> ¶</a></span> +</dt> <dd> +<p>This warning requires <samp class="option">-fanalyzer</samp>, which enables it; use <samp class="option">-Wno-analyzer-use-of-uninitialized-value</samp> to disable it. </p> <p>This diagnostic warns for paths through the code in which an uninitialized value is used. </p> <p>See <a class="uref" href="https://cwe.mitre.org/data/definitions/457.html">CWE-457: Use of Uninitialized Variable</a>. </p> </dd> </dl> <p>The analyzer has hardcoded knowledge about the behavior of the following memory-management functions: </p> <ul class="itemize mark-bullet"> <li> +<code class="code">alloca</code> </li> +<li>The built-in functions <code class="code">__builtin_alloc</code>, <code class="code">__builtin_alloc_with_align</code>, </li> +<li> +<code class="code">__builtin_calloc</code>, <code class="code">__builtin_free</code>, <code class="code">__builtin_malloc</code>, <code class="code">__builtin_memcpy</code>, <code class="code">__builtin_memcpy_chk</code>, <code class="code">__builtin_memset</code>, <code class="code">__builtin_memset_chk</code>, <code class="code">__builtin_realloc</code>, <code class="code">__builtin_stack_restore</code>, and <code class="code">__builtin_stack_save</code> </li> +<li> +<code class="code">calloc</code> </li> +<li> +<code class="code">free</code> </li> +<li> +<code class="code">malloc</code> </li> +<li> +<code class="code">memset</code> </li> +<li> +<code class="code">operator delete</code> </li> +<li> +<code class="code">operator delete []</code> </li> +<li> +<code class="code">operator new</code> </li> +<li> +<code class="code">operator new []</code> </li> +<li> +<code class="code">realloc</code> </li> +<li> +<code class="code">strdup</code> </li> +<li> +<code class="code">strndup</code> </li> +</ul> <p>of the following functions for working with file descriptors: </p> <ul class="itemize mark-bullet"> <li> +<code class="code">open</code> </li> +<li> +<code class="code">close</code> </li> +<li> +<code class="code">creat</code> </li> +<li> +<code class="code">dup</code>, <code class="code">dup2</code> and <code class="code">dup3</code> </li> +<li> +<code class="code">isatty</code> </li> +<li> +<code class="code">pipe</code>, and <code class="code">pipe2</code> </li> +<li> +<code class="code">read</code> </li> +<li> +<code class="code">write</code> </li> +<li> +<code class="code">socket</code>, <code class="code">bind</code>, <code class="code">listen</code>, <code class="code">accept</code>, and <code class="code">connect</code> </li> +</ul> <p>of the following functions for working with <code class="code"><stdio.h></code> streams: </p> +<ul class="itemize mark-bullet"> <li>The built-in functions <code class="code">__builtin_fprintf</code>, <code class="code">__builtin_fprintf_unlocked</code>, <code class="code">__builtin_fputc</code>, <code class="code">__builtin_fputc_unlocked</code>, <code class="code">__builtin_fputs</code>, <code class="code">__builtin_fputs_unlocked</code>, <code class="code">__builtin_fwrite</code>, <code class="code">__builtin_fwrite_unlocked</code>, <code class="code">__builtin_printf</code>, <code class="code">__builtin_printf_unlocked</code>, <code class="code">__builtin_putc</code>, <code class="code">__builtin_putchar</code>, <code class="code">__builtin_putchar_unlocked</code>, <code class="code">__builtin_putc_unlocked</code>, <code class="code">__builtin_puts</code>, <code class="code">__builtin_puts_unlocked</code>, <code class="code">__builtin_vfprintf</code>, and <code class="code">__builtin_vprintf</code> </li> +<li> +<code class="code">fopen</code> </li> +<li> +<code class="code">fclose</code> </li> +<li> +<code class="code">ferror</code> </li> +<li> +<code class="code">fgets</code> </li> +<li> +<code class="code">fgets_unlocked</code> </li> +<li> +<code class="code">fileno</code> </li> +<li> +<code class="code">fread</code> </li> +<li> +<code class="code">getc</code> </li> +<li> +<code class="code">getchar</code> </li> +<li> +<code class="code">fprintf</code> </li> +<li> +<code class="code">printf</code> </li> +<li> +<code class="code">fwrite</code> </li> +</ul> <p>and of the following functions: </p> <ul class="itemize mark-bullet"> <li>The built-in functions <code class="code">__builtin_expect</code>, <code class="code">__builtin_expect_with_probability</code>, <code class="code">__builtin_strchr</code>, <code class="code">__builtin_strcpy</code>, <code class="code">__builtin_strcpy_chk</code>, <code class="code">__builtin_strlen</code>, <code class="code">__builtin_va_copy</code>, and <code class="code">__builtin_va_start</code> </li> +<li>The GNU extensions <code class="code">error</code> and <code class="code">error_at_line</code> </li> +<li> +<code class="code">getpass</code> </li> +<li> +<code class="code">longjmp</code> </li> +<li> +<code class="code">putenv</code> </li> +<li> +<code class="code">setjmp</code> </li> +<li> +<code class="code">siglongjmp</code> </li> +<li> +<code class="code">signal</code> </li> +<li> +<code class="code">sigsetjmp</code> </li> +<li> +<code class="code">strchr</code> </li> +<li> +<code class="code">strlen</code> </li> +</ul> <p>In addition, various functions with an <code class="code">__analyzer_</code> prefix have special meaning to the analyzer, described in the GCC Internals manual. </p> <p>Pertinent parameters for controlling the exploration are: </p> +<ul class="itemize mark-bullet"> <li> +<samp class="option">--param analyzer-bb-explosion-factor=<var class="var">value</var></samp> </li> +<li> +<samp class="option">--param analyzer-max-enodes-per-program-point=<var class="var">value</var></samp> </li> +<li> +<samp class="option">--param analyzer-max-recursion-depth=<var class="var">value</var></samp> </li> +<li> +<samp class="option">--param analyzer-min-snodes-for-call-summary=<var class="var">value</var></samp> </li> +</ul> <p>The following options control the analyzer. </p> <dl class="table"> <dt> + <span><code class="code">-fanalyzer-call-summaries</code><a class="copiable-link" href="#index-fanalyzer-call-summaries"> ¶</a></span> +</dt> <dd> +<p>Simplify interprocedural analysis by computing the effect of certain calls, rather than exploring all paths through the function from callsite to each possible return. </p> <p>If enabled, call summaries are only used for functions with more than one call site, and that are sufficiently complicated (as per <samp class="option">--param analyzer-min-snodes-for-call-summary=<var class="var">value</var></samp>). </p> </dd> <dt> +<span><code class="code">-fanalyzer-checker=<var class="var">name</var></code><a class="copiable-link" href="#index-fanalyzer-checker"> ¶</a></span> +</dt> <dd> +<p>Restrict the analyzer to run just the named checker, and enable it. </p> <p>Some checkers are disabled by default (even with <samp class="option">-fanalyzer</samp>), such as the <code class="code">taint</code> checker that implements <samp class="option">-Wanalyzer-tainted-array-index</samp>, and this option is required to enable them. </p> <p><em class="emph">Note:</em> currently, <samp class="option">-fanalyzer-checker=taint</samp> disables the following warnings from <samp class="option">-fanalyzer</samp>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-Wanalyzer-deref-before-check +-Wanalyzer-double-fclose +-Wanalyzer-double-free +-Wanalyzer-exposure-through-output-file +-Wanalyzer-fd-access-mode-mismatch +-Wanalyzer-fd-double-close +-Wanalyzer-fd-leak +-Wanalyzer-fd-use-after-close +-Wanalyzer-fd-use-without-check +-Wanalyzer-file-leak +-Wanalyzer-free-of-non-heap +-Wanalyzer-malloc-leak +-Wanalyzer-mismatching-deallocation +-Wanalyzer-null-argument +-Wanalyzer-null-dereference +-Wanalyzer-possible-null-argument +-Wanalyzer-possible-null-dereference +-Wanalyzer-unsafe-call-within-signal-handler +-Wanalyzer-use-after-free +-Wanalyzer-va-list-leak +-Wanalyzer-va-list-use-after-va-end</pre> +</div> </dd> <dt> + <span><code class="code">-fno-analyzer-feasibility</code><a class="copiable-link" href="#index-fanalyzer-feasibility"> ¶</a></span> +</dt> <dd> +<p>This option is intended for analyzer developers. </p> <p>By default the analyzer verifies that there is a feasible control flow path for each diagnostic it emits: that the conditions that hold are not mutually exclusive. Diagnostics for which no feasible path can be found are rejected. This filtering can be suppressed with <samp class="option">-fno-analyzer-feasibility</samp>, for debugging issues in this code. </p> </dd> <dt> + <span><code class="code">-fanalyzer-fine-grained</code><a class="copiable-link" href="#index-fanalyzer-fine-grained"> ¶</a></span> +</dt> <dd> +<p>This option is intended for analyzer developers. </p> <p>Internally the analyzer builds an “exploded graph” that combines control flow graphs with data flow information. </p> <p>By default, an edge in this graph can contain the effects of a run of multiple statements within a basic block. With <samp class="option">-fanalyzer-fine-grained</samp>, each statement gets its own edge. </p> </dd> <dt> + <span><code class="code">-fanalyzer-show-duplicate-count</code><a class="copiable-link" href="#index-fanalyzer-show-duplicate-count"> ¶</a></span> +</dt> <dd> +<p>This option is intended for analyzer developers: if multiple diagnostics have been detected as being duplicates of each other, it emits a note when reporting the best diagnostic, giving the number of additional diagnostics that were suppressed by the deduplication logic. </p> </dd> <dt> + <span><code class="code">-fno-analyzer-state-merge</code><a class="copiable-link" href="#index-fanalyzer-state-merge"> ¶</a></span> +</dt> <dd> +<p>This option is intended for analyzer developers. </p> <p>By default the analyzer attempts to simplify analysis by merging sufficiently similar states at each program point as it builds its “exploded graph”. With <samp class="option">-fno-analyzer-state-merge</samp> this merging can be suppressed, for debugging state-handling issues. </p> </dd> <dt> + <span><code class="code">-fno-analyzer-state-purge</code><a class="copiable-link" href="#index-fanalyzer-state-purge"> ¶</a></span> +</dt> <dd> +<p>This option is intended for analyzer developers. </p> <p>By default the analyzer attempts to simplify analysis by purging aspects of state at a program point that appear to no longer be relevant e.g. the values of locals that aren’t accessed later in the function and which aren’t relevant to leak analysis. </p> <p>With <samp class="option">-fno-analyzer-state-purge</samp> this purging of state can be suppressed, for debugging state-handling issues. </p> </dd> <dt> + <span><code class="code">-fno-analyzer-suppress-followups</code><a class="copiable-link" href="#index-fanalyzer-suppress-followups"> ¶</a></span> +</dt> <dd> +<p>This option is intended for analyzer developers. </p> <p>By default the analyzer will stop exploring an execution path after encountering certain diagnostics, in order to avoid potentially issuing a cascade of follow-up diagnostics. </p> <p>The diagnostics that terminate analysis along a path are: </p> <ul class="itemize mark-bullet"> <li> +<samp class="option">-Wanalyzer-null-argument</samp> </li> +<li> +<samp class="option">-Wanalyzer-null-dereference</samp> </li> +<li> +<samp class="option">-Wanalyzer-use-after-free</samp> </li> +<li> +<samp class="option">-Wanalyzer-use-of-pointer-in-stale-stack-frame</samp> </li> +<li> +<samp class="option">-Wanalyzer-use-of-uninitialized-value</samp> </li> +</ul> <p>With <samp class="option">-fno-analyzer-suppress-followups</samp> the analyzer will continue to explore such paths even after such diagnostics, which may be helpful for debugging issues in the analyzer, or for microbenchmarks for detecting undefined behavior. </p> </dd> <dt> + <span><code class="code">-fanalyzer-transitivity</code><a class="copiable-link" href="#index-fanalyzer-transitivity"> ¶</a></span> +</dt> <dd> +<p>This option enables transitivity of constraints within the analyzer. </p> </dd> <dt> + <span><code class="code">-fno-analyzer-undo-inlining</code><a class="copiable-link" href="#index-fanalyzer-undo-inlining"> ¶</a></span> +</dt> <dd> +<p>This option is intended for analyzer developers. </p> <p><samp class="option">-fanalyzer</samp> runs relatively late compared to other code analysis tools, and some optimizations have already been applied to the code. In particular function inlining may have occurred, leading to the interprocedural execution paths emitted by the analyzer containing function frames that don’t correspond to those in the original source code. </p> <p>By default the analyzer attempts to reconstruct the original function frames, and to emit events showing the inlined calls. </p> <p>With <samp class="option">-fno-analyzer-undo-inlining</samp> this attempt to reconstruct the original frame information can be be disabled, which may be of help when debugging issues in the analyzer. </p> </dd> <dt><code class="code">-fanalyzer-verbose-edges</code></dt> <dd> +<p>This option is intended for analyzer developers. It enables more verbose, lower-level detail in the descriptions of control flow within diagnostic paths. </p> </dd> <dt><code class="code">-fanalyzer-verbose-state-changes</code></dt> <dd> +<p>This option is intended for analyzer developers. It enables more verbose, lower-level detail in the descriptions of events relating to state machines within diagnostic paths. </p> </dd> <dt><code class="code">-fanalyzer-verbosity=<var class="var">level</var></code></dt> <dd> +<p>This option controls the complexity of the control flow paths that are emitted for analyzer diagnostics. </p> <p>The <var class="var">level</var> can be one of: </p> <dl class="table"> <dt>‘<samp class="samp">0</samp>’</dt> <dd> +<p>At this level, interprocedural call and return events are displayed, along with the most pertinent state-change events relating to a diagnostic. For example, for a double-<code class="code">free</code> diagnostic, both calls to <code class="code">free</code> will be shown. </p> </dd> <dt>‘<samp class="samp">1</samp>’</dt> <dd> +<p>As per the previous level, but also show events for the entry to each function. </p> </dd> <dt>‘<samp class="samp">2</samp>’</dt> <dd> +<p>As per the previous level, but also show events relating to control flow that are significant to triggering the issue (e.g. “true path taken” at a conditional). </p> <p>This level is the default. </p> </dd> <dt>‘<samp class="samp">3</samp>’</dt> <dd> +<p>As per the previous level, but show all control flow events, not just significant ones. </p> </dd> <dt>‘<samp class="samp">4</samp>’</dt> <dd> +<p>This level is intended for analyzer developers; it adds various other events intended for debugging the analyzer. </p> </dd> </dl> </dd> <dt> +<span><code class="code">-fdump-analyzer</code><a class="copiable-link" href="#index-fdump-analyzer"> ¶</a></span> +</dt> <dd> +<p>Dump internal details about what the analyzer is doing to <samp class="file"><var class="var">file</var>.analyzer.txt</samp>. <samp class="option">-fdump-analyzer-stderr</samp> overrides this option. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-stderr</code><a class="copiable-link" href="#index-fdump-analyzer-stderr"> ¶</a></span> +</dt> <dd> +<p>Dump internal details about what the analyzer is doing to stderr. This option overrides <samp class="option">-fdump-analyzer</samp>. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-callgraph</code><a class="copiable-link" href="#index-fdump-analyzer-callgraph"> ¶</a></span> +</dt> <dd> +<p>Dump a representation of the call graph suitable for viewing with GraphViz to <samp class="file"><var class="var">file</var>.callgraph.dot</samp>. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-exploded-graph</code><a class="copiable-link" href="#index-fdump-analyzer-exploded-graph"> ¶</a></span> +</dt> <dd> +<p>Dump a representation of the “exploded graph” suitable for viewing with GraphViz to <samp class="file"><var class="var">file</var>.eg.dot</samp>. Nodes are color-coded based on state-machine states to emphasize state changes. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-exploded-nodes</code><a class="copiable-link" href="#index-dump-analyzer-exploded-nodes"> ¶</a></span> +</dt> <dd> +<p>Emit diagnostics showing where nodes in the “exploded graph” are in relation to the program source. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-exploded-nodes-2</code><a class="copiable-link" href="#index-dump-analyzer-exploded-nodes-2"> ¶</a></span> +</dt> <dd> +<p>Dump a textual representation of the “exploded graph” to <samp class="file"><var class="var">file</var>.eg.txt</samp>. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-exploded-nodes-3</code><a class="copiable-link" href="#index-dump-analyzer-exploded-nodes-3"> ¶</a></span> +</dt> <dd> +<p>Dump a textual representation of the “exploded graph” to one dump file per node, to <samp class="file"><var class="var">file</var>.eg-<var class="var">id</var>.txt</samp>. This is typically a large number of dump files. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-exploded-paths</code><a class="copiable-link" href="#index-fdump-analyzer-exploded-paths"> ¶</a></span> +</dt> <dd> +<p>Dump a textual representation of the “exploded path” for each diagnostic to <samp class="file"><var class="var">file</var>.<var class="var">idx</var>.<var class="var">kind</var>.epath.txt</samp>. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-feasibility</code><a class="copiable-link" href="#index-dump-analyzer-feasibility"> ¶</a></span> +</dt> <dd> +<p>Dump internal details about the analyzer’s search for feasible paths. The details are written in a form suitable for viewing with GraphViz to filenames of the form <samp class="file"><var class="var">file</var>.*.fg.dot</samp>, <samp class="file"><var class="var">file</var>.*.tg.dot</samp>, and <samp class="file"><var class="var">file</var>.*.fpath.txt</samp>. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-json</code><a class="copiable-link" href="#index-fdump-analyzer-json"> ¶</a></span> +</dt> <dd> +<p>Dump a compressed JSON representation of analyzer internals to <samp class="file"><var class="var">file</var>.analyzer.json.gz</samp>. The precise format is subject to change. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-state-purge</code><a class="copiable-link" href="#index-fdump-analyzer-state-purge"> ¶</a></span> +</dt> <dd> +<p>As per <samp class="option">-fdump-analyzer-supergraph</samp>, dump a representation of the “supergraph” suitable for viewing with GraphViz, but annotate the graph with information on what state will be purged at each node. The graph is written to <samp class="file"><var class="var">file</var>.state-purge.dot</samp>. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-supergraph</code><a class="copiable-link" href="#index-fdump-analyzer-supergraph"> ¶</a></span> +</dt> <dd> +<p>Dump representations of the “supergraph” suitable for viewing with GraphViz to <samp class="file"><var class="var">file</var>.supergraph.dot</samp> and to <samp class="file"><var class="var">file</var>.supergraph-eg.dot</samp>. These show all of the control flow graphs in the program, with interprocedural edges for calls and returns. The second dump contains annotations showing nodes in the “exploded graph” and diagnostics associated with them. </p> </dd> <dt> +<span><code class="code">-fdump-analyzer-untracked</code><a class="copiable-link" href="#index-fdump-analyzer-untracked"> ¶</a></span> +</dt> <dd> +<p>Emit custom warnings with internal details intended for analyzer developers. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="debugging-options">Options for Debugging Your Program</a>, Previous: <a href="warning-options">Options to Request or Suppress Warnings</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Static-Analyzer-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Static-Analyzer-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/static-definitions.html b/devdocs/gcc~13/static-definitions.html new file mode 100644 index 00000000..e529ff8b --- /dev/null +++ b/devdocs/gcc~13/static-definitions.html @@ -0,0 +1,13 @@ +<div class="subsection-level-extent" id="Static-Definitions"> <div class="nav-panel"> <p> Next: <a href="name-lookup" accesskey="n" rel="next">Name Lookup, Templates, and Accessing Members of Base Classes</a>, Up: <a href="c_002b_002b-misunderstandings" accesskey="u" rel="up">Common Misunderstandings with GNU C++</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Declare-and-Define-Static-Members"><span>14.7.1 Declare <em class="emph">and</em> Define Static Members<a class="copiable-link" href="#Declare-and-Define-Static-Members"> ¶</a></span></h1> <p>When a class has static data members, it is not enough to <em class="emph">declare</em> the static member; you must also <em class="emph">define</em> it. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">class Foo +{ + … + void method(); + static int bar; +};</pre> +</div> <p>This declaration only establishes that the class <code class="code">Foo</code> has an <code class="code">int</code> named <code class="code">Foo::bar</code>, and a member function named <code class="code">Foo::method</code>. But you still need to define <em class="emph">both</em> <code class="code">method</code> and <code class="code">bar</code> elsewhere. According to the ISO standard, you must supply an initializer in one (and only one) source file, such as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int Foo::bar = 0;</pre> +</div> <p>Other C++ compilers may not correctly implement the standard behavior. As a result, when you switch to <code class="command">g++</code> from one of these compilers, you may discover that a program that appeared to work correctly in fact does not conform to the standard: <code class="command">g++</code> reports as undefined symbols any static data members that lack definitions. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Static-Definitions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Static-Definitions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/structure-layout-pragmas.html b/devdocs/gcc~13/structure-layout-pragmas.html new file mode 100644 index 00000000..6ae12cfd --- /dev/null +++ b/devdocs/gcc~13/structure-layout-pragmas.html @@ -0,0 +1,16 @@ +<div class="subsection-level-extent" id="Structure-Layout-Pragmas"> <div class="nav-panel"> <p> Next: <a href="weak-pragmas" accesskey="n" rel="next">Weak Pragmas</a>, Previous: <a href="symbol-renaming-pragmas" accesskey="p" rel="prev">Symbol-Renaming Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Structure-Layout-Pragmas-1"><span>6.62.10 Structure-Layout Pragmas<a class="copiable-link" href="#Structure-Layout-Pragmas-1"> ¶</a></span></h1> <p>For compatibility with Microsoft Windows compilers, GCC supports a set of <code class="code">#pragma</code> directives that change the maximum alignment of members of structures (other than zero-width bit-fields), unions, and classes subsequently defined. The <var class="var">n</var> value below always is required to be a small power of two and specifies the new alignment in bytes. </p> <ol class="enumerate"> <li> <code class="code">#pragma pack(<var class="var">n</var>)</code> simply sets the new alignment. </li> +<li> <code class="code">#pragma pack()</code> sets the alignment to the one that was in effect when compilation started (see also command-line option <samp class="option">-fpack-struct[=<var class="var">n</var>]</samp> see <a class="pxref" href="code-gen-options">Options for Code Generation Conventions</a>). </li> +<li> <code class="code">#pragma pack(push[,<var class="var">n</var>])</code> pushes the current alignment setting on an internal stack and then optionally sets the new alignment. </li> +<li> <code class="code">#pragma pack(pop)</code> restores the alignment setting to the one saved at the top of the internal stack (and removes that stack entry). Note that <code class="code">#pragma pack([<var class="var">n</var>])</code> does not influence this internal stack; thus it is possible to have <code class="code">#pragma pack(push)</code> followed by multiple <code class="code">#pragma pack(<var class="var">n</var>)</code> instances and finalized by a single <code class="code">#pragma pack(pop)</code>. </li> +</ol> <p>Some targets, e.g. x86 and PowerPC, support the <code class="code">#pragma ms_struct</code> directive which lays out structures and unions subsequently defined as the documented <code class="code">__attribute__ ((ms_struct))</code>. </p> <ol class="enumerate"> <li> <code class="code">#pragma ms_struct on</code> turns on the Microsoft layout. </li> +<li> <code class="code">#pragma ms_struct off</code> turns off the Microsoft layout. </li> +<li> <code class="code">#pragma ms_struct reset</code> goes back to the default layout. </li> +</ol> <p>Most targets also support the <code class="code">#pragma scalar_storage_order</code> directive which lays out structures and unions subsequently defined as the documented <code class="code">__attribute__ ((scalar_storage_order))</code>. </p> <ol class="enumerate"> <li> <code class="code">#pragma scalar_storage_order big-endian</code> sets the storage order of the scalar fields to big-endian. </li> +<li> <code class="code">#pragma scalar_storage_order little-endian</code> sets the storage order of the scalar fields to little-endian. </li> +<li> <code class="code">#pragma scalar_storage_order default</code> goes back to the endianness that was in effect when compilation started (see also command-line option <samp class="option">-fsso-struct=<var class="var">endianness</var></samp> see <a class="pxref" href="c-dialect-options">Options Controlling C Dialect</a>). </li> +</ol> </div> <div class="nav-panel"> <p> Next: <a href="weak-pragmas">Weak Pragmas</a>, Previous: <a href="symbol-renaming-pragmas">Symbol-Renaming Pragmas</a>, Up: <a href="pragmas">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Structure-Layout-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Structure-Layout-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/structures-unions-enumerations-and-bit-fields-implementation.html b/devdocs/gcc~13/structures-unions-enumerations-and-bit-fields-implementation.html new file mode 100644 index 00000000..e7301f6c --- /dev/null +++ b/devdocs/gcc~13/structures-unions-enumerations-and-bit-fields-implementation.html @@ -0,0 +1,14 @@ +<div class="section-level-extent" id="Structures-unions-enumerations-and-bit-fields-implementation"> <div class="nav-panel"> <p> Next: <a href="qualifiers-implementation" accesskey="n" rel="next">Qualifiers</a>, Previous: <a href="hints-implementation" accesskey="p" rel="prev">Hints</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Structures_002c-Unions_002c-Enumerations_002c-and-Bit-Fields"><span>4.9 Structures, Unions, Enumerations, and Bit-Fields<a class="copiable-link" href="#Structures_002c-Unions_002c-Enumerations_002c-and-Bit-Fields"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>A member of a union object is accessed using a member of a different type (C90 6.3.2.3). <p>The relevant bytes of the representation of the object are treated as an object of the type used for the access. See <a class="xref" href="optimize-options#Type-punning">Type-punning</a>. This may be a trap representation. </p> </li> +<li>Whether a “plain” <code class="code">int</code> bit-field is treated as a <code class="code">signed int</code> bit-field or as an <code class="code">unsigned int</code> bit-field (C90 6.5.2, C90 6.5.2.1, C99 and C11 6.7.2, C99 and C11 6.7.2.1). <p>By default it is treated as <code class="code">signed int</code> but this may be changed by the <samp class="option">-funsigned-bitfields</samp> option. </p> </li> +<li>Allowable bit-field types other than <code class="code">_Bool</code>, <code class="code">signed int</code>, and <code class="code">unsigned int</code> (C99 and C11 6.7.2.1). <p>Other integer types, such as <code class="code">long int</code>, and enumerated types are permitted even in strictly conforming mode. </p> </li> +<li>Whether atomic types are permitted for bit-fields (C11 6.7.2.1). <p>Atomic types are not permitted for bit-fields. </p> </li> +<li>Whether a bit-field can straddle a storage-unit boundary (C90 6.5.2.1, C99 and C11 6.7.2.1). <p>Determined by ABI. </p> </li> +<li>The order of allocation of bit-fields within a unit (C90 6.5.2.1, C99 and C11 6.7.2.1). <p>Determined by ABI. </p> </li> +<li>The alignment of non-bit-field members of structures (C90 6.5.2.1, C99 and C11 6.7.2.1). <p>Determined by ABI. </p> </li> +<li>The integer type compatible with each enumerated type (C90 6.5.2.2, C99 and C11 6.7.2.2). <p>Normally, the type is <code class="code">unsigned int</code> if there are no negative values in the enumeration, otherwise <code class="code">int</code>. If <samp class="option">-fshort-enums</samp> is specified, then if there are negative values it is the first of <code class="code">signed char</code>, <code class="code">short</code> and <code class="code">int</code> that can represent all the values, otherwise it is the first of <code class="code">unsigned char</code>, <code class="code">unsigned short</code> and <code class="code">unsigned int</code> that can represent all the values. </p> <p>On some targets, <samp class="option">-fshort-enums</samp> is the default; this is determined by the ABI. </p> </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="qualifiers-implementation">Qualifiers</a>, Previous: <a href="hints-implementation">Hints</a>, Up: <a href="c-implementation">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Structures-unions-enumerations-and-bit-fields-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Structures-unions-enumerations-and-bit-fields-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/submodel-options.html b/devdocs/gcc~13/submodel-options.html new file mode 100644 index 00000000..4cc71b14 --- /dev/null +++ b/devdocs/gcc~13/submodel-options.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Submodel-Options"> <div class="nav-panel"> <p> Next: <a href="spec-files" accesskey="n" rel="next">Specifying Subprocesses and the Switches to Pass to Them</a>, Previous: <a href="developer-options" accesskey="p" rel="prev">GCC Developer Options</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Machine-Dependent-Options"><span>3.19 Machine-Dependent Options<a class="copiable-link" href="#Machine-Dependent-Options"> ¶</a></span></h1> <p>Each target machine supported by GCC can have its own options—for example, to allow you to compile for a particular processor variant or ABI, or to control optimizations specific to that machine. By convention, the names of machine-specific options start with ‘<samp class="samp">-m</samp>’. </p> <p>Some configurations of the compiler also support additional target-specific options, usually for compatibility with other compilers on the same platform. </p> <ul class="mini-toc"> <li><a href="aarch64-options" accesskey="1">AArch64 Options</a></li> <li><a href="adapteva-epiphany-options" accesskey="2">Adapteva Epiphany Options</a></li> <li><a href="amd-gcn-options" accesskey="3">AMD GCN Options</a></li> <li><a href="arc-options" accesskey="4">ARC Options</a></li> <li><a href="arm-options" accesskey="5">ARM Options</a></li> <li><a href="avr-options" accesskey="6">AVR Options</a></li> <li><a href="blackfin-options" accesskey="7">Blackfin Options</a></li> <li><a href="c6x-options" accesskey="8">C6X Options</a></li> <li><a href="cris-options" accesskey="9">CRIS Options</a></li> <li><a href="c-sky-options">C-SKY Options</a></li> <li><a href="darwin-options">Darwin Options</a></li> <li><a href="dec-alpha-options">DEC Alpha Options</a></li> <li><a href="ebpf-options">eBPF Options</a></li> <li><a href="fr30-options">FR30 Options</a></li> <li><a href="ft32-options">FT32 Options</a></li> <li><a href="frv-options">FRV Options</a></li> <li><a href="gnu_002flinux-options">GNU/Linux Options</a></li> <li><a href="h8_002f300-options">H8/300 Options</a></li> <li><a href="hppa-options">HPPA Options</a></li> <li><a href="ia-64-options">IA-64 Options</a></li> <li><a href="lm32-options">LM32 Options</a></li> <li><a href="loongarch-options">LoongArch Options</a></li> <li><a href="m32c-options">M32C Options</a></li> <li><a href="m32r_002fd-options">M32R/D Options</a></li> <li><a href="m680x0-options">M680x0 Options</a></li> <li><a href="mcore-options">MCore Options</a></li> <li><a href="microblaze-options">MicroBlaze Options</a></li> <li><a href="mips-options">MIPS Options</a></li> <li><a href="mmix-options">MMIX Options</a></li> <li><a href="mn10300-options">MN10300 Options</a></li> <li><a href="moxie-options">Moxie Options</a></li> <li><a href="msp430-options">MSP430 Options</a></li> <li><a href="nds32-options">NDS32 Options</a></li> <li><a href="nios-ii-options">Nios II Options</a></li> <li><a href="nvidia-ptx-options">Nvidia PTX Options</a></li> <li><a href="openrisc-options">OpenRISC Options</a></li> <li><a href="pdp-11-options">PDP-11 Options</a></li> <li><a href="powerpc-options">PowerPC Options</a></li> <li><a href="pru-options">PRU Options</a></li> <li><a href="risc-v-options">RISC-V Options</a></li> <li><a href="rl78-options">RL78 Options</a></li> <li><a href="rs_002f6000-and-powerpc-options">IBM RS/6000 and PowerPC Options</a></li> <li><a href="rx-options">RX Options</a></li> <li><a href="s_002f390-and-zseries-options">S/390 and zSeries Options</a></li> <li><a href="sh-options">SH Options</a></li> <li><a href="solaris-2-options">Solaris 2 Options</a></li> <li><a href="sparc-options">SPARC Options</a></li> <li><a href="system-v-options">Options for System V</a></li> <li><a href="v850-options">V850 Options</a></li> <li><a href="vax-options">VAX Options</a></li> <li><a href="visium-options">Visium Options</a></li> <li><a href="vms-options">VMS Options</a></li> <li><a href="vxworks-options">VxWorks Options</a></li> <li><a href="x86-options">x86 Options</a></li> <li><a href="x86-windows-options">x86 Windows Options</a></li> <li><a href="xstormy16-options">Xstormy16 Options</a></li> <li><a href="xtensa-options">Xtensa Options</a></li> <li><a href="zseries-options">zSeries Options</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="spec-files">Specifying Subprocesses and the Switches to Pass to Them</a>, Previous: <a href="developer-options">GCC Developer Options</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Submodel-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Submodel-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/subscripting.html b/devdocs/gcc~13/subscripting.html new file mode 100644 index 00000000..a80e3b2e --- /dev/null +++ b/devdocs/gcc~13/subscripting.html @@ -0,0 +1,14 @@ +<div class="section-level-extent" id="Subscripting"> <div class="nav-panel"> <p> Next: <a href="pointer-arith" accesskey="n" rel="next">Arithmetic on <code class="code">void</code>- and Function-Pointers</a>, Previous: <a href="escaped-newlines" accesskey="p" rel="prev">Slightly Looser Rules for Escaped Newlines</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Non-Lvalue-Arrays-May-Have-Subscripts"><span>6.23 Non-Lvalue Arrays May Have Subscripts<a class="copiable-link" href="#Non-Lvalue-Arrays-May-Have-Subscripts"> ¶</a></span></h1> <p>In ISO C99, arrays that are not lvalues still decay to pointers, and may be subscripted, although they may not be modified or used after the next sequence point and the unary ‘<samp class="samp">&</samp>’ operator may not be applied to them. As an extension, GNU C allows such arrays to be subscripted in C90 mode, though otherwise they do not decay to pointers outside C99 mode. For example, this is valid in GNU C though not valid in C90: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">struct foo {int a[4];}; + +struct foo f(); + +bar (int index) +{ + return f().a[index]; +}</pre></div> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Subscripting.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Subscripting.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/symbian-os-function-attributes.html b/devdocs/gcc~13/symbian-os-function-attributes.html new file mode 100644 index 00000000..a907afa9 --- /dev/null +++ b/devdocs/gcc~13/symbian-os-function-attributes.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="Symbian-OS-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="v850-function-attributes" accesskey="n" rel="next">V850 Function Attributes</a>, Previous: <a href="sh-function-attributes" accesskey="p" rel="prev">SH Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Symbian-OS-Function-Attributes-1"><span>6.33.30 Symbian OS Function Attributes<a class="copiable-link" href="#Symbian-OS-Function-Attributes-1"> ¶</a></span></h1> <p>See <a class="xref" href="microsoft-windows-function-attributes">Microsoft Windows Function Attributes</a>, for discussion of the <code class="code">dllexport</code> and <code class="code">dllimport</code> attributes. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Symbian-OS-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Symbian-OS-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/symbol-renaming-pragmas.html b/devdocs/gcc~13/symbol-renaming-pragmas.html new file mode 100644 index 00000000..a66911e2 --- /dev/null +++ b/devdocs/gcc~13/symbol-renaming-pragmas.html @@ -0,0 +1,13 @@ +<div class="subsection-level-extent" id="Symbol-Renaming-Pragmas"> <div class="nav-panel"> <p> Next: <a href="structure-layout-pragmas" accesskey="n" rel="next">Structure-Layout Pragmas</a>, Previous: <a href="solaris-pragmas" accesskey="p" rel="prev">Solaris Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Symbol-Renaming-Pragmas-1"><span>6.62.9 Symbol-Renaming Pragmas<a class="copiable-link" href="#Symbol-Renaming-Pragmas-1"> ¶</a></span></h1> <p>GCC supports a <code class="code">#pragma</code> directive that changes the name used in assembly for a given declaration. While this pragma is supported on all platforms, it is intended primarily to provide compatibility with the Solaris system headers. This effect can also be achieved using the asm labels extension (see <a class="pxref" href="asm-labels">Controlling Names Used in Assembler Code</a>). </p> <dl class="table"> <dt> +<span><code class="code">redefine_extname <var class="var">oldname</var> <var class="var">newname</var></code><a class="copiable-link" href="#index-pragma_002c-redefine_005fextname"> ¶</a></span> +</dt> <dd> <p>This pragma gives the C function <var class="var">oldname</var> the assembly symbol <var class="var">newname</var>. The preprocessor macro <code class="code">__PRAGMA_REDEFINE_EXTNAME</code> is defined if this pragma is available (currently on all platforms). </p> +</dd> </dl> <p>This pragma and the <code class="code">asm</code> labels extension interact in a complicated manner. Here are some corner cases you may want to be aware of: </p> <ol class="enumerate"> <li> This pragma silently applies only to declarations with external linkage. The <code class="code">asm</code> label feature does not have this restriction. </li> +<li> In C++, this pragma silently applies only to declarations with “C” linkage. Again, <code class="code">asm</code> labels do not have this restriction. </li> +<li> If either of the ways of changing the assembly name of a declaration are applied to a declaration whose assembly name has already been determined (either by a previous use of one of these features, or because the compiler needed the assembly name in order to generate code), and the new name is different, a warning issues and the name does not change. </li> +<li> The <var class="var">oldname</var> used by <code class="code">#pragma redefine_extname</code> is always the C-language name. </li> +</ol> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Symbol-Renaming-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Symbol-Renaming-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/synchronization.html b/devdocs/gcc~13/synchronization.html new file mode 100644 index 00000000..750d7215 --- /dev/null +++ b/devdocs/gcc~13/synchronization.html @@ -0,0 +1,9 @@ +<div class="section-level-extent" id="Synchronization"> <div class="nav-panel"> <p> Next: <a href="fast-enumeration" accesskey="n" rel="next">Fast Enumeration</a>, Previous: <a href="exceptions" accesskey="p" rel="prev">Exceptions</a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Synchronization-1"><span>8.8 Synchronization<a class="copiable-link" href="#Synchronization-1"> ¶</a></span></h1> <p>GNU Objective-C provides support for synchronized blocks: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">@synchronized (ObjCClass *guard) { + … +}</pre> +</div> <p>Upon entering the <code class="code">@synchronized</code> block, a thread of execution shall first check whether a lock has been placed on the corresponding <code class="code">guard</code> object by another thread. If it has, the current thread shall wait until the other thread relinquishes its lock. Once <code class="code">guard</code> becomes available, the current thread will place its own lock on it, execute the code contained in the <code class="code">@synchronized</code> block, and finally relinquish the lock (thereby making <code class="code">guard</code> available to other threads). </p> <p>Unlike Java, Objective-C does not allow for entire methods to be marked <code class="code">@synchronized</code>. Note that throwing exceptions out of <code class="code">@synchronized</code> blocks is allowed, and will cause the guarding object to be unlocked properly. </p> <p>Because of the interactions between synchronization and exception handling, you can only use <code class="code">@synchronized</code> when compiling with exceptions enabled, that is with the command line option <samp class="option">-fobjc-exceptions</samp>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Synchronization.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Synchronization.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/system-v-options.html b/devdocs/gcc~13/system-v-options.html new file mode 100644 index 00000000..3c92f914 --- /dev/null +++ b/devdocs/gcc~13/system-v-options.html @@ -0,0 +1,20 @@ +<div class="subsection-level-extent" id="System-V-Options"> <div class="nav-panel"> <p> Next: <a href="v850-options" accesskey="n" rel="next">V850 Options</a>, Previous: <a href="sparc-options" accesskey="p" rel="prev">SPARC Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Options-for-System-V"><span>3.19.48 Options for System V<a class="copiable-link" href="#Options-for-System-V"> ¶</a></span></h1> <p>These additional options are available on System V Release 4 for compatibility with other compilers on those systems: </p> <dl class="table"> <dt> +<span><code class="code">-G</code><a class="copiable-link" href="#index-G-5"> ¶</a></span> +</dt> <dd> +<p>Create a shared object. It is recommended that <samp class="option">-symbolic</samp> or <samp class="option">-shared</samp> be used instead. </p> </dd> <dt> +<span><code class="code">-Qy</code><a class="copiable-link" href="#index-Qy"> ¶</a></span> +</dt> <dd> +<p>Identify the versions of each tool used by the compiler, in a <code class="code">.ident</code> assembler directive in the output. </p> </dd> <dt> +<span><code class="code">-Qn</code><a class="copiable-link" href="#index-Qn"> ¶</a></span> +</dt> <dd> +<p>Refrain from adding <code class="code">.ident</code> directives to the output file (this is the default). </p> </dd> <dt> +<span><code class="code">-YP,<var class="var">dirs</var></code><a class="copiable-link" href="#index-YP"> ¶</a></span> +</dt> <dd> +<p>Search the directories <var class="var">dirs</var>, and no others, for libraries specified with <samp class="option">-l</samp>. </p> </dd> <dt> +<span><code class="code">-Ym,<var class="var">dir</var></code><a class="copiable-link" href="#index-Ym"> ¶</a></span> +</dt> <dd><p>Look in the directory <var class="var">dir</var> to find the M4 preprocessor. The assembler uses this option. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/System-V-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/System-V-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/target-builtins.html b/devdocs/gcc~13/target-builtins.html new file mode 100644 index 00000000..ae9c3577 --- /dev/null +++ b/devdocs/gcc~13/target-builtins.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Target-Builtins"> <div class="nav-panel"> <p> Next: <a href="target-format-checks" accesskey="n" rel="next">Format Checks Specific to Particular Target Machines</a>, Previous: <a href="other-builtins" accesskey="p" rel="prev">Other Built-in Functions Provided by GCC</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Built-in-Functions-Specific-to-Particular-Target-Machines"><span>6.60 Built-in Functions Specific to Particular Target Machines<a class="copiable-link" href="#Built-in-Functions-Specific-to-Particular-Target-Machines"> ¶</a></span></h1> <p>On some target machines, GCC supports many built-in functions specific to those machines. Generally these generate calls to specific machine instructions, but allow the compiler to schedule those calls. </p> <ul class="mini-toc"> <li><a href="aarch64-built-in-functions" accesskey="1">AArch64 Built-in Functions</a></li> <li><a href="alpha-built-in-functions" accesskey="2">Alpha Built-in Functions</a></li> <li><a href="altera-nios-ii-built-in-functions" accesskey="3">Altera Nios II Built-in Functions</a></li> <li><a href="arc-built-in-functions" accesskey="4">ARC Built-in Functions</a></li> <li><a href="arc-simd-built-in-functions" accesskey="5">ARC SIMD Built-in Functions</a></li> <li><a href="arm-iwmmxt-built-in-functions" accesskey="6">ARM iWMMXt Built-in Functions</a></li> <li><a href="arm-c-language-extensions-_0028acle_0029" accesskey="7">ARM C Language Extensions (ACLE)</a></li> <li><a href="arm-floating-point-status-and-control-intrinsics" accesskey="8">ARM Floating Point Status and Control Intrinsics</a></li> <li><a href="arm-armv8-m-security-extensions" accesskey="9">ARM ARMv8-M Security Extensions</a></li> <li><a href="avr-built-in-functions">AVR Built-in Functions</a></li> <li><a href="blackfin-built-in-functions">Blackfin Built-in Functions</a></li> <li><a href="bpf-built-in-functions">BPF Built-in Functions</a></li> <li><a href="fr-v-built-in-functions">FR-V Built-in Functions</a></li> <li><a href="loongarch-base-built-in-functions">LoongArch Base Built-in Functions</a></li> <li><a href="mips-dsp-built-in-functions">MIPS DSP Built-in Functions</a></li> <li><a href="mips-paired-single-support">MIPS Paired-Single Support</a></li> <li><a href="mips-loongson-built-in-functions">MIPS Loongson Built-in Functions</a></li> <li><a href="mips-simd-architecture-_0028msa_0029-support">MIPS SIMD Architecture (MSA) Support</a></li> <li><a href="other-mips-built-in-functions">Other MIPS Built-in Functions</a></li> <li><a href="msp430-built-in-functions">MSP430 Built-in Functions</a></li> <li><a href="nds32-built-in-functions">NDS32 Built-in Functions</a></li> <li><a href="basic-powerpc-built-in-functions">Basic PowerPC Built-in Functions</a></li> <li><a href="powerpc-altivec_002fvsx-built-in-functions">PowerPC AltiVec/VSX Built-in Functions</a></li> <li><a href="powerpc-hardware-transactional-memory-built-in-functions">PowerPC Hardware Transactional Memory Built-in Functions</a></li> <li><a href="powerpc-atomic-memory-operation-functions">PowerPC Atomic Memory Operation Functions</a></li> <li><a href="powerpc-matrix-multiply-assist-built-in-functions">PowerPC Matrix-Multiply Assist Built-in Functions</a></li> <li><a href="pru-built-in-functions">PRU Built-in Functions</a></li> <li><a href="risc-v-built-in-functions">RISC-V Built-in Functions</a></li> <li><a href="risc-v-vector-intrinsics">RISC-V Vector Intrinsics</a></li> <li><a href="rx-built-in-functions">RX Built-in Functions</a></li> <li><a href="s_002f390-system-z-built-in-functions">S/390 System z Built-in Functions</a></li> <li><a href="sh-built-in-functions">SH Built-in Functions</a></li> <li><a href="sparc-vis-built-in-functions">SPARC VIS Built-in Functions</a></li> <li><a href="ti-c6x-built-in-functions">TI C6X Built-in Functions</a></li> <li><a href="x86-built-in-functions">x86 Built-in Functions</a></li> <li><a href="x86-transactional-memory-intrinsics">x86 Transactional Memory Intrinsics</a></li> <li><a href="x86-control-flow-protection-intrinsics">x86 Control-Flow Protection Intrinsics</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Target-Builtins.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Target-Builtins.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/target-format-checks.html b/devdocs/gcc~13/target-format-checks.html new file mode 100644 index 00000000..9386dc65 --- /dev/null +++ b/devdocs/gcc~13/target-format-checks.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Target-Format-Checks"> <div class="nav-panel"> <p> Next: <a href="pragmas" accesskey="n" rel="next">Pragmas Accepted by GCC</a>, Previous: <a href="target-builtins" accesskey="p" rel="prev">Built-in Functions Specific to Particular Target Machines</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Format-Checks-Specific-to-Particular-Target-Machines"><span>6.61 Format Checks Specific to Particular Target Machines<a class="copiable-link" href="#Format-Checks-Specific-to-Particular-Target-Machines"> ¶</a></span></h1> <p>For some target machines, GCC supports additional options to the format attribute (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> <ul class="mini-toc"> <li><a href="solaris-format-checks" accesskey="1">Solaris Format Checks</a></li> <li><a href="darwin-format-checks" accesskey="2">Darwin Format Checks</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Target-Format-Checks.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Target-Format-Checks.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/template-instantiation.html b/devdocs/gcc~13/template-instantiation.html new file mode 100644 index 00000000..c918864b --- /dev/null +++ b/devdocs/gcc~13/template-instantiation.html @@ -0,0 +1,18 @@ +<div class="section-level-extent" id="Template-Instantiation"> <div class="nav-panel"> <p> Next: <a href="bound-member-functions" accesskey="n" rel="next">Extracting the Function Pointer from a Bound Pointer to Member Function</a>, Previous: <a href="c_002b_002b-interface" accesskey="p" rel="prev">C++ Interface and Implementation Pragmas</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Where_0027s-the-Template_003f"><span>7.5 Where’s the Template?<a class="copiable-link" href="#Where_0027s-the-Template_003f"> ¶</a></span></h1> <p>C++ templates were the first language feature to require more intelligence from the environment than was traditionally found on a UNIX system. Somehow the compiler and linker have to make sure that each template instance occurs exactly once in the executable if it is needed, and not at all otherwise. There are two basic approaches to this problem, which are referred to as the Borland model and the Cfront model. </p> <dl class="table"> <dt>Borland model</dt> <dd> +<p>Borland C++ solved the template instantiation problem by adding the code equivalent of common blocks to their linker; the compiler emits template instances in each translation unit that uses them, and the linker collapses them together. The advantage of this model is that the linker only has to consider the object files themselves; there is no external complexity to worry about. The disadvantage is that compilation time is increased because the template code is being compiled repeatedly. Code written for this model tends to include definitions of all templates in the header file, since they must be seen to be instantiated. </p> </dd> <dt>Cfront model</dt> <dd><p>The AT&T C++ translator, Cfront, solved the template instantiation problem by creating the notion of a template repository, an automatically maintained place where template instances are stored. A more modern version of the repository works as follows: As individual object files are built, the compiler places any template definitions and instantiations encountered in the repository. At link time, the link wrapper adds in the objects in the repository and compiles any needed instances that were not previously emitted. The advantages of this model are more optimal compilation speed and the ability to use the system linker; to implement the Borland model a compiler vendor also needs to replace the linker. The disadvantages are vastly increased complexity, and thus potential for error; for some code this can be just as transparent, but in practice it can been very difficult to build multiple programs in one directory and one program in multiple directories. Code written for this model tends to separate definitions of non-inline member templates into a separate file, which should be compiled separately. </p></dd> </dl> <p>G++ implements the Borland model on targets where the linker supports it, including ELF targets (such as GNU/Linux), Mac OS X and Microsoft Windows. Otherwise G++ implements neither automatic model. </p> <p>You have the following options for dealing with template instantiations: </p> <ol class="enumerate"> <li> Do nothing. Code written for the Borland model works fine, but each translation unit contains instances of each of the templates it uses. The duplicate instances will be discarded by the linker, but in a large program, this can lead to an unacceptable amount of code duplication in object files or shared libraries. <p>Duplicate instances of a template can be avoided by defining an explicit instantiation in one object file, and preventing the compiler from doing implicit instantiations in any other object files by using an explicit instantiation declaration, using the <code class="code">extern template</code> syntax: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern template int max (int, int);</pre> +</div> <p>This syntax is defined in the C++ 2011 standard, but has been supported by G++ and other compilers since well before 2011. </p> <p>Explicit instantiations can be used for the largest or most frequently duplicated instances, without having to know exactly which other instances are used in the rest of the program. You can scatter the explicit instantiations throughout your program, perhaps putting them in the translation units where the instances are used or the translation units that define the templates themselves; you can put all of the explicit instantiations you need into one big file; or you can create small files like </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include "Foo.h" +#include "Foo.cc" + +template class Foo<int>; +template ostream& operator << + (ostream&, const Foo<int>&);</pre> +</div> <p>for each of the instances you need, and create a template instantiation library from those. </p> <p>This is the simplest option, but also offers flexibility and fine-grained control when necessary. It is also the most portable alternative and programs using this approach will work with most modern compilers. </p> </li> +<li> Compile your code with <samp class="option">-fno-implicit-templates</samp> to disable the implicit generation of template instances, and explicitly instantiate all the ones you use. This approach requires more knowledge of exactly which instances you need than do the others, but it’s less mysterious and allows greater control if you want to ensure that only the intended instances are used. <p>If you are using Cfront-model code, you can probably get away with not using <samp class="option">-fno-implicit-templates</samp> when compiling files that don’t ‘<samp class="samp">#include</samp>’ the member template definitions. </p> <p>If you use one big file to do the instantiations, you may want to compile it without <samp class="option">-fno-implicit-templates</samp> so you get all of the instances required by your explicit instantiations (but not by any other files) without having to specify them as well. </p> <p>In addition to forward declaration of explicit instantiations (with <code class="code">extern</code>), G++ has extended the template instantiation syntax to support instantiation of the compiler support data for a template class (i.e. the vtable) without instantiating any of its members (with <code class="code">inline</code>), and instantiation of only the static data members of a template class, without the support data or member functions (with <code class="code">static</code>): </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">inline template class Foo<int>; +static template class Foo<int>;</pre> +</div> </li> +</ol> </div> <div class="nav-panel"> <p> Next: <a href="bound-member-functions">Extracting the Function Pointer from a Bound Pointer to Member Function</a>, Previous: <a href="c_002b_002b-interface">C++ Interface and Implementation Pragmas</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Template-Instantiation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Template-Instantiation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/temporaries.html b/devdocs/gcc~13/temporaries.html new file mode 100644 index 00000000..f933a394 --- /dev/null +++ b/devdocs/gcc~13/temporaries.html @@ -0,0 +1,20 @@ +<div class="subsection-level-extent" id="Temporaries"> <div class="nav-panel"> <p> Next: <a href="copy-assignment" accesskey="n" rel="next">Implicit Copy-Assignment for Virtual Bases</a>, Previous: <a href="name-lookup" accesskey="p" rel="prev">Name Lookup, Templates, and Accessing Members of Base Classes</a>, Up: <a href="c_002b_002b-misunderstandings" accesskey="u" rel="up">Common Misunderstandings with GNU C++</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Temporaries-May-Vanish-Before-You-Expect"><span>14.7.3 Temporaries May Vanish Before You Expect<a class="copiable-link" href="#Temporaries-May-Vanish-Before-You-Expect"> ¶</a></span></h1> <p>It is dangerous to use pointers or references to <em class="emph">portions</em> of a temporary object. The compiler may very well delete the object before you expect it to, leaving a pointer to garbage. The most common place where this problem crops up is in classes like string classes, especially ones that define a conversion function to type <code class="code">char *</code> or <code class="code">const char *</code>—which is one reason why the standard <code class="code">string</code> class requires you to call the <code class="code">c_str</code> member function. However, any class that returns a pointer to some internal structure is potentially subject to this problem. </p> <p>For example, a program may use a function <code class="code">strfunc</code> that returns <code class="code">string</code> objects, and another function <code class="code">charfunc</code> that operates on pointers to <code class="code">char</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">string strfunc (); +void charfunc (const char *); + +void +f () +{ + const char *p = strfunc().c_str(); + … + charfunc (p); + … + charfunc (p); +}</pre> +</div> <p>In this situation, it may seem reasonable to save a pointer to the C string returned by the <code class="code">c_str</code> member function and use that rather than call <code class="code">c_str</code> repeatedly. However, the temporary string created by the call to <code class="code">strfunc</code> is destroyed after <code class="code">p</code> is initialized, at which point <code class="code">p</code> is left pointing to freed memory. </p> <p>Code like this may run successfully under some other compilers, particularly obsolete cfront-based compilers that delete temporaries along with normal local variables. However, the GNU C++ behavior is standard-conforming, so if your program depends on late destruction of temporaries it is not portable. </p> <p>The safe way to write such code is to give the temporary a name, which forces it to remain until the end of the scope of the name. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">const string& tmp = strfunc (); +charfunc (tmp.c_str ());</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="copy-assignment">Implicit Copy-Assignment for Virtual Bases</a>, Previous: <a href="name-lookup">Name Lookup, Templates, and Accessing Members of Base Classes</a>, Up: <a href="c_002b_002b-misunderstandings">Common Misunderstandings with GNU C++</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Temporaries.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Temporaries.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/thread-local.html b/devdocs/gcc~13/thread-local.html new file mode 100644 index 00000000..079bf8b0 --- /dev/null +++ b/devdocs/gcc~13/thread-local.html @@ -0,0 +1,9 @@ +<div class="section-level-extent" id="Thread-Local"> <div class="nav-panel"> <p> Next: <a href="binary-constants" accesskey="n" rel="next">Binary Constants using the ‘<samp class="samp">0b</samp>’ Prefix</a>, Previous: <a href="unnamed-fields" accesskey="p" rel="prev">Unnamed Structure and Union Fields</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Thread-Local-Storage"><span>6.64 Thread-Local Storage<a class="copiable-link" href="#Thread-Local-Storage"> ¶</a></span></h1> <p>Thread-local storage (<abbr class="acronym">TLS</abbr>) is a mechanism by which variables are allocated such that there is one instance of the variable per extant thread. The runtime model GCC uses to implement this originates in the IA-64 processor-specific ABI, but has since been migrated to other processors as well. It requires significant support from the linker (<code class="command">ld</code>), dynamic linker (<code class="command">ld.so</code>), and system libraries (<samp class="file">libc.so</samp> and <samp class="file">libpthread.so</samp>), so it is not available everywhere. </p> <p>At the user level, the extension is visible with a new storage class keyword: <code class="code">__thread</code>. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__thread int i; +extern __thread struct state s; +static __thread char *p;</pre> +</div> <p>The <code class="code">__thread</code> specifier may be used alone, with the <code class="code">extern</code> or <code class="code">static</code> specifiers, but with no other storage class specifier. When used with <code class="code">extern</code> or <code class="code">static</code>, <code class="code">__thread</code> must appear immediately after the other storage class specifier. </p> <p>The <code class="code">__thread</code> specifier may be applied to any global, file-scoped static, function-scoped static, or static data member of a class. It may not be applied to block-scoped automatic or non-static data member. </p> <p>When the address-of operator is applied to a thread-local variable, it is evaluated at run time and returns the address of the current thread’s instance of that variable. An address so obtained may be used by any thread. When a thread terminates, any pointers to thread-local variables in that thread become invalid. </p> <p>No static initialization may refer to the address of a thread-local variable. </p> <p>In C++, if an initializer is present for a thread-local variable, it must be a <var class="var">constant-expression</var>, as defined in 5.19.2 of the ANSI/ISO C++ standard. </p> <p>See <a class="uref" href="https://www.akkadia.org/drepper/tls.pdf">ELF Handling For Thread-Local Storage</a> for a detailed explanation of the four thread-local storage addressing models, and how the runtime is expected to function. </p> <ul class="mini-toc"> <li><a href="c99-thread-local-edits" accesskey="1">ISO/IEC 9899:1999 Edits for Thread-Local Storage</a></li> <li><a href="c_002b_002b98-thread-local-edits" accesskey="2">ISO/IEC 14882:1998 Edits for Thread-Local Storage</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="binary-constants">Binary Constants using the ‘<samp class="samp">0b</samp>’ Prefix</a>, Previous: <a href="unnamed-fields">Unnamed Structure and Union Fields</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Thread-Local.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Thread-Local.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/ti-c6x-built-in-functions.html b/devdocs/gcc~13/ti-c6x-built-in-functions.html new file mode 100644 index 00000000..acfb1d67 --- /dev/null +++ b/devdocs/gcc~13/ti-c6x-built-in-functions.html @@ -0,0 +1,32 @@ +<div class="subsection-level-extent" id="TI-C6X-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="x86-built-in-functions" accesskey="n" rel="next">x86 Built-in Functions</a>, Previous: <a href="sparc-vis-built-in-functions" accesskey="p" rel="prev">SPARC VIS Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="TI-C6X-Built-in-Functions-1"><span>6.60.34 TI C6X Built-in Functions<a class="copiable-link" href="#TI-C6X-Built-in-Functions-1"> ¶</a></span></h1> <p>GCC provides intrinsics to access certain instructions of the TI C6X processors. These intrinsics, listed below, are available after inclusion of the <code class="code">c6x_intrinsics.h</code> header file. They map directly to C6X instructions. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int _sadd (int, int); +int _ssub (int, int); +int _sadd2 (int, int); +int _ssub2 (int, int); +long long _mpy2 (int, int); +long long _smpy2 (int, int); +int _add4 (int, int); +int _sub4 (int, int); +int _saddu4 (int, int); + +int _smpy (int, int); +int _smpyh (int, int); +int _smpyhl (int, int); +int _smpylh (int, int); + +int _sshl (int, int); +int _subc (int, int); + +int _avg2 (int, int); +int _avgu4 (int, int); + +int _clrr (int, int); +int _extr (int, int); +int _extru (int, int); +int _abs (int); +int _abs2 (int);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/TI-C6X-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/TI-C6X-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/traditional-gnu-objective-c-runtime-api.html b/devdocs/gcc~13/traditional-gnu-objective-c-runtime-api.html new file mode 100644 index 00000000..ba504cca --- /dev/null +++ b/devdocs/gcc~13/traditional-gnu-objective-c-runtime-api.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="Traditional-GNU-Objective-C-runtime-API"> <div class="nav-panel"> <p> Previous: <a href="modern-gnu-objective-c-runtime-api" accesskey="p" rel="prev">Modern GNU Objective-C Runtime API</a>, Up: <a href="gnu-objective-c-runtime-api" accesskey="u" rel="up">GNU Objective-C Runtime API</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Traditional-GNU-Objective-C-Runtime-API"><span>8.1.2 Traditional GNU Objective-C Runtime API<a class="copiable-link" href="#Traditional-GNU-Objective-C-Runtime-API"> ¶</a></span></h1> <p>The GNU Objective-C runtime used to provide a different API, which we call the “traditional” GNU Objective-C runtime API. Functions belonging to this API are easy to recognize because they use a different naming convention, such as <code class="code">class_get_super_class()</code> (traditional API) instead of <code class="code">class_getSuperclass()</code> (modern API). Software using this API includes the file <samp class="file">objc/objc-api.h</samp> where it is declared. </p> <p>Starting with GCC 4.7.0, the traditional GNU runtime API is no longer available. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Traditional-GNU-Objective-C-runtime-API.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Traditional-GNU-Objective-C-runtime-API.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/translation-implementation.html b/devdocs/gcc~13/translation-implementation.html new file mode 100644 index 00000000..a88be4a5 --- /dev/null +++ b/devdocs/gcc~13/translation-implementation.html @@ -0,0 +1,8 @@ +<div class="section-level-extent" id="Translation-implementation"> <div class="nav-panel"> <p> Next: <a href="environment-implementation" accesskey="n" rel="next">Environment</a>, Up: <a href="c-implementation" accesskey="u" rel="up">C Implementation-Defined Behavior</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Translation"><span>4.1 Translation<a class="copiable-link" href="#Translation"> ¶</a></span></h1> <ul class="itemize mark-bullet"> <li>How a diagnostic is identified (C90 3.7, C99 and C11 3.10, C90, C99 and C11 5.1.1.3). <p>Diagnostics consist of all the output sent to stderr by GCC. </p> </li> +<li>Whether each nonempty sequence of white-space characters other than new-line is retained or replaced by one space character in translation phase 3 (C90, C99 and C11 5.1.1.2). <p>See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html#Implementation-defined-behavior">Implementation-defined behavior</a> in The C Preprocessor. </p> </li> +</ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Translation-implementation.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Translation-implementation.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/trouble.html b/devdocs/gcc~13/trouble.html new file mode 100644 index 00000000..932b8be9 --- /dev/null +++ b/devdocs/gcc~13/trouble.html @@ -0,0 +1,6 @@ +<div class="chapter-level-extent" id="Trouble"> <div class="nav-panel"> <p> Next: <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Bugs.html" accesskey="n" rel="next">Reporting Bugs</a>, Previous: <a href="lto-dump" accesskey="p" rel="prev"><code class="command">lto-dump</code>—Tool for dumping LTO object files.</a>, Up: <a href="index" accesskey="u" rel="up">Introduction</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="chapter" id="Known-Causes-of-Trouble-with-GCC"><span>14 Known Causes of Trouble with GCC<a class="copiable-link" href="#Known-Causes-of-Trouble-with-GCC"> ¶</a></span></h1> <p>This section describes known problems that affect users of GCC. Most of these are not GCC bugs per se—if they were, we would fix them. But the result for a user may be like the result of a bug. </p> <p>Some of these problems are due to bugs in other software, some are missing features that are too much work to add, and some are places where people’s opinions differ as to what is best. </p> <ul class="mini-toc"> <li><a href="actual-bugs" accesskey="1">Actual Bugs We Haven’t Fixed Yet</a></li> <li><a href="interoperation" accesskey="2">Interoperation</a></li> <li><a href="incompatibilities" accesskey="3">Incompatibilities of GCC</a></li> <li><a href="fixed-headers" accesskey="4">Fixed Header Files</a></li> <li><a href="standard-libraries" accesskey="5">Standard Libraries</a></li> <li><a href="disappointments" accesskey="6">Disappointments and Misunderstandings</a></li> <li><a href="c_002b_002b-misunderstandings" accesskey="7">Common Misunderstandings with GNU C++</a></li> <li><a href="non-bugs" accesskey="8">Certain Changes We Don’t Want to Make</a></li> <li><a href="warnings-and-errors" accesskey="9">Warning Messages and Error Messages</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Trouble.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Trouble.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/type-attributes.html b/devdocs/gcc~13/type-attributes.html new file mode 100644 index 00000000..dce2fefa --- /dev/null +++ b/devdocs/gcc~13/type-attributes.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Type-Attributes"> <div class="nav-panel"> <p> Next: <a href="label-attributes" accesskey="n" rel="next">Label Attributes</a>, Previous: <a href="variable-attributes" accesskey="p" rel="prev">Specifying Attributes of Variables</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Specifying-Attributes-of-Types"><span>6.35 Specifying Attributes of Types<a class="copiable-link" href="#Specifying-Attributes-of-Types"> ¶</a></span></h1> <p>The keyword <code class="code">__attribute__</code> allows you to specify various special properties of types. Some type attributes apply only to structure and union types, and in C++, also class types, while others can apply to any type defined via a <code class="code">typedef</code> declaration. Unless otherwise specified, the same restrictions and effects apply to attributes regardless of whether a type is a trivial structure or a C++ class with user-defined constructors, destructors, or a copy assignment. </p> <p>Other attributes are defined for functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>), labels (see <a class="pxref" href="label-attributes">Label Attributes</a>), enumerators (see <a class="pxref" href="enumerator-attributes">Enumerator Attributes</a>), statements (see <a class="pxref" href="statement-attributes">Statement Attributes</a>), and for variables (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> <p>The <code class="code">__attribute__</code> keyword is followed by an attribute specification enclosed in double parentheses. </p> <p>You may specify type attributes in an enum, struct or union type declaration or definition by placing them immediately after the <code class="code">struct</code>, <code class="code">union</code> or <code class="code">enum</code> keyword. You can also place them just past the closing curly brace of the definition, but this is less preferred because logically the type should be fully defined at the closing brace. </p> <p>You can also include type attributes in a <code class="code">typedef</code> declaration. See <a class="xref" href="attribute-syntax">Attribute Syntax</a>, for details of the exact syntax for using attributes. </p> <ul class="mini-toc"> <li><a href="common-type-attributes" accesskey="1">Common Type Attributes</a></li> <li><a href="arc-type-attributes" accesskey="2">ARC Type Attributes</a></li> <li><a href="arm-type-attributes" accesskey="3">ARM Type Attributes</a></li> <li><a href="bpf-type-attributes" accesskey="4">BPF Type Attributes</a></li> <li><a href="type-attributes" accesskey="5">PowerPC Type Attributes</a></li> <li><a href="type-attributes" accesskey="6">x86 Type Attributes</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="label-attributes">Label Attributes</a>, Previous: <a href="variable-attributes">Specifying Attributes of Variables</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Type-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Type-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/type-encoding.html b/devdocs/gcc~13/type-encoding.html new file mode 100644 index 00000000..cb585a1b --- /dev/null +++ b/devdocs/gcc~13/type-encoding.html @@ -0,0 +1,159 @@ +<div class="section-level-extent" id="Type-encoding"> <div class="nav-panel"> <p> Next: <a href="garbage-collection" accesskey="n" rel="next">Garbage Collection</a>, Previous: <a href="executing-code-before-main" accesskey="p" rel="prev"><code class="code">+load</code>: Executing Code before <code class="code">main</code></a>, Up: <a href="objective-c" accesskey="u" rel="up">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Type-Encoding"><span>8.3 Type Encoding<a class="copiable-link" href="#Type-Encoding"> ¶</a></span></h1> <p>This is an advanced section. Type encodings are used extensively by the compiler and by the runtime, but you generally do not need to know about them to use Objective-C. </p> <p>The Objective-C compiler generates type encodings for all the types. These type encodings are used at runtime to find out information about selectors and methods and about objects and classes. </p> <p>The types are encoded in the following way: </p> <table class="multitable"> <tbody> +<tr> +<td width="25%"><code class="code">_Bool</code></td> +<td width="75%"><code class="code">B</code></td> +</tr> <tr> +<td width="25%"><code class="code">char</code></td> +<td width="75%"><code class="code">c</code></td> +</tr> <tr> +<td width="25%"><code class="code">unsigned char</code></td> +<td width="75%"><code class="code">C</code></td> +</tr> <tr> +<td width="25%"><code class="code">short</code></td> +<td width="75%"><code class="code">s</code></td> +</tr> <tr> +<td width="25%"><code class="code">unsigned short</code></td> +<td width="75%"><code class="code">S</code></td> +</tr> <tr> +<td width="25%"><code class="code">int</code></td> +<td width="75%"><code class="code">i</code></td> +</tr> <tr> +<td width="25%"><code class="code">unsigned int</code></td> +<td width="75%"><code class="code">I</code></td> +</tr> <tr> +<td width="25%"><code class="code">long</code></td> +<td width="75%"><code class="code">l</code></td> +</tr> <tr> +<td width="25%"><code class="code">unsigned long</code></td> +<td width="75%"><code class="code">L</code></td> +</tr> <tr> +<td width="25%"><code class="code">long long</code></td> +<td width="75%"><code class="code">q</code></td> +</tr> <tr> +<td width="25%"><code class="code">unsigned long long</code></td> +<td width="75%"><code class="code">Q</code></td> +</tr> <tr> +<td width="25%"><code class="code">float</code></td> +<td width="75%"><code class="code">f</code></td> +</tr> <tr> +<td width="25%"><code class="code">double</code></td> +<td width="75%"><code class="code">d</code></td> +</tr> <tr> +<td width="25%"><code class="code">long double</code></td> +<td width="75%"><code class="code">D</code></td> +</tr> <tr> +<td width="25%"><code class="code">void</code></td> +<td width="75%"><code class="code">v</code></td> +</tr> <tr> +<td width="25%"><code class="code">id</code></td> +<td width="75%"><code class="code">@</code></td> +</tr> <tr> +<td width="25%"><code class="code">Class</code></td> +<td width="75%"><code class="code">#</code></td> +</tr> <tr> +<td width="25%"><code class="code">SEL</code></td> +<td width="75%"><code class="code">:</code></td> +</tr> <tr> +<td width="25%"><code class="code">char*</code></td> +<td width="75%"><code class="code">*</code></td> +</tr> <tr> +<td width="25%"><code class="code">enum</code></td> +<td width="75%">an <code class="code">enum</code> is encoded exactly as the integer type that the compiler uses for it, which depends on the enumeration values. Often the compiler users <code class="code">unsigned int</code>, which is then encoded as <code class="code">I</code>.</td> +</tr> <tr> +<td width="25%">unknown type</td> +<td width="75%"><code class="code">?</code></td> +</tr> <tr> +<td width="25%">Complex types</td> +<td width="75%"> +<code class="code">j</code> followed by the inner type. For example <code class="code">_Complex double</code> is encoded as "jd".</td> +</tr> <tr> +<td width="25%">bit-fields</td> +<td width="75%"> +<code class="code">b</code> followed by the starting position of the bit-field, the type of the bit-field and the size of the bit-field (the bit-fields encoding was changed from the NeXT’s compiler encoding, see below)</td> +</tr> </tbody> </table> <p>The encoding of bit-fields has changed to allow bit-fields to be properly handled by the runtime functions that compute sizes and alignments of types that contain bit-fields. The previous encoding contained only the size of the bit-field. Using only this information it is not possible to reliably compute the size occupied by the bit-field. This is very important in the presence of the Boehm’s garbage collector because the objects are allocated using the typed memory facility available in this collector. The typed memory allocation requires information about where the pointers are located inside the object. </p> <p>The position in the bit-field is the position, counting in bits, of the bit closest to the beginning of the structure. </p> <p>The non-atomic types are encoded as follows: </p> <table class="multitable"> <tbody> +<tr> +<td width="20%">pointers</td> +<td width="80%">‘<samp class="samp">^</samp>’ followed by the pointed type.</td> +</tr> <tr> +<td width="20%">arrays</td> +<td width="80%">‘<samp class="samp">[</samp>’ followed by the number of elements in the array followed by the type of the elements followed by ‘<samp class="samp">]</samp>’</td> +</tr> <tr> +<td width="20%">structures</td> +<td width="80%">‘<samp class="samp">{</samp>’ followed by the name of the structure (or ‘<samp class="samp">?</samp>’ if the structure is unnamed), the ‘<samp class="samp">=</samp>’ sign, the type of the members and by ‘<samp class="samp">}</samp>’</td> +</tr> <tr> +<td width="20%">unions</td> +<td width="80%">‘<samp class="samp">(</samp>’ followed by the name of the structure (or ‘<samp class="samp">?</samp>’ if the union is unnamed), the ‘<samp class="samp">=</samp>’ sign, the type of the members followed by ‘<samp class="samp">)</samp>’</td> +</tr> <tr> +<td width="20%">vectors</td> +<td width="80%">‘<samp class="samp">![</samp>’ followed by the vector_size (the number of bytes composing the vector) followed by a comma, followed by the alignment (in bytes) of the vector, followed by the type of the elements followed by ‘<samp class="samp">]</samp>’</td> +</tr> </tbody> </table> <p>Here are some types and their encodings, as they are generated by the compiler on an i386 machine: </p> <table class="multitable"> <thead><tr> +<th width="60%">Objective-C type</th> +<th width="40%">Compiler encoding</th> +</tr></thead> <tbody> +<tr> +<td width="60%"><div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int a[10];</pre> +</div></td> +<td width="40%"><code class="code">[10i]</code></td> +</tr> <tr> +<td width="60%"><div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct { + int i; + float f[3]; + int a:3; + int b:2; + char c; +}</pre> +</div></td> +<td width="40%"><code class="code">{?=i[3f]b128i3b131i2c}</code></td> +</tr> <tr> +<td width="60%"><div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int a __attribute__ ((vector_size (16)));</pre> +</div></td> +<td width="40%"> +<code class="code">![16,16i]</code> (alignment depends on the machine)</td> +</tr> </tbody> </table> <p>In addition to the types the compiler also encodes the type specifiers. The table below describes the encoding of the current Objective-C type specifiers: </p> <table class="multitable"> <thead><tr> +<th width="25%">Specifier</th> +<th width="75%">Encoding</th> +</tr></thead> <tbody> +<tr> +<td width="25%"><code class="code">const</code></td> +<td width="75%"><code class="code">r</code></td> +</tr> <tr> +<td width="25%"><code class="code">in</code></td> +<td width="75%"><code class="code">n</code></td> +</tr> <tr> +<td width="25%"><code class="code">inout</code></td> +<td width="75%"><code class="code">N</code></td> +</tr> <tr> +<td width="25%"><code class="code">out</code></td> +<td width="75%"><code class="code">o</code></td> +</tr> <tr> +<td width="25%"><code class="code">bycopy</code></td> +<td width="75%"><code class="code">O</code></td> +</tr> <tr> +<td width="25%"><code class="code">byref</code></td> +<td width="75%"><code class="code">R</code></td> +</tr> <tr> +<td width="25%"><code class="code">oneway</code></td> +<td width="75%"><code class="code">V</code></td> +</tr> </tbody> </table> <p>The type specifiers are encoded just before the type. Unlike types however, the type specifiers are only encoded when they appear in method argument types. </p> <p>Note how <code class="code">const</code> interacts with pointers: </p> <table class="multitable"> <thead><tr> +<th width="25%">Objective-C type</th> +<th width="75%">Compiler encoding</th> +</tr></thead> <tbody> +<tr> +<td width="25%"><div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">const int</pre> +</div></td> +<td width="75%"><code class="code">ri</code></td> +</tr> <tr> +<td width="25%"><div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">const int*</pre> +</div></td> +<td width="75%"><code class="code">^ri</code></td> +</tr> <tr> +<td width="25%"><div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int *const</pre> +</div></td> +<td width="75%"><code class="code">r^i</code></td> +</tr> </tbody> </table> <p><code class="code">const int*</code> is a pointer to a <code class="code">const int</code>, and so is encoded as <code class="code">^ri</code>. <code class="code">int* const</code>, instead, is a <code class="code">const</code> pointer to an <code class="code">int</code>, and so is encoded as <code class="code">r^i</code>. </p> <p>Finally, there is a complication when encoding <code class="code">const char *</code> versus <code class="code">char * const</code>. Because <code class="code">char *</code> is encoded as <code class="code">*</code> and not as <code class="code">^c</code>, there is no way to express the fact that <code class="code">r</code> applies to the pointer or to the pointee. </p> <p>Hence, it is assumed as a convention that <code class="code">r*</code> means <code class="code">const +char *</code> (since it is what is most often meant), and there is no way to encode <code class="code">char *const</code>. <code class="code">char *const</code> would simply be encoded as <code class="code">*</code>, and the <code class="code">const</code> is lost. </p> <ul class="mini-toc"> <li><a href="legacy-type-encoding" accesskey="1">Legacy Type Encoding</a></li> <li><a href="_0040encode" accesskey="2"><code class="code">@encode</code></a></li> <li><a href="method-signatures" accesskey="3">Method Signatures</a></li> </ul> </div> <div class="nav-panel"> <p> Next: <a href="garbage-collection">Garbage Collection</a>, Previous: <a href="executing-code-before-main"><code class="code">+load</code>: Executing Code before <code class="code">main</code></a>, Up: <a href="objective-c">GNU Objective-C Features</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Type-encoding.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Type-encoding.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/type-traits.html b/devdocs/gcc~13/type-traits.html new file mode 100644 index 00000000..d253e803 --- /dev/null +++ b/devdocs/gcc~13/type-traits.html @@ -0,0 +1,75 @@ +<div class="section-level-extent" id="Type-Traits"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-concepts" accesskey="n" rel="next">C++ Concepts</a>, Previous: <a href="function-multiversioning" accesskey="p" rel="prev">Function Multiversioning</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Type-Traits-1"><span>7.9 Type Traits<a class="copiable-link" href="#Type-Traits-1"> ¶</a></span></h1> <p>The C++ front end implements syntactic extensions that allow compile-time determination of various characteristics of a type (or of a pair of types). </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fhas_005fnothrow_005fassign"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__has_nothrow_assign</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fhas_005fnothrow_005fassign"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is <code class="code">const</code>-qualified or is a reference type then the trait is <code class="code">false</code>. Otherwise if <code class="code">__has_trivial_assign (type)</code> is <code class="code">true</code> then the trait is <code class="code">true</code>, else if <var class="var">type</var> is a cv-qualified class or union type with copy assignment operators that are known not to throw an exception then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, (possibly cv-qualified) <code class="code">void</code>, or an array of unknown bound. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fhas_005fnothrow_005fcopy"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__has_nothrow_copy</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fhas_005fnothrow_005fcopy"> ¶</a></span> +</dt> <dd><p>If <code class="code">__has_trivial_copy (type)</code> is <code class="code">true</code> then the trait is <code class="code">true</code>, else if <var class="var">type</var> is a cv-qualified class or union type with copy constructors that are known not to throw an exception then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, (possibly cv-qualified) <code class="code">void</code>, or an array of unknown bound. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fhas_005fnothrow_005fconstructor"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__has_nothrow_constructor</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fhas_005fnothrow_005fconstructor"> ¶</a></span> +</dt> <dd><p>If <code class="code">__has_trivial_constructor (type)</code> is <code class="code">true</code> then the trait is <code class="code">true</code>, else if <var class="var">type</var> is a cv class or union type (or array thereof) with a default constructor that is known not to throw an exception then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, (possibly cv-qualified) <code class="code">void</code>, or an array of unknown bound. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fhas_005ftrivial_005fassign"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__has_trivial_assign</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fhas_005ftrivial_005fassign"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is <code class="code">const</code>- qualified or is a reference type then the trait is <code class="code">false</code>. Otherwise if <code class="code">__is_trivial (type)</code> is <code class="code">true</code> then the trait is <code class="code">true</code>, else if <var class="var">type</var> is a cv-qualified class or union type with a trivial copy assignment ([class.copy]) then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, (possibly cv-qualified) <code class="code">void</code>, or an array of unknown bound. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fhas_005ftrivial_005fcopy"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__has_trivial_copy</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fhas_005ftrivial_005fcopy"> ¶</a></span> +</dt> <dd><p>If <code class="code">__is_trivial (type)</code> is <code class="code">true</code> or <var class="var">type</var> is a reference type then the trait is <code class="code">true</code>, else if <var class="var">type</var> is a cv class or union type with a trivial copy constructor ([class.copy]) then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, (possibly cv-qualified) <code class="code">void</code>, or an array of unknown bound. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fhas_005ftrivial_005fconstructor"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__has_trivial_constructor</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fhas_005ftrivial_005fconstructor"> ¶</a></span> +</dt> <dd><p>If <code class="code">__is_trivial (type)</code> is <code class="code">true</code> then the trait is <code class="code">true</code>, else if <var class="var">type</var> is a cv-qualified class or union type (or array thereof) with a trivial default constructor ([class.ctor]) then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, (possibly cv-qualified) <code class="code">void</code>, or an array of unknown bound. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fhas_005ftrivial_005fdestructor"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__has_trivial_destructor</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fhas_005ftrivial_005fdestructor"> ¶</a></span> +</dt> <dd><p>If <code class="code">__is_trivial (type)</code> is <code class="code">true</code> or <var class="var">type</var> is a reference type then the trait is <code class="code">true</code>, else if <var class="var">type</var> is a cv class or union type (or array thereof) with a trivial destructor ([class.dtor]) then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, (possibly cv-qualified) <code class="code">void</code>, or an array of unknown bound. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fhas_005fvirtual_005fdestructor"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__has_virtual_destructor</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fhas_005fvirtual_005fdestructor"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a class type with a virtual destructor ([class.dtor]) then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: If <var class="var">type</var> is a non-union class type, it shall be a complete type. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fabstract"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_abstract</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fabstract"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is an abstract class ([class.abstract]) then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: If <var class="var">type</var> is a non-union class type, it shall be a complete type. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005faggregate"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_aggregate</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005faggregate"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is an aggregate type ([dcl.init.aggr]) the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: If <var class="var">type</var> is a class type, it shall be a complete type. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fbase_005fof"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_base_of</strong> <code class="def-code-arguments">(<var class="var">base_type</var>, <var class="var">derived_type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fbase_005fof"> ¶</a></span> +</dt> <dd><p>If <var class="var">base_type</var> is a base class of <var class="var">derived_type</var> ([class.derived]) then the trait is <code class="code">true</code>, otherwise it is <code class="code">false</code>. Top-level cv-qualifications of <var class="var">base_type</var> and <var class="var">derived_type</var> are ignored. For the purposes of this trait, a class type is considered is own base. Requires: if <code class="code">__is_class (base_type)</code> and <code class="code">__is_class (derived_type)</code> are <code class="code">true</code> and <var class="var">base_type</var> and <var class="var">derived_type</var> are not the same type (disregarding cv-qualifiers), <var class="var">derived_type</var> shall be a complete type. A diagnostic is produced if this requirement is not met. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fclass"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_class</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fclass"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a cv-qualified class type, and not a union type ([basic.compound]) the trait is <code class="code">true</code>, else it is <code class="code">false</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fempty"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_empty</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fempty"> ¶</a></span> +</dt> <dd><p>If <code class="code">__is_class (type)</code> is <code class="code">false</code> then the trait is <code class="code">false</code>. Otherwise <var class="var">type</var> is considered empty if and only if: <var class="var">type</var> has no non-static data members, or all non-static data members, if any, are bit-fields of length 0, and <var class="var">type</var> has no virtual members, and <var class="var">type</var> has no virtual base classes, and <var class="var">type</var> has no base classes <var class="var">base_type</var> for which <code class="code">__is_empty (base_type)</code> is <code class="code">false</code>. Requires: If <var class="var">type</var> is a non-union class type, it shall be a complete type. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fenum"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_enum</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fenum"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a cv enumeration type ([basic.compound]) the trait is <code class="code">true</code>, else it is <code class="code">false</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005ffinal"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_final</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005ffinal"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a class or union type marked <code class="code">final</code>, then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: If <var class="var">type</var> is a class type, it shall be a complete type. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fliteral_005ftype"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_literal_type</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fliteral_005ftype"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a literal type ([basic.types]) the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, (possibly cv-qualified) <code class="code">void</code>, or an array of unknown bound. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fpod"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_pod</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fpod"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a cv POD type ([basic.types]) then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, (possibly cv-qualified) <code class="code">void</code>, or an array of unknown bound. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fpolymorphic"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_polymorphic</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fpolymorphic"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a polymorphic class ([class.virtual]) then the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: If <var class="var">type</var> is a non-union class type, it shall be a complete type. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fstandard_005flayout"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_standard_layout</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fstandard_005flayout"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a standard-layout type ([basic.types]) the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, an array of complete types, or (possibly cv-qualified) <code class="code">void</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005ftrivial"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_trivial</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005ftrivial"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a trivial type ([basic.types]) the trait is <code class="code">true</code>, else it is <code class="code">false</code>. Requires: <var class="var">type</var> shall be a complete type, an array of complete types, or (possibly cv-qualified) <code class="code">void</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005funion"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_union</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005funion"> ¶</a></span> +</dt> <dd><p>If <var class="var">type</var> is a cv union type ([basic.compound]) the trait is <code class="code">true</code>, else it is <code class="code">false</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005funderlying_005ftype"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__underlying_type</strong> <code class="def-code-arguments">(<var class="var">type</var>)</code><a class="copiable-link" href="#index-_005f_005funderlying_005ftype"> ¶</a></span> +</dt> <dd><p>The underlying type of <var class="var">type</var>. Requires: <var class="var">type</var> shall be an enumeration type ([dcl.enum]). </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005finteger_005fpack"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__integer_pack</strong> <code class="def-code-arguments">(<var class="var">length</var>)</code><a class="copiable-link" href="#index-_005f_005finteger_005fpack"> ¶</a></span> +</dt> <dd><p>When used as the pattern of a pack expansion within a template definition, expands to a template argument pack containing integers from <code class="code">0</code> to <code class="code"><var class="var">length</var>-1</code>. This is provided for efficient implementation of <code class="code">std::make_integer_sequence</code>. </p></dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-concepts">C++ Concepts</a>, Previous: <a href="function-multiversioning">Function Multiversioning</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Type-Traits.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Type-Traits.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/typeof.html b/devdocs/gcc~13/typeof.html new file mode 100644 index 00000000..c487e7a1 --- /dev/null +++ b/devdocs/gcc~13/typeof.html @@ -0,0 +1,29 @@ +<div class="section-level-extent" id="Typeof"> <div class="nav-panel"> <p> Next: <a href="conditionals" accesskey="n" rel="next">Conditionals with Omitted Operands</a>, Previous: <a href="constructing-calls" accesskey="p" rel="prev">Constructing Function Calls</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Referring-to-a-Type-with-typeof"><span>6.7 Referring to a Type with typeof<a class="copiable-link" href="#Referring-to-a-Type-with-typeof"> ¶</a></span></h1> <p>Another way to refer to the type of an expression is with <code class="code">typeof</code>. The syntax of using of this keyword looks like <code class="code">sizeof</code>, but the construct acts semantically like a type name defined with <code class="code">typedef</code>. </p> <p>There are two ways of writing the argument to <code class="code">typeof</code>: with an expression or with a type. Here is an example with an expression: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typeof (x[0](1))</pre> +</div> <p>This assumes that <code class="code">x</code> is an array of pointers to functions; the type described is that of the values of the functions. </p> <p>Here is an example with a typename as the argument: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typeof (int *)</pre> +</div> <p>Here the type described is that of pointers to <code class="code">int</code>. </p> <p>If you are writing a header file that must work when included in ISO C programs, write <code class="code">__typeof__</code> instead of <code class="code">typeof</code>. See <a class="xref" href="alternate-keywords">Alternate Keywords</a>. </p> <p>A <code class="code">typeof</code> construct can be used anywhere a typedef name can be used. For example, you can use it in a declaration, in a cast, or inside of <code class="code">sizeof</code> or <code class="code">typeof</code>. </p> <p>The operand of <code class="code">typeof</code> is evaluated for its side effects if and only if it is an expression of variably modified type or the name of such a type. </p> <p><code class="code">typeof</code> is often useful in conjunction with statement expressions (see <a class="pxref" href="statement-exprs">Statements and Declarations in Expressions</a>). Here is how the two together can be used to define a safe “maximum” macro which operates on any arithmetic type and evaluates each of its arguments exactly once: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define max(a,b) \ + ({ typeof (a) _a = (a); \ + typeof (b) _b = (b); \ + _a > _b ? _a : _b; })</pre> +</div> <p>The reason for using names that start with underscores for the local variables is to avoid conflicts with variable names that occur within the expressions that are substituted for <code class="code">a</code> and <code class="code">b</code>. Eventually we hope to design a new form of declaration syntax that allows you to declare variables whose scopes start only after their initializers; this will be a more reliable way to prevent such conflicts. </p> <p>Some more examples of the use of <code class="code">typeof</code>: </p> <ul class="itemize mark-bullet"> <li>This declares <code class="code">y</code> with the type of what <code class="code">x</code> points to. <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typeof (*x) y;</pre> +</div> </li> +<li>This declares <code class="code">y</code> as an array of such values. <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typeof (*x) y[4];</pre> +</div> </li> +<li>This declares <code class="code">y</code> as an array of pointers to characters: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typeof (typeof (char *)[4]) y;</pre> +</div> <p>It is equivalent to the following traditional C declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">char *y[4];</pre> +</div> <p>To see the meaning of the declaration using <code class="code">typeof</code>, and why it might be a useful way to write, rewrite it with these macros: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define pointer(T) typeof(T *) +#define array(T, N) typeof(T [N])</pre> +</div> <p>Now the declaration can be rewritten this way: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">array (pointer (char), 4) y;</pre> +</div> <p>Thus, <code class="code">array (pointer (char), 4)</code> is the type of arrays of 4 pointers to <code class="code">char</code>. </p> +</li> +</ul> <p>In GNU C, but not GNU C++, you may also declare the type of a variable as <code class="code">__auto_type</code>. In that case, the declaration must declare only one variable, whose declarator must just be an identifier, the declaration must be initialized, and the type of the variable is determined by the initializer; the name of the variable is not in scope until after the initializer. (In C++, you should use C++11 <code class="code">auto</code> for this purpose.) Using <code class="code">__auto_type</code>, the “maximum” macro above could be written as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define max(a,b) \ + ({ __auto_type _a = (a); \ + __auto_type _b = (b); \ + _a > _b ? _a : _b; })</pre> +</div> <p>Using <code class="code">__auto_type</code> instead of <code class="code">typeof</code> has two advantages: </p> <ul class="itemize mark-bullet"> <li>Each argument to the macro appears only once in the expansion of the macro. This prevents the size of the macro expansion growing exponentially when calls to such macros are nested inside arguments of such macros. </li> +<li>If the argument to the macro has variably modified type, it is evaluated only once when using <code class="code">__auto_type</code>, but twice if <code class="code">typeof</code> is used. </li> +</ul> </div> <div class="nav-panel"> <p> Next: <a href="conditionals">Conditionals with Omitted Operands</a>, Previous: <a href="constructing-calls">Constructing Function Calls</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Typeof.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Typeof.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/unnamed-fields.html b/devdocs/gcc~13/unnamed-fields.html new file mode 100644 index 00000000..807cee8b --- /dev/null +++ b/devdocs/gcc~13/unnamed-fields.html @@ -0,0 +1,27 @@ +<div class="section-level-extent" id="Unnamed-Fields"> <div class="nav-panel"> <p> Next: <a href="thread-local" accesskey="n" rel="next">Thread-Local Storage</a>, Previous: <a href="pragmas" accesskey="p" rel="prev">Pragmas Accepted by GCC</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Unnamed-Structure-and-Union-Fields"><span>6.63 Unnamed Structure and Union Fields<a class="copiable-link" href="#Unnamed-Structure-and-Union-Fields"> ¶</a></span></h1> <p>As permitted by ISO C11 and for compatibility with other compilers, GCC allows you to define a structure or union that contains, as fields, structures and unions without names. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct { + int a; + union { + int b; + float c; + }; + int d; +} foo;</pre> +</div> <p>In this example, you are able to access members of the unnamed union with code like ‘<samp class="samp">foo.b</samp>’. Note that only unnamed structs and unions are allowed, you may not have, for example, an unnamed <code class="code">int</code>. </p> <p>You must never create such structures that cause ambiguous field definitions. For example, in this structure: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct { + int a; + struct { + int a; + }; +} foo;</pre> +</div> <p>it is ambiguous which <code class="code">a</code> is being referred to with ‘<samp class="samp">foo.a</samp>’. The compiler gives errors for such constructs. </p> <p>Unless <samp class="option">-fms-extensions</samp> is used, the unnamed field must be a structure or union definition without a tag (for example, ‘<samp class="samp">struct { int a; };</samp>’). If <samp class="option">-fms-extensions</samp> is used, the field may also be a definition with a tag such as ‘<samp class="samp">struct foo { int a; };</samp>’, a reference to a previously defined structure or union such as ‘<samp class="samp">struct foo;</samp>’, or a reference to a <code class="code">typedef</code> name for a previously defined structure or union type. </p> <p>The option <samp class="option">-fplan9-extensions</samp> enables <samp class="option">-fms-extensions</samp> as well as two other extensions. First, a pointer to a structure is automatically converted to a pointer to an anonymous field for assignments and function calls. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct s1 { int a; }; +struct s2 { struct s1; }; +extern void f1 (struct s1 *); +void f2 (struct s2 *p) { f1 (p); }</pre> +</div> <p>In the call to <code class="code">f1</code> inside <code class="code">f2</code>, the pointer <code class="code">p</code> is converted into a pointer to the anonymous field. </p> <p>Second, when the type of an anonymous field is a <code class="code">typedef</code> for a <code class="code">struct</code> or <code class="code">union</code>, code may refer to the field using the name of the <code class="code">typedef</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef struct { int a; } s1; +struct s2 { s1; }; +s1 f1 (struct s2 *p) { return p->s1; }</pre> +</div> <p>These usages are only permitted when they are not ambiguous. </p> </div> <div class="nav-panel"> <p> Next: <a href="thread-local">Thread-Local Storage</a>, Previous: <a href="pragmas">Pragmas Accepted by GCC</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Unnamed-Fields.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Unnamed-Fields.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/using-assembly-language-with-c.html b/devdocs/gcc~13/using-assembly-language-with-c.html new file mode 100644 index 00000000..6152e72b --- /dev/null +++ b/devdocs/gcc~13/using-assembly-language-with-c.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Using-Assembly-Language-with-C"> <div class="nav-panel"> <p> Next: <a href="alternate-keywords" accesskey="n" rel="next">Alternate Keywords</a>, Previous: <a href="volatiles" accesskey="p" rel="prev">When is a Volatile Object Accessed?</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="How-to-Use-Inline-Assembly-Language-in-C-Code"><span>6.47 How to Use Inline Assembly Language in C Code<a class="copiable-link" href="#How-to-Use-Inline-Assembly-Language-in-C-Code"> ¶</a></span></h1> <p>The <code class="code">asm</code> keyword allows you to embed assembler instructions within C code. GCC provides two forms of inline <code class="code">asm</code> statements. A <em class="dfn">basic <code class="code">asm</code></em> statement is one with no operands (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>), while an <em class="dfn">extended <code class="code">asm</code></em> statement (see <a class="pxref" href="extended-asm">Extended Asm - Assembler Instructions with C Expression Operands</a>) includes one or more operands. The extended form is preferred for mixing C and assembly language within a function, but to include assembly language at top level you must use basic <code class="code">asm</code>. </p> <p>You can also use the <code class="code">asm</code> keyword to override the assembler name for a C symbol, or to place a C variable in a specific register. </p> <ul class="mini-toc"> <li><a href="basic-asm" accesskey="1">Basic Asm — Assembler Instructions Without Operands</a></li> <li><a href="extended-asm" accesskey="2">Extended Asm - Assembler Instructions with C Expression Operands</a></li> <li><a href="constraints" accesskey="3">Constraints for <code class="code">asm</code> Operands</a></li> <li><a href="asm-labels" accesskey="4">Controlling Names Used in Assembler Code</a></li> <li><a href="explicit-register-variables" accesskey="5">Variables in Specified Registers</a></li> <li><a href="size-of-an-asm" accesskey="6">Size of an <code class="code">asm</code></a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Using-Assembly-Language-with-C.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Using-Assembly-Language-with-C.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/using-fast-enumeration.html b/devdocs/gcc~13/using-fast-enumeration.html new file mode 100644 index 00000000..f212bd86 --- /dev/null +++ b/devdocs/gcc~13/using-fast-enumeration.html @@ -0,0 +1,18 @@ +<div class="subsection-level-extent" id="Using-fast-enumeration"> <div class="nav-panel"> <p> Next: <a href="c99-like-fast-enumeration-syntax" accesskey="n" rel="next">C99-Like Fast Enumeration Syntax</a>, Up: <a href="fast-enumeration" accesskey="u" rel="up">Fast Enumeration</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Using-Fast-Enumeration"><span>8.9.1 Using Fast Enumeration<a class="copiable-link" href="#Using-Fast-Enumeration"> ¶</a></span></h1> <p>GNU Objective-C provides support for the fast enumeration syntax: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">id array = …; +id object; + +for (object in array) +{ + /* Do something with 'object' */ +}</pre> +</div> <p><code class="code">array</code> needs to be an Objective-C object (usually a collection object, for example an array, a dictionary or a set) which implements the “Fast Enumeration Protocol” (see below). If you are using a Foundation library such as GNUstep Base or Apple Cocoa Foundation, all collection objects in the library implement this protocol and can be used in this way. </p> <p>The code above would iterate over all objects in <code class="code">array</code>. For each of them, it assigns it to <code class="code">object</code>, then executes the <code class="code">Do something with 'object'</code> statements. </p> <p>Here is a fully worked-out example using a Foundation library (which provides the implementation of <code class="code">NSArray</code>, <code class="code">NSString</code> and <code class="code">NSLog</code>): </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">NSArray *array = [NSArray arrayWithObjects: @"1", @"2", @"3", nil]; +NSString *object; + +for (object in array) + NSLog (@"Iterating over %@", object);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Using-fast-enumeration.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Using-fast-enumeration.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/v850-function-attributes.html b/devdocs/gcc~13/v850-function-attributes.html new file mode 100644 index 00000000..662fe0ac --- /dev/null +++ b/devdocs/gcc~13/v850-function-attributes.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="V850-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="visium-function-attributes" accesskey="n" rel="next">Visium Function Attributes</a>, Previous: <a href="symbian-os-function-attributes" accesskey="p" rel="prev">Symbian OS Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="V850-Function-Attributes-1"><span>6.33.31 V850 Function Attributes<a class="copiable-link" href="#V850-Function-Attributes-1"> ¶</a></span></h1> <p>The V850 back end supports these function attributes: </p> <dl class="table"> <dt> + <span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-V850"> ¶</a></span> +</dt> <dt><code class="code">interrupt_handler</code></dt> <dd><p>Use these attributes to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when either attribute is present. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/V850-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/V850-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/v850-options.html b/devdocs/gcc~13/v850-options.html new file mode 100644 index 00000000..669e9df4 --- /dev/null +++ b/devdocs/gcc~13/v850-options.html @@ -0,0 +1,94 @@ +<div class="subsection-level-extent" id="V850-Options"> <div class="nav-panel"> <p> Next: <a href="vax-options" accesskey="n" rel="next">VAX Options</a>, Previous: <a href="system-v-options" accesskey="p" rel="prev">Options for System V</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="V850-Options-1"><span>3.19.49 V850 Options<a class="copiable-link" href="#V850-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for V850 implementations: </p> <dl class="table"> <dt> + <span><code class="code">-mlong-calls</code><a class="copiable-link" href="#index-mlong-calls-7"> ¶</a></span> +</dt> <dt><code class="code">-mno-long-calls</code></dt> <dd> +<p>Treat all calls as being far away (near). If calls are assumed to be far away, the compiler always loads the function’s address into a register, and calls indirect through the pointer. </p> </dd> <dt> + <span><code class="code">-mno-ep</code><a class="copiable-link" href="#index-mno-ep"> ¶</a></span> +</dt> <dt><code class="code">-mep</code></dt> <dd> +<p>Do not optimize (do optimize) basic blocks that use the same index pointer 4 or more times to copy pointer into the <code class="code">ep</code> register, and use the shorter <code class="code">sld</code> and <code class="code">sst</code> instructions. The <samp class="option">-mep</samp> option is on by default if you optimize. </p> </dd> <dt> + <span><code class="code">-mno-prolog-function</code><a class="copiable-link" href="#index-mno-prolog-function"> ¶</a></span> +</dt> <dt><code class="code">-mprolog-function</code></dt> <dd> +<p>Do not use (do use) external functions to save and restore registers at the prologue and epilogue of a function. The external functions are slower, but use less code space if more than one function saves the same number of registers. The <samp class="option">-mprolog-function</samp> option is on by default if you optimize. </p> </dd> <dt> +<span><code class="code">-mspace</code><a class="copiable-link" href="#index-mspace"> ¶</a></span> +</dt> <dd> +<p>Try to make the code as small as possible. At present, this just turns on the <samp class="option">-mep</samp> and <samp class="option">-mprolog-function</samp> options. </p> </dd> <dt> +<span><code class="code">-mtda=<var class="var">n</var></code><a class="copiable-link" href="#index-mtda"> ¶</a></span> +</dt> <dd> +<p>Put static or global variables whose size is <var class="var">n</var> bytes or less into the tiny data area that register <code class="code">ep</code> points to. The tiny data area can hold up to 256 bytes in total (128 bytes for byte references). </p> </dd> <dt> +<span><code class="code">-msda=<var class="var">n</var></code><a class="copiable-link" href="#index-msda"> ¶</a></span> +</dt> <dd> +<p>Put static or global variables whose size is <var class="var">n</var> bytes or less into the small data area that register <code class="code">gp</code> points to. The small data area can hold up to 64 kilobytes. </p> </dd> <dt> +<span><code class="code">-mzda=<var class="var">n</var></code><a class="copiable-link" href="#index-mzda"> ¶</a></span> +</dt> <dd> +<p>Put static or global variables whose size is <var class="var">n</var> bytes or less into the first 32 kilobytes of memory. </p> </dd> <dt> +<span><code class="code">-mv850</code><a class="copiable-link" href="#index-mv850"> ¶</a></span> +</dt> <dd> +<p>Specify that the target processor is the V850. </p> </dd> <dt> +<span><code class="code">-mv850e3v5</code><a class="copiable-link" href="#index-mv850e3v5"> ¶</a></span> +</dt> <dd> +<p>Specify that the target processor is the V850E3V5. The preprocessor constant <code class="code">__v850e3v5__</code> is defined if this option is used. </p> </dd> <dt> +<span><code class="code">-mv850e2v4</code><a class="copiable-link" href="#index-mv850e2v4"> ¶</a></span> +</dt> <dd> +<p>Specify that the target processor is the V850E3V5. This is an alias for the <samp class="option">-mv850e3v5</samp> option. </p> </dd> <dt> +<span><code class="code">-mv850e2v3</code><a class="copiable-link" href="#index-mv850e2v3"> ¶</a></span> +</dt> <dd> +<p>Specify that the target processor is the V850E2V3. The preprocessor constant <code class="code">__v850e2v3__</code> is defined if this option is used. </p> </dd> <dt> +<span><code class="code">-mv850e2</code><a class="copiable-link" href="#index-mv850e2"> ¶</a></span> +</dt> <dd> +<p>Specify that the target processor is the V850E2. The preprocessor constant <code class="code">__v850e2__</code> is defined if this option is used. </p> </dd> <dt> +<span><code class="code">-mv850e1</code><a class="copiable-link" href="#index-mv850e1"> ¶</a></span> +</dt> <dd> +<p>Specify that the target processor is the V850E1. The preprocessor constants <code class="code">__v850e1__</code> and <code class="code">__v850e__</code> are defined if this option is used. </p> </dd> <dt> +<span><code class="code">-mv850es</code><a class="copiable-link" href="#index-mv850es"> ¶</a></span> +</dt> <dd> +<p>Specify that the target processor is the V850ES. This is an alias for the <samp class="option">-mv850e1</samp> option. </p> </dd> <dt> +<span><code class="code">-mv850e</code><a class="copiable-link" href="#index-mv850e"> ¶</a></span> +</dt> <dd> +<p>Specify that the target processor is the V850E. The preprocessor constant <code class="code">__v850e__</code> is defined if this option is used. </p> <p>If neither <samp class="option">-mv850</samp> nor <samp class="option">-mv850e</samp> nor <samp class="option">-mv850e1</samp> nor <samp class="option">-mv850e2</samp> nor <samp class="option">-mv850e2v3</samp> nor <samp class="option">-mv850e3v5</samp> are defined then a default target processor is chosen and the relevant ‘<samp class="samp">__v850*__</samp>’ preprocessor constant is defined. </p> <p>The preprocessor constants <code class="code">__v850</code> and <code class="code">__v851__</code> are always defined, regardless of which processor variant is the target. </p> </dd> <dt> + <span><code class="code">-mdisable-callt</code><a class="copiable-link" href="#index-mdisable-callt"> ¶</a></span> +</dt> <dt><code class="code">-mno-disable-callt</code></dt> <dd> +<p>This option suppresses generation of the <code class="code">CALLT</code> instruction for the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850 architecture. </p> <p>This option is enabled by default when the RH850 ABI is in use (see <samp class="option">-mrh850-abi</samp>), and disabled by default when the GCC ABI is in use. If <code class="code">CALLT</code> instructions are being generated then the C preprocessor symbol <code class="code">__V850_CALLT__</code> is defined. </p> </dd> <dt> + <span><code class="code">-mrelax</code><a class="copiable-link" href="#index-mrelax-8"> ¶</a></span> +</dt> <dt><code class="code">-mno-relax</code></dt> <dd> +<p>Pass on (or do not pass on) the <samp class="option">-mrelax</samp> command-line option to the assembler. </p> </dd> <dt> + <span><code class="code">-mlong-jumps</code><a class="copiable-link" href="#index-mlong-jumps"> ¶</a></span> +</dt> <dt><code class="code">-mno-long-jumps</code></dt> <dd> +<p>Disable (or re-enable) the generation of PC-relative jump instructions. </p> </dd> <dt> + <span><code class="code">-msoft-float</code><a class="copiable-link" href="#index-msoft-float-14"> ¶</a></span> +</dt> <dt><code class="code">-mhard-float</code></dt> <dd> +<p>Disable (or re-enable) the generation of hardware floating point instructions. This option is only significant when the target architecture is ‘<samp class="samp">V850E2V3</samp>’ or higher. If hardware floating point instructions are being generated then the C preprocessor symbol <code class="code">__FPU_OK__</code> is defined, otherwise the symbol <code class="code">__NO_FPU__</code> is defined. </p> </dd> <dt> +<span><code class="code">-mloop</code><a class="copiable-link" href="#index-mloop-1"> ¶</a></span> +</dt> <dd> +<p>Enables the use of the e3v5 LOOP instruction. The use of this instruction is not enabled by default when the e3v5 architecture is selected because its use is still experimental. </p> </dd> <dt> + <span><code class="code">-mrh850-abi</code><a class="copiable-link" href="#index-mrh850-abi"> ¶</a></span> +</dt> <dt><code class="code">-mghs</code></dt> <dd> +<p>Enables support for the RH850 version of the V850 ABI. This is the default. With this version of the ABI the following rules apply: </p> <ul class="itemize mark-bullet"> <li>Integer sized structures and unions are returned via a memory pointer rather than a register. </li> +<li>Large structures and unions (more than 8 bytes in size) are passed by value. </li> +<li>Functions are aligned to 16-bit boundaries. </li> +<li>The <samp class="option">-m8byte-align</samp> command-line option is supported. </li> +<li>The <samp class="option">-mdisable-callt</samp> command-line option is enabled by default. The <samp class="option">-mno-disable-callt</samp> command-line option is not supported. </li> +</ul> <p>When this version of the ABI is enabled the C preprocessor symbol <code class="code">__V850_RH850_ABI__</code> is defined. </p> </dd> <dt> +<span><code class="code">-mgcc-abi</code><a class="copiable-link" href="#index-mgcc-abi"> ¶</a></span> +</dt> <dd> +<p>Enables support for the old GCC version of the V850 ABI. With this version of the ABI the following rules apply: </p> <ul class="itemize mark-bullet"> <li>Integer sized structures and unions are returned in register <code class="code">r10</code>. </li> +<li>Large structures and unions (more than 8 bytes in size) are passed by reference. </li> +<li>Functions are aligned to 32-bit boundaries, unless optimizing for size. </li> +<li>The <samp class="option">-m8byte-align</samp> command-line option is not supported. </li> +<li>The <samp class="option">-mdisable-callt</samp> command-line option is supported but not enabled by default. </li> +</ul> <p>When this version of the ABI is enabled the C preprocessor symbol <code class="code">__V850_GCC_ABI__</code> is defined. </p> </dd> <dt> + <span><code class="code">-m8byte-align</code><a class="copiable-link" href="#index-m8byte-align"> ¶</a></span> +</dt> <dt><code class="code">-mno-8byte-align</code></dt> <dd> +<p>Enables support for <code class="code">double</code> and <code class="code">long long</code> types to be aligned on 8-byte boundaries. The default is to restrict the alignment of all objects to at most 4-bytes. When <samp class="option">-m8byte-align</samp> is in effect the C preprocessor symbol <code class="code">__V850_8BYTE_ALIGN__</code> is defined. </p> </dd> <dt> +<span><code class="code">-mbig-switch</code><a class="copiable-link" href="#index-mbig-switch-1"> ¶</a></span> +</dt> <dd> +<p>Generate code suitable for big switch tables. Use this option only if the assembler/linker complain about out of range branches within a switch table. </p> </dd> <dt> +<span><code class="code">-mapp-regs</code><a class="copiable-link" href="#index-mapp-regs-1"> ¶</a></span> +</dt> <dd> +<p>This option causes r2 and r5 to be used in the code generated by the compiler. This setting is the default. </p> </dd> <dt> +<span><code class="code">-mno-app-regs</code><a class="copiable-link" href="#index-mno-app-regs-1"> ¶</a></span> +</dt> <dd> +<p>This option causes r2 and r5 to be treated as fixed registers. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="vax-options">VAX Options</a>, Previous: <a href="system-v-options">Options for System V</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/V850-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/V850-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/v850-variable-attributes.html b/devdocs/gcc~13/v850-variable-attributes.html new file mode 100644 index 00000000..f6062876 --- /dev/null +++ b/devdocs/gcc~13/v850-variable-attributes.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="V850-Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="variable-attributes" accesskey="n" rel="next">x86 Variable Attributes</a>, Previous: <a href="rl78-variable-attributes" accesskey="p" rel="prev">RL78 Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="V850-Variable-Attributes-1"><span>6.34.14 V850 Variable Attributes<a class="copiable-link" href="#V850-Variable-Attributes-1"> ¶</a></span></h1> <p>These variable attributes are supported by the V850 back end: </p> <dl class="table"> <dt> +<span><code class="code">sda</code><a class="copiable-link" href="#index-sda-variable-attribute_002c-V850"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to explicitly place a variable in the small data area, which can hold up to 64 kilobytes. </p> </dd> <dt> +<span><code class="code">tda</code><a class="copiable-link" href="#index-tda-variable-attribute_002c-V850"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to explicitly place a variable in the tiny data area, which can hold up to 256 bytes in total. </p> </dd> <dt> +<span><code class="code">zda</code><a class="copiable-link" href="#index-zda-variable-attribute_002c-V850"> ¶</a></span> +</dt> <dd><p>Use this attribute to explicitly place a variable in the first 32 kilobytes of memory. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/V850-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/V850-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/vague-linkage.html b/devdocs/gcc~13/vague-linkage.html new file mode 100644 index 00000000..02edf2e3 --- /dev/null +++ b/devdocs/gcc~13/vague-linkage.html @@ -0,0 +1,14 @@ +<div class="section-level-extent" id="Vague-Linkage"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-interface" accesskey="n" rel="next">C++ Interface and Implementation Pragmas</a>, Previous: <a href="restricted-pointers" accesskey="p" rel="prev">Restricting Pointer Aliasing</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Vague-Linkage-1"><span>7.3 Vague Linkage<a class="copiable-link" href="#Vague-Linkage-1"> ¶</a></span></h1> <p>There are several constructs in C++ that require space in the object file but are not clearly tied to a single translation unit. We say that these constructs have “vague linkage”. Typically such constructs are emitted wherever they are needed, though sometimes we can be more clever. </p> <dl class="table"> <dt>Inline Functions</dt> <dd> +<p>Inline functions are typically defined in a header file which can be included in many different compilations. Hopefully they can usually be inlined, but sometimes an out-of-line copy is necessary, if the address of the function is taken or if inlining fails. In general, we emit an out-of-line copy in all translation units where one is needed. As an exception, we only emit inline virtual functions with the vtable, since it always requires a copy. </p> <p>Local static variables and string constants used in an inline function are also considered to have vague linkage, since they must be shared between all inlined and out-of-line instances of the function. </p> </dd> <dt> +<span>VTables<a class="copiable-link" href="#index-vtable"> ¶</a></span> +</dt> <dd> +<p>C++ virtual functions are implemented in most compilers using a lookup table, known as a vtable. The vtable contains pointers to the virtual functions provided by a class, and each object of the class contains a pointer to its vtable (or vtables, in some multiple-inheritance situations). If the class declares any non-inline, non-pure virtual functions, the first one is chosen as the “key method” for the class, and the vtable is only emitted in the translation unit where the key method is defined. </p> <p><em class="emph">Note:</em> If the chosen key method is later defined as inline, the vtable is still emitted in every translation unit that defines it. Make sure that any inline virtuals are declared inline in the class body, even if they are not defined there. </p> </dd> <dt> + <span><code class="code">type_info</code> objects<a class="copiable-link" href="#index-type_005finfo"> ¶</a></span> +</dt> <dd> +<p>C++ requires information about types to be written out in order to implement ‘<samp class="samp">dynamic_cast</samp>’, ‘<samp class="samp">typeid</samp>’ and exception handling. For polymorphic classes (classes with virtual functions), the ‘<samp class="samp">type_info</samp>’ object is written out along with the vtable so that ‘<samp class="samp">dynamic_cast</samp>’ can determine the dynamic type of a class object at run time. For all other types, we write out the ‘<samp class="samp">type_info</samp>’ object when it is used: when applying ‘<samp class="samp">typeid</samp>’ to an expression, throwing an object, or referring to a type in a catch clause or exception specification. </p> </dd> <dt>Template Instantiations</dt> <dd> +<p>Most everything in this section also applies to template instantiations, but there are other options as well. See <a class="xref" href="template-instantiation">Where’s the Template?</a>. </p> </dd> </dl> <p>When used with GNU ld version 2.8 or later on an ELF system such as GNU/Linux or Solaris 2, or on Microsoft Windows, duplicate copies of these constructs will be discarded at link time. This is known as COMDAT support. </p> <p>On targets that don’t support COMDAT, but do support weak symbols, GCC uses them. This way one copy overrides all the others, but the unused copies still take up space in the executable. </p> <p>For targets that do not support either COMDAT or weak symbols, most entities with vague linkage are emitted as local symbols to avoid duplicate definition errors from the linker. This does not happen for local statics in inlines, however, as having multiple copies almost certainly breaks things. </p> <p>See <a class="xref" href="c_002b_002b-interface">Declarations and Definitions in One Header</a>, for another way to control placement of these constructs. </p> </div> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-interface">C++ Interface and Implementation Pragmas</a>, Previous: <a href="restricted-pointers">Restricting Pointer Aliasing</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Vague-Linkage.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Vague-Linkage.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/variable-attributes.html b/devdocs/gcc~13/variable-attributes.html new file mode 100644 index 00000000..ecc99e1d --- /dev/null +++ b/devdocs/gcc~13/variable-attributes.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Variable-Attributes"> <div class="nav-panel"> <p> Next: <a href="type-attributes" accesskey="n" rel="next">Specifying Attributes of Types</a>, Previous: <a href="function-attributes" accesskey="p" rel="prev">Declaring Attributes of Functions</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Specifying-Attributes-of-Variables"><span>6.34 Specifying Attributes of Variables<a class="copiable-link" href="#Specifying-Attributes-of-Variables"> ¶</a></span></h1> <p>The keyword <code class="code">__attribute__</code> allows you to specify special properties of variables, function parameters, or structure, union, and, in C++, class members. This <code class="code">__attribute__</code> keyword is followed by an attribute specification enclosed in double parentheses. Some attributes are currently defined generically for variables. Other attributes are defined for variables on particular target systems. Other attributes are available for functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>), labels (see <a class="pxref" href="label-attributes">Label Attributes</a>), enumerators (see <a class="pxref" href="enumerator-attributes">Enumerator Attributes</a>), statements (see <a class="pxref" href="statement-attributes">Statement Attributes</a>), and for types (see <a class="pxref" href="type-attributes">Specifying Attributes of Types</a>). Other front ends might define more attributes (see <a class="pxref" href="c_002b_002b-extensions">Extensions to the C++ Language</a>). </p> <p>See <a class="xref" href="attribute-syntax">Attribute Syntax</a>, for details of the exact syntax for using attributes. </p> <ul class="mini-toc"> <li><a href="common-variable-attributes" accesskey="1">Common Variable Attributes</a></li> <li><a href="arc-variable-attributes" accesskey="2">ARC Variable Attributes</a></li> <li><a href="variable-attributes" accesskey="3">AVR Variable Attributes</a></li> <li><a href="blackfin-variable-attributes" accesskey="4">Blackfin Variable Attributes</a></li> <li><a href="h8_002f300-variable-attributes" accesskey="5">H8/300 Variable Attributes</a></li> <li><a href="ia-64-variable-attributes" accesskey="6">IA-64 Variable Attributes</a></li> <li><a href="loongarch-variable-attributes" accesskey="7">LoongArch Variable Attributes</a></li> <li><a href="m32r_002fd-variable-attributes" accesskey="8">M32R/D Variable Attributes</a></li> <li><a href="microsoft-windows-variable-attributes" accesskey="9">Microsoft Windows Variable Attributes</a></li> <li><a href="msp430-variable-attributes">MSP430 Variable Attributes</a></li> <li><a href="nvidia-ptx-variable-attributes">Nvidia PTX Variable Attributes</a></li> <li><a href="powerpc-variable-attributes">PowerPC Variable Attributes</a></li> <li><a href="rl78-variable-attributes">RL78 Variable Attributes</a></li> <li><a href="v850-variable-attributes">V850 Variable Attributes</a></li> <li><a href="variable-attributes">x86 Variable Attributes</a></li> <li><a href="xstormy16-variable-attributes">Xstormy16 Variable Attributes</a></li> </ul> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/variable-length.html b/devdocs/gcc~13/variable-length.html new file mode 100644 index 00000000..e7c12b28 --- /dev/null +++ b/devdocs/gcc~13/variable-length.html @@ -0,0 +1,29 @@ +<div class="section-level-extent" id="Variable-Length"> <div class="nav-panel"> <p> Next: <a href="variadic-macros" accesskey="n" rel="next">Macros with a Variable Number of Arguments.</a>, Previous: <a href="empty-structures" accesskey="p" rel="prev">Structures with No Members</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Arrays-of-Variable-Length"><span>6.20 Arrays of Variable Length<a class="copiable-link" href="#Arrays-of-Variable-Length"> ¶</a></span></h1> <p>Variable-length automatic arrays are allowed in ISO C99, and as an extension GCC accepts them in C90 mode and in C++. These arrays are declared like any other automatic arrays, but with a length that is not a constant expression. The storage is allocated at the point of declaration and deallocated when the block scope containing the declaration exits. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">FILE * +concat_fopen (char *s1, char *s2, char *mode) +{ + char str[strlen (s1) + strlen (s2) + 1]; + strcpy (str, s1); + strcat (str, s2); + return fopen (str, mode); +}</pre> +</div> <p>Jumping or breaking out of the scope of the array name deallocates the storage. Jumping into the scope is not allowed; you get an error message for it. </p> <p>As an extension, GCC accepts variable-length arrays as a member of a structure or a union. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void +foo (int n) +{ + struct S { int x[n]; }; +}</pre> +</div> <p>You can use the function <code class="code">alloca</code> to get an effect much like variable-length arrays. The function <code class="code">alloca</code> is available in many other C implementations (but not in all). On the other hand, variable-length arrays are more elegant. </p> <p>There are other differences between these two methods. Space allocated with <code class="code">alloca</code> exists until the containing <em class="emph">function</em> returns. The space for a variable-length array is deallocated as soon as the array name’s scope ends, unless you also use <code class="code">alloca</code> in this scope. </p> <p>You can also use variable-length arrays as arguments to functions: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct entry +tester (int len, char data[len][len]) +{ + /* <span class="r">…</span> */ +}</pre> +</div> <p>The length of an array is computed once when the storage is allocated and is remembered for the scope of the array in case you access it with <code class="code">sizeof</code>. </p> <p>If you want to pass the array first and the length afterward, you can use a forward declaration in the parameter list—another GNU extension. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct entry +tester (int len; char data[len][len], int len) +{ + /* <span class="r">…</span> */ +}</pre> +</div> <p>The ‘<samp class="samp">int len</samp>’ before the semicolon is a <em class="dfn">parameter forward declaration</em>, and it serves the purpose of making the name <code class="code">len</code> known when the declaration of <code class="code">data</code> is parsed. </p> <p>You can write any number of such parameter forward declarations in the parameter list. They can be separated by commas or semicolons, but the last one must end with a semicolon, which is followed by the “real” parameter declarations. Each forward declaration must match a “real” declaration in parameter name and data type. ISO C99 does not support parameter forward declarations. </p> </div> <div class="nav-panel"> <p> Next: <a href="variadic-macros">Macros with a Variable Number of Arguments.</a>, Previous: <a href="empty-structures">Structures with No Members</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Variable-Length.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Variable-Length.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/variadic-macros.html b/devdocs/gcc~13/variadic-macros.html new file mode 100644 index 00000000..1660e7f9 --- /dev/null +++ b/devdocs/gcc~13/variadic-macros.html @@ -0,0 +1,10 @@ +<div class="section-level-extent" id="Variadic-Macros"> <div class="nav-panel"> <p> Next: <a href="escaped-newlines" accesskey="n" rel="next">Slightly Looser Rules for Escaped Newlines</a>, Previous: <a href="variable-length" accesskey="p" rel="prev">Arrays of Variable Length</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Macros-with-a-Variable-Number-of-Arguments_002e"><span>6.21 Macros with a Variable Number of Arguments.<a class="copiable-link" href="#Macros-with-a-Variable-Number-of-Arguments_002e"> ¶</a></span></h1> <p>In the ISO C standard of 1999, a macro can be declared to accept a variable number of arguments much as a function can. The syntax for defining the macro is similar to that of a function. Here is an example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define debug(format, ...) fprintf (stderr, format, __VA_ARGS__)</pre> +</div> <p>Here ‘<samp class="samp">…</samp>’ is a <em class="dfn">variable argument</em>. In the invocation of such a macro, it represents the zero or more tokens until the closing parenthesis that ends the invocation, including any commas. This set of tokens replaces the identifier <code class="code">__VA_ARGS__</code> in the macro body wherever it appears. See the CPP manual for more information. </p> <p>GCC has long supported variadic macros, and used a different syntax that allowed you to give a name to the variable arguments just like any other argument. Here is an example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define debug(format, args...) fprintf (stderr, format, args)</pre> +</div> <p>This is in all ways equivalent to the ISO C example above, but arguably more readable and descriptive. </p> <p>GNU CPP has two further variadic macro extensions, and permits them to be used with either of the above forms of macro definition. </p> <p>In standard C, you are not allowed to leave the variable argument out entirely; but you are allowed to pass an empty argument. For example, this invocation is invalid in ISO C, because there is no comma after the string: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">debug ("A message")</pre> +</div> <p>GNU CPP permits you to completely omit the variable arguments in this way. In the above examples, the compiler would complain, though since the expansion of the macro still has the extra comma after the format string. </p> <p>To help solve this problem, CPP behaves specially for variable arguments used with the token paste operator, ‘<samp class="samp">##</samp>’. If instead you write </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define debug(format, ...) fprintf (stderr, format, ## __VA_ARGS__)</pre> +</div> <p>and if the variable arguments are omitted or empty, the ‘<samp class="samp">##</samp>’ operator causes the preprocessor to remove the comma before it. If you do provide some variable arguments in your macro invocation, GNU CPP does not complain about the paste operation and instead places the variable arguments after the comma. Just like any other pasted macro argument, these arguments are not macro expanded. </p> </div> <div class="nav-panel"> <p> Next: <a href="escaped-newlines">Slightly Looser Rules for Escaped Newlines</a>, Previous: <a href="variable-length">Arrays of Variable Length</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Variadic-Macros.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Variadic-Macros.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/variadic-pointer-args.html b/devdocs/gcc~13/variadic-pointer-args.html new file mode 100644 index 00000000..d60ca096 --- /dev/null +++ b/devdocs/gcc~13/variadic-pointer-args.html @@ -0,0 +1,6 @@ +<div class="section-level-extent" id="Variadic-Pointer-Args"> <div class="nav-panel"> <p> Next: <a href="pointers-to-arrays" accesskey="n" rel="next">Pointers to Arrays with Qualifiers Work as Expected</a>, Previous: <a href="pointer-arith" accesskey="p" rel="prev">Arithmetic on <code class="code">void</code>- and Function-Pointers</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Pointer-Arguments-in-Variadic-Functions"><span>6.25 Pointer Arguments in Variadic Functions<a class="copiable-link" href="#Pointer-Arguments-in-Variadic-Functions"> ¶</a></span></h1> <p>Standard C requires that pointer types used with <code class="code">va_arg</code> in functions with variable argument lists either must be compatible with that of the actual argument, or that one type must be a pointer to <code class="code">void</code> and the other a pointer to a character type. GNU C implements the POSIX XSI extension that additionally permits the use of <code class="code">va_arg</code> with a pointer type to receive arguments of any other pointer type. </p> <p>In particular, in GNU C ‘<samp class="samp">va_arg (ap, void *)</samp>’ can safely be used to consume an argument of any pointer type. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Variadic-Pointer-Args.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Variadic-Pointer-Args.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/vax-options.html b/devdocs/gcc~13/vax-options.html new file mode 100644 index 00000000..49c45781 --- /dev/null +++ b/devdocs/gcc~13/vax-options.html @@ -0,0 +1,17 @@ +<div class="subsection-level-extent" id="VAX-Options"> <div class="nav-panel"> <p> Next: <a href="visium-options" accesskey="n" rel="next">Visium Options</a>, Previous: <a href="v850-options" accesskey="p" rel="prev">V850 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="VAX-Options-1"><span>3.19.50 VAX Options<a class="copiable-link" href="#VAX-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for the VAX: </p> <dl class="table"> <dt> +<span><code class="code">-munix</code><a class="copiable-link" href="#index-munix"> ¶</a></span> +</dt> <dd> +<p>Do not output certain jump instructions (<code class="code">aobleq</code> and so on) that the Unix assembler for the VAX cannot handle across long ranges. </p> </dd> <dt> +<span><code class="code">-mgnu</code><a class="copiable-link" href="#index-mgnu"> ¶</a></span> +</dt> <dd> +<p>Do output those jump instructions, on the assumption that the GNU assembler is being used. </p> </dd> <dt> +<span><code class="code">-mg</code><a class="copiable-link" href="#index-mg"> ¶</a></span> +</dt> <dd> +<p>Output code for G-format floating-point numbers instead of D-format. </p> </dd> <dt> + <span><code class="code">-mlra</code><a class="copiable-link" href="#index-mlra-4"> ¶</a></span> +</dt> <dt><code class="code">-mno-lra</code></dt> <dd><p>Enable Local Register Allocation. This is still experimental for the VAX, so by default the compiler uses standard reload. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/VAX-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/VAX-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/vector-extensions.html b/devdocs/gcc~13/vector-extensions.html new file mode 100644 index 00000000..440066e2 --- /dev/null +++ b/devdocs/gcc~13/vector-extensions.html @@ -0,0 +1,86 @@ +<div class="section-level-extent" id="Vector-Extensions"> <div class="nav-panel"> <p> Next: <a href="offsetof" accesskey="n" rel="next">Support for <code class="code">offsetof</code></a>, Previous: <a href="return-address" accesskey="p" rel="prev">Getting the Return or Frame Address of a Function</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Using-Vector-Instructions-through-Built-in-Functions"><span>6.52 Using Vector Instructions through Built-in Functions<a class="copiable-link" href="#Using-Vector-Instructions-through-Built-in-Functions"> ¶</a></span></h1> <p>On some targets, the instruction set contains SIMD vector instructions which operate on multiple values contained in one large register at the same time. For example, on the x86 the MMX, 3DNow! and SSE extensions can be used this way. </p> <p>The first step in using these extensions is to provide the necessary data types. This should be done using an appropriate <code class="code">typedef</code>: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int v4si __attribute__ ((vector_size (16)));</pre> +</div> <p>The <code class="code">int</code> type specifies the <em class="dfn">base type</em>, while the attribute specifies the vector size for the variable, measured in bytes. For example, the declaration above causes the compiler to set the mode for the <code class="code">v4si</code> type to be 16 bytes wide and divided into <code class="code">int</code> sized units. For a 32-bit <code class="code">int</code> this means a vector of 4 units of 4 bytes, and the corresponding mode of <code class="code">foo</code> is <abbr class="acronym">V4SI</abbr>. </p> <p>The <code class="code">vector_size</code> attribute is only applicable to integral and floating scalars, although arrays, pointers, and function return values are allowed in conjunction with this construct. Only sizes that are positive power-of-two multiples of the base type size are currently allowed. </p> <p>All the basic integer types can be used as base types, both as signed and as unsigned: <code class="code">char</code>, <code class="code">short</code>, <code class="code">int</code>, <code class="code">long</code>, <code class="code">long long</code>. In addition, <code class="code">float</code> and <code class="code">double</code> can be used to build floating-point vector types. </p> <p>Specifying a combination that is not valid for the current architecture causes GCC to synthesize the instructions using a narrower mode. For example, if you specify a variable of type <code class="code">V4SI</code> and your architecture does not allow for this specific SIMD type, GCC produces code that uses 4 <code class="code">SIs</code>. </p> <p>The types defined in this manner can be used with a subset of normal C operations. Currently, GCC allows using the following operators on these types: <code class="code">+, -, *, /, unary minus, ^, |, &, ~, %</code>. </p> <p>The operations behave like C++ <code class="code">valarrays</code>. Addition is defined as the addition of the corresponding elements of the operands. For example, in the code below, each of the 4 elements in <var class="var">a</var> is added to the corresponding 4 elements in <var class="var">b</var> and the resulting vector is stored in <var class="var">c</var>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int v4si __attribute__ ((vector_size (16))); + +v4si a, b, c; + +c = a + b;</pre> +</div> <p>Subtraction, multiplication, division, and the logical operations operate in a similar manner. Likewise, the result of using the unary minus or complement operators on a vector type is a vector whose elements are the negative or complemented values of the corresponding elements in the operand. </p> <p>It is possible to use shifting operators <code class="code"><<</code>, <code class="code">>></code> on integer-type vectors. The operation is defined as following: <code class="code">{a0, +a1, …, an} >> {b0, b1, …, bn} == {a0 >> b0, a1 >> b1, +…, an >> bn}</code>. Vector operands must have the same number of elements. </p> <p>For convenience, it is allowed to use a binary vector operation where one operand is a scalar. In that case the compiler transforms the scalar operand into a vector where each element is the scalar from the operation. The transformation happens only if the scalar could be safely converted to the vector-element type. Consider the following code. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int v4si __attribute__ ((vector_size (16))); + +v4si a, b, c; +long l; + +a = b + 1; /* a = b + {1,1,1,1}; */ +a = 2 * b; /* a = {2,2,2,2} * b; */ + +a = l + a; /* Error, cannot convert long to int. */</pre> +</div> <p>Vectors can be subscripted as if the vector were an array with the same number of elements and base type. Out of bound accesses invoke undefined behavior at run time. Warnings for out of bound accesses for vector subscription can be enabled with <samp class="option">-Warray-bounds</samp>. </p> <p>Vector comparison is supported with standard comparison operators: <code class="code">==, !=, <, <=, >, >=</code>. Comparison operands can be vector expressions of integer-type or real-type. Comparison between integer-type vectors and real-type vectors are not supported. The result of the comparison is a vector of the same width and number of elements as the comparison operands with a signed integral element type. </p> <p>Vectors are compared element-wise producing 0 when comparison is false and -1 (constant of the appropriate type where all bits are set) otherwise. Consider the following example. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int v4si __attribute__ ((vector_size (16))); + +v4si a = {1,2,3,4}; +v4si b = {3,2,1,4}; +v4si c; + +c = a > b; /* The result would be {0, 0,-1, 0} */ +c = a == b; /* The result would be {0,-1, 0,-1} */</pre> +</div> <p>In C++, the ternary operator <code class="code">?:</code> is available. <code class="code">a?b:c</code>, where <code class="code">b</code> and <code class="code">c</code> are vectors of the same type and <code class="code">a</code> is an integer vector with the same number of elements of the same size as <code class="code">b</code> and <code class="code">c</code>, computes all three arguments and creates a vector <code class="code">{a[0]?b[0]:c[0], a[1]?b[1]:c[1], …}</code>. Note that unlike in OpenCL, <code class="code">a</code> is thus interpreted as <code class="code">a != 0</code> and not <code class="code">a < 0</code>. As in the case of binary operations, this syntax is also accepted when one of <code class="code">b</code> or <code class="code">c</code> is a scalar that is then transformed into a vector. If both <code class="code">b</code> and <code class="code">c</code> are scalars and the type of <code class="code">true?b:c</code> has the same size as the element type of <code class="code">a</code>, then <code class="code">b</code> and <code class="code">c</code> are converted to a vector type whose elements have this type and with the same number of elements as <code class="code">a</code>. </p> <p>In C++, the logic operators <code class="code">!, &&, ||</code> are available for vectors. <code class="code">!v</code> is equivalent to <code class="code">v == 0</code>, <code class="code">a && b</code> is equivalent to <code class="code">a!=0 & b!=0</code> and <code class="code">a || b</code> is equivalent to <code class="code">a!=0 | b!=0</code>. For mixed operations between a scalar <code class="code">s</code> and a vector <code class="code">v</code>, <code class="code">s && v</code> is equivalent to <code class="code">s?v!=0:0</code> (the evaluation is short-circuit) and <code class="code">v && s</code> is equivalent to <code class="code">v!=0 & (s?-1:0)</code>. </p> <p>Vector shuffling is available using functions <code class="code">__builtin_shuffle (vec, mask)</code> and <code class="code">__builtin_shuffle (vec0, vec1, mask)</code>. Both functions construct a permutation of elements from one or two vectors and return a vector of the same type as the input vector(s). The <var class="var">mask</var> is an integral vector with the same width (<var class="var">W</var>) and element count (<var class="var">N</var>) as the output vector. </p> <p>The elements of the input vectors are numbered in memory ordering of <var class="var">vec0</var> beginning at 0 and <var class="var">vec1</var> beginning at <var class="var">N</var>. The elements of <var class="var">mask</var> are considered modulo <var class="var">N</var> in the single-operand case and modulo <em class="math">2*<var class="var">N</var></em> in the two-operand case. </p> <p>Consider the following example, </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int v4si __attribute__ ((vector_size (16))); + +v4si a = {1,2,3,4}; +v4si b = {5,6,7,8}; +v4si mask1 = {0,1,1,3}; +v4si mask2 = {0,4,2,5}; +v4si res; + +res = __builtin_shuffle (a, mask1); /* res is {1,2,2,4} */ +res = __builtin_shuffle (a, b, mask2); /* res is {1,5,3,6} */</pre> +</div> <p>Note that <code class="code">__builtin_shuffle</code> is intentionally semantically compatible with the OpenCL <code class="code">shuffle</code> and <code class="code">shuffle2</code> functions. </p> <p>You can declare variables and use them in function calls and returns, as well as in assignments and some casts. You can specify a vector type as a return type for a function. Vector types can also be used as function arguments. It is possible to cast from one vector type to another, provided they are of the same size (in fact, you can also cast vectors to and from other datatypes of the same size). </p> <p>You cannot operate between vectors of different lengths or different signedness without a cast. </p> <p>Vector shuffling is available using the <code class="code">__builtin_shufflevector (vec1, vec2, index...)</code> function. <var class="var">vec1</var> and <var class="var">vec2</var> must be expressions with vector type with a compatible element type. The result of <code class="code">__builtin_shufflevector</code> is a vector with the same element type as <var class="var">vec1</var> and <var class="var">vec2</var> but that has an element count equal to the number of indices specified. </p> <p>The <var class="var">index</var> arguments are a list of integers that specify the elements indices of the first two vectors that should be extracted and returned in a new vector. These element indices are numbered sequentially starting with the first vector, continuing into the second vector. An index of -1 can be used to indicate that the corresponding element in the returned vector is a don’t care and can be freely chosen to optimized the generated code sequence performing the shuffle operation. </p> <p>Consider the following example, </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int v4si __attribute__ ((vector_size (16))); +typedef int v8si __attribute__ ((vector_size (32))); + +v8si a = {1,-2,3,-4,5,-6,7,-8}; +v4si b = __builtin_shufflevector (a, a, 0, 2, 4, 6); /* b is {1,3,5,7} */ +v4si c = {-2,-4,-6,-8}; +v8si d = __builtin_shufflevector (c, b, 4, 0, 5, 1, 6, 2, 7, 3); /* d is a */</pre> +</div> <p>Vector conversion is available using the <code class="code">__builtin_convertvector (vec, vectype)</code> function. <var class="var">vec</var> must be an expression with integral or floating vector type and <var class="var">vectype</var> an integral or floating vector type with the same number of elements. The result has <var class="var">vectype</var> type and value of a C cast of every element of <var class="var">vec</var> to the element type of <var class="var">vectype</var>. </p> <p>Consider the following example, </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int v4si __attribute__ ((vector_size (16))); +typedef float v4sf __attribute__ ((vector_size (16))); +typedef double v4df __attribute__ ((vector_size (32))); +typedef unsigned long long v4di __attribute__ ((vector_size (32))); + +v4si a = {1,-2,3,-4}; +v4sf b = {1.5f,-2.5f,3.f,7.f}; +v4di c = {1ULL,5ULL,0ULL,10ULL}; +v4sf d = __builtin_convertvector (a, v4sf); /* d is {1.f,-2.f,3.f,-4.f} */ +/* Equivalent of: + v4sf d = { (float)a[0], (float)a[1], (float)a[2], (float)a[3] }; */ +v4df e = __builtin_convertvector (a, v4df); /* e is {1.,-2.,3.,-4.} */ +v4df f = __builtin_convertvector (b, v4df); /* f is {1.5,-2.5,3.,7.} */ +v4si g = __builtin_convertvector (f, v4si); /* g is {1,-2,3,7} */ +v4si h = __builtin_convertvector (c, v4si); /* h is {1,5,0,10} */</pre> +</div> <p>Sometimes it is desirable to write code using a mix of generic vector operations (for clarity) and machine-specific vector intrinsics (to access vector instructions that are not exposed via generic built-ins). On x86, intrinsic functions for integer vectors typically use the same vector type <code class="code">__m128i</code> irrespective of how they interpret the vector, making it necessary to cast their arguments and return values from/to other vector types. In C, you can make use of a <code class="code">union</code> type: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <immintrin.h> + +typedef unsigned char u8x16 __attribute__ ((vector_size (16))); +typedef unsigned int u32x4 __attribute__ ((vector_size (16))); + +typedef union { + __m128i mm; + u8x16 u8; + u32x4 u32; +} v128;</pre> +</div> <p>for variables that can be used with both built-in operators and x86 intrinsics: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v128 x, y = { 0 }; +memcpy (&x, ptr, sizeof x); +y.u8 += 0x80; +x.mm = _mm_adds_epu8 (x.mm, y.mm); +x.u32 &= 0xffffff; + +/* Instead of a variable, a compound literal may be used to pass the + return value of an intrinsic call to a function expecting the union: */ +v128 foo (v128); +x = foo ((v128) {_mm_adds_epu8 (x.mm, y.mm)});</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="offsetof">Support for <code class="code">offsetof</code></a>, Previous: <a href="return-address">Getting the Return or Frame Address of a Function</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Vector-Extensions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Vector-Extensions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/visibility-pragmas.html b/devdocs/gcc~13/visibility-pragmas.html new file mode 100644 index 00000000..1b65c7d6 --- /dev/null +++ b/devdocs/gcc~13/visibility-pragmas.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="Visibility-Pragmas"> <div class="nav-panel"> <p> Next: <a href="push_002fpop-macro-pragmas" accesskey="n" rel="next">Push/Pop Macro Pragmas</a>, Previous: <a href="diagnostic-pragmas" accesskey="p" rel="prev">Diagnostic Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Visibility-Pragmas-1"><span>6.62.13 Visibility Pragmas<a class="copiable-link" href="#Visibility-Pragmas-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">#pragma GCC visibility push(<var class="var">visibility</var>)</code><a class="copiable-link" href="#index-pragma_002c-visibility"> ¶</a></span> +</dt> <dt><code class="code">#pragma GCC visibility pop</code></dt> <dd> <p>This pragma allows the user to set the visibility for multiple declarations without having to give each a visibility attribute (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> <p>In C++, ‘<samp class="samp">#pragma GCC visibility</samp>’ affects only namespace-scope declarations. Class members and template specializations are not affected; if you want to override the visibility for a particular member or instantiation, you must use an attribute. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Visibility-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Visibility-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/visium-function-attributes.html b/devdocs/gcc~13/visium-function-attributes.html new file mode 100644 index 00000000..1a8f1e2a --- /dev/null +++ b/devdocs/gcc~13/visium-function-attributes.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="Visium-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="x86-function-attributes" accesskey="n" rel="next">x86 Function Attributes</a>, Previous: <a href="v850-function-attributes" accesskey="p" rel="prev">V850 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Visium-Function-Attributes-1"><span>6.33.32 Visium Function Attributes<a class="copiable-link" href="#Visium-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the Visium back end: </p> <dl class="table"> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-Visium"> ¶</a></span> +</dt> <dd><p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Visium-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Visium-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/visium-options.html b/devdocs/gcc~13/visium-options.html new file mode 100644 index 00000000..bcdd535a --- /dev/null +++ b/devdocs/gcc~13/visium-options.html @@ -0,0 +1,29 @@ +<div class="subsection-level-extent" id="Visium-Options"> <div class="nav-panel"> <p> Next: <a href="vms-options" accesskey="n" rel="next">VMS Options</a>, Previous: <a href="vax-options" accesskey="p" rel="prev">VAX Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Visium-Options-1"><span>3.19.51 Visium Options<a class="copiable-link" href="#Visium-Options-1"> ¶</a></span></h1> <dl class="table"> <dt> +<span><code class="code">-mdebug</code><a class="copiable-link" href="#index-mdebug-2"> ¶</a></span> +</dt> <dd> +<p>A program which performs file I/O and is destined to run on an MCM target should be linked with this option. It causes the libraries libc.a and libdebug.a to be linked. The program should be run on the target under the control of the GDB remote debugging stub. </p> </dd> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-9"> ¶</a></span> +</dt> <dd> +<p>A program which performs file I/O and is destined to run on the simulator should be linked with option. This causes libraries libc.a and libsim.a to be linked. </p> </dd> <dt> + <span><code class="code">-mfpu</code><a class="copiable-link" href="#index-mfpu-5"> ¶</a></span> +</dt> <dt><code class="code">-mhard-float</code></dt> <dd> +<p>Generate code containing floating-point instructions. This is the default. </p> </dd> <dt> + <span><code class="code">-mno-fpu</code><a class="copiable-link" href="#index-mno-fpu-1"> ¶</a></span> +</dt> <dt><code class="code">-msoft-float</code></dt> <dd> +<p>Generate code containing library calls for floating-point. </p> <p><samp class="option">-msoft-float</samp> changes the calling convention in the output file; therefore, it is only useful if you compile <em class="emph">all</em> of a program with this option. In particular, you need to compile <samp class="file">libgcc.a</samp>, the library that comes with GCC, with <samp class="option">-msoft-float</samp> in order for this to work. </p> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu_type</var></code><a class="copiable-link" href="#index-mcpu-13"> ¶</a></span> +</dt> <dd> +<p>Set the instruction set, register set, and instruction scheduling parameters for machine type <var class="var">cpu_type</var>. Supported values for <var class="var">cpu_type</var> are ‘<samp class="samp">mcm</samp>’, ‘<samp class="samp">gr5</samp>’ and ‘<samp class="samp">gr6</samp>’. </p> <p>‘<samp class="samp">mcm</samp>’ is a synonym of ‘<samp class="samp">gr5</samp>’ present for backward compatibility. </p> <p>By default (unless configured otherwise), GCC generates code for the GR5 variant of the Visium architecture. </p> <p>With <samp class="option">-mcpu=gr6</samp>, GCC generates code for the GR6 variant of the Visium architecture. The only difference from GR5 code is that the compiler will generate block move instructions. </p> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu_type</var></code><a class="copiable-link" href="#index-mtune-16"> ¶</a></span> +</dt> <dd> +<p>Set the instruction scheduling parameters for machine type <var class="var">cpu_type</var>, but do not set the instruction set or register set that the option <samp class="option">-mcpu=<var class="var">cpu_type</var></samp> would. </p> </dd> <dt> +<span><code class="code">-msv-mode</code><a class="copiable-link" href="#index-msv-mode"> ¶</a></span> +</dt> <dd> +<p>Generate code for the supervisor mode, where there are no restrictions on the access to general registers. This is the default. </p> </dd> <dt> +<span><code class="code">-muser-mode</code><a class="copiable-link" href="#index-muser-mode-1"> ¶</a></span> +</dt> <dd><p>Generate code for the user mode, where the access to some general registers is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this mode; on the GR6, only registers r29 to r31 are affected. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="vms-options">VMS Options</a>, Previous: <a href="vax-options">VAX Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Visium-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Visium-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/vms-options.html b/devdocs/gcc~13/vms-options.html new file mode 100644 index 00000000..3c73748d --- /dev/null +++ b/devdocs/gcc~13/vms-options.html @@ -0,0 +1,17 @@ +<div class="subsection-level-extent" id="VMS-Options"> <div class="nav-panel"> <p> Next: <a href="vxworks-options" accesskey="n" rel="next">VxWorks Options</a>, Previous: <a href="visium-options" accesskey="p" rel="prev">Visium Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="VMS-Options-1"><span>3.19.52 VMS Options<a class="copiable-link" href="#VMS-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for the VMS implementations: </p> <dl class="table"> <dt> +<span><code class="code">-mvms-return-codes</code><a class="copiable-link" href="#index-mvms-return-codes"> ¶</a></span> +</dt> <dd> +<p>Return VMS condition codes from <code class="code">main</code>. The default is to return POSIX-style condition (e.g. error) codes. </p> </dd> <dt> +<span><code class="code">-mdebug-main=<var class="var">prefix</var></code><a class="copiable-link" href="#index-mdebug-main_003dprefix"> ¶</a></span> +</dt> <dd> +<p>Flag the first routine whose name starts with <var class="var">prefix</var> as the main routine for the debugger. </p> </dd> <dt> +<span><code class="code">-mmalloc64</code><a class="copiable-link" href="#index-mmalloc64"> ¶</a></span> +</dt> <dd> +<p>Default to 64-bit memory allocation routines. </p> </dd> <dt> +<span><code class="code">-mpointer-size=<var class="var">size</var></code><a class="copiable-link" href="#index-mpointer-size_003dsize"> ¶</a></span> +</dt> <dd><p>Set the default size of pointers. Possible options for <var class="var">size</var> are ‘<samp class="samp">32</samp>’ or ‘<samp class="samp">short</samp>’ for 32 bit pointers, ‘<samp class="samp">64</samp>’ or ‘<samp class="samp">long</samp>’ for 64 bit pointers, and ‘<samp class="samp">no</samp>’ for supporting only 32 bit pointers. The later option disables <code class="code">pragma pointer_size</code>. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/VMS-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/VMS-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/volatiles.html b/devdocs/gcc~13/volatiles.html new file mode 100644 index 00000000..2b85fec1 --- /dev/null +++ b/devdocs/gcc~13/volatiles.html @@ -0,0 +1,23 @@ +<div class="section-level-extent" id="Volatiles"> <div class="nav-panel"> <p> Next: <a href="using-assembly-language-with-c" accesskey="n" rel="next">How to Use Inline Assembly Language in C Code</a>, Previous: <a href="inline" accesskey="p" rel="prev">An Inline Function is As Fast As a Macro</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="When-is-a-Volatile-Object-Accessed_003f"><span>6.46 When is a Volatile Object Accessed?<a class="copiable-link" href="#When-is-a-Volatile-Object-Accessed_003f"> ¶</a></span></h1> <p>C has the concept of volatile objects. These are normally accessed by pointers and used for accessing hardware or inter-thread communication. The standard encourages compilers to refrain from optimizations concerning accesses to volatile objects, but leaves it implementation defined as to what constitutes a volatile access. The minimum requirement is that at a sequence point all previous accesses to volatile objects have stabilized and no subsequent accesses have occurred. Thus an implementation is free to reorder and combine volatile accesses that occur between sequence points, but cannot do so for accesses across a sequence point. The use of volatile does not allow you to violate the restriction on updating objects multiple times between two sequence points. </p> <p>Accesses to non-volatile objects are not ordered with respect to volatile accesses. You cannot use a volatile object as a memory barrier to order a sequence of writes to non-volatile memory. For instance: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int *ptr = <var class="var">something</var>; +volatile int vobj; +*ptr = <var class="var">something</var>; +vobj = 1;</pre> +</div> <p>Unless <var class="var">*ptr</var> and <var class="var">vobj</var> can be aliased, it is not guaranteed that the write to <var class="var">*ptr</var> occurs by the time the update of <var class="var">vobj</var> happens. If you need this guarantee, you must use a stronger memory barrier such as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int *ptr = <var class="var">something</var>; +volatile int vobj; +*ptr = <var class="var">something</var>; +asm volatile ("" : : : "memory"); +vobj = 1;</pre> +</div> <p>A scalar volatile object is read when it is accessed in a void context: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">volatile int *src = <var class="var">somevalue</var>; +*src;</pre> +</div> <p>Such expressions are rvalues, and GCC implements this as a read of the volatile object being pointed to. </p> <p>Assignments are also expressions and have an rvalue. However when assigning to a scalar volatile, the volatile object is not reread, regardless of whether the assignment expression’s rvalue is used or not. If the assignment’s rvalue is used, the value is that assigned to the volatile object. For instance, there is no read of <var class="var">vobj</var> in all the following cases: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int obj; +volatile int vobj; +vobj = <var class="var">something</var>; +obj = vobj = <var class="var">something</var>; +obj ? vobj = <var class="var">onething</var> : vobj = <var class="var">anotherthing</var>; +obj = (<var class="var">something</var>, vobj = <var class="var">anotherthing</var>);</pre> +</div> <p>If you need to read the volatile object after an assignment has occurred, you must use a separate expression with an intervening sequence point. </p> <p>As bit-fields are not individually addressable, volatile bit-fields may be implicitly read when written to, or when adjacent bit-fields are accessed. Bit-field operations may be optimized such that adjacent bit-fields are only partially accessed, if they straddle a storage unit boundary. For these reasons it is unwise to use volatile bit-fields to access hardware. </p> </div> <div class="nav-panel"> <p> Next: <a href="using-assembly-language-with-c">How to Use Inline Assembly Language in C Code</a>, Previous: <a href="inline">An Inline Function is As Fast As a Macro</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Volatiles.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Volatiles.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/vxworks-options.html b/devdocs/gcc~13/vxworks-options.html new file mode 100644 index 00000000..00d4ed34 --- /dev/null +++ b/devdocs/gcc~13/vxworks-options.html @@ -0,0 +1,20 @@ +<div class="subsection-level-extent" id="VxWorks-Options"> <div class="nav-panel"> <p> Next: <a href="x86-options" accesskey="n" rel="next">x86 Options</a>, Previous: <a href="vms-options" accesskey="p" rel="prev">VMS Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="VxWorks-Options-1"><span>3.19.53 VxWorks Options<a class="copiable-link" href="#VxWorks-Options-1"> ¶</a></span></h1> <p>The options in this section are defined for all VxWorks targets. Options specific to the target hardware are listed with the other options for that target. </p> <dl class="table"> <dt> +<span><code class="code">-mrtp</code><a class="copiable-link" href="#index-mrtp"> ¶</a></span> +</dt> <dd> +<p>GCC can generate code for both VxWorks kernels and real time processes (RTPs). This option switches from the former to the latter. It also defines the preprocessor macro <code class="code">__RTP__</code>. </p> </dd> <dt> +<span><code class="code">-non-static</code><a class="copiable-link" href="#index-non-static"> ¶</a></span> +</dt> <dd> +<p>Link an RTP executable against shared libraries rather than static libraries. The options <samp class="option">-static</samp> and <samp class="option">-shared</samp> can also be used for RTPs (see <a class="pxref" href="link-options">Options for Linking</a>); <samp class="option">-static</samp> is the default. </p> </dd> <dt> + <span><code class="code">-Bstatic</code><a class="copiable-link" href="#index-Bstatic"> ¶</a></span> +</dt> <dt><code class="code">-Bdynamic</code></dt> <dd> +<p>These options are passed down to the linker. They are defined for compatibility with Diab. </p> </dd> <dt> +<span><code class="code">-Xbind-lazy</code><a class="copiable-link" href="#index-Xbind-lazy"> ¶</a></span> +</dt> <dd> +<p>Enable lazy binding of function calls. This option is equivalent to <samp class="option">-Wl,-z,now</samp> and is defined for compatibility with Diab. </p> </dd> <dt> +<span><code class="code">-Xbind-now</code><a class="copiable-link" href="#index-Xbind-now"> ¶</a></span> +</dt> <dd><p>Disable lazy binding of function calls. This option is the default and is defined for compatibility with Diab. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/VxWorks-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/VxWorks-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/warning-options.html b/devdocs/gcc~13/warning-options.html new file mode 100644 index 00000000..6e0cea99 --- /dev/null +++ b/devdocs/gcc~13/warning-options.html @@ -0,0 +1,1404 @@ +<div class="section-level-extent" id="Warning-Options"> <div class="nav-panel"> <p> Next: <a href="static-analyzer-options" accesskey="n" rel="next">Options That Control Static Analysis</a>, Previous: <a href="diagnostic-message-formatting-options" accesskey="p" rel="prev">Options to Control Diagnostic Messages Formatting</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Options-to-Request-or-Suppress-Warnings"><span>3.8 Options to Request or Suppress Warnings<a class="copiable-link" href="#Options-to-Request-or-Suppress-Warnings"> ¶</a></span></h1> <p>Warnings are diagnostic messages that report constructions that are not inherently erroneous but that are risky or suggest there may have been an error. </p> <p>The following language-independent options do not enable specific warnings but control the kinds of diagnostics produced by GCC. </p> <dl class="table"> <dt> + <span><code class="code">-fsyntax-only</code><a class="copiable-link" href="#index-syntax-checking"> ¶</a></span> +</dt> <dd> +<p>Check the code for syntax errors, but don’t do anything beyond that. </p> </dd> <dt> +<span><code class="code">-fmax-errors=<var class="var">n</var></code><a class="copiable-link" href="#index-fmax-errors"> ¶</a></span> +</dt> <dd> +<p>Limits the maximum number of error messages to <var class="var">n</var>, at which point GCC bails out rather than attempting to continue processing the source code. If <var class="var">n</var> is 0 (the default), there is no limit on the number of error messages produced. If <samp class="option">-Wfatal-errors</samp> is also specified, then <samp class="option">-Wfatal-errors</samp> takes precedence over this option. </p> </dd> <dt> +<span><code class="code">-w</code><a class="copiable-link" href="#index-w"> ¶</a></span> +</dt> <dd> +<p>Inhibit all warning messages. </p> </dd> <dt> + <span><code class="code">-Werror</code><a class="copiable-link" href="#index-Werror"> ¶</a></span> +</dt> <dd> +<p>Make all warnings into errors. </p> </dd> <dt> + <span><code class="code">-Werror=</code><a class="copiable-link" href="#index-Werror_003d"> ¶</a></span> +</dt> <dd> +<p>Make the specified warning into an error. The specifier for a warning is appended; for example <samp class="option">-Werror=switch</samp> turns the warnings controlled by <samp class="option">-Wswitch</samp> into errors. This switch takes a negative form, to be used to negate <samp class="option">-Werror</samp> for specific warnings; for example <samp class="option">-Wno-error=switch</samp> makes <samp class="option">-Wswitch</samp> warnings not be errors, even when <samp class="option">-Werror</samp> is in effect. </p> <p>The warning message for each controllable warning includes the option that controls the warning. That option can then be used with <samp class="option">-Werror=</samp> and <samp class="option">-Wno-error=</samp> as described above. (Printing of the option in the warning message can be disabled using the <samp class="option">-fno-diagnostics-show-option</samp> flag.) </p> <p>Note that specifying <samp class="option">-Werror=</samp><var class="var">foo</var> automatically implies <samp class="option">-W</samp><var class="var">foo</var>. However, <samp class="option">-Wno-error=</samp><var class="var">foo</var> does not imply anything. </p> </dd> <dt> + <span><code class="code">-Wfatal-errors</code><a class="copiable-link" href="#index-Wfatal-errors"> ¶</a></span> +</dt> <dd> +<p>This option causes the compiler to abort compilation on the first error occurred rather than trying to keep going and printing further error messages. </p> </dd> </dl> <p>You can request many specific warnings with options beginning with ‘<samp class="samp">-W</samp>’, for example <samp class="option">-Wimplicit</samp> to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning ‘<samp class="samp">-Wno-</samp>’ to turn off warnings; for example, <samp class="option">-Wno-implicit</samp>. This manual lists only one of the two forms, whichever is not the default. For further language-specific options also refer to <a class="ref" href="c_002b_002b-dialect-options">Options Controlling C++ Dialect</a> and <a class="ref" href="objective-c-and-objective-c_002b_002b-dialect-options">Options Controlling Objective-C and Objective-C++ Dialects</a>. Additional warnings can be produced by enabling the static analyzer; See <a class="xref" href="static-analyzer-options">Options That Control Static Analysis</a>. </p> <p>Some options, such as <samp class="option">-Wall</samp> and <samp class="option">-Wextra</samp>, turn on other options, such as <samp class="option">-Wunused</samp>, which may turn on further options, such as <samp class="option">-Wunused-value</samp>. The combined effect of positive and negative forms is that more specific options have priority over less specific ones, independently of their position in the command-line. For options of the same specificity, the last one takes effect. Options enabled or disabled via pragmas (see <a class="pxref" href="diagnostic-pragmas">Diagnostic Pragmas</a>) take effect as if they appeared at the end of the command-line. </p> <p>When an unrecognized warning option is requested (e.g., <samp class="option">-Wunknown-warning</samp>), GCC emits a diagnostic stating that the option is not recognized. However, if the <samp class="option">-Wno-</samp> form is used, the behavior is slightly different: no diagnostic is produced for <samp class="option">-Wno-unknown-warning</samp> unless other diagnostics are being produced. This allows the use of new <samp class="option">-Wno-</samp> options with old compilers, but if something goes wrong, the compiler warns that an unrecognized option is present. </p> <p>The effectiveness of some warnings depends on optimizations also being enabled. For example <samp class="option">-Wsuggest-final-types</samp> is more effective with link-time optimization and some instances of other warnings may not be issued at all unless optimization is enabled. While optimization in general improves the efficacy of control and data flow sensitive warnings, in some cases it may also cause false positives. </p> <dl class="table"> <dt> + <span><code class="code">-Wpedantic</code><a class="copiable-link" href="#index-pedantic-1"> ¶</a></span> +</dt> <dt><code class="code">-pedantic</code></dt> <dd> +<p>Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do not follow ISO C and ISO C++. For ISO C, follows the version of the ISO C standard specified by any <samp class="option">-std</samp> option used. </p> <p>Valid ISO C and ISO C++ programs should compile properly with or without this option (though a rare few require <samp class="option">-ansi</samp> or a <samp class="option">-std</samp> option specifying the required version of ISO C). However, without this option, certain GNU extensions and traditional C and C++ features are supported as well. With this option, they are rejected. </p> <p><samp class="option">-Wpedantic</samp> does not cause warning messages for use of the alternate keywords whose names begin and end with ‘<samp class="samp">__</samp>’. This alternate format can also be used to disable warnings for non-ISO ‘<samp class="samp">__intN</samp>’ types, i.e. ‘<samp class="samp">__intN__</samp>’. Pedantic warnings are also disabled in the expression that follows <code class="code">__extension__</code>. However, only system header files should use these escape routes; application programs should avoid them. See <a class="xref" href="alternate-keywords">Alternate Keywords</a>. </p> <p>Some users try to use <samp class="option">-Wpedantic</samp> to check programs for strict ISO C conformance. They soon find that it does not do quite what they want: it finds some non-ISO practices, but not all—only those for which ISO C <em class="emph">requires</em> a diagnostic, and some others for which diagnostics have been added. </p> <p>A feature to report any failure to conform to ISO C might be useful in some instances, but would require considerable additional work and would be quite different from <samp class="option">-Wpedantic</samp>. We don’t have plans to support such a feature in the near future. </p> <p>Where the standard specified with <samp class="option">-std</samp> represents a GNU extended dialect of C, such as ‘<samp class="samp">gnu90</samp>’ or ‘<samp class="samp">gnu99</samp>’, there is a corresponding <em class="dfn">base standard</em>, the version of ISO C on which the GNU extended dialect is based. Warnings from <samp class="option">-Wpedantic</samp> are given where they are required by the base standard. (It does not make sense for such warnings to be given only for features not in the specified GNU C dialect, since by definition the GNU dialects of C include all features the compiler supports with the given option, and there would be nothing to warn about.) </p> </dd> <dt> +<span><code class="code">-pedantic-errors</code><a class="copiable-link" href="#index-pedantic-errors-1"> ¶</a></span> +</dt> <dd> +<p>Give an error whenever the <em class="dfn">base standard</em> (see <samp class="option">-Wpedantic</samp>) requires a diagnostic, in some cases where there is undefined behavior at compile-time and in some other cases that do not prevent compilation of programs that are valid according to the standard. This is not equivalent to <samp class="option">-Werror=pedantic</samp>, since there are errors enabled by this option and not enabled by the latter and vice versa. </p> </dd> <dt> + <span><code class="code">-Wall</code><a class="copiable-link" href="#index-Wall"> ¶</a></span> +</dt> <dd> +<p>This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros. This also enables some language-specific warnings described in <a class="ref" href="c_002b_002b-dialect-options">Options Controlling C++ Dialect</a> and <a class="ref" href="objective-c-and-objective-c_002b_002b-dialect-options">Options Controlling Objective-C and Objective-C++ Dialects</a>. </p> <p><samp class="option">-Wall</samp> turns on the following warning flags: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-Waddress +-Warray-bounds=1 <span class="r">(only with</span> <samp class="option">-O2</samp><span class="r">)</span> +-Warray-compare +-Warray-parameter=2 <span class="r">(C and Objective-C only)</span> +-Wbool-compare +-Wbool-operation +-Wc++11-compat -Wc++14-compat +-Wcatch-value <span class="r">(C++ and Objective-C++ only)</span> +-Wchar-subscripts +-Wcomment +-Wdangling-pointer=2 +-Wduplicate-decl-specifier <span class="r">(C and Objective-C only)</span> +-Wenum-compare <span class="r">(in C/ObjC; this is on by default in C++)</span> +-Wenum-int-mismatch <span class="r">(C and Objective-C only)</span> +-Wformat +-Wformat-overflow +-Wformat-truncation +-Wint-in-bool-context +-Wimplicit <span class="r">(C and Objective-C only)</span> +-Wimplicit-int <span class="r">(C and Objective-C only)</span> +-Wimplicit-function-declaration <span class="r">(C and Objective-C only)</span> +-Winit-self <span class="r">(only for C++)</span> +-Wlogical-not-parentheses +-Wmain <span class="r">(only for C/ObjC and unless</span> <samp class="option">-ffreestanding</samp><span class="r">)</span> +-Wmaybe-uninitialized +-Wmemset-elt-size +-Wmemset-transposed-args +-Wmisleading-indentation <span class="r">(only for C/C++)</span> +-Wmismatched-dealloc +-Wmismatched-new-delete <span class="r">(only for C/C++)</span> +-Wmissing-attributes +-Wmissing-braces <span class="r">(only for C/ObjC)</span> +-Wmultistatement-macros +-Wnarrowing <span class="r">(only for C++)</span> +-Wnonnull +-Wnonnull-compare +-Wopenmp-simd +-Wparentheses +-Wpessimizing-move <span class="r">(only for C++)</span> +-Wpointer-sign +-Wrange-loop-construct <span class="r">(only for C++)</span> +-Wreorder +-Wrestrict +-Wreturn-type +-Wself-move <span class="r">(only for C++)</span> +-Wsequence-point +-Wsign-compare <span class="r">(only in C++)</span> +-Wsizeof-array-div +-Wsizeof-pointer-div +-Wsizeof-pointer-memaccess +-Wstrict-aliasing +-Wstrict-overflow=1 +-Wswitch +-Wtautological-compare +-Wtrigraphs +-Wuninitialized +-Wunknown-pragmas +-Wunused-function +-Wunused-label +-Wunused-value +-Wunused-variable +-Wuse-after-free=2 +-Wvla-parameter <span class="r">(C and Objective-C only)</span> +-Wvolatile-register-var +-Wzero-length-bounds</pre> +</div> <p>Note that some warning flags are not implied by <samp class="option">-Wall</samp>. Some of them warn about constructions that users generally do not consider questionable, but which occasionally you might wish to check for; others warn about constructions that are necessary or hard to avoid in some cases, and there is no simple way to modify the code to suppress the warning. Some of them are enabled by <samp class="option">-Wextra</samp> but many of them must be enabled individually. </p> </dd> <dt> + <span><code class="code">-Wextra</code><a class="copiable-link" href="#index-W"> ¶</a></span> +</dt> <dd> +<p>This enables some extra warning flags that are not enabled by <samp class="option">-Wall</samp>. (This option used to be called <samp class="option">-W</samp>. The older name is still supported, but the newer name is more descriptive.) </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-Wclobbered +-Wcast-function-type +-Wdeprecated-copy <span class="r">(C++ only)</span> +-Wempty-body +-Wenum-conversion <span class="r">(C only)</span> +-Wignored-qualifiers +-Wimplicit-fallthrough=3 +-Wmissing-field-initializers +-Wmissing-parameter-type <span class="r">(C only)</span> +-Wold-style-declaration <span class="r">(C only)</span> +-Woverride-init +-Wsign-compare <span class="r">(C only)</span> +-Wstring-compare +-Wredundant-move <span class="r">(only for C++)</span> +-Wtype-limits +-Wuninitialized +-Wshift-negative-value <span class="r">(in C++11 to C++17 and in C99 and newer)</span> +-Wunused-parameter <span class="r">(only with</span> <samp class="option">-Wunused</samp> <span class="r">or</span> <samp class="option">-Wall</samp><span class="r">)</span> +-Wunused-but-set-parameter <span class="r">(only with</span> <samp class="option">-Wunused</samp> <span class="r">or</span> <samp class="option">-Wall</samp><span class="r">)</span></pre> +</div> <p>The option <samp class="option">-Wextra</samp> also prints warning messages for the following cases: </p> <ul class="itemize mark-bullet"> <li>A pointer is compared against integer zero with <code class="code"><</code>, <code class="code"><=</code>, <code class="code">></code>, or <code class="code">>=</code>. </li> +<li>(C++ only) An enumerator and a non-enumerator both appear in a conditional expression. </li> +<li>(C++ only) Ambiguous virtual bases. </li> +<li>(C++ only) Subscripting an array that has been declared <code class="code">register</code>. </li> +<li>(C++ only) Taking the address of a variable that has been declared <code class="code">register</code>. </li> +<li>(C++ only) A base class is not initialized in the copy constructor of a derived class. </li> +</ul> </dd> <dt> + <span><code class="code">-Wabi <span class="r">(C, Objective-C, C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wabi"> ¶</a></span> +</dt> <dd> <p>Warn about code affected by ABI changes. This includes code that may not be compatible with the vendor-neutral C++ ABI as well as the psABI for the particular target. </p> <p>Since G++ now defaults to updating the ABI with each major release, normally <samp class="option">-Wabi</samp> warns only about C++ ABI compatibility problems if there is a check added later in a release series for an ABI issue discovered since the initial release. <samp class="option">-Wabi</samp> warns about more things if an older ABI version is selected (with <samp class="option">-fabi-version=<var class="var">n</var></samp>). </p> <p><samp class="option">-Wabi</samp> can also be used with an explicit version number to warn about C++ ABI compatibility with a particular <samp class="option">-fabi-version</samp> level, e.g. <samp class="option">-Wabi=2</samp> to warn about changes relative to <samp class="option">-fabi-version=2</samp>. </p> <p>If an explicit version number is provided and <samp class="option">-fabi-compat-version</samp> is not specified, the version number from this option is used for compatibility aliases. If no explicit version number is provided with this option, but <samp class="option">-fabi-compat-version</samp> is specified, that version number is used for C++ ABI warnings. </p> <p>Although an effort has been made to warn about all such cases, there are probably some cases that are not warned about, even though G++ is generating incompatible code. There may also be cases where warnings are emitted even though the code that is generated is compatible. </p> <p>You should rewrite your code to avoid these warnings if you are concerned about the fact that code generated by G++ may not be binary compatible with code generated by other compilers. </p> <p>Known incompatibilities in <samp class="option">-fabi-version=2</samp> (which was the default from GCC 3.4 to 4.9) include: </p> <ul class="itemize mark-bullet"> <li>A template with a non-type template parameter of reference type was mangled incorrectly: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern int N; +template <int &> struct S {}; +void n (S<N>) {2}</pre> +</div> <p>This was fixed in <samp class="option">-fabi-version=3</samp>. </p> </li> +<li>SIMD vector types declared using <code class="code">__attribute ((vector_size))</code> were mangled in a non-standard way that does not allow for overloading of functions taking vectors of different sizes. <p>The mangling was changed in <samp class="option">-fabi-version=4</samp>. </p> </li> +<li> +<code class="code">__attribute ((const))</code> and <code class="code">noreturn</code> were mangled as type qualifiers, and <code class="code">decltype</code> of a plain declaration was folded away. <p>These mangling issues were fixed in <samp class="option">-fabi-version=5</samp>. </p> </li> +<li>Scoped enumerators passed as arguments to a variadic function are promoted like unscoped enumerators, causing <code class="code">va_arg</code> to complain. On most targets this does not actually affect the parameter passing ABI, as there is no way to pass an argument smaller than <code class="code">int</code>. <p>Also, the ABI changed the mangling of template argument packs, <code class="code">const_cast</code>, <code class="code">static_cast</code>, prefix increment/decrement, and a class scope function used as a template argument. </p> <p>These issues were corrected in <samp class="option">-fabi-version=6</samp>. </p> </li> +<li>Lambdas in default argument scope were mangled incorrectly, and the ABI changed the mangling of <code class="code">nullptr_t</code>. <p>These issues were corrected in <samp class="option">-fabi-version=7</samp>. </p> </li> +<li>When mangling a function type with function-cv-qualifiers, the un-qualified function type was incorrectly treated as a substitution candidate. <p>This was fixed in <samp class="option">-fabi-version=8</samp>, the default for GCC 5.1. </p> </li> +<li> +<code class="code">decltype(nullptr)</code> incorrectly had an alignment of 1, leading to unaligned accesses. Note that this did not affect the ABI of a function with a <code class="code">nullptr_t</code> parameter, as parameters have a minimum alignment. <p>This was fixed in <samp class="option">-fabi-version=9</samp>, the default for GCC 5.2. </p> </li> +<li>Target-specific attributes that affect the identity of a type, such as ia32 calling conventions on a function type (stdcall, regparm, etc.), did not affect the mangled name, leading to name collisions when function pointers were used as template arguments. <p>This was fixed in <samp class="option">-fabi-version=10</samp>, the default for GCC 6.1. </p> </li> +</ul> <p>This option also enables warnings about psABI-related changes. The known psABI changes at this point include: </p> <ul class="itemize mark-bullet"> <li>For SysV/x86-64, unions with <code class="code">long double</code> members are passed in memory as specified in psABI. Prior to GCC 4.4, this was not the case. For example: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">union U { + long double ld; + int i; +};</pre> +</div> <p><code class="code">union U</code> is now always passed in memory. </p> </li> +</ul> </dd> <dt><code class="code">-Wno-changes-meaning <span class="r">(C++ and Objective-C++ only)</span></code></dt> <dd> +<p>C++ requires that unqualified uses of a name within a class have the same meaning in the complete scope of the class, so declaring the name after using it is ill-formed: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct A; +struct B1 { A a; typedef A A; }; // warning, 'A' changes meaning +struct B2 { A a; struct A { }; }; // error, 'A' changes meaning</pre> +</div> <p>By default, the B1 case is only a warning because the two declarations have the same type, while the B2 case is an error. Both diagnostics can be disabled with <samp class="option">-Wno-changes-meaning</samp>. Alternately, the error case can be reduced to a warning with <samp class="option">-Wno-error=changes-meaning</samp> or <samp class="option">-fpermissive</samp>. </p> <p>Both diagnostics are also suppressed by <samp class="option">-fms-extensions</samp>. </p> </dd> <dt> + <span><code class="code">-Wchar-subscripts</code><a class="copiable-link" href="#index-Wchar-subscripts"> ¶</a></span> +</dt> <dd> +<p>Warn if an array subscript has type <code class="code">char</code>. This is a common cause of error, as programmers often forget that this type is signed on some machines. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-coverage-mismatch</code><a class="copiable-link" href="#index-Wno-coverage-mismatch"> ¶</a></span> +</dt> <dd> +<p>Warn if feedback profiles do not match when using the <samp class="option">-fprofile-use</samp> option. If a source file is changed between compiling with <samp class="option">-fprofile-generate</samp> and with <samp class="option">-fprofile-use</samp>, the files with the profile feedback can fail to match the source file and GCC cannot use the profile feedback information. By default, this warning is enabled and is treated as an error. <samp class="option">-Wno-coverage-mismatch</samp> can be used to disable the warning or <samp class="option">-Wno-error=coverage-mismatch</samp> can be used to disable the error. Disabling the error for this warning can result in poorly optimized code and is useful only in the case of very minor changes such as bug fixes to an existing code-base. Completely disabling the warning is not recommended. </p> </dd> <dt> + <span><code class="code">-Wno-coverage-invalid-line-number</code><a class="copiable-link" href="#index-Wno-coverage-invalid-line-number"> ¶</a></span> +</dt> <dd> +<p>Warn in case a function ends earlier than it begins due to an invalid linenum macros. The warning is emitted only with <samp class="option">--coverage</samp> enabled. </p> <p>By default, this warning is enabled and is treated as an error. <samp class="option">-Wno-coverage-invalid-line-number</samp> can be used to disable the warning or <samp class="option">-Wno-error=coverage-invalid-line-number</samp> can be used to disable the error. </p> </dd> <dt> + <span><code class="code">-Wno-cpp <span class="r">(C, Objective-C, C++, Objective-C++ and Fortran only)</span></code><a class="copiable-link" href="#index-Wno-cpp"> ¶</a></span> +</dt> <dd> +<p>Suppress warning messages emitted by <code class="code">#warning</code> directives. </p> </dd> <dt> + <span><code class="code">-Wdouble-promotion <span class="r">(C, C++, Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wdouble-promotion"> ¶</a></span> +</dt> <dd> +<p>Give a warning when a value of type <code class="code">float</code> is implicitly promoted to <code class="code">double</code>. CPUs with a 32-bit “single-precision” floating-point unit implement <code class="code">float</code> in hardware, but emulate <code class="code">double</code> in software. On such a machine, doing computations using <code class="code">double</code> values is much more expensive because of the overhead required for software emulation. </p> <p>It is easy to accidentally do computations with <code class="code">double</code> because floating-point literals are implicitly of type <code class="code">double</code>. For example, in: </p> +<div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">float area(float radius) +{ + return 3.14159 * radius * radius; +}</pre></div> +</div> <p>the compiler performs the entire computation with <code class="code">double</code> because the floating-point literal is a <code class="code">double</code>. </p> </dd> <dt> + <span><code class="code">-Wduplicate-decl-specifier <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wduplicate-decl-specifier"> ¶</a></span> +</dt> <dd> +<p>Warn if a declaration has duplicate <code class="code">const</code>, <code class="code">volatile</code>, <code class="code">restrict</code> or <code class="code">_Atomic</code> specifier. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wformat</code><a class="copiable-link" href="#index-Wformat"> ¶</a></span> +</dt> <dt><code class="code">-Wformat=<var class="var">n</var></code></dt> <dd> +<p>Check calls to <code class="code">printf</code> and <code class="code">scanf</code>, etc., to make sure that the arguments supplied have types appropriate to the format string specified, and that the conversions specified in the format string make sense. This includes standard functions, and others specified by format attributes (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>), in the <code class="code">printf</code>, <code class="code">scanf</code>, <code class="code">strftime</code> and <code class="code">strfmon</code> (an X/Open extension, not in the C standard) families (or other target-specific families). Which functions are checked without format attributes having been specified depends on the standard version selected, and such checks of functions without the attribute specified are disabled by <samp class="option">-ffreestanding</samp> or <samp class="option">-fno-builtin</samp>. </p> <p>The formats are checked against the format features supported by GNU libc version 2.2. These include all ISO C90 and C99 features, as well as features from the Single Unix Specification and some BSD and GNU extensions. Other library implementations may not support all these features; GCC does not support warning about features that go beyond a particular library’s limitations. However, if <samp class="option">-Wpedantic</samp> is used with <samp class="option">-Wformat</samp>, warnings are given about format features not in the selected standard version (but not for <code class="code">strfmon</code> formats, since those are not in any version of the C standard). See <a class="xref" href="c-dialect-options">Options Controlling C Dialect</a>. </p> <dl class="table"> <dt> + <span><code class="code">-Wformat=1</code><a class="copiable-link" href="#index-Wformat-1"> ¶</a></span> +</dt> <dt><code class="code">-Wformat</code></dt> <dd> +<p>Option <samp class="option">-Wformat</samp> is equivalent to <samp class="option">-Wformat=1</samp>, and <samp class="option">-Wno-format</samp> is equivalent to <samp class="option">-Wformat=0</samp>. Since <samp class="option">-Wformat</samp> also checks for null format arguments for several functions, <samp class="option">-Wformat</samp> also implies <samp class="option">-Wnonnull</samp>. Some aspects of this level of format checking can be disabled by the options: <samp class="option">-Wno-format-contains-nul</samp>, <samp class="option">-Wno-format-extra-args</samp>, and <samp class="option">-Wno-format-zero-length</samp>. <samp class="option">-Wformat</samp> is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> +<span><code class="code">-Wformat=2</code><a class="copiable-link" href="#index-Wformat_003d2"> ¶</a></span> +</dt> <dd><p>Enable <samp class="option">-Wformat</samp> plus additional format checks. Currently equivalent to <samp class="option">-Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k</samp>. </p></dd> </dl> </dd> <dt> + <span><code class="code">-Wno-format-contains-nul</code><a class="copiable-link" href="#index-Wno-format-contains-nul"> ¶</a></span> +</dt> <dd> +<p>If <samp class="option">-Wformat</samp> is specified, do not warn about format strings that contain NUL bytes. </p> </dd> <dt> + <span><code class="code">-Wno-format-extra-args</code><a class="copiable-link" href="#index-Wno-format-extra-args"> ¶</a></span> +</dt> <dd> +<p>If <samp class="option">-Wformat</samp> is specified, do not warn about excess arguments to a <code class="code">printf</code> or <code class="code">scanf</code> format function. The C standard specifies that such arguments are ignored. </p> <p>Where the unused arguments lie between used arguments that are specified with ‘<samp class="samp">$</samp>’ operand number specifications, normally warnings are still given, since the implementation could not know what type to pass to <code class="code">va_arg</code> to skip the unused arguments. However, in the case of <code class="code">scanf</code> formats, this option suppresses the warning if the unused arguments are all pointers, since the Single Unix Specification says that such unused arguments are allowed. </p> </dd> <dt> + <span><code class="code">-Wformat-overflow</code><a class="copiable-link" href="#index-Wformat-overflow"> ¶</a></span> +</dt> <dt><code class="code">-Wformat-overflow=<var class="var">level</var></code></dt> <dd> +<p>Warn about calls to formatted input/output functions such as <code class="code">sprintf</code> and <code class="code">vsprintf</code> that might overflow the destination buffer. When the exact number of bytes written by a format directive cannot be determined at compile-time it is estimated based on heuristics that depend on the <var class="var">level</var> argument and on optimization. While enabling optimization will in most cases improve the accuracy of the warning, it may also result in false positives. </p> <dl class="table"> <dt> + <span><code class="code">-Wformat-overflow</code><a class="copiable-link" href="#index-Wformat-overflow-1"> ¶</a></span> +</dt> <dt><code class="code">-Wformat-overflow=1</code></dt> <dd> +<p>Level <var class="var">1</var> of <samp class="option">-Wformat-overflow</samp> enabled by <samp class="option">-Wformat</samp> employs a conservative approach that warns only about calls that most likely overflow the buffer. At this level, numeric arguments to format directives with unknown values are assumed to have the value of one, and strings of unknown length to be empty. Numeric arguments that are known to be bounded to a subrange of their type, or string arguments whose output is bounded either by their directive’s precision or by a finite set of string literals, are assumed to take on the value within the range that results in the most bytes on output. For example, the call to <code class="code">sprintf</code> below is diagnosed because even with both <var class="var">a</var> and <var class="var">b</var> equal to zero, the terminating NUL character (<code class="code">'\0'</code>) appended by the function to the destination buffer will be written past its end. Increasing the size of the buffer by a single byte is sufficient to avoid the warning, though it may not be sufficient to avoid the overflow. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (int a, int b) +{ + char buf [13]; + sprintf (buf, "a = %i, b = %i\n", a, b); +}</pre> +</div> </dd> <dt><code class="code">-Wformat-overflow=2</code></dt> <dd> +<p>Level <var class="var">2</var> warns also about calls that might overflow the destination buffer given an argument of sufficient length or magnitude. At level <var class="var">2</var>, unknown numeric arguments are assumed to have the minimum representable value for signed types with a precision greater than 1, and the maximum representable value otherwise. Unknown string arguments whose length cannot be assumed to be bounded either by the directive’s precision, or by a finite set of string literals they may evaluate to, or the character array they may point to, are assumed to be 1 character long. </p> <p>At level <var class="var">2</var>, the call in the example above is again diagnosed, but this time because with <var class="var">a</var> equal to a 32-bit <code class="code">INT_MIN</code> the first <code class="code">%i</code> directive will write some of its digits beyond the end of the destination buffer. To make the call safe regardless of the values of the two variables, the size of the destination buffer must be increased to at least 34 bytes. GCC includes the minimum size of the buffer in an informational note following the warning. </p> <p>An alternative to increasing the size of the destination buffer is to constrain the range of formatted values. The maximum length of string arguments can be bounded by specifying the precision in the format directive. When numeric arguments of format directives can be assumed to be bounded by less than the precision of their type, choosing an appropriate length modifier to the format specifier will reduce the required buffer size. For example, if <var class="var">a</var> and <var class="var">b</var> in the example above can be assumed to be within the precision of the <code class="code">short int</code> type then using either the <code class="code">%hi</code> format directive or casting the argument to <code class="code">short</code> reduces the maximum required size of the buffer to 24 bytes. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (int a, int b) +{ + char buf [23]; + sprintf (buf, "a = %hi, b = %i\n", a, (short)b); +}</pre> +</div> </dd> </dl> </dd> <dt> + <span><code class="code">-Wno-format-zero-length</code><a class="copiable-link" href="#index-Wno-format-zero-length"> ¶</a></span> +</dt> <dd> +<p>If <samp class="option">-Wformat</samp> is specified, do not warn about zero-length formats. The C standard specifies that zero-length formats are allowed. </p> </dd> <dt> + <span><code class="code">-Wformat-nonliteral</code><a class="copiable-link" href="#index-Wformat-nonliteral"> ¶</a></span> +</dt> <dd> +<p>If <samp class="option">-Wformat</samp> is specified, also warn if the format string is not a string literal and so cannot be checked, unless the format function takes its format arguments as a <code class="code">va_list</code>. </p> </dd> <dt> + <span><code class="code">-Wformat-security</code><a class="copiable-link" href="#index-Wformat-security"> ¶</a></span> +</dt> <dd> +<p>If <samp class="option">-Wformat</samp> is specified, also warn about uses of format functions that represent possible security problems. At present, this warns about calls to <code class="code">printf</code> and <code class="code">scanf</code> functions where the format string is not a string literal and there are no format arguments, as in <code class="code">printf (foo);</code>. This may be a security hole if the format string came from untrusted input and contains ‘<samp class="samp">%n</samp>’. (This is currently a subset of what <samp class="option">-Wformat-nonliteral</samp> warns about, but in future warnings may be added to <samp class="option">-Wformat-security</samp> that are not included in <samp class="option">-Wformat-nonliteral</samp>.) </p> </dd> <dt> + <span><code class="code">-Wformat-signedness</code><a class="copiable-link" href="#index-Wformat-signedness"> ¶</a></span> +</dt> <dd> +<p>If <samp class="option">-Wformat</samp> is specified, also warn if the format string requires an unsigned argument and the argument is signed and vice versa. </p> </dd> <dt> + <span><code class="code">-Wformat-truncation</code><a class="copiable-link" href="#index-Wformat-truncation"> ¶</a></span> +</dt> <dt><code class="code">-Wformat-truncation=<var class="var">level</var></code></dt> <dd> +<p>Warn about calls to formatted input/output functions such as <code class="code">snprintf</code> and <code class="code">vsnprintf</code> that might result in output truncation. When the exact number of bytes written by a format directive cannot be determined at compile-time it is estimated based on heuristics that depend on the <var class="var">level</var> argument and on optimization. While enabling optimization will in most cases improve the accuracy of the warning, it may also result in false positives. Except as noted otherwise, the option uses the same logic <samp class="option">-Wformat-overflow</samp>. </p> <dl class="table"> <dt> + <span><code class="code">-Wformat-truncation</code><a class="copiable-link" href="#index-Wformat-truncation-1"> ¶</a></span> +</dt> <dt><code class="code">-Wformat-truncation=1</code></dt> <dd> +<p>Level <var class="var">1</var> of <samp class="option">-Wformat-truncation</samp> enabled by <samp class="option">-Wformat</samp> employs a conservative approach that warns only about calls to bounded functions whose return value is unused and that will most likely result in output truncation. </p> </dd> <dt><code class="code">-Wformat-truncation=2</code></dt> <dd><p>Level <var class="var">2</var> warns also about calls to bounded functions whose return value is used and that might result in truncation given an argument of sufficient length or magnitude. </p></dd> </dl> </dd> <dt> + <span><code class="code">-Wformat-y2k</code><a class="copiable-link" href="#index-Wformat-y2k"> ¶</a></span> +</dt> <dd> +<p>If <samp class="option">-Wformat</samp> is specified, also warn about <code class="code">strftime</code> formats that may yield only a two-digit year. </p> </dd> <dt> + <span><code class="code">-Wnonnull</code><a class="copiable-link" href="#index-Wnonnull"> ¶</a></span> +</dt> <dd> +<p>Warn about passing a null pointer for arguments marked as requiring a non-null value by the <code class="code">nonnull</code> function attribute. </p> <p><samp class="option">-Wnonnull</samp> is included in <samp class="option">-Wall</samp> and <samp class="option">-Wformat</samp>. It can be disabled with the <samp class="option">-Wno-nonnull</samp> option. </p> </dd> <dt> + <span><code class="code">-Wnonnull-compare</code><a class="copiable-link" href="#index-Wnonnull-compare"> ¶</a></span> +</dt> <dd> +<p>Warn when comparing an argument marked with the <code class="code">nonnull</code> function attribute against null inside the function. </p> <p><samp class="option">-Wnonnull-compare</samp> is included in <samp class="option">-Wall</samp>. It can be disabled with the <samp class="option">-Wno-nonnull-compare</samp> option. </p> </dd> <dt> + <span><code class="code">-Wnull-dereference</code><a class="copiable-link" href="#index-Wnull-dereference"> ¶</a></span> +</dt> <dd> +<p>Warn if the compiler detects paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. This option is only active when <samp class="option">-fdelete-null-pointer-checks</samp> is active, which is enabled by optimizations in most targets. The precision of the warnings depends on the optimization options used. </p> </dd> <dt> + <span><code class="code">-Winfinite-recursion</code><a class="copiable-link" href="#index-Winfinite-recursion"> ¶</a></span> +</dt> <dd> +<p>Warn about infinitely recursive calls. The warning is effective at all optimization levels but requires optimization in order to detect infinite recursion in calls between two or more functions. <samp class="option">-Winfinite-recursion</samp> is included in <samp class="option">-Wall</samp>. </p> <p>Compare with <samp class="option">-Wanalyzer-infinite-recursion</samp> which provides a similar diagnostic, but is implemented in a different way (as part of <samp class="option">-fanalyzer</samp>). </p> </dd> <dt> + <span><code class="code">-Winit-self <span class="r">(C, C++, Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Winit-self"> ¶</a></span> +</dt> <dd> +<p>Warn about uninitialized variables that are initialized with themselves. Note this option can only be used with the <samp class="option">-Wuninitialized</samp> option. </p> <p>For example, GCC warns about <code class="code">i</code> being uninitialized in the following snippet only when <samp class="option">-Winit-self</samp> has been specified: </p> +<div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">int f() +{ + int i = i; + return i; +}</pre></div> +</div> <p>This warning is enabled by <samp class="option">-Wall</samp> in C++. </p> </dd> <dt> + <span><code class="code">-Wno-implicit-int <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wimplicit-int"> ¶</a></span> +</dt> <dd> +<p>This option controls warnings when a declaration does not specify a type. This warning is enabled by default in C99 and later dialects of C, and also by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-implicit-function-declaration <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wimplicit-function-declaration"> ¶</a></span> +</dt> <dd> +<p>This option controls warnings when a function is used before being declared. This warning is enabled by default in C99 and later dialects of C, and also by <samp class="option">-Wall</samp>. The warning is made into an error by <samp class="option">-pedantic-errors</samp>. </p> </dd> <dt> + <span><code class="code">-Wimplicit <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wimplicit"> ¶</a></span> +</dt> <dd> +<p>Same as <samp class="option">-Wimplicit-int</samp> and <samp class="option">-Wimplicit-function-declaration</samp>. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wimplicit-fallthrough</code><a class="copiable-link" href="#index-Wimplicit-fallthrough"> ¶</a></span> +</dt> <dd> +<p><samp class="option">-Wimplicit-fallthrough</samp> is the same as <samp class="option">-Wimplicit-fallthrough=3</samp> and <samp class="option">-Wno-implicit-fallthrough</samp> is the same as <samp class="option">-Wimplicit-fallthrough=0</samp>. </p> </dd> <dt> +<span><code class="code">-Wimplicit-fallthrough=<var class="var">n</var></code><a class="copiable-link" href="#index-Wimplicit-fallthrough_003d"> ¶</a></span> +</dt> <dd> +<p>Warn when a switch case falls through. For example: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">switch (cond) + { + case 1: + a = 1; + break; + case 2: + a = 2; + case 3: + a = 3; + break; + }</pre></div> +</div> <p>This warning does not warn when the last statement of a case cannot fall through, e.g. when there is a return statement or a call to function declared with the noreturn attribute. <samp class="option">-Wimplicit-fallthrough=</samp> also takes into account control flow statements, such as ifs, and only warns when appropriate. E.g. </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">switch (cond) + { + case 1: + if (i > 3) { + bar (5); + break; + } else if (i < 1) { + bar (0); + } else + return; + default: + … + }</pre></div> +</div> <p>Since there are occasions where a switch case fall through is desirable, GCC provides an attribute, <code class="code">__attribute__ ((fallthrough))</code>, that is to be used along with a null statement to suppress this warning that would normally occur: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">switch (cond) + { + case 1: + bar (0); + __attribute__ ((fallthrough)); + default: + … + }</pre></div> +</div> <p>C++17 provides a standard way to suppress the <samp class="option">-Wimplicit-fallthrough</samp> warning using <code class="code">[[fallthrough]];</code> instead of the GNU attribute. In C++11 or C++14 users can use <code class="code">[[gnu::fallthrough]];</code>, which is a GNU extension. Instead of these attributes, it is also possible to add a fallthrough comment to silence the warning. The whole body of the C or C++ style comment should match the given regular expressions listed below. The option argument <var class="var">n</var> specifies what kind of comments are accepted: </p> <ul class="itemize mark-bullet"> <li> +<samp class="option">-Wimplicit-fallthrough=0</samp> disables the warning altogether. </li> +<li> +<samp class="option">-Wimplicit-fallthrough=1</samp> matches <code class="code">.*</code> regular expression, any comment is used as fallthrough comment. </li> +<li> +<samp class="option">-Wimplicit-fallthrough=2</samp> case insensitively matches <code class="code">.*falls?[ \t-]*thr(ough|u).*</code> regular expression. </li> +<li> +<samp class="option">-Wimplicit-fallthrough=3</samp> case sensitively matches one of the following regular expressions: <ul class="itemize mark-bullet"> <li> +<code class="code">-fallthrough</code> </li> +<li> +<code class="code">@fallthrough@</code> </li> +<li> +<code class="code">lint -fallthrough[ \t]*</code> </li> +<li> +<code class="code">[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?</code> </li> +<li> +<code class="code">[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?</code> </li> +<li> +<code class="code">[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?</code> </li> +</ul> </li> +<li> +<samp class="option">-Wimplicit-fallthrough=4</samp> case sensitively matches one of the following regular expressions: <ul class="itemize mark-bullet"> <li> +<code class="code">-fallthrough</code> </li> +<li> +<code class="code">@fallthrough@</code> </li> +<li> +<code class="code">lint -fallthrough[ \t]*</code> </li> +<li> +<code class="code">[ \t]*FALLTHR(OUGH|U)[ \t]*</code> </li> +</ul> </li> +<li> +<samp class="option">-Wimplicit-fallthrough=5</samp> doesn’t recognize any comments as fallthrough comments, only attributes disable the warning. </li> +</ul> <p>The comment needs to be followed after optional whitespace and other comments by <code class="code">case</code> or <code class="code">default</code> keywords or by a user label that precedes some <code class="code">case</code> or <code class="code">default</code> label. </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">switch (cond) + { + case 1: + bar (0); + /* FALLTHRU */ + default: + … + }</pre></div> +</div> <p>The <samp class="option">-Wimplicit-fallthrough=3</samp> warning is enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-if-not-aligned <span class="r">(C, C++, Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wif-not-aligned"> ¶</a></span> +</dt> <dd> +<p>Control if warnings triggered by the <code class="code">warn_if_not_aligned</code> attribute should be issued. These warnings are enabled by default. </p> </dd> <dt> + <span><code class="code">-Wignored-qualifiers <span class="r">(C and C++ only)</span></code><a class="copiable-link" href="#index-Wignored-qualifiers"> ¶</a></span> +</dt> <dd> +<p>Warn if the return type of a function has a type qualifier such as <code class="code">const</code>. For ISO C such a type qualifier has no effect, since the value returned by a function is not an lvalue. For C++, the warning is only emitted for scalar types or <code class="code">void</code>. ISO C prohibits qualified <code class="code">void</code> return types on function definitions, so such return types always receive a warning even without this option. </p> <p>This warning is also enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-ignored-attributes <span class="r">(C and C++ only)</span></code><a class="copiable-link" href="#index-Wignored-attributes"> ¶</a></span> +</dt> <dd> +<p>This option controls warnings when an attribute is ignored. This is different from the <samp class="option">-Wattributes</samp> option in that it warns whenever the compiler decides to drop an attribute, not that the attribute is either unknown, used in a wrong place, etc. This warning is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wmain</code><a class="copiable-link" href="#index-Wmain"> ¶</a></span> +</dt> <dd> +<p>Warn if the type of <code class="code">main</code> is suspicious. <code class="code">main</code> should be a function with external linkage, returning int, taking either zero arguments, two, or three arguments of appropriate types. This warning is enabled by default in C++ and is enabled by either <samp class="option">-Wall</samp> or <samp class="option">-Wpedantic</samp>. </p> </dd> <dt> + <span><code class="code">-Wmisleading-indentation <span class="r">(C and C++ only)</span></code><a class="copiable-link" href="#index-Wmisleading-indentation"> ¶</a></span> +</dt> <dd> +<p>Warn when the indentation of the code does not reflect the block structure. Specifically, a warning is issued for <code class="code">if</code>, <code class="code">else</code>, <code class="code">while</code>, and <code class="code">for</code> clauses with a guarded statement that does not use braces, followed by an unguarded statement with the same indentation. </p> <p>In the following example, the call to “bar” is misleadingly indented as if it were guarded by the “if” conditional. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (some_condition ()) + foo (); + bar (); /* Gotcha: this is not guarded by the "if". */</pre> +</div> <p>In the case of mixed tabs and spaces, the warning uses the <samp class="option">-ftabstop=</samp> option to determine if the statements line up (defaulting to 8). </p> <p>The warning is not issued for code involving multiline preprocessor logic such as the following example. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (flagA) + foo (0); +#if SOME_CONDITION_THAT_DOES_NOT_HOLD + if (flagB) +#endif + foo (1);</pre> +</div> <p>The warning is not issued after a <code class="code">#line</code> directive, since this typically indicates autogenerated code, and no assumptions can be made about the layout of the file that the directive references. </p> <p>This warning is enabled by <samp class="option">-Wall</samp> in C and C++. </p> </dd> <dt> + <span><code class="code">-Wmissing-attributes</code><a class="copiable-link" href="#index-Wmissing-attributes"> ¶</a></span> +</dt> <dd> +<p>Warn when a declaration of a function is missing one or more attributes that a related function is declared with and whose absence may adversely affect the correctness or efficiency of generated code. For example, the warning is issued for declarations of aliases that use attributes to specify less restrictive requirements than those of their targets. This typically represents a potential optimization opportunity. By contrast, the <samp class="option">-Wattribute-alias=2</samp> option controls warnings issued when the alias is more restrictive than the target, which could lead to incorrect code generation. Attributes considered include <code class="code">alloc_align</code>, <code class="code">alloc_size</code>, <code class="code">cold</code>, <code class="code">const</code>, <code class="code">hot</code>, <code class="code">leaf</code>, <code class="code">malloc</code>, <code class="code">nonnull</code>, <code class="code">noreturn</code>, <code class="code">nothrow</code>, <code class="code">pure</code>, <code class="code">returns_nonnull</code>, and <code class="code">returns_twice</code>. </p> <p>In C++, the warning is issued when an explicit specialization of a primary template declared with attribute <code class="code">alloc_align</code>, <code class="code">alloc_size</code>, <code class="code">assume_aligned</code>, <code class="code">format</code>, <code class="code">format_arg</code>, <code class="code">malloc</code>, or <code class="code">nonnull</code> is declared without it. Attributes <code class="code">deprecated</code>, <code class="code">error</code>, and <code class="code">warning</code> suppress the warning. (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> <p>You can use the <code class="code">copy</code> attribute to apply the same set of attributes to a declaration as that on another declaration without explicitly enumerating the attributes. This attribute can be applied to declarations of functions (see <a class="pxref" href="common-function-attributes">Common Function Attributes</a>), variables (see <a class="pxref" href="common-variable-attributes">Common Variable Attributes</a>), or types (see <a class="pxref" href="common-type-attributes">Common Type Attributes</a>). </p> <p><samp class="option">-Wmissing-attributes</samp> is enabled by <samp class="option">-Wall</samp>. </p> <p>For example, since the declaration of the primary function template below makes use of both attribute <code class="code">malloc</code> and <code class="code">alloc_size</code> the declaration of the explicit specialization of the template is diagnosed because it is missing one of the attributes. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">template <class T> +T* __attribute__ ((malloc, alloc_size (1))) +allocate (size_t); + +template <> +void* __attribute__ ((malloc)) // missing alloc_size +allocate<void> (size_t);</pre> +</div> </dd> <dt> + <span><code class="code">-Wmissing-braces</code><a class="copiable-link" href="#index-Wmissing-braces"> ¶</a></span> +</dt> <dd> +<p>Warn if an aggregate or union initializer is not fully bracketed. In the following example, the initializer for <code class="code">a</code> is not fully bracketed, but that for <code class="code">b</code> is fully bracketed. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int a[2][2] = { 0, 1, 2, 3 }; +int b[2][2] = { { 0, 1 }, { 2, 3 } };</pre> +</div> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wmissing-include-dirs <span class="r">(C, C++, Objective-C, Objective-C++ and Fortran only)</span></code><a class="copiable-link" href="#index-Wmissing-include-dirs"> ¶</a></span> +</dt> <dd> +<p>Warn if a user-supplied include directory does not exist. This opions is disabled by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially enabled by default by warning for -I and -J, only. </p> </dd> <dt> + <span><code class="code">-Wno-missing-profile</code><a class="copiable-link" href="#index-Wmissing-profile"> ¶</a></span> +</dt> <dd> +<p>This option controls warnings if feedback profiles are missing when using the <samp class="option">-fprofile-use</samp> option. This option diagnoses those cases where a new function or a new file is added between compiling with <samp class="option">-fprofile-generate</samp> and with <samp class="option">-fprofile-use</samp>, without regenerating the profiles. In these cases, the profile feedback data files do not contain any profile feedback information for the newly added function or file respectively. Also, in the case when profile count data (.gcda) files are removed, GCC cannot use any profile feedback information. In all these cases, warnings are issued to inform you that a profile generation step is due. Ignoring the warning can result in poorly optimized code. <samp class="option">-Wno-missing-profile</samp> can be used to disable the warning, but this is not recommended and should be done only when non-existent profile data is justified. </p> </dd> <dt> + <span><code class="code">-Wmismatched-dealloc</code><a class="copiable-link" href="#index-Wmismatched-dealloc"> ¶</a></span> +</dt> <dd> <p>Warn for calls to deallocation functions with pointer arguments returned from from allocations functions for which the former isn’t a suitable deallocator. A pair of functions can be associated as matching allocators and deallocators by use of attribute <code class="code">malloc</code>. Unless disabled by the <samp class="option">-fno-builtin</samp> option the standard functions <code class="code">calloc</code>, <code class="code">malloc</code>, <code class="code">realloc</code>, and <code class="code">free</code>, as well as the corresponding forms of C++ <code class="code">operator new</code> and <code class="code">operator delete</code> are implicitly associated as matching allocators and deallocators. In the following example <code class="code">mydealloc</code> is the deallocator for pointers returned from <code class="code">myalloc</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void mydealloc (void*); + +__attribute__ ((malloc (mydealloc, 1))) void* +myalloc (size_t); + +void f (void) +{ + void *p = myalloc (32); + // …use p… + free (p); // warning: not a matching deallocator for myalloc + mydealloc (p); // ok +}</pre> +</div> <p>In C++, the related option <samp class="option">-Wmismatched-new-delete</samp> diagnoses mismatches involving either <code class="code">operator new</code> or <code class="code">operator delete</code>. </p> <p>Option <samp class="option">-Wmismatched-dealloc</samp> is included in <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wmultistatement-macros</code><a class="copiable-link" href="#index-Wmultistatement-macros"> ¶</a></span> +</dt> <dd> +<p>Warn about unsafe multiple statement macros that appear to be guarded by a clause such as <code class="code">if</code>, <code class="code">else</code>, <code class="code">for</code>, <code class="code">switch</code>, or <code class="code">while</code>, in which only the first statement is actually guarded after the macro is expanded. </p> <p>For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define DOIT x++; y++ +if (c) + DOIT;</pre> +</div> <p>will increment <code class="code">y</code> unconditionally, not just when <code class="code">c</code> holds. The can usually be fixed by wrapping the macro in a do-while loop: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define DOIT do { x++; y++; } while (0) +if (c) + DOIT;</pre> +</div> <p>This warning is enabled by <samp class="option">-Wall</samp> in C and C++. </p> </dd> <dt> + <span><code class="code">-Wparentheses</code><a class="copiable-link" href="#index-Wparentheses"> ¶</a></span> +</dt> <dd> +<p>Warn if parentheses are omitted in certain contexts, such as when there is an assignment in a context where a truth value is expected, or when operators are nested whose precedence people often get confused about. </p> <p>Also warn if a comparison like <code class="code">x<=y<=z</code> appears; this is equivalent to <code class="code">(x<=y ? 1 : 0) <= z</code>, which is a different interpretation from that of ordinary mathematical notation. </p> <p>Also warn for dangerous uses of the GNU extension to <code class="code">?:</code> with omitted middle operand. When the condition in the <code class="code">?</code>: operator is a boolean expression, the omitted value is always 1. Often programmers expect it to be a value computed inside the conditional expression instead. </p> <p>For C++ this also warns for some cases of unnecessary parentheses in declarations, which can indicate an attempt at a function call instead of a declaration: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ + // Declares a local variable called mymutex. + std::unique_lock<std::mutex> (mymutex); + // User meant std::unique_lock<std::mutex> lock (mymutex); +}</pre> +</div> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-self-move <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wself-move"> ¶</a></span> +</dt> <dd> +<p>This warning warns when a value is moved to itself with <code class="code">std::move</code>. Such a <code class="code">std::move</code> typically has no effect. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct T { +… +}; +void fn() +{ + T t; + … + t = std::move (t); +}</pre> +</div> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wsequence-point</code><a class="copiable-link" href="#index-Wsequence-point"> ¶</a></span> +</dt> <dd> +<p>Warn about code that may have undefined semantics because of violations of sequence point rules in the C and C++ standards. </p> <p>The C and C++ standards define the order in which expressions in a C/C++ program are evaluated in terms of <em class="dfn">sequence points</em>, which represent a partial ordering between the execution of parts of the program: those executed before the sequence point, and those executed after it. These occur after the evaluation of a full expression (one which is not part of a larger expression), after the evaluation of the first operand of a <code class="code">&&</code>, <code class="code">||</code>, <code class="code">? :</code> or <code class="code">,</code> (comma) operator, before a function is called (but after the evaluation of its arguments and the expression denoting the called function), and in certain other places. Other than as expressed by the sequence point rules, the order of evaluation of subexpressions of an expression is not specified. All these rules describe only a partial order rather than a total order, since, for example, if two functions are called within one expression with no sequence point between them, the order in which the functions are called is not specified. However, the standards committee have ruled that function calls do not overlap. </p> <p>It is not specified when between sequence points modifications to the values of objects take effect. Programs whose behavior depends on this have undefined behavior; the C and C++ standards specify that “Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.”. If a program breaks these rules, the results on any particular implementation are entirely unpredictable. </p> <p>Examples of code with undefined behavior are <code class="code">a = a++;</code>, <code class="code">a[n] += b[n++]</code> and <code class="code">a[i++] = i;</code>. Some more complicated cases are not diagnosed by this option, and it may give an occasional false positive result, but in general it has been found fairly effective at detecting this sort of problem in programs. </p> <p>The C++17 standard will define the order of evaluation of operands in more cases: in particular it requires that the right-hand side of an assignment be evaluated before the left-hand side, so the above examples are no longer undefined. But this option will still warn about them, to help people avoid writing code that is undefined in C and earlier revisions of C++. </p> <p>The standard is worded confusingly, therefore there is some debate over the precise meaning of the sequence point rules in subtle cases. Links to discussions of the problem, including proposed formal definitions, may be found on the GCC readings page, at <a class="uref" href="https://gcc.gnu.org/readings.html">https://gcc.gnu.org/readings.html</a>. </p> <p>This warning is enabled by <samp class="option">-Wall</samp> for C and C++. </p> </dd> <dt> + <span><code class="code">-Wno-return-local-addr</code><a class="copiable-link" href="#index-Wno-return-local-addr"> ¶</a></span> +</dt> <dd> +<p>Do not warn about returning a pointer (or in C++, a reference) to a variable that goes out of scope after the function returns. </p> </dd> <dt> + <span><code class="code">-Wreturn-type</code><a class="copiable-link" href="#index-Wreturn-type"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a function is defined with a return type that defaults to <code class="code">int</code>. Also warn about any <code class="code">return</code> statement with no return value in a function whose return type is not <code class="code">void</code> (falling off the end of the function body is considered returning without a value). </p> <p>For C only, warn about a <code class="code">return</code> statement with an expression in a function whose return type is <code class="code">void</code>, unless the expression type is also <code class="code">void</code>. As a GNU extension, the latter case is accepted without a warning unless <samp class="option">-Wpedantic</samp> is used. Attempting to use the return value of a non-<code class="code">void</code> function other than <code class="code">main</code> that flows off the end by reaching the closing curly brace that terminates the function is undefined. </p> <p>Unlike in C, in C++, flowing off the end of a non-<code class="code">void</code> function other than <code class="code">main</code> results in undefined behavior even when the value of the function is not used. </p> <p>This warning is enabled by default in C++ and by <samp class="option">-Wall</samp> otherwise. </p> </dd> <dt> + <span><code class="code">-Wno-shift-count-negative</code><a class="copiable-link" href="#index-Wshift-count-negative"> ¶</a></span> +</dt> <dd> +<p>Controls warnings if a shift count is negative. This warning is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wno-shift-count-overflow</code><a class="copiable-link" href="#index-Wshift-count-overflow"> ¶</a></span> +</dt> <dd> +<p>Controls warnings if a shift count is greater than or equal to the bit width of the type. This warning is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wshift-negative-value</code><a class="copiable-link" href="#index-Wshift-negative-value"> ¶</a></span> +</dt> <dd> +<p>Warn if left shifting a negative value. This warning is enabled by <samp class="option">-Wextra</samp> in C99 (and newer) and C++11 to C++17 modes. </p> </dd> <dt> + <span><code class="code">-Wno-shift-overflow</code><a class="copiable-link" href="#index-Wshift-overflow"> ¶</a></span> +</dt> <dt><code class="code">-Wshift-overflow=<var class="var">n</var></code></dt> <dd> +<p>These options control warnings about left shift overflows. </p> <dl class="table"> <dt><code class="code">-Wshift-overflow=1</code></dt> <dd> +<p>This is the warning level of <samp class="option">-Wshift-overflow</samp> and is enabled by default in C99 and C++11 modes (and newer). This warning level does not warn about left-shifting 1 into the sign bit. (However, in C, such an overflow is still rejected in contexts where an integer constant expression is required.) No warning is emitted in C++20 mode (and newer), as signed left shifts always wrap. </p> </dd> <dt><code class="code">-Wshift-overflow=2</code></dt> <dd><p>This warning level also warns about left-shifting 1 into the sign bit, unless C++14 mode (or newer) is active. </p></dd> </dl> </dd> <dt> + <span><code class="code">-Wswitch</code><a class="copiable-link" href="#index-Wswitch"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a <code class="code">switch</code> statement has an index of enumerated type and lacks a <code class="code">case</code> for one or more of the named codes of that enumeration. (The presence of a <code class="code">default</code> label prevents this warning.) <code class="code">case</code> labels outside the enumeration range also provoke warnings when this option is used (even if there is a <code class="code">default</code> label). This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wswitch-default</code><a class="copiable-link" href="#index-Wswitch-default"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a <code class="code">switch</code> statement does not have a <code class="code">default</code> case. </p> </dd> <dt> + <span><code class="code">-Wswitch-enum</code><a class="copiable-link" href="#index-Wswitch-enum"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a <code class="code">switch</code> statement has an index of enumerated type and lacks a <code class="code">case</code> for one or more of the named codes of that enumeration. <code class="code">case</code> labels outside the enumeration range also provoke warnings when this option is used. The only difference between <samp class="option">-Wswitch</samp> and this option is that this option gives a warning about an omitted enumeration code even if there is a <code class="code">default</code> label. </p> </dd> <dt> + <span><code class="code">-Wno-switch-bool</code><a class="copiable-link" href="#index-Wswitch-bool"> ¶</a></span> +</dt> <dd> +<p>Do not warn when a <code class="code">switch</code> statement has an index of boolean type and the case values are outside the range of a boolean type. It is possible to suppress this warning by casting the controlling expression to a type other than <code class="code">bool</code>. For example: </p> +<div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">switch ((int) (a == 4)) + { + … + }</pre></div> +</div> <p>This warning is enabled by default for C and C++ programs. </p> </dd> <dt> + <span><code class="code">-Wno-switch-outside-range</code><a class="copiable-link" href="#index-Wswitch-outside-range"> ¶</a></span> +</dt> <dd> +<p>This option controls warnings when a <code class="code">switch</code> case has a value that is outside of its respective type range. This warning is enabled by default for C and C++ programs. </p> </dd> <dt> + <span><code class="code">-Wno-switch-unreachable</code><a class="copiable-link" href="#index-Wswitch-unreachable"> ¶</a></span> +</dt> <dd> +<p>Do not warn when a <code class="code">switch</code> statement contains statements between the controlling expression and the first case label, which will never be executed. For example: </p> +<div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">switch (cond) + { + i = 15; + … + case 5: + … + }</pre></div> +</div> <p><samp class="option">-Wswitch-unreachable</samp> does not warn if the statement between the controlling expression and the first case label is just a declaration: </p> +<div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">switch (cond) + { + int i; + … + case 5: + i = 5; + … + }</pre></div> +</div> <p>This warning is enabled by default for C and C++ programs. </p> </dd> <dt> + <span><code class="code">-Wsync-nand <span class="r">(C and C++ only)</span></code><a class="copiable-link" href="#index-Wsync-nand"> ¶</a></span> +</dt> <dd> +<p>Warn when <code class="code">__sync_fetch_and_nand</code> and <code class="code">__sync_nand_and_fetch</code> built-in functions are used. These functions changed semantics in GCC 4.4. </p> </dd> <dt> + <span><code class="code">-Wtrivial-auto-var-init</code><a class="copiable-link" href="#index-Wtrivial-auto-var-init"> ¶</a></span> +</dt> <dd> +<p>Warn when <code class="code">-ftrivial-auto-var-init</code> cannot initialize the automatic variable. A common situation is an automatic variable that is declared between the controlling expression and the first case label of a <code class="code">switch</code> statement. </p> </dd> <dt> + <span><code class="code">-Wunused-but-set-parameter</code><a class="copiable-link" href="#index-Wunused-but-set-parameter"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a function parameter is assigned to, but otherwise unused (aside from its declaration). </p> <p>To suppress this warning use the <code class="code">unused</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> <p>This warning is also enabled by <samp class="option">-Wunused</samp> together with <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wunused-but-set-variable</code><a class="copiable-link" href="#index-Wunused-but-set-variable"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a local variable is assigned to, but otherwise unused (aside from its declaration). This warning is enabled by <samp class="option">-Wall</samp>. </p> <p>To suppress this warning use the <code class="code">unused</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> <p>This warning is also enabled by <samp class="option">-Wunused</samp>, which is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wunused-function</code><a class="copiable-link" href="#index-Wunused-function"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a static function is declared but not defined or a non-inline static function is unused. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wunused-label</code><a class="copiable-link" href="#index-Wunused-label"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a label is declared but not used. This warning is enabled by <samp class="option">-Wall</samp>. </p> <p>To suppress this warning use the <code class="code">unused</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> </dd> <dt> + <span><code class="code">-Wunused-local-typedefs <span class="r">(C, Objective-C, C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wunused-local-typedefs"> ¶</a></span> +</dt> <dd> +<p>Warn when a typedef locally defined in a function is not used. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wunused-parameter</code><a class="copiable-link" href="#index-Wunused-parameter"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a function parameter is unused aside from its declaration. </p> <p>To suppress this warning use the <code class="code">unused</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> </dd> <dt> + <span><code class="code">-Wno-unused-result</code><a class="copiable-link" href="#index-Wunused-result"> ¶</a></span> +</dt> <dd> +<p>Do not warn if a caller of a function marked with attribute <code class="code">warn_unused_result</code> (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>) does not use its return value. The default is <samp class="option">-Wunused-result</samp>. </p> </dd> <dt> + <span><code class="code">-Wunused-variable</code><a class="copiable-link" href="#index-Wunused-variable"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a local or static variable is unused aside from its declaration. This option implies <samp class="option">-Wunused-const-variable=1</samp> for C, but not for C++. This warning is enabled by <samp class="option">-Wall</samp>. </p> <p>To suppress this warning use the <code class="code">unused</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> </dd> <dt> + <span><code class="code">-Wunused-const-variable</code><a class="copiable-link" href="#index-Wunused-const-variable"> ¶</a></span> +</dt> <dt><code class="code">-Wunused-const-variable=<var class="var">n</var></code></dt> <dd> +<p>Warn whenever a constant static variable is unused aside from its declaration. <samp class="option">-Wunused-const-variable=1</samp> is enabled by <samp class="option">-Wunused-variable</samp> for C, but not for C++. In C this declares variable storage, but in C++ this is not an error since const variables take the place of <code class="code">#define</code>s. </p> <p>To suppress this warning use the <code class="code">unused</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> <dl class="table"> <dt><code class="code">-Wunused-const-variable=1</code></dt> <dd> +<p>This is the warning level that is enabled by <samp class="option">-Wunused-variable</samp> for C. It warns only about unused static const variables defined in the main compilation unit, but not about static const variables declared in any header included. </p> </dd> <dt><code class="code">-Wunused-const-variable=2</code></dt> <dd><p>This warning level also warns for unused constant static variables in headers (excluding system headers). This is the warning level of <samp class="option">-Wunused-const-variable</samp> and must be explicitly requested since in C++ this isn’t an error and in C it might be harder to clean up all headers included. </p></dd> </dl> </dd> <dt> + <span><code class="code">-Wunused-value</code><a class="copiable-link" href="#index-Wunused-value"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a statement computes a result that is explicitly not used. To suppress this warning cast the unused expression to <code class="code">void</code>. This includes an expression-statement or the left-hand side of a comma expression that contains no side effects. For example, an expression such as <code class="code">x[i,j]</code> causes a warning, while <code class="code">x[(void)i,j]</code> does not. </p> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wunused</code><a class="copiable-link" href="#index-Wunused"> ¶</a></span> +</dt> <dd> +<p>All the above <samp class="option">-Wunused</samp> options combined. </p> <p>In order to get a warning about an unused function parameter, you must either specify <samp class="option">-Wextra -Wunused</samp> (note that <samp class="option">-Wall</samp> implies <samp class="option">-Wunused</samp>), or separately specify <samp class="option">-Wunused-parameter</samp>. </p> </dd> <dt> + <span><code class="code">-Wuninitialized</code><a class="copiable-link" href="#index-Wuninitialized"> ¶</a></span> +</dt> <dd> +<p>Warn if an object with automatic or allocated storage duration is used without having been initialized. In C++, also warn if a non-static reference or non-static <code class="code">const</code> member appears in a class without constructors. </p> <p>In addition, passing a pointer (or in C++, a reference) to an uninitialized object to a <code class="code">const</code>-qualified argument of a built-in function known to read the object is also diagnosed by this warning. (<samp class="option">-Wmaybe-uninitialized</samp> is issued for ordinary functions.) </p> <p>If you want to warn about code that uses the uninitialized value of the variable in its own initializer, use the <samp class="option">-Winit-self</samp> option. </p> <p>These warnings occur for individual uninitialized elements of structure, union or array variables as well as for variables that are uninitialized as a whole. They do not occur for variables or elements declared <code class="code">volatile</code>. Because these warnings depend on optimization, the exact variables or elements for which there are warnings depend on the precise optimization options and version of GCC used. </p> <p>Note that there may be no warning about a variable that is used only to compute a value that itself is never used, because such computations may be deleted by data flow analysis before the warnings are printed. </p> <p>In C++, this warning also warns about using uninitialized objects in member-initializer-lists. For example, GCC warns about <code class="code">b</code> being uninitialized in the following snippet: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct A { + int a; + int b; + A() : a(b) { } +};</pre> +</div> </dd> <dt> + <span><code class="code">-Wno-invalid-memory-model</code><a class="copiable-link" href="#index-Winvalid-memory-model"> ¶</a></span> +</dt> <dd> +<p>This option controls warnings for invocations of <a class="ref" href="_005f_005fatomic-builtins">Built-in Functions for Memory Model Aware Atomic Operations</a>, <a class="ref" href="_005f_005fsync-builtins">Legacy <code class="code">__sync</code> Built-in Functions for Atomic Memory Access</a>, and the C11 atomic generic functions with a memory consistency argument that is either invalid for the operation or outside the range of values of the <code class="code">memory_order</code> enumeration. For example, since the <code class="code">__atomic_store</code> and <code class="code">__atomic_store_n</code> built-ins are only defined for the relaxed, release, and sequentially consistent memory orders the following code is diagnosed: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void store (int *i) +{ + __atomic_store_n (i, 0, memory_order_consume); +}</pre> +</div> <p><samp class="option">-Winvalid-memory-model</samp> is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wmaybe-uninitialized</code><a class="copiable-link" href="#index-Wmaybe-uninitialized"> ¶</a></span> +</dt> <dd> +<p>For an object with automatic or allocated storage duration, if there exists a path from the function entry to a use of the object that is initialized, but there exist some other paths for which the object is not initialized, the compiler emits a warning if it cannot prove the uninitialized paths are not executed at run time. </p> <p>In addition, passing a pointer (or in C++, a reference) to an uninitialized object to a <code class="code">const</code>-qualified function argument is also diagnosed by this warning. (<samp class="option">-Wuninitialized</samp> is issued for built-in functions known to read the object.) Annotating the function with attribute <code class="code">access (none)</code> indicates that the argument isn’t used to access the object and avoids the warning (see <a class="pxref" href="common-function-attributes">Common Function Attributes</a>). </p> <p>These warnings are only possible in optimizing compilation, because otherwise GCC does not keep track of the state of variables. </p> <p>These warnings are made optional because GCC may not be able to determine when the code is correct in spite of appearing to have an error. Here is one example of how this can happen: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">{ + int x; + switch (y) + { + case 1: x = 1; + break; + case 2: x = 4; + break; + case 3: x = 5; + } + foo (x); +}</pre></div> +</div> <p>If the value of <code class="code">y</code> is always 1, 2 or 3, then <code class="code">x</code> is always initialized, but GCC doesn’t know this. To suppress the warning, you need to provide a default case with assert(0) or similar code. </p> <p>This option also warns when a non-volatile automatic variable might be changed by a call to <code class="code">longjmp</code>. The compiler sees only the calls to <code class="code">setjmp</code>. It cannot know where <code class="code">longjmp</code> will be called; in fact, a signal handler could call it at any point in the code. As a result, you may get a warning even when there is in fact no problem because <code class="code">longjmp</code> cannot in fact be called at the place that would cause a problem. </p> <p>Some spurious warnings can be avoided if you declare all the functions you use that never return as <code class="code">noreturn</code>. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> <p>This warning is enabled by <samp class="option">-Wall</samp> or <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wunknown-pragmas</code><a class="copiable-link" href="#index-Wunknown-pragmas"> ¶</a></span> +</dt> <dd> +<p>Warn when a <code class="code">#pragma</code> directive is encountered that is not understood by GCC. If this command-line option is used, warnings are even issued for unknown pragmas in system header files. This is not the case if the warnings are only enabled by the <samp class="option">-Wall</samp> command-line option. </p> </dd> <dt> + <span><code class="code">-Wno-pragmas</code><a class="copiable-link" href="#index-Wno-pragmas"> ¶</a></span> +</dt> <dd> +<p>Do not warn about misuses of pragmas, such as incorrect parameters, invalid syntax, or conflicts between pragmas. See also <samp class="option">-Wunknown-pragmas</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-prio-ctor-dtor</code><a class="copiable-link" href="#index-Wno-prio-ctor-dtor"> ¶</a></span> +</dt> <dd> +<p>Do not warn if a priority from 0 to 100 is used for constructor or destructor. The use of constructor and destructor attributes allow you to assign a priority to the constructor/destructor to control its order of execution before <code class="code">main</code> is called or after it returns. The priority values must be greater than 100 as the compiler reserves priority values between 0–100 for the implementation. </p> </dd> <dt> + <span><code class="code">-Wstrict-aliasing</code><a class="copiable-link" href="#index-Wstrict-aliasing"> ¶</a></span> +</dt> <dd> +<p>This option is only active when <samp class="option">-fstrict-aliasing</samp> is active. It warns about code that might break the strict aliasing rules that the compiler is using for optimization. The warning does not catch all cases, but does attempt to catch the more common pitfalls. It is included in <samp class="option">-Wall</samp>. It is equivalent to <samp class="option">-Wstrict-aliasing=3</samp> </p> </dd> <dt> +<span><code class="code">-Wstrict-aliasing=n</code><a class="copiable-link" href="#index-Wstrict-aliasing_003dn"> ¶</a></span> +</dt> <dd> +<p>This option is only active when <samp class="option">-fstrict-aliasing</samp> is active. It warns about code that might break the strict aliasing rules that the compiler is using for optimization. Higher levels correspond to higher accuracy (fewer false positives). Higher levels also correspond to more effort, similar to the way <samp class="option">-O</samp> works. <samp class="option">-Wstrict-aliasing</samp> is equivalent to <samp class="option">-Wstrict-aliasing=3</samp>. </p> <p>Level 1: Most aggressive, quick, least accurate. Possibly useful when higher levels do not warn but <samp class="option">-fstrict-aliasing</samp> still breaks the code, as it has very few false negatives. However, it has many false positives. Warns for all pointer conversions between possibly incompatible types, even if never dereferenced. Runs in the front end only. </p> <p>Level 2: Aggressive, quick, not too precise. May still have many false positives (not as many as level 1 though), and few false negatives (but possibly more than level 1). Unlike level 1, it only warns when an address is taken. Warns about incomplete types. Runs in the front end only. </p> <p>Level 3 (default for <samp class="option">-Wstrict-aliasing</samp>): Should have very few false positives and few false negatives. Slightly slower than levels 1 or 2 when optimization is enabled. Takes care of the common pun+dereference pattern in the front end: <code class="code">*(int*)&some_float</code>. If optimization is enabled, it also runs in the back end, where it deals with multiple statement cases using flow-sensitive points-to information. Only warns when the converted pointer is dereferenced. Does not warn about incomplete types. </p> </dd> <dt> + <span><code class="code">-Wstrict-overflow</code><a class="copiable-link" href="#index-Wstrict-overflow"> ¶</a></span> +</dt> <dt><code class="code">-Wstrict-overflow=<var class="var">n</var></code></dt> <dd> +<p>This option is only active when signed overflow is undefined. It warns about cases where the compiler optimizes based on the assumption that signed overflow does not occur. Note that it does not warn about all cases where the code might overflow: it only warns about cases where the compiler implements some optimization. Thus this warning depends on the optimization level. </p> <p>An optimization that assumes that signed overflow does not occur is perfectly safe if the values of the variables involved are such that overflow never does, in fact, occur. Therefore this warning can easily give a false positive: a warning about code that is not actually a problem. To help focus on important issues, several warning levels are defined. No warnings are issued for the use of undefined signed overflow when estimating how many iterations a loop requires, in particular when determining whether a loop will be executed at all. </p> <dl class="table"> <dt><code class="code">-Wstrict-overflow=1</code></dt> <dd> +<p>Warn about cases that are both questionable and easy to avoid. For example the compiler simplifies <code class="code">x + 1 > x</code> to <code class="code">1</code>. This level of <samp class="option">-Wstrict-overflow</samp> is enabled by <samp class="option">-Wall</samp>; higher levels are not, and must be explicitly requested. </p> </dd> <dt><code class="code">-Wstrict-overflow=2</code></dt> <dd> +<p>Also warn about other cases where a comparison is simplified to a constant. For example: <code class="code">abs (x) >= 0</code>. This can only be simplified when signed integer overflow is undefined, because <code class="code">abs (INT_MIN)</code> overflows to <code class="code">INT_MIN</code>, which is less than zero. <samp class="option">-Wstrict-overflow</samp> (with no level) is the same as <samp class="option">-Wstrict-overflow=2</samp>. </p> </dd> <dt><code class="code">-Wstrict-overflow=3</code></dt> <dd> +<p>Also warn about other cases where a comparison is simplified. For example: <code class="code">x + 1 > 1</code> is simplified to <code class="code">x > 0</code>. </p> </dd> <dt><code class="code">-Wstrict-overflow=4</code></dt> <dd> +<p>Also warn about other simplifications not covered by the above cases. For example: <code class="code">(x * 10) / 5</code> is simplified to <code class="code">x * 2</code>. </p> </dd> <dt><code class="code">-Wstrict-overflow=5</code></dt> <dd><p>Also warn about cases where the compiler reduces the magnitude of a constant involved in a comparison. For example: <code class="code">x + 2 > y</code> is simplified to <code class="code">x + 1 >= y</code>. This is reported only at the highest warning level because this simplification applies to many comparisons, so this warning level gives a very large number of false positives. </p></dd> </dl> </dd> <dt> + <span><code class="code">-Wstring-compare</code><a class="copiable-link" href="#index-Wstring-compare"> ¶</a></span> +</dt> <dd> +<p>Warn for calls to <code class="code">strcmp</code> and <code class="code">strncmp</code> whose result is determined to be either zero or non-zero in tests for such equality owing to the length of one argument being greater than the size of the array the other argument is stored in (or the bound in the case of <code class="code">strncmp</code>). Such calls could be mistakes. For example, the call to <code class="code">strcmp</code> below is diagnosed because its result is necessarily non-zero irrespective of the contents of the array <code class="code">a</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern char a[4]; +void f (char *d) +{ + strcpy (d, "string"); + … + if (0 == strcmp (a, d)) // cannot be true + puts ("a and d are the same"); +}</pre> +</div> <p><samp class="option">-Wstring-compare</samp> is enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-stringop-overflow</code><a class="copiable-link" href="#index-Wstringop-overflow"> ¶</a></span> +</dt> <dt><code class="code">-Wstringop-overflow</code></dt> <dt><code class="code">-Wstringop-overflow=<var class="var">type</var></code></dt> <dd> +<p>Warn for calls to string manipulation functions such as <code class="code">memcpy</code> and <code class="code">strcpy</code> that are determined to overflow the destination buffer. The optional argument is one greater than the type of Object Size Checking to perform to determine the size of the destination. See <a class="xref" href="object-size-checking">Object Size Checking</a>. The argument is meaningful only for functions that operate on character arrays but not for raw memory functions like <code class="code">memcpy</code> which always make use of Object Size type-0. The option also warns for calls that specify a size in excess of the largest possible object or at most <code class="code">SIZE_MAX / 2</code> bytes. The option produces the best results with optimization enabled but can detect a small subset of simple buffer overflows even without optimization in calls to the GCC built-in functions like <code class="code">__builtin_memcpy</code> that correspond to the standard functions. In any case, the option warns about just a subset of buffer overflows detected by the corresponding overflow checking built-ins. For example, the option issues a warning for the <code class="code">strcpy</code> call below because it copies at least 5 characters (the string <code class="code">"blue"</code> including the terminating NUL) into the buffer of size 4. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">enum Color { blue, purple, yellow }; +const char* f (enum Color clr) +{ + static char buf [4]; + const char *str; + switch (clr) + { + case blue: str = "blue"; break; + case purple: str = "purple"; break; + case yellow: str = "yellow"; break; + } + + return strcpy (buf, str); // warning here +}</pre> +</div> <p>Option <samp class="option">-Wstringop-overflow=2</samp> is enabled by default. </p> <dl class="table"> <dt> + <span><code class="code">-Wstringop-overflow</code><a class="copiable-link" href="#index-Wstringop-overflow-1"> ¶</a></span> +</dt> <dt><code class="code">-Wstringop-overflow=1</code></dt> <dd> +<p>The <samp class="option">-Wstringop-overflow=1</samp> option uses type-zero Object Size Checking to determine the sizes of destination objects. At this setting the option does not warn for writes past the end of subobjects of larger objects accessed by pointers unless the size of the largest surrounding object is known. When the destination may be one of several objects it is assumed to be the largest one of them. On Linux systems, when optimization is enabled at this setting the option warns for the same code as when the <code class="code">_FORTIFY_SOURCE</code> macro is defined to a non-zero value. </p> </dd> <dt><code class="code">-Wstringop-overflow=2</code></dt> <dd> +<p>The <samp class="option">-Wstringop-overflow=2</samp> option uses type-one Object Size Checking to determine the sizes of destination objects. At this setting the option warns about overflows when writing to members of the largest complete objects whose exact size is known. However, it does not warn for excessive writes to the same members of unknown objects referenced by pointers since they may point to arrays containing unknown numbers of elements. This is the default setting of the option. </p> </dd> <dt><code class="code">-Wstringop-overflow=3</code></dt> <dd> +<p>The <samp class="option">-Wstringop-overflow=3</samp> option uses type-two Object Size Checking to determine the sizes of destination objects. At this setting the option warns about overflowing the smallest object or data member. This is the most restrictive setting of the option that may result in warnings for safe code. </p> </dd> <dt><code class="code">-Wstringop-overflow=4</code></dt> <dd><p>The <samp class="option">-Wstringop-overflow=4</samp> option uses type-three Object Size Checking to determine the sizes of destination objects. At this setting the option warns about overflowing any data members, and when the destination is one of several objects it uses the size of the largest of them to decide whether to issue a warning. Similarly to <samp class="option">-Wstringop-overflow=3</samp> this setting of the option may result in warnings for benign code. </p></dd> </dl> </dd> <dt> + <span><code class="code">-Wno-stringop-overread</code><a class="copiable-link" href="#index-Wstringop-overread"> ¶</a></span> +</dt> <dd> +<p>Warn for calls to string manipulation functions such as <code class="code">memchr</code>, or <code class="code">strcpy</code> that are determined to read past the end of the source sequence. </p> <p>Option <samp class="option">-Wstringop-overread</samp> is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wno-stringop-truncation</code><a class="copiable-link" href="#index-Wstringop-truncation"> ¶</a></span> +</dt> <dd> +<p>Do not warn for calls to bounded string manipulation functions such as <code class="code">strncat</code>, <code class="code">strncpy</code>, and <code class="code">stpncpy</code> that may either truncate the copied string or leave the destination unchanged. </p> <p>In the following example, the call to <code class="code">strncat</code> specifies a bound that is less than the length of the source string. As a result, the copy of the source will be truncated and so the call is diagnosed. To avoid the warning use <code class="code">bufsize - strlen (buf) - 1)</code> as the bound. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void append (char *buf, size_t bufsize) +{ + strncat (buf, ".txt", 3); +}</pre> +</div> <p>As another example, the following call to <code class="code">strncpy</code> results in copying to <code class="code">d</code> just the characters preceding the terminating NUL, without appending the NUL to the end. Assuming the result of <code class="code">strncpy</code> is necessarily a NUL-terminated string is a common mistake, and so the call is diagnosed. To avoid the warning when the result is not expected to be NUL-terminated, call <code class="code">memcpy</code> instead. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void copy (char *d, const char *s) +{ + strncpy (d, s, strlen (s)); +}</pre> +</div> <p>In the following example, the call to <code class="code">strncpy</code> specifies the size of the destination buffer as the bound. If the length of the source string is equal to or greater than this size the result of the copy will not be NUL-terminated. Therefore, the call is also diagnosed. To avoid the warning, specify <code class="code">sizeof buf - 1</code> as the bound and set the last element of the buffer to <code class="code">NUL</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void copy (const char *s) +{ + char buf[80]; + strncpy (buf, s, sizeof buf); + … +}</pre> +</div> <p>In situations where a character array is intended to store a sequence of bytes with no terminating <code class="code">NUL</code> such an array may be annotated with attribute <code class="code">nonstring</code> to avoid this warning. Such arrays, however, are not suitable arguments to functions that expect <code class="code">NUL</code>-terminated strings. To help detect accidental misuses of such arrays GCC issues warnings unless it can prove that the use is safe. See <a class="xref" href="common-variable-attributes">Common Variable Attributes</a>. </p> </dd> <dt> + <span><code class="code">-Wstrict-flex-arrays</code><a class="copiable-link" href="#index-Wstrict-flex-arrays"> ¶</a></span> +</dt> <dd> +<p>Warn about inproper usages of flexible array members according to the <var class="var">level</var> of the <code class="code">strict_flex_array (<var class="var">level</var>)</code> attribute attached to the trailing array field of a structure if it’s available, otherwise according to the <var class="var">level</var> of the option <samp class="option">-fstrict-flex-arrays=<var class="var">level</var></samp>. </p> <p>This option is effective only when <var class="var">level</var> is bigger than 0. Otherwise, it will be ignored with a warning. </p> <p>when <var class="var">level</var>=1, warnings will be issued for a trailing array reference of a structure that have 2 or more elements if the trailing array is referenced as a flexible array member. </p> <p>when <var class="var">level</var>=2, in addition to <var class="var">level</var>=1, additional warnings will be issued for a trailing one-element array reference of a structure if the array is referenced as a flexible array member. </p> <p>when <var class="var">level</var>=3, in addition to <var class="var">level</var>=2, additional warnings will be issued for a trailing zero-length array reference of a structure if the array is referenced as a flexible array member. </p> </dd> <dt> + <span><code class="code">-Wsuggest-attribute=<span class="r">[</span>pure<span class="r">|</span>const<span class="r">|</span>noreturn<span class="r">|</span>format<span class="r">|</span>cold<span class="r">|</span>malloc<span class="r">]</span></code><a class="copiable-link" href="#index-Wsuggest-attribute_003d"> ¶</a></span> +</dt> <dd> +<p>Warn for cases where adding an attribute may be beneficial. The attributes currently supported are listed below. </p> <dl class="table"> <dt> + <span><code class="code">-Wsuggest-attribute=pure</code><a class="copiable-link" href="#index-Wsuggest-attribute_003dpure"> ¶</a></span> +</dt> <dt><code class="code">-Wsuggest-attribute=const</code></dt> <dt><code class="code">-Wsuggest-attribute=noreturn</code></dt> <dt><code class="code">-Wmissing-noreturn</code></dt> <dt><code class="code">-Wsuggest-attribute=malloc</code></dt> <dd> <p>Warn about functions that might be candidates for attributes <code class="code">pure</code>, <code class="code">const</code> or <code class="code">noreturn</code> or <code class="code">malloc</code>. The compiler only warns for functions visible in other compilation units or (in the case of <code class="code">pure</code> and <code class="code">const</code>) if it cannot prove that the function returns normally. A function returns normally if it doesn’t contain an infinite loop or return abnormally by throwing, calling <code class="code">abort</code> or trapping. This analysis requires option <samp class="option">-fipa-pure-const</samp>, which is enabled by default at <samp class="option">-O</samp> and higher. Higher optimization levels improve the accuracy of the analysis. </p> </dd> <dt> + <span><code class="code">-Wsuggest-attribute=format</code><a class="copiable-link" href="#index-Wsuggest-attribute_003dformat"> ¶</a></span> +</dt> <dt><code class="code">-Wmissing-format-attribute</code></dt> <dd> <p>Warn about function pointers that might be candidates for <code class="code">format</code> attributes. Note these are only possible candidates, not absolute ones. GCC guesses that function pointers with <code class="code">format</code> attributes that are used in assignment, initialization, parameter passing or return statements should have a corresponding <code class="code">format</code> attribute in the resulting type. I.e. the left-hand side of the assignment or initialization, the type of the parameter variable, or the return type of the containing function respectively should also have a <code class="code">format</code> attribute to avoid the warning. </p> <p>GCC also warns about function definitions that might be candidates for <code class="code">format</code> attributes. Again, these are only possible candidates. GCC guesses that <code class="code">format</code> attributes might be appropriate for any function that calls a function like <code class="code">vprintf</code> or <code class="code">vscanf</code>, but this might not always be the case, and some functions for which <code class="code">format</code> attributes are appropriate may not be detected. </p> </dd> <dt> + <span><code class="code">-Wsuggest-attribute=cold</code><a class="copiable-link" href="#index-Wsuggest-attribute_003dcold"> ¶</a></span> +</dt> <dd> <p>Warn about functions that might be candidates for <code class="code">cold</code> attribute. This is based on static detection and generally only warns about functions which always leads to a call to another <code class="code">cold</code> function such as wrappers of C++ <code class="code">throw</code> or fatal error reporting functions leading to <code class="code">abort</code>. </p> +</dd> </dl> </dd> <dt> + <span><code class="code">-Walloc-zero</code><a class="copiable-link" href="#index-Wno-alloc-zero"> ¶</a></span> +</dt> <dd> +<p>Warn about calls to allocation functions decorated with attribute <code class="code">alloc_size</code> that specify zero bytes, including those to the built-in forms of the functions <code class="code">aligned_alloc</code>, <code class="code">alloca</code>, <code class="code">calloc</code>, <code class="code">malloc</code>, and <code class="code">realloc</code>. Because the behavior of these functions when called with a zero size differs among implementations (and in the case of <code class="code">realloc</code> has been deprecated) relying on it may result in subtle portability bugs and should be avoided. </p> </dd> <dt> + <span><code class="code">-Walloc-size-larger-than=<var class="var">byte-size</var></code><a class="copiable-link" href="#index-Walloc-size-larger-than_003d"> ¶</a></span> +</dt> <dd> +<p>Warn about calls to functions decorated with attribute <code class="code">alloc_size</code> that attempt to allocate objects larger than the specified number of bytes, or where the result of the size computation in an integer type with infinite precision would exceed the value of ‘<samp class="samp">PTRDIFF_MAX</samp>’ on the target. <samp class="option">-Walloc-size-larger-than=</samp>‘<samp class="samp">PTRDIFF_MAX</samp>’ is enabled by default. Warnings controlled by the option can be disabled either by specifying <var class="var">byte-size</var> of ‘<samp class="samp">SIZE_MAX</samp>’ or more or by <samp class="option">-Wno-alloc-size-larger-than</samp>. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> </dd> <dt> +<span><code class="code">-Wno-alloc-size-larger-than</code><a class="copiable-link" href="#index-Wno-alloc-size-larger-than-1"> ¶</a></span> +</dt> <dd> +<p>Disable <samp class="option">-Walloc-size-larger-than=</samp> warnings. The option is equivalent to <samp class="option">-Walloc-size-larger-than=</samp>‘<samp class="samp">SIZE_MAX</samp>’ or larger. </p> </dd> <dt> + <span><code class="code">-Walloca</code><a class="copiable-link" href="#index-Wno-alloca"> ¶</a></span> +</dt> <dd> +<p>This option warns on all uses of <code class="code">alloca</code> in the source. </p> </dd> <dt> + <span><code class="code">-Walloca-larger-than=<var class="var">byte-size</var></code><a class="copiable-link" href="#index-Walloca-larger-than_003d"> ¶</a></span> +</dt> <dd> +<p>This option warns on calls to <code class="code">alloca</code> with an integer argument whose value is either zero, or that is not bounded by a controlling predicate that limits its value to at most <var class="var">byte-size</var>. It also warns for calls to <code class="code">alloca</code> where the bound value is unknown. Arguments of non-integer types are considered unbounded even if they appear to be constrained to the expected range. </p> <p>For example, a bounded case of <code class="code">alloca</code> could be: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void func (size_t n) +{ + void *p; + if (n <= 1000) + p = alloca (n); + else + p = malloc (n); + f (p); +}</pre> +</div> <p>In the above example, passing <code class="code">-Walloca-larger-than=1000</code> would not issue a warning because the call to <code class="code">alloca</code> is known to be at most 1000 bytes. However, if <code class="code">-Walloca-larger-than=500</code> were passed, the compiler would emit a warning. </p> <p>Unbounded uses, on the other hand, are uses of <code class="code">alloca</code> with no controlling predicate constraining its integer argument. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void func () +{ + void *p = alloca (n); + f (p); +}</pre> +</div> <p>If <code class="code">-Walloca-larger-than=500</code> were passed, the above would trigger a warning, but this time because of the lack of bounds checking. </p> <p>Note, that even seemingly correct code involving signed integers could cause a warning: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void func (signed int n) +{ + if (n < 500) + { + p = alloca (n); + f (p); + } +}</pre> +</div> <p>In the above example, <var class="var">n</var> could be negative, causing a larger than expected argument to be implicitly cast into the <code class="code">alloca</code> call. </p> <p>This option also warns when <code class="code">alloca</code> is used in a loop. </p> <p><samp class="option">-Walloca-larger-than=</samp>‘<samp class="samp">PTRDIFF_MAX</samp>’ is enabled by default but is usually only effective when <samp class="option">-ftree-vrp</samp> is active (default for <samp class="option">-O2</samp> and above). </p> <p>See also <samp class="option">-Wvla-larger-than=</samp>‘<samp class="samp">byte-size</samp>’. </p> </dd> <dt> +<span><code class="code">-Wno-alloca-larger-than</code><a class="copiable-link" href="#index-Wno-alloca-larger-than-1"> ¶</a></span> +</dt> <dd> +<p>Disable <samp class="option">-Walloca-larger-than=</samp> warnings. The option is equivalent to <samp class="option">-Walloca-larger-than=</samp>‘<samp class="samp">SIZE_MAX</samp>’ or larger. </p> </dd> <dt> + <span><code class="code">-Warith-conversion</code><a class="copiable-link" href="#index-Warith-conversion"> ¶</a></span> +</dt> <dd> +<p>Do warn about implicit conversions from arithmetic operations even when conversion of the operands to the same type cannot change their values. This affects warnings from <samp class="option">-Wconversion</samp>, <samp class="option">-Wfloat-conversion</samp>, and <samp class="option">-Wsign-conversion</samp>. </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">void f (char c, int i) +{ + c = c + i; // warns with <samp class="option">-Wconversion</samp> + c = c + 1; // only warns with <samp class="option">-Warith-conversion</samp> +}</pre></div> +</div> </dd> <dt> + <span><code class="code">-Warray-bounds</code><a class="copiable-link" href="#index-Wno-array-bounds"> ¶</a></span> +</dt> <dt><code class="code">-Warray-bounds=<var class="var">n</var></code></dt> <dd> +<p>Warn about out of bounds subscripts or offsets into arrays. This warning is enabled by <samp class="option">-Wall</samp>. It is more effective when <samp class="option">-ftree-vrp</samp> is active (the default for <samp class="option">-O2</samp> and above) but a subset of instances are issued even without optimization. </p> <p>By default, the trailing array of a structure will be treated as a flexible array member by <samp class="option">-Warray-bounds</samp> or <samp class="option">-Warray-bounds=<var class="var">n</var></samp> if it is declared as either a flexible array member per C99 standard onwards (‘<samp class="samp">[]</samp>’), a GCC zero-length array extension (‘<samp class="samp">[0]</samp>’), or an one-element array (‘<samp class="samp">[1]</samp>’). As a result, out of bounds subscripts or offsets into zero-length arrays or one-element arrays are not warned by default. </p> <p>You can add the option <samp class="option">-fstrict-flex-arrays</samp> or <samp class="option">-fstrict-flex-arrays=<var class="var">level</var></samp> to control how this option treat trailing array of a structure as a flexible array member: </p> <p>when <var class="var">level</var><=1, no change to the default behavior. </p> <p>when <var class="var">level</var>=2, additional warnings will be issued for out of bounds subscripts or offsets into one-element arrays; </p> <p>when <var class="var">level</var>=3, in addition to <var class="var">level</var>=2, additional warnings will be issued for out of bounds subscripts or offsets into zero-length arrays. </p> <dl class="table"> <dt><code class="code">-Warray-bounds=1</code></dt> <dd> +<p>This is the default warning level of <samp class="option">-Warray-bounds</samp> and is enabled by <samp class="option">-Wall</samp>; higher levels are not, and must be explicitly requested. </p> </dd> <dt><code class="code">-Warray-bounds=2</code></dt> <dd><p>This warning level also warns about the intermediate results of pointer arithmetic that may yield out of bounds values. This warning level may give a larger number of false positives and is deactivated by default. </p></dd> </dl> </dd> <dt> + <span><code class="code">-Warray-compare</code><a class="copiable-link" href="#index-Warray-compare"> ¶</a></span> +</dt> <dd> +<p>Warn about equality and relational comparisons between two operands of array type. This comparison was deprecated in C++20. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int arr1[5]; +int arr2[5]; +bool same = arr1 == arr2;</pre> +</div> <p><samp class="option">-Warray-compare</samp> is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> +<span><code class="code">-Warray-parameter</code><a class="copiable-link" href="#index-Wno-array-parameter"> ¶</a></span> +</dt> <dt><code class="code">-Warray-parameter=<var class="var">n</var></code></dt> <dd> +<p>Warn about redeclarations of functions involving arguments of array or pointer types of inconsistent kinds or forms, and enable the detection of out-of-bounds accesses to such parameters by warnings such as <samp class="option">-Warray-bounds</samp>. </p> <p>If the first function declaration uses the array form the bound specified in the array is assumed to be the minimum number of elements expected to be provided in calls to the function and the maximum number of elements accessed by it. Failing to provide arguments of sufficient size or accessing more than the maximum number of elements may be diagnosed by warnings such as <samp class="option">-Warray-bounds</samp>. At level 1 the warning diagnoses inconsistencies involving array parameters declared using the <code class="code">T[static N]</code> form. </p> <p>For example, the warning triggers for the following redeclarations because the first one allows an array of any size to be passed to <code class="code">f</code> while the second one with the keyword <code class="code">static</code> specifies that the array argument must have at least four elements. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (int[static 4]); +void f (int[]); // warning (inconsistent array form) + +void g (void) +{ + int *p = (int *)malloc (4); + f (p); // warning (array too small) + … +}</pre> +</div> <p>At level 2 the warning also triggers for redeclarations involving any other inconsistency in array or pointer argument forms denoting array sizes. Pointers and arrays of unspecified bound are considered equivalent and do not trigger a warning. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void g (int*); +void g (int[]); // no warning +void g (int[8]); // warning (inconsistent array bound)</pre> +</div> <p><samp class="option">-Warray-parameter=2</samp> is included in <samp class="option">-Wall</samp>. The <samp class="option">-Wvla-parameter</samp> option triggers warnings for similar inconsistencies involving Variable Length Array arguments. </p> </dd> <dt> + <span><code class="code">-Wattribute-alias=<var class="var">n</var></code><a class="copiable-link" href="#index-Wattribute-alias"> ¶</a></span> +</dt> <dt><code class="code">-Wno-attribute-alias</code></dt> <dd> +<p>Warn about declarations using the <code class="code">alias</code> and similar attributes whose target is incompatible with the type of the alias. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> <dl class="table"> <dt><code class="code">-Wattribute-alias=1</code></dt> <dd> +<p>The default warning level of the <samp class="option">-Wattribute-alias</samp> option diagnoses incompatibilities between the type of the alias declaration and that of its target. Such incompatibilities are typically indicative of bugs. </p> </dd> <dt><code class="code">-Wattribute-alias=2</code></dt> <dd> <p>At this level <samp class="option">-Wattribute-alias</samp> also diagnoses cases where the attributes of the alias declaration are more restrictive than the attributes applied to its target. These mismatches can potentially result in incorrect code generation. In other cases they may be benign and could be resolved simply by adding the missing attribute to the target. For comparison, see the <samp class="option">-Wmissing-attributes</samp> option, which controls diagnostics when the alias declaration is less restrictive than the target, rather than more restrictive. </p> <p>Attributes considered include <code class="code">alloc_align</code>, <code class="code">alloc_size</code>, <code class="code">cold</code>, <code class="code">const</code>, <code class="code">hot</code>, <code class="code">leaf</code>, <code class="code">malloc</code>, <code class="code">nonnull</code>, <code class="code">noreturn</code>, <code class="code">nothrow</code>, <code class="code">pure</code>, <code class="code">returns_nonnull</code>, and <code class="code">returns_twice</code>. </p> +</dd> </dl> <p><samp class="option">-Wattribute-alias</samp> is equivalent to <samp class="option">-Wattribute-alias=1</samp>. This is the default. You can disable these warnings with either <samp class="option">-Wno-attribute-alias</samp> or <samp class="option">-Wattribute-alias=0</samp>. </p> </dd> <dt> + <span><code class="code">-Wbidi-chars=<span class="r">[</span>none<span class="r">|</span>unpaired<span class="r">|</span>any<span class="r">|</span>ucn<span class="r">]</span></code><a class="copiable-link" href="#index-Wbidi-chars_003d"> ¶</a></span> +</dt> <dd> +<p>Warn about possibly misleading UTF-8 bidirectional control characters in comments, string literals, character constants, and identifiers. Such characters can change left-to-right writing direction into right-to-left (and vice versa), which can cause confusion between the logical order and visual order. This may be dangerous; for instance, it may seem that a piece of code is not commented out, whereas it in fact is. </p> <p>There are three levels of warning supported by GCC. The default is <samp class="option">-Wbidi-chars=unpaired</samp>, which warns about improperly terminated bidi contexts. <samp class="option">-Wbidi-chars=none</samp> turns the warning off. <samp class="option">-Wbidi-chars=any</samp> warns about any use of bidirectional control characters. </p> <p>By default, this warning does not warn about UCNs. It is, however, possible to turn on such checking by using <samp class="option">-Wbidi-chars=unpaired,ucn</samp> or <samp class="option">-Wbidi-chars=any,ucn</samp>. Using <samp class="option">-Wbidi-chars=ucn</samp> is valid, and is equivalent to <samp class="option">-Wbidi-chars=unpaired,ucn</samp>, if no previous <samp class="option">-Wbidi-chars=any</samp> was specified. </p> </dd> <dt> + <span><code class="code">-Wbool-compare</code><a class="copiable-link" href="#index-Wno-bool-compare"> ¶</a></span> +</dt> <dd> +<p>Warn about boolean expression compared with an integer value different from <code class="code">true</code>/<code class="code">false</code>. For instance, the following comparison is always false: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int n = 5; +… +if ((n > 1) == 2) { … }</pre> +</div> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wbool-operation</code><a class="copiable-link" href="#index-Wno-bool-operation"> ¶</a></span> +</dt> <dd> +<p>Warn about suspicious operations on expressions of a boolean type. For instance, bitwise negation of a boolean is very likely a bug in the program. For C, this warning also warns about incrementing or decrementing a boolean, which rarely makes sense. (In C++, decrementing a boolean is always invalid. Incrementing a boolean is invalid in C++17, and deprecated otherwise.) </p> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wduplicated-branches</code><a class="copiable-link" href="#index-Wno-duplicated-branches"> ¶</a></span> +</dt> <dd> +<p>Warn when an if-else has identical branches. This warning detects cases like </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (p != NULL) + return 0; +else + return 0;</pre> +</div> <p>It doesn’t warn when both branches contain just a null statement. This warning also warn for conditional operators: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int i = x ? *p : *p;</pre> +</div> </dd> <dt> + <span><code class="code">-Wduplicated-cond</code><a class="copiable-link" href="#index-Wno-duplicated-cond"> ¶</a></span> +</dt> <dd> +<p>Warn about duplicated conditions in an if-else-if chain. For instance, warn for the following code: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (p->q != NULL) { … } +else if (p->q != NULL) { … }</pre> +</div> </dd> <dt> + <span><code class="code">-Wframe-address</code><a class="copiable-link" href="#index-Wno-frame-address"> ¶</a></span> +</dt> <dd> +<p>Warn when the ‘<samp class="samp">__builtin_frame_address</samp>’ or ‘<samp class="samp">__builtin_return_address</samp>’ is called with an argument greater than 0. Such calls may return indeterminate values or crash the program. The warning is included in <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-discarded-qualifiers <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wno-discarded-qualifiers"> ¶</a></span> +</dt> <dd> +<p>Do not warn if type qualifiers on pointers are being discarded. Typically, the compiler warns if a <code class="code">const char *</code> variable is passed to a function that takes a <code class="code">char *</code> parameter. This option can be used to suppress such a warning. </p> </dd> <dt> + <span><code class="code">-Wno-discarded-array-qualifiers <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wno-discarded-array-qualifiers"> ¶</a></span> +</dt> <dd> +<p>Do not warn if type qualifiers on arrays which are pointer targets are being discarded. Typically, the compiler warns if a <code class="code">const int (*)[]</code> variable is passed to a function that takes a <code class="code">int (*)[]</code> parameter. This option can be used to suppress such a warning. </p> </dd> <dt> + <span><code class="code">-Wno-incompatible-pointer-types <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wno-incompatible-pointer-types"> ¶</a></span> +</dt> <dd> +<p>Do not warn when there is a conversion between pointers that have incompatible types. This warning is for cases not covered by <samp class="option">-Wno-pointer-sign</samp>, which warns for pointer argument passing or assignment with different signedness. </p> </dd> <dt> + <span><code class="code">-Wno-int-conversion <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wno-int-conversion"> ¶</a></span> +</dt> <dd> +<p>Do not warn about incompatible integer to pointer and pointer to integer conversions. This warning is about implicit conversions; for explicit conversions the warnings <samp class="option">-Wno-int-to-pointer-cast</samp> and <samp class="option">-Wno-pointer-to-int-cast</samp> may be used. </p> </dd> <dt> + <span><code class="code">-Wzero-length-bounds</code><a class="copiable-link" href="#index-Wzero-length-bounds"> ¶</a></span> +</dt> <dd> +<p>Warn about accesses to elements of zero-length array members that might overlap other members of the same object. Declaring interior zero-length arrays is discouraged because accesses to them are undefined. See <a class="xref" href="zero-length">Arrays of Length Zero</a>. </p> <p>For example, the first two stores in function <code class="code">bad</code> are diagnosed because the array elements overlap the subsequent members <code class="code">b</code> and <code class="code">c</code>. The third store is diagnosed by <samp class="option">-Warray-bounds</samp> because it is beyond the bounds of the enclosing object. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct X { int a[0]; int b, c; }; +struct X x; + +void bad (void) +{ + x.a[0] = 0; // -Wzero-length-bounds + x.a[1] = 1; // -Wzero-length-bounds + x.a[2] = 2; // -Warray-bounds +}</pre> +</div> <p>Option <samp class="option">-Wzero-length-bounds</samp> is enabled by <samp class="option">-Warray-bounds</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-div-by-zero</code><a class="copiable-link" href="#index-Wno-div-by-zero"> ¶</a></span> +</dt> <dd> +<p>Do not warn about compile-time integer division by zero. Floating-point division by zero is not warned about, as it can be a legitimate way of obtaining infinities and NaNs. </p> </dd> <dt> + <span><code class="code">-Wsystem-headers</code><a class="copiable-link" href="#index-Wsystem-headers"> ¶</a></span> +</dt> <dd> +<p>Print warning messages for constructs found in system header files. Warnings from system headers are normally suppressed, on the assumption that they usually do not indicate real problems and would only make the compiler output harder to read. Using this command-line option tells GCC to emit warnings from system headers as if they occurred in user code. However, note that using <samp class="option">-Wall</samp> in conjunction with this option does <em class="emph">not</em> warn about unknown pragmas in system headers—for that, <samp class="option">-Wunknown-pragmas</samp> must also be used. </p> </dd> <dt> + <span><code class="code">-Wtautological-compare</code><a class="copiable-link" href="#index-Wtautological-compare"> ¶</a></span> +</dt> <dd> +<p>Warn if a self-comparison always evaluates to true or false. This warning detects various mistakes such as: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int i = 1; +… +if (i > i) { … }</pre> +</div> <p>This warning also warns about bitwise comparisons that always evaluate to true or false, for instance: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if ((a & 16) == 10) { … }</pre> +</div> <p>will always be false. </p> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wtrampolines</code><a class="copiable-link" href="#index-Wtrampolines"> ¶</a></span> +</dt> <dd> +<p>Warn about trampolines generated for pointers to nested functions. A trampoline is a small piece of data or code that is created at run time on the stack when the address of a nested function is taken, and is used to call the nested function indirectly. For some targets, it is made up of data only and thus requires no special treatment. But, for most targets, it is made up of code and thus requires the stack to be made executable in order for the program to work properly. </p> </dd> <dt> + <span><code class="code">-Wfloat-equal</code><a class="copiable-link" href="#index-Wfloat-equal"> ¶</a></span> +</dt> <dd> +<p>Warn if floating-point values are used in equality comparisons. </p> <p>The idea behind this is that sometimes it is convenient (for the programmer) to consider floating-point values as approximations to infinitely precise real numbers. If you are doing this, then you need to compute (by analyzing the code, or in some other way) the maximum or likely maximum error that the computation introduces, and allow for it when performing comparisons (and when producing output, but that’s a different problem). In particular, instead of testing for equality, you should check to see whether the two values have ranges that overlap; and this is done with the relational operators, so equality comparisons are probably mistaken. </p> </dd> <dt> + <span><code class="code">-Wtraditional <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wtraditional"> ¶</a></span> +</dt> <dd> +<p>Warn about certain constructs that behave differently in traditional and ISO C. Also warn about ISO C constructs that have no traditional C equivalent, and/or problematic constructs that should be avoided. </p> <ul class="itemize mark-bullet"> <li>Macro parameters that appear within string literals in the macro body. In traditional C macro replacement takes place within string literals, but in ISO C it does not. </li> +<li>In traditional C, some preprocessor directives did not exist. Traditional preprocessors only considered a line to be a directive if the ‘<samp class="samp">#</samp>’ appeared in column 1 on the line. Therefore <samp class="option">-Wtraditional</samp> warns about directives that traditional C understands but ignores because the ‘<samp class="samp">#</samp>’ does not appear as the first character on the line. It also suggests you hide directives like <code class="code">#pragma</code> not understood by traditional C by indenting them. Some traditional implementations do not recognize <code class="code">#elif</code>, so this option suggests avoiding it altogether. </li> +<li>A function-like macro that appears without arguments. </li> +<li>The unary plus operator. </li> +<li>The ‘<samp class="samp">U</samp>’ integer constant suffix, or the ‘<samp class="samp">F</samp>’ or ‘<samp class="samp">L</samp>’ floating-point constant suffixes. (Traditional C does support the ‘<samp class="samp">L</samp>’ suffix on integer constants.) Note, these suffixes appear in macros defined in the system headers of most modern systems, e.g. the ‘<samp class="samp">_MIN</samp>’/‘<samp class="samp">_MAX</samp>’ macros in <code class="code"><limits.h></code>. Use of these macros in user code might normally lead to spurious warnings, however GCC’s integrated preprocessor has enough context to avoid warning in these cases. </li> +<li>A function declared external in one block and then used after the end of the block. </li> +<li>A <code class="code">switch</code> statement has an operand of type <code class="code">long</code>. </li> +<li>A non-<code class="code">static</code> function declaration follows a <code class="code">static</code> one. This construct is not accepted by some traditional C compilers. </li> +<li>The ISO type of an integer constant has a different width or signedness from its traditional type. This warning is only issued if the base of the constant is ten. I.e. hexadecimal or octal values, which typically represent bit patterns, are not warned about. </li> +<li>Usage of ISO string concatenation is detected. </li> +<li>Initialization of automatic aggregates. </li> +<li>Identifier conflicts with labels. Traditional C lacks a separate namespace for labels. </li> +<li>Initialization of unions. If the initializer is zero, the warning is omitted. This is done under the assumption that the zero initializer in user code appears conditioned on e.g. <code class="code">__STDC__</code> to avoid missing initializer warnings and relies on default initialization to zero in the traditional C case. </li> +<li>Conversions by prototypes between fixed/floating-point values and vice versa. The absence of these prototypes when compiling with traditional C causes serious problems. This is a subset of the possible conversion warnings; for the full set use <samp class="option">-Wtraditional-conversion</samp>. </li> +<li>Use of ISO C style function definitions. This warning intentionally is <em class="emph">not</em> issued for prototype declarations or variadic functions because these ISO C features appear in your code when using libiberty’s traditional C compatibility macros, <code class="code">PARAMS</code> and <code class="code">VPARAMS</code>. This warning is also bypassed for nested functions because that feature is already a GCC extension and thus not relevant to traditional C compatibility. </li> +</ul> </dd> <dt> + <span><code class="code">-Wtraditional-conversion <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wtraditional-conversion"> ¶</a></span> +</dt> <dd> +<p>Warn if a prototype causes a type conversion that is different from what would happen to the same argument in the absence of a prototype. This includes conversions of fixed point to floating and vice versa, and conversions changing the width or signedness of a fixed-point argument except when the same as the default promotion. </p> </dd> <dt> + <span><code class="code">-Wdeclaration-after-statement <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wdeclaration-after-statement"> ¶</a></span> +</dt> <dd> +<p>Warn when a declaration is found after a statement in a block. This construct, known from C++, was introduced with ISO C99 and is by default allowed in GCC. It is not supported by ISO C90. See <a class="xref" href="mixed-labels-and-declarations">Mixed Declarations, Labels and Code</a>. </p> </dd> <dt> + <span><code class="code">-Wshadow</code><a class="copiable-link" href="#index-Wshadow"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a local variable or type declaration shadows another variable, parameter, type, class member (in C++), or instance variable (in Objective-C) or whenever a built-in function is shadowed. Note that in C++, the compiler warns if a local variable shadows an explicit typedef, but not if it shadows a struct/class/enum. If this warning is enabled, it includes also all instances of local shadowing. This means that <samp class="option">-Wno-shadow=local</samp> and <samp class="option">-Wno-shadow=compatible-local</samp> are ignored when <samp class="option">-Wshadow</samp> is used. Same as <samp class="option">-Wshadow=global</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-shadow-ivar <span class="r">(Objective-C only)</span></code><a class="copiable-link" href="#index-Wno-shadow-ivar"> ¶</a></span> +</dt> <dd> +<p>Do not warn whenever a local variable shadows an instance variable in an Objective-C method. </p> </dd> <dt> +<span><code class="code">-Wshadow=global</code><a class="copiable-link" href="#index-Wshadow_003dglobal"> ¶</a></span> +</dt> <dd> +<p>Warn for any shadowing. Same as <samp class="option">-Wshadow</samp>. </p> </dd> <dt> +<span><code class="code">-Wshadow=local</code><a class="copiable-link" href="#index-Wshadow_003dlocal"> ¶</a></span> +</dt> <dd> +<p>Warn when a local variable shadows another local variable or parameter. </p> </dd> <dt> +<span><code class="code">-Wshadow=compatible-local</code><a class="copiable-link" href="#index-Wshadow_003dcompatible-local"> ¶</a></span> +</dt> <dd> +<p>Warn when a local variable shadows another local variable or parameter whose type is compatible with that of the shadowing variable. In C++, type compatibility here means the type of the shadowing variable can be converted to that of the shadowed variable. The creation of this flag (in addition to <samp class="option">-Wshadow=local</samp>) is based on the idea that when a local variable shadows another one of incompatible type, it is most likely intentional, not a bug or typo, as shown in the following example: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i) +{ + for (int i = 0; i < N; ++i) + { + ... + } + ... +}</pre></div> +</div> <p>Since the two variable <code class="code">i</code> in the example above have incompatible types, enabling only <samp class="option">-Wshadow=compatible-local</samp> does not emit a warning. Because their types are incompatible, if a programmer accidentally uses one in place of the other, type checking is expected to catch that and emit an error or warning. Use of this flag instead of <samp class="option">-Wshadow=local</samp> can possibly reduce the number of warnings triggered by intentional shadowing. Note that this also means that shadowing <code class="code">const char *i</code> by <code class="code">char *i</code> does not emit a warning. </p> <p>This warning is also enabled by <samp class="option">-Wshadow=local</samp>. </p> </dd> <dt> + <span><code class="code">-Wlarger-than=<var class="var">byte-size</var></code><a class="copiable-link" href="#index-Wlarger-than_003d"> ¶</a></span> +</dt> <dd> +<p>Warn whenever an object is defined whose size exceeds <var class="var">byte-size</var>. <samp class="option">-Wlarger-than=</samp>‘<samp class="samp">PTRDIFF_MAX</samp>’ is enabled by default. Warnings controlled by the option can be disabled either by specifying <var class="var">byte-size</var> of ‘<samp class="samp">SIZE_MAX</samp>’ or more or by <samp class="option">-Wno-larger-than</samp>. </p> <p>Also warn for calls to bounded functions such as <code class="code">memchr</code> or <code class="code">strnlen</code> that specify a bound greater than the largest possible object, which is ‘<samp class="samp">PTRDIFF_MAX</samp>’ bytes by default. These warnings can only be disabled by <samp class="option">-Wno-larger-than</samp>. </p> </dd> <dt> +<span><code class="code">-Wno-larger-than</code><a class="copiable-link" href="#index-Wno-larger-than"> ¶</a></span> +</dt> <dd> +<p>Disable <samp class="option">-Wlarger-than=</samp> warnings. The option is equivalent to <samp class="option">-Wlarger-than=</samp>‘<samp class="samp">SIZE_MAX</samp>’ or larger. </p> </dd> <dt> + <span><code class="code">-Wframe-larger-than=<var class="var">byte-size</var></code><a class="copiable-link" href="#index-Wframe-larger-than_003d"> ¶</a></span> +</dt> <dd> +<p>Warn if the size of a function frame exceeds <var class="var">byte-size</var>. The computation done to determine the stack frame size is approximate and not conservative. The actual requirements may be somewhat greater than <var class="var">byte-size</var> even if you do not get a warning. In addition, any space allocated via <code class="code">alloca</code>, variable-length arrays, or related constructs is not included by the compiler when determining whether or not to issue a warning. <samp class="option">-Wframe-larger-than=</samp>‘<samp class="samp">PTRDIFF_MAX</samp>’ is enabled by default. Warnings controlled by the option can be disabled either by specifying <var class="var">byte-size</var> of ‘<samp class="samp">SIZE_MAX</samp>’ or more or by <samp class="option">-Wno-frame-larger-than</samp>. </p> </dd> <dt> +<span><code class="code">-Wno-frame-larger-than</code><a class="copiable-link" href="#index-Wno-frame-larger-than-1"> ¶</a></span> +</dt> <dd> +<p>Disable <samp class="option">-Wframe-larger-than=</samp> warnings. The option is equivalent to <samp class="option">-Wframe-larger-than=</samp>‘<samp class="samp">SIZE_MAX</samp>’ or larger. </p> </dd> <dt> + <span><code class="code">-Wfree-nonheap-object</code><a class="copiable-link" href="#index-Wfree-nonheap-object"> ¶</a></span> +</dt> <dd> +<p>Warn when attempting to deallocate an object that was either not allocated on the heap, or by using a pointer that was not returned from a prior call to the corresponding allocation function. For example, because the call to <code class="code">stpcpy</code> returns a pointer to the terminating nul character and not to the beginning of the object, the call to <code class="code">free</code> below is diagnosed. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (char *p) +{ + p = stpcpy (p, "abc"); + // ... + free (p); // warning +}</pre> +</div> <p><samp class="option">-Wfree-nonheap-object</samp> is included in <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wstack-usage=<var class="var">byte-size</var></code><a class="copiable-link" href="#index-Wstack-usage"> ¶</a></span> +</dt> <dd> +<p>Warn if the stack usage of a function might exceed <var class="var">byte-size</var>. The computation done to determine the stack usage is conservative. Any space allocated via <code class="code">alloca</code>, variable-length arrays, or related constructs is included by the compiler when determining whether or not to issue a warning. </p> <p>The message is in keeping with the output of <samp class="option">-fstack-usage</samp>. </p> <ul class="itemize mark-bullet"> <li>If the stack usage is fully static but exceeds the specified amount, it’s: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">warning: stack usage is 1120 bytes</pre> +</div> </li> +<li>If the stack usage is (partly) dynamic but bounded, it’s: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">warning: stack usage might be 1648 bytes</pre> +</div> </li> +<li>If the stack usage is (partly) dynamic and not bounded, it’s: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">warning: stack usage might be unbounded</pre> +</div> </li> +</ul> <p><samp class="option">-Wstack-usage=</samp>‘<samp class="samp">PTRDIFF_MAX</samp>’ is enabled by default. Warnings controlled by the option can be disabled either by specifying <var class="var">byte-size</var> of ‘<samp class="samp">SIZE_MAX</samp>’ or more or by <samp class="option">-Wno-stack-usage</samp>. </p> </dd> <dt> +<span><code class="code">-Wno-stack-usage</code><a class="copiable-link" href="#index-Wno-stack-usage-1"> ¶</a></span> +</dt> <dd> +<p>Disable <samp class="option">-Wstack-usage=</samp> warnings. The option is equivalent to <samp class="option">-Wstack-usage=</samp>‘<samp class="samp">SIZE_MAX</samp>’ or larger. </p> </dd> <dt> + <span><code class="code">-Wunsafe-loop-optimizations</code><a class="copiable-link" href="#index-Wunsafe-loop-optimizations"> ¶</a></span> +</dt> <dd> +<p>Warn if the loop cannot be optimized because the compiler cannot assume anything on the bounds of the loop indices. With <samp class="option">-funsafe-loop-optimizations</samp> warn if the compiler makes such assumptions. </p> </dd> <dt> + <span><code class="code">-Wno-pedantic-ms-format <span class="r">(MinGW targets only)</span></code><a class="copiable-link" href="#index-Wno-pedantic-ms-format"> ¶</a></span> +</dt> <dd> +<p>When used in combination with <samp class="option">-Wformat</samp> and <samp class="option">-pedantic</samp> without GNU extensions, this option disables the warnings about non-ISO <code class="code">printf</code> / <code class="code">scanf</code> format width specifiers <code class="code">I32</code>, <code class="code">I64</code>, and <code class="code">I</code> used on Windows targets, which depend on the MS runtime. </p> </dd> <dt> + <span><code class="code">-Wpointer-arith</code><a class="copiable-link" href="#index-Wpointer-arith"> ¶</a></span> +</dt> <dd> +<p>Warn about anything that depends on the “size of” a function type or of <code class="code">void</code>. GNU C assigns these types a size of 1, for convenience in calculations with <code class="code">void *</code> pointers and pointers to functions. In C++, warn also when an arithmetic operation involves <code class="code">NULL</code>. This warning is also enabled by <samp class="option">-Wpedantic</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-pointer-compare</code><a class="copiable-link" href="#index-Wpointer-compare"> ¶</a></span> +</dt> <dd> +<p>Do not warn if a pointer is compared with a zero character constant. This usually means that the pointer was meant to be dereferenced. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">const char *p = foo (); +if (p == '\0') + return 42;</pre> +</div> <p>Note that the code above is invalid in C++11. </p> <p>This warning is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wtsan</code><a class="copiable-link" href="#index-Wtsan"> ¶</a></span> +</dt> <dd> +<p>Warn about unsupported features in ThreadSanitizer. </p> <p>ThreadSanitizer does not support <code class="code">std::atomic_thread_fence</code> and can report false positives. </p> <p>This warning is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wtype-limits</code><a class="copiable-link" href="#index-Wtype-limits"> ¶</a></span> +</dt> <dd> +<p>Warn if a comparison is always true or always false due to the limited range of the data type, but do not warn for constant expressions. For example, warn if an unsigned variable is compared against zero with <code class="code"><</code> or <code class="code">>=</code>. This warning is also enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wabsolute-value <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wabsolute-value"> ¶</a></span> +</dt> <dd> +<p>Warn for calls to standard functions that compute the absolute value of an argument when a more appropriate standard function is available. For example, calling <code class="code">abs(3.14)</code> triggers the warning because the appropriate function to call to compute the absolute value of a double argument is <code class="code">fabs</code>. The option also triggers warnings when the argument in a call to such a function has an unsigned type. This warning can be suppressed with an explicit type cast and it is also enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wcomment</code><a class="copiable-link" href="#index-Wcomment"> ¶</a></span> +</dt> <dt><code class="code">-Wcomments</code></dt> <dd> +<p>Warn whenever a comment-start sequence ‘<samp class="samp">/*</samp>’ appears in a ‘<samp class="samp">/*</samp>’ comment, or whenever a backslash-newline appears in a ‘<samp class="samp">//</samp>’ comment. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> +<span><code class="code">-Wtrigraphs</code><a class="copiable-link" href="#index-Wtrigraphs"> ¶</a></span> +</dt> <dd> +<p>Warn if any trigraphs are encountered that might change the meaning of the program. Trigraphs within comments are not warned about, except those that would form escaped newlines. </p> <p>This option is implied by <samp class="option">-Wall</samp>. If <samp class="option">-Wall</samp> is not given, this option is still enabled unless trigraphs are enabled. To get trigraph conversion without warnings, but get the other <samp class="option">-Wall</samp> warnings, use ‘<samp class="samp">-trigraphs -Wall -Wno-trigraphs</samp>’. </p> </dd> <dt> + <span><code class="code">-Wundef</code><a class="copiable-link" href="#index-Wundef"> ¶</a></span> +</dt> <dd> +<p>Warn if an undefined identifier is evaluated in an <code class="code">#if</code> directive. Such identifiers are replaced with zero. </p> </dd> <dt> +<span><code class="code">-Wexpansion-to-defined</code><a class="copiable-link" href="#index-Wexpansion-to-defined"> ¶</a></span> +</dt> <dd> +<p>Warn whenever ‘<samp class="samp">defined</samp>’ is encountered in the expansion of a macro (including the case where the macro is expanded by an ‘<samp class="samp">#if</samp>’ directive). Such usage is not portable. This warning is also enabled by <samp class="option">-Wpedantic</samp> and <samp class="option">-Wextra</samp>. </p> </dd> <dt> +<span><code class="code">-Wunused-macros</code><a class="copiable-link" href="#index-Wunused-macros"> ¶</a></span> +</dt> <dd> +<p>Warn about macros defined in the main file that are unused. A macro is <em class="dfn">used</em> if it is expanded or tested for existence at least once. The preprocessor also warns if the macro has not been used at the time it is redefined or undefined. </p> <p>Built-in macros, macros defined on the command line, and macros defined in include files are not warned about. </p> <p><em class="emph">Note:</em> If a macro is actually used, but only used in skipped conditional blocks, then the preprocessor reports it as unused. To avoid the warning in such a case, you might improve the scope of the macro’s definition by, for example, moving it into the first skipped block. Alternatively, you could provide a dummy use with something like: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#if defined the_macro_causing_the_warning +#endif</pre> +</div> </dd> <dt> + <span><code class="code">-Wno-endif-labels</code><a class="copiable-link" href="#index-Wno-endif-labels"> ¶</a></span> +</dt> <dd> +<p>Do not warn whenever an <code class="code">#else</code> or an <code class="code">#endif</code> are followed by text. This sometimes happens in older programs with code of the form </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#if FOO +… +#else FOO +… +#endif FOO</pre> +</div> <p>The second and third <code class="code">FOO</code> should be in comments. This warning is on by default. </p> </dd> <dt> + <span><code class="code">-Wbad-function-cast <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wbad-function-cast"> ¶</a></span> +</dt> <dd> +<p>Warn when a function call is cast to a non-matching type. For example, warn if a call to a function returning an integer type is cast to a pointer type. </p> </dd> <dt> + <span><code class="code">-Wc90-c99-compat <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wc90-c99-compat"> ¶</a></span> +</dt> <dd> +<p>Warn about features not present in ISO C90, but present in ISO C99. For instance, warn about use of variable length arrays, <code class="code">long long</code> type, <code class="code">bool</code> type, compound literals, designated initializers, and so on. This option is independent of the standards mode. Warnings are disabled in the expression that follows <code class="code">__extension__</code>. </p> </dd> <dt> + <span><code class="code">-Wc99-c11-compat <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wc99-c11-compat"> ¶</a></span> +</dt> <dd> +<p>Warn about features not present in ISO C99, but present in ISO C11. For instance, warn about use of anonymous structures and unions, <code class="code">_Atomic</code> type qualifier, <code class="code">_Thread_local</code> storage-class specifier, <code class="code">_Alignas</code> specifier, <code class="code">Alignof</code> operator, <code class="code">_Generic</code> keyword, and so on. This option is independent of the standards mode. Warnings are disabled in the expression that follows <code class="code">__extension__</code>. </p> </dd> <dt> + <span><code class="code">-Wc11-c2x-compat <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wc11-c2x-compat"> ¶</a></span> +</dt> <dd> +<p>Warn about features not present in ISO C11, but present in ISO C2X. For instance, warn about omitting the string in <code class="code">_Static_assert</code>, use of ‘<samp class="samp">[[]]</samp>’ syntax for attributes, use of decimal floating-point types, and so on. This option is independent of the standards mode. Warnings are disabled in the expression that follows <code class="code">__extension__</code>. </p> </dd> <dt> + <span><code class="code">-Wc++-compat <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b-compat"> ¶</a></span> +</dt> <dd> +<p>Warn about ISO C constructs that are outside of the common subset of ISO C and ISO C++, e.g. request for implicit conversion from <code class="code">void *</code> to a pointer to non-<code class="code">void</code> type. </p> </dd> <dt> + <span><code class="code">-Wc++11-compat <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b11-compat"> ¶</a></span> +</dt> <dd> +<p>Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords in ISO C++ 2011. This warning turns on <samp class="option">-Wnarrowing</samp> and is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wc++14-compat <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b14-compat"> ¶</a></span> +</dt> <dd> +<p>Warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wc++17-compat <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b17-compat"> ¶</a></span> +</dt> <dd> +<p>Warn about C++ constructs whose meaning differs between ISO C++ 2014 and ISO C++ 2017. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wc++20-compat <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b20-compat"> ¶</a></span> +</dt> <dd> +<p>Warn about C++ constructs whose meaning differs between ISO C++ 2017 and ISO C++ 2020. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-c++11-extensions <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b11-extensions"> ¶</a></span> +</dt> <dd> +<p>Do not warn about C++11 constructs in code being compiled using an older C++ standard. Even without this option, some C++11 constructs will only be diagnosed if <samp class="option">-Wpedantic</samp> is used. </p> </dd> <dt> + <span><code class="code">-Wno-c++14-extensions <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b14-extensions"> ¶</a></span> +</dt> <dd> +<p>Do not warn about C++14 constructs in code being compiled using an older C++ standard. Even without this option, some C++14 constructs will only be diagnosed if <samp class="option">-Wpedantic</samp> is used. </p> </dd> <dt> + <span><code class="code">-Wno-c++17-extensions <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b17-extensions"> ¶</a></span> +</dt> <dd> +<p>Do not warn about C++17 constructs in code being compiled using an older C++ standard. Even without this option, some C++17 constructs will only be diagnosed if <samp class="option">-Wpedantic</samp> is used. </p> </dd> <dt> + <span><code class="code">-Wno-c++20-extensions <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b20-extensions"> ¶</a></span> +</dt> <dd> +<p>Do not warn about C++20 constructs in code being compiled using an older C++ standard. Even without this option, some C++20 constructs will only be diagnosed if <samp class="option">-Wpedantic</samp> is used. </p> </dd> <dt> + <span><code class="code">-Wno-c++23-extensions <span class="r">(C++ and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wc_002b_002b23-extensions"> ¶</a></span> +</dt> <dd> +<p>Do not warn about C++23 constructs in code being compiled using an older C++ standard. Even without this option, some C++23 constructs will only be diagnosed if <samp class="option">-Wpedantic</samp> is used. </p> </dd> <dt> + <span><code class="code">-Wcast-qual</code><a class="copiable-link" href="#index-Wcast-qual"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a <code class="code">const char *</code> is cast to an ordinary <code class="code">char *</code>. </p> <p>Also warn when making a cast that introduces a type qualifier in an unsafe way. For example, casting <code class="code">char **</code> to <code class="code">const char **</code> is unsafe, as in this example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">/* p is char ** value. */ +const char **q = (const char **) p; +/* Assignment of readonly string to const char * is OK. */ +*q = "string"; +/* Now char** pointer points to read-only memory. */ +**p = 'b';</pre> +</div> </dd> <dt> + <span><code class="code">-Wcast-align</code><a class="copiable-link" href="#index-Wcast-align"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a pointer is cast such that the required alignment of the target is increased. For example, warn if a <code class="code">char *</code> is cast to an <code class="code">int *</code> on machines where integers can only be accessed at two- or four-byte boundaries. </p> </dd> <dt> +<span><code class="code">-Wcast-align=strict</code><a class="copiable-link" href="#index-Wcast-align_003dstrict"> ¶</a></span> +</dt> <dd> +<p>Warn whenever a pointer is cast such that the required alignment of the target is increased. For example, warn if a <code class="code">char *</code> is cast to an <code class="code">int *</code> regardless of the target machine. </p> </dd> <dt> + <span><code class="code">-Wcast-function-type</code><a class="copiable-link" href="#index-Wcast-function-type"> ¶</a></span> +</dt> <dd> +<p>Warn when a function pointer is cast to an incompatible function pointer. In a cast involving function types with a variable argument list only the types of initial arguments that are provided are considered. Any parameter of pointer-type matches any other pointer-type. Any benign differences in integral types are ignored, like <code class="code">int</code> vs. <code class="code">long</code> on ILP32 targets. Likewise type qualifiers are ignored. The function type <code class="code">void (*) (void)</code> is special and matches everything, which can be used to suppress this warning. In a cast involving pointer to member types this warning warns whenever the type cast is changing the pointer to member type. This warning is enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wwrite-strings</code><a class="copiable-link" href="#index-Wwrite-strings"> ¶</a></span> +</dt> <dd> +<p>When compiling C, give string constants the type <code class="code">const +char[<var class="var">length</var>]</code> so that copying the address of one into a non-<code class="code">const</code> <code class="code">char *</code> pointer produces a warning. These warnings help you find at compile time code that can try to write into a string constant, but only if you have been very careful about using <code class="code">const</code> in declarations and prototypes. Otherwise, it is just a nuisance. This is why we did not make <samp class="option">-Wall</samp> request these warnings. </p> <p>When compiling C++, warn about the deprecated conversion from string literals to <code class="code">char *</code>. This warning is enabled by default for C++ programs. </p> </dd> <dt> + <span><code class="code">-Wclobbered</code><a class="copiable-link" href="#index-Wclobbered"> ¶</a></span> +</dt> <dd> +<p>Warn for variables that might be changed by <code class="code">longjmp</code> or <code class="code">vfork</code>. This warning is also enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-complain-wrong-lang</code><a class="copiable-link" href="#index-Wcomplain-wrong-lang"> ¶</a></span> +</dt> <dd> +<p>By default, language front ends complain when a command-line option is valid, but not applicable to that front end. This may be disabled with <samp class="option">-Wno-complain-wrong-lang</samp>, which is mostly useful when invoking a single compiler driver for multiple source files written in different languages, for example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">$ g++ -fno-rtti a.cc b.f90</pre> +</div> <p>The driver <samp class="file">g++</samp> invokes the C++ front end to compile <samp class="file">a.cc</samp> and the Fortran front end to compile <samp class="file">b.f90</samp>. The latter front end diagnoses ‘<samp class="samp">f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran</samp>’, which may be disabled with <samp class="option">-Wno-complain-wrong-lang</samp>. </p> </dd> <dt> + <span><code class="code">-Wconversion</code><a class="copiable-link" href="#index-Wconversion"> ¶</a></span> +</dt> <dd> +<p>Warn for implicit conversions that may alter a value. This includes conversions between real and integer, like <code class="code">abs (x)</code> when <code class="code">x</code> is <code class="code">double</code>; conversions between signed and unsigned, like <code class="code">unsigned ui = -1</code>; and conversions to smaller types, like <code class="code">sqrtf (M_PI)</code>. Do not warn for explicit casts like <code class="code">abs +((int) x)</code> and <code class="code">ui = (unsigned) -1</code>, or if the value is not changed by the conversion like in <code class="code">abs (2.0)</code>. Warnings about conversions between signed and unsigned integers can be disabled by using <samp class="option">-Wno-sign-conversion</samp>. </p> <p>For C++, also warn for confusing overload resolution for user-defined conversions; and conversions that never use a type conversion operator: conversions to <code class="code">void</code>, the same type, a base class or a reference to them. Warnings about conversions between signed and unsigned integers are disabled by default in C++ unless <samp class="option">-Wsign-conversion</samp> is explicitly enabled. </p> <p>Warnings about conversion from arithmetic on a small type back to that type are only given with <samp class="option">-Warith-conversion</samp>. </p> </dd> <dt> + <span><code class="code">-Wdangling-else</code><a class="copiable-link" href="#index-Wdangling-else"> ¶</a></span> +</dt> <dd> +<p>Warn about constructions where there may be confusion to which <code class="code">if</code> statement an <code class="code">else</code> branch belongs. Here is an example of such a case: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">{ + if (a) + if (b) + foo (); + else + bar (); +}</pre></div> +</div> <p>In C/C++, every <code class="code">else</code> branch belongs to the innermost possible <code class="code">if</code> statement, which in this example is <code class="code">if (b)</code>. This is often not what the programmer expected, as illustrated in the above example by indentation the programmer chose. When there is the potential for this confusion, GCC issues a warning when this flag is specified. To eliminate the warning, add explicit braces around the innermost <code class="code">if</code> statement so there is no way the <code class="code">else</code> can belong to the enclosing <code class="code">if</code>. The resulting code looks like this: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">{ + if (a) + { + if (b) + foo (); + else + bar (); + } +}</pre></div> +</div> <p>This warning is enabled by <samp class="option">-Wparentheses</samp>. </p> </dd> <dt> + <span><code class="code">-Wdangling-pointer</code><a class="copiable-link" href="#index-Wdangling-pointer"> ¶</a></span> +</dt> <dt><code class="code">-Wdangling-pointer=<var class="var">n</var></code></dt> <dd> +<p>Warn about uses of pointers (or C++ references) to objects with automatic storage duration after their lifetime has ended. This includes local variables declared in nested blocks, compound literals and other unnamed temporary objects. In addition, warn about storing the address of such objects in escaped pointers. The warning is enabled at all optimization levels but may yield different results with optimization than without. </p> <dl class="table"> <dt><code class="code">-Wdangling-pointer=1</code></dt> <dd> +<p>At level 1 the warning diagnoses only unconditional uses of dangling pointers. For example </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int f (int c1, int c2, x) +{ + char *p = strchr ((char[]){ c1, c2 }, c3); + // warning: dangling pointer to a compound literal + return p ? *p : 'x'; +}</pre> +</div> <p>In the following function the store of the address of the local variable <code class="code">x</code> in the escaped pointer <code class="code">*p</code> also triggers the warning. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void g (int **p) +{ + int x = 7; + // warning: storing the address of a local variable in *p + *p = &x; +}</pre> +</div> </dd> <dt><code class="code">-Wdangling-pointer=2</code></dt> <dd> +<p>At level 2, in addition to unconditional uses the warning also diagnoses conditional uses of dangling pointers. </p> <p>For example, because the array <var class="var">a</var> in the following function is out of scope when the pointer <var class="var">s</var> that was set to point is used, the warning triggers at this level. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (char *s) +{ + if (!s) + { + char a[12] = "tmpname"; + s = a; + } + // warning: dangling pointer to a may be used + strcat (s, ".tmp"); + ... +}</pre> +</div> </dd> </dl> <p><samp class="option">-Wdangling-pointer=2</samp> is included in <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wdate-time</code><a class="copiable-link" href="#index-Wdate-time"> ¶</a></span> +</dt> <dd> +<p>Warn when macros <code class="code">__TIME__</code>, <code class="code">__DATE__</code> or <code class="code">__TIMESTAMP__</code> are encountered as they might prevent bit-wise-identical reproducible compilations. </p> </dd> <dt> + <span><code class="code">-Wempty-body</code><a class="copiable-link" href="#index-Wempty-body"> ¶</a></span> +</dt> <dd> +<p>Warn if an empty body occurs in an <code class="code">if</code>, <code class="code">else</code> or <code class="code">do +while</code> statement. This warning is also enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-endif-labels</code><a class="copiable-link" href="#index-Wendif-labels-1"> ¶</a></span> +</dt> <dd> +<p>Do not warn about stray tokens after <code class="code">#else</code> and <code class="code">#endif</code>. </p> </dd> <dt> + <span><code class="code">-Wenum-compare</code><a class="copiable-link" href="#index-Wenum-compare"> ¶</a></span> +</dt> <dd> +<p>Warn about a comparison between values of different enumerated types. In C++ enumerated type mismatches in conditional expressions are also diagnosed and the warning is enabled by default. In C this warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wenum-conversion</code><a class="copiable-link" href="#index-Wenum-conversion"> ¶</a></span> +</dt> <dd> +<p>Warn when a value of enumerated type is implicitly converted to a different enumerated type. This warning is enabled by <samp class="option">-Wextra</samp> in C. </p> </dd> <dt> + <span><code class="code">-Wenum-int-mismatch <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wenum-int-mismatch"> ¶</a></span> +</dt> <dd> +<p>Warn about mismatches between an enumerated type and an integer type in declarations. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">enum E { l = -1, z = 0, g = 1 }; +int foo(void); +enum E foo(void);</pre> +</div> <p>In C, an enumerated type is compatible with <code class="code">char</code>, a signed integer type, or an unsigned integer type. However, since the choice of the underlying type of an enumerated type is implementation-defined, such mismatches may cause portability issues. In C++, such mismatches are an error. In C, this warning is enabled by <samp class="option">-Wall</samp> and <samp class="option">-Wc++-compat</samp>. </p> </dd> <dt> + <span><code class="code">-Wjump-misses-init <span class="r">(C, Objective-C only)</span></code><a class="copiable-link" href="#index-Wjump-misses-init"> ¶</a></span> +</dt> <dd> +<p>Warn if a <code class="code">goto</code> statement or a <code class="code">switch</code> statement jumps forward across the initialization of a variable, or jumps backward to a label after the variable has been initialized. This only warns about variables that are initialized when they are declared. This warning is only supported for C and Objective-C; in C++ this sort of branch is an error in any case. </p> <p><samp class="option">-Wjump-misses-init</samp> is included in <samp class="option">-Wc++-compat</samp>. It can be disabled with the <samp class="option">-Wno-jump-misses-init</samp> option. </p> </dd> <dt> + <span><code class="code">-Wsign-compare</code><a class="copiable-link" href="#index-Wsign-compare"> ¶</a></span> +</dt> <dd> +<p>Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned. In C++, this warning is also enabled by <samp class="option">-Wall</samp>. In C, it is also enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wsign-conversion</code><a class="copiable-link" href="#index-Wsign-conversion"> ¶</a></span> +</dt> <dd> +<p>Warn for implicit conversions that may change the sign of an integer value, like assigning a signed integer expression to an unsigned integer variable. An explicit cast silences the warning. In C, this option is enabled also by <samp class="option">-Wconversion</samp>. </p> </dd> <dt> + <span><code class="code">-Wfloat-conversion</code><a class="copiable-link" href="#index-Wfloat-conversion"> ¶</a></span> +</dt> <dd> +<p>Warn for implicit conversions that reduce the precision of a real value. This includes conversions from real to integer, and from higher precision real to lower precision real values. This option is also enabled by <samp class="option">-Wconversion</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-scalar-storage-order</code><a class="copiable-link" href="#index-Wno-scalar-storage-order"> ¶</a></span> +</dt> <dd> +<p>Do not warn on suspicious constructs involving reverse scalar storage order. </p> </dd> <dt> + <span><code class="code">-Wsizeof-array-div</code><a class="copiable-link" href="#index-Wsizeof-array-div"> ¶</a></span> +</dt> <dd> +<p>Warn about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element. In such a case, the computation will not yield the number of elements in the array, which is likely what the user intended. This warning warns e.g. about </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int fn () +{ + int arr[10]; + return sizeof (arr) / sizeof (short); +}</pre> +</div> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wsizeof-pointer-div</code><a class="copiable-link" href="#index-Wsizeof-pointer-div"> ¶</a></span> +</dt> <dd> +<p>Warn for suspicious divisions of two sizeof expressions that divide the pointer size by the element size, which is the usual way to compute the array size but won’t work out correctly with pointers. This warning warns e.g. about <code class="code">sizeof (ptr) / sizeof (ptr[0])</code> if <code class="code">ptr</code> is not an array, but a pointer. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wsizeof-pointer-memaccess</code><a class="copiable-link" href="#index-Wsizeof-pointer-memaccess"> ¶</a></span> +</dt> <dd> +<p>Warn for suspicious length parameters to certain string and memory built-in functions if the argument uses <code class="code">sizeof</code>. This warning triggers for example for <code class="code">memset (ptr, 0, sizeof (ptr));</code> if <code class="code">ptr</code> is not an array, but a pointer, and suggests a possible fix, or about <code class="code">memcpy (&foo, ptr, sizeof (&foo));</code>. <samp class="option">-Wsizeof-pointer-memaccess</samp> also warns about calls to bounded string copy functions like <code class="code">strncat</code> or <code class="code">strncpy</code> that specify as the bound a <code class="code">sizeof</code> expression of the source array. For example, in the following function the call to <code class="code">strncat</code> specifies the size of the source string as the bound. That is almost certainly a mistake and so the call is diagnosed. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void make_file (const char *name) +{ + char path[PATH_MAX]; + strncpy (path, name, sizeof path - 1); + strncat (path, ".text", sizeof ".text"); + … +}</pre> +</div> <p>The <samp class="option">-Wsizeof-pointer-memaccess</samp> option is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-sizeof-array-argument</code><a class="copiable-link" href="#index-Wsizeof-array-argument"> ¶</a></span> +</dt> <dd> +<p>Do not warn when the <code class="code">sizeof</code> operator is applied to a parameter that is declared as an array in a function definition. This warning is enabled by default for C and C++ programs. </p> </dd> <dt> + <span><code class="code">-Wmemset-elt-size</code><a class="copiable-link" href="#index-Wmemset-elt-size"> ¶</a></span> +</dt> <dd> +<p>Warn for suspicious calls to the <code class="code">memset</code> built-in function, if the first argument references an array, and the third argument is a number equal to the number of elements, but not equal to the size of the array in memory. This indicates that the user has omitted a multiplication by the element size. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wmemset-transposed-args</code><a class="copiable-link" href="#index-Wmemset-transposed-args"> ¶</a></span> +</dt> <dd> +<p>Warn for suspicious calls to the <code class="code">memset</code> built-in function where the second argument is not zero and the third argument is zero. For example, the call <code class="code">memset (buf, sizeof buf, 0)</code> is diagnosed because <code class="code">memset (buf, 0, sizeof buf)</code> was meant instead. The diagnostic is only emitted if the third argument is a literal zero. Otherwise, if it is an expression that is folded to zero, or a cast of zero to some type, it is far less likely that the arguments have been mistakenly transposed and no warning is emitted. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Waddress</code><a class="copiable-link" href="#index-Waddress"> ¶</a></span> +</dt> <dd> +<p>Warn about suspicious uses of address expressions. These include comparing the address of a function or a declared object to the null pointer constant such as in </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (void); +void g (void) +{ + if (!f) // warning: expression evaluates to false + abort (); +}</pre> +</div> <p>comparisons of a pointer to a string literal, such as in </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (const char *x) +{ + if (x == "abc") // warning: expression evaluates to false + puts ("equal"); +}</pre> +</div> <p>and tests of the results of pointer addition or subtraction for equality to null, such as in </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (const int *p, int i) +{ + return p + i == NULL; +}</pre> +</div> <p>Such uses typically indicate a programmer error: the address of most functions and objects necessarily evaluates to true (the exception are weak symbols), so their use in a conditional might indicate missing parentheses in a function call or a missing dereference in an array expression. The subset of the warning for object pointers can be suppressed by casting the pointer operand to an integer type such as <code class="code">intptr_t</code> or <code class="code">uintptr_t</code>. Comparisons against string literals result in unspecified behavior and are not portable, and suggest the intent was to call <code class="code">strcmp</code>. The warning is suppressed if the suspicious expression is the result of macro expansion. <samp class="option">-Waddress</samp> warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-address-of-packed-member</code><a class="copiable-link" href="#index-Waddress-of-packed-member"> ¶</a></span> +</dt> <dd> +<p>Do not warn when the address of packed member of struct or union is taken, which usually results in an unaligned pointer value. This is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wlogical-op</code><a class="copiable-link" href="#index-Wlogical-op"> ¶</a></span> +</dt> <dd> +<p>Warn about suspicious uses of logical operators in expressions. This includes using logical operators in contexts where a bit-wise operator is likely to be expected. Also warns when the operands of a logical operator are the same: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern int a; +if (a < 0 && a < 0) { … }</pre> +</div> </dd> <dt> + <span><code class="code">-Wlogical-not-parentheses</code><a class="copiable-link" href="#index-Wlogical-not-parentheses"> ¶</a></span> +</dt> <dd> +<p>Warn about logical not used on the left hand side operand of a comparison. This option does not warn if the right operand is considered to be a boolean expression. Its purpose is to detect suspicious code like the following: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int a; +… +if (!a > 1) { … }</pre> +</div> <p>It is possible to suppress the warning by wrapping the LHS into parentheses: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if ((!a) > 1) { … }</pre> +</div> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Waggregate-return</code><a class="copiable-link" href="#index-Waggregate-return"> ¶</a></span> +</dt> <dd> +<p>Warn if any functions that return structures or unions are defined or called. (In languages where you can return an array, this also elicits a warning.) </p> </dd> <dt> + <span><code class="code">-Wno-aggressive-loop-optimizations</code><a class="copiable-link" href="#index-Wno-aggressive-loop-optimizations"> ¶</a></span> +</dt> <dd> +<p>Warn if in a loop with constant number of iterations the compiler detects undefined behavior in some statement during one or more of the iterations. </p> </dd> <dt> + <span><code class="code">-Wno-attributes</code><a class="copiable-link" href="#index-Wno-attributes"> ¶</a></span> +</dt> <dd> +<p>Do not warn if an unexpected <code class="code">__attribute__</code> is used, such as unrecognized attributes, function attributes applied to variables, etc. This does not stop errors for incorrect use of supported attributes. </p> <p>Additionally, using <samp class="option">-Wno-attributes=</samp>, it is possible to suppress warnings about unknown scoped attributes (in C++11 and C2X). For example, <samp class="option">-Wno-attributes=vendor::attr</samp> disables warning about the following declaration: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">[[vendor::attr]] void f();</pre> +</div> <p>It is also possible to disable warning about all attributes in a namespace using <samp class="option">-Wno-attributes=vendor::</samp> which prevents warning about both of these declarations: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">[[vendor::safe]] void f(); +[[vendor::unsafe]] void f2();</pre> +</div> <p>Note that <samp class="option">-Wno-attributes=</samp> does not imply <samp class="option">-Wno-attributes</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-builtin-declaration-mismatch</code><a class="copiable-link" href="#index-Wno-builtin-declaration-mismatch"> ¶</a></span> +</dt> <dd> +<p>Warn if a built-in function is declared with an incompatible signature or as a non-function, or when a built-in function declared with a type that does not include a prototype is called with arguments whose promoted types do not match those expected by the function. When <samp class="option">-Wextra</samp> is specified, also warn when a built-in function that takes arguments is declared without a prototype. The <samp class="option">-Wbuiltin-declaration-mismatch</samp> warning is enabled by default. To avoid the warning include the appropriate header to bring the prototypes of built-in functions into scope. </p> <p>For example, the call to <code class="code">memset</code> below is diagnosed by the warning because the function expects a value of type <code class="code">size_t</code> as its argument but the type of <code class="code">32</code> is <code class="code">int</code>. With <samp class="option">-Wextra</samp>, the declaration of the function is diagnosed as well. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">extern void* memset (); +void f (void *d) +{ + memset (d, '\0', 32); +}</pre> +</div> </dd> <dt> + <span><code class="code">-Wno-builtin-macro-redefined</code><a class="copiable-link" href="#index-Wno-builtin-macro-redefined"> ¶</a></span> +</dt> <dd> +<p>Do not warn if certain built-in macros are redefined. This suppresses warnings for redefinition of <code class="code">__TIMESTAMP__</code>, <code class="code">__TIME__</code>, <code class="code">__DATE__</code>, <code class="code">__FILE__</code>, and <code class="code">__BASE_FILE__</code>. </p> </dd> <dt> + <span><code class="code">-Wstrict-prototypes <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wstrict-prototypes"> ¶</a></span> +</dt> <dd> +<p>Warn if a function is declared or defined without specifying the argument types. (An old-style function definition is permitted without a warning if preceded by a declaration that specifies the argument types.) </p> </dd> <dt> + <span><code class="code">-Wold-style-declaration <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wold-style-declaration"> ¶</a></span> +</dt> <dd> +<p>Warn for obsolescent usages, according to the C Standard, in a declaration. For example, warn if storage-class specifiers like <code class="code">static</code> are not the first things in a declaration. This warning is also enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wold-style-definition <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wold-style-definition"> ¶</a></span> +</dt> <dd> +<p>Warn if an old-style function definition is used. A warning is given even if there is a previous prototype. A definition using ‘<samp class="samp">()</samp>’ is not considered an old-style definition in C2X mode, because it is equivalent to ‘<samp class="samp">(void)</samp>’ in that case, but is considered an old-style definition for older standards. </p> </dd> <dt> + <span><code class="code">-Wmissing-parameter-type <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wmissing-parameter-type"> ¶</a></span> +</dt> <dd> +<p>A function parameter is declared without a type specifier in K&R-style functions: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void foo(bar) { }</pre> +</div> <p>This warning is also enabled by <samp class="option">-Wextra</samp>. </p> </dd> <dt> + <span><code class="code">-Wmissing-prototypes <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wmissing-prototypes"> ¶</a></span> +</dt> <dd> +<p>Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definition itself provides a prototype. Use this option to detect global functions that do not have a matching prototype declaration in a header file. This option is not valid for C++ because all function declarations provide prototypes and a non-matching declaration declares an overload rather than conflict with an earlier declaration. Use <samp class="option">-Wmissing-declarations</samp> to detect missing declarations in C++. </p> </dd> <dt> + <span><code class="code">-Wmissing-declarations</code><a class="copiable-link" href="#index-Wmissing-declarations"> ¶</a></span> +</dt> <dd> +<p>Warn if a global function is defined without a previous declaration. Do so even if the definition itself provides a prototype. Use this option to detect global functions that are not declared in header files. In C, no warnings are issued for functions with previous non-prototype declarations; use <samp class="option">-Wmissing-prototypes</samp> to detect missing prototypes. In C++, no warnings are issued for function templates, or for inline functions, or for functions in anonymous namespaces. </p> </dd> <dt> + <span><code class="code">-Wmissing-field-initializers</code><a class="copiable-link" href="#index-Wmissing-field-initializers"> ¶</a></span> +</dt> <dd> +<p>Warn if a structure’s initializer has some fields missing. For example, the following code causes such a warning, because <code class="code">x.h</code> is implicitly zero: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct s { int f, g, h; }; +struct s x = { 3, 4 };</pre> +</div> <p>This option does not warn about designated initializers, so the following modification does not trigger a warning: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct s { int f, g, h; }; +struct s x = { .f = 3, .g = 4 };</pre> +</div> <p>In C this option does not warn about the universal zero initializer ‘<samp class="samp">{ 0 }</samp>’: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct s { int f, g, h; }; +struct s x = { 0 };</pre> +</div> <p>Likewise, in C++ this option does not warn about the empty { } initializer, for example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct s { int f, g, h; }; +s x = { };</pre> +</div> <p>This warning is included in <samp class="option">-Wextra</samp>. To get other <samp class="option">-Wextra</samp> warnings without this one, use <samp class="option">-Wextra -Wno-missing-field-initializers</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-missing-requires</code><a class="copiable-link" href="#index-Wmissing-requires"> ¶</a></span> +</dt> <dd> <p>By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">bool satisfied = requires { C<T> };</pre> +</div> <p>Here ‘<samp class="samp">satisfied</samp>’ will be true if ‘<samp class="samp">C<T></samp>’ is a valid expression, which it is for all T. Presumably the user meant to write </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">bool satisfied = requires { requires C<T> };</pre> +</div> <p>so ‘<samp class="samp">satisfied</samp>’ is only true if concept ‘<samp class="samp">C</samp>’ is satisfied for type ‘<samp class="samp">T</samp>’. </p> <p>This warning can be disabled with <samp class="option">-Wno-missing-requires</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-missing-template-keyword</code><a class="copiable-link" href="#index-Wmissing-template-keyword"> ¶</a></span> +</dt> <dd> <p>The member access tokens ., -> and :: must be followed by the <code class="code">template</code> keyword if the parent object is dependent and the member being named is a template. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">template <class X> +void DoStuff (X x) +{ + x.template DoSomeOtherStuff<X>(); // Good. + x.DoMoreStuff<X>(); // Warning, x is dependent. +}</pre> +</div> <p>In rare cases it is possible to get false positives. To silence this, wrap the expression in parentheses. For example, the following is treated as a template, even where m and N are integers: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void NotATemplate (my_class t) +{ + int N = 5; + + bool test = t.m < N > (0); // Treated as a template. + test = (t.m < N) > (0); // Same meaning, but not treated as a template. +}</pre> +</div> <p>This warning can be disabled with <samp class="option">-Wno-missing-template-keyword</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-multichar</code><a class="copiable-link" href="#index-Wno-multichar"> ¶</a></span> +</dt> <dd> +<p>Do not warn if a multicharacter constant (‘<samp class="samp">'FOOF'</samp>’) is used. Usually they indicate a typo in the user’s code, as they have implementation-defined values, and should not be used in portable code. </p> </dd> <dt> + <span><code class="code">-Wnormalized=<span class="r">[</span>none<span class="r">|</span>id<span class="r">|</span>nfc<span class="r">|</span>nfkc<span class="r">]</span></code><a class="copiable-link" href="#index-Wnormalized_003d"> ¶</a></span> +</dt> <dd> +<p>In ISO C and ISO C++, two identifiers are different if they are different sequences of characters. However, sometimes when characters outside the basic ASCII character set are used, you can have two different character sequences that look the same. To avoid confusion, the ISO 10646 standard sets out some <em class="dfn">normalization rules</em> which when applied ensure that two sequences that look the same are turned into the same sequence. GCC can warn you if you are using identifiers that have not been normalized; this option controls that warning. </p> <p>There are four levels of warning supported by GCC. The default is <samp class="option">-Wnormalized=nfc</samp>, which warns about any identifier that is not in the ISO 10646 “C” normalized form, <em class="dfn">NFC</em>. NFC is the recommended form for most uses. It is equivalent to <samp class="option">-Wnormalized</samp>. </p> <p>Unfortunately, there are some characters allowed in identifiers by ISO C and ISO C++ that, when turned into NFC, are not allowed in identifiers. That is, there’s no way to use these symbols in portable ISO C or C++ and have all your identifiers in NFC. <samp class="option">-Wnormalized=id</samp> suppresses the warning for these characters. It is hoped that future versions of the standards involved will correct this, which is why this option is not the default. </p> <p>You can switch the warning off for all characters by writing <samp class="option">-Wnormalized=none</samp> or <samp class="option">-Wno-normalized</samp>. You should only do this if you are using some other normalization scheme (like “D”), because otherwise you can easily create bugs that are literally impossible to see. </p> <p>Some characters in ISO 10646 have distinct meanings but look identical in some fonts or display methodologies, especially once formatting has been applied. For instance <code class="code">\u207F</code>, “SUPERSCRIPT LATIN SMALL LETTER N”, displays just like a regular <code class="code">n</code> that has been placed in a superscript. ISO 10646 defines the <em class="dfn">NFKC</em> normalization scheme to convert all these into a standard form as well, and GCC warns if your code is not in NFKC if you use <samp class="option">-Wnormalized=nfkc</samp>. This warning is comparable to warning about every identifier that contains the letter O because it might be confused with the digit 0, and so is not the default, but may be useful as a local coding convention if the programming environment cannot be fixed to display these characters distinctly. </p> </dd> <dt> + <span><code class="code">-Wno-attribute-warning</code><a class="copiable-link" href="#index-Wno-attribute-warning"> ¶</a></span> +</dt> <dd> +<p>Do not warn about usage of functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>) declared with <code class="code">warning</code> attribute. By default, this warning is enabled. <samp class="option">-Wno-attribute-warning</samp> can be used to disable the warning or <samp class="option">-Wno-error=attribute-warning</samp> can be used to disable the error when compiled with <samp class="option">-Werror</samp> flag. </p> </dd> <dt> + <span><code class="code">-Wno-deprecated</code><a class="copiable-link" href="#index-Wno-deprecated"> ¶</a></span> +</dt> <dd> +<p>Do not warn about usage of deprecated features. See <a class="xref" href="deprecated-features">Deprecated Features</a>. </p> </dd> <dt> + <span><code class="code">-Wno-deprecated-declarations</code><a class="copiable-link" href="#index-Wno-deprecated-declarations"> ¶</a></span> +</dt> <dd> +<p>Do not warn about uses of functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>), variables (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>), and types (see <a class="pxref" href="type-attributes">Specifying Attributes of Types</a>) marked as deprecated by using the <code class="code">deprecated</code> attribute. </p> </dd> <dt> + <span><code class="code">-Wno-overflow</code><a class="copiable-link" href="#index-Wno-overflow"> ¶</a></span> +</dt> <dd> +<p>Do not warn about compile-time overflow in constant expressions. </p> </dd> <dt> + <span><code class="code">-Wno-odr</code><a class="copiable-link" href="#index-Wno-odr"> ¶</a></span> +</dt> <dd> +<p>Warn about One Definition Rule violations during link-time optimization. Enabled by default. </p> </dd> <dt> + <span><code class="code">-Wopenacc-parallelism</code><a class="copiable-link" href="#index-Wopenacc-parallelism"> ¶</a></span> +</dt> <dd> +<p>Warn about potentially suboptimal choices related to OpenACC parallelism. </p> </dd> <dt> + <span><code class="code">-Wopenmp-simd</code><a class="copiable-link" href="#index-Wopenmp-simd"> ¶</a></span> +</dt> <dd> +<p>Warn if the vectorizer cost model overrides the OpenMP simd directive set by user. The <samp class="option">-fsimd-cost-model=unlimited</samp> option can be used to relax the cost model. </p> </dd> <dt> + <span><code class="code">-Woverride-init <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Woverride-init"> ¶</a></span> +</dt> <dd> +<p>Warn if an initialized field without side effects is overridden when using designated initializers (see <a class="pxref" href="designated-inits">Designated Initializers</a>). </p> <p>This warning is included in <samp class="option">-Wextra</samp>. To get other <samp class="option">-Wextra</samp> warnings without this one, use <samp class="option">-Wextra -Wno-override-init</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-override-init-side-effects <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Woverride-init-side-effects"> ¶</a></span> +</dt> <dd> +<p>Do not warn if an initialized field with side effects is overridden when using designated initializers (see <a class="pxref" href="designated-inits">Designated Initializers</a>). This warning is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wpacked</code><a class="copiable-link" href="#index-Wpacked"> ¶</a></span> +</dt> <dd> +<p>Warn if a structure is given the packed attribute, but the packed attribute has no effect on the layout or size of the structure. Such structures may be mis-aligned for little benefit. For instance, in this code, the variable <code class="code">f.x</code> in <code class="code">struct bar</code> is misaligned even though <code class="code">struct bar</code> does not itself have the packed attribute: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">struct foo { + int x; + char a, b, c, d; +} __attribute__((packed)); +struct bar { + char z; + struct foo f; +};</pre></div> +</div> </dd> <dt> + <span><code class="code">-Wnopacked-bitfield-compat</code><a class="copiable-link" href="#index-Wpacked-bitfield-compat"> ¶</a></span> +</dt> <dd> +<p>The 4.1, 4.2 and 4.3 series of GCC ignore the <code class="code">packed</code> attribute on bit-fields of type <code class="code">char</code>. This was fixed in GCC 4.4 but the change can lead to differences in the structure layout. GCC informs you when the offset of such a field has changed in GCC 4.4. For example there is no longer a 4-bit padding between field <code class="code">a</code> and <code class="code">b</code> in this structure: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct foo +{ + char a:4; + char b:8; +} __attribute__ ((packed));</pre> +</div> <p>This warning is enabled by default. Use <samp class="option">-Wno-packed-bitfield-compat</samp> to disable this warning. </p> </dd> <dt> + <span><code class="code">-Wpacked-not-aligned <span class="r">(C, C++, Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wpacked-not-aligned"> ¶</a></span> +</dt> <dd> +<p>Warn if a structure field with explicitly specified alignment in a packed struct or union is misaligned. For example, a warning will be issued on <code class="code">struct S</code>, like, <code class="code">warning: alignment 1 of +'struct S' is less than 8</code>, in this code: </p> <div class="example smallexample"> <div class="group"><pre class="example-preformatted" data-language="cpp">struct __attribute__ ((aligned (8))) S8 { char a[8]; }; +struct __attribute__ ((packed)) S { + struct S8 s8; +};</pre></div> +</div> <p>This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wpadded</code><a class="copiable-link" href="#index-Wpadded"> ¶</a></span> +</dt> <dd> +<p>Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure. Sometimes when this happens it is possible to rearrange the fields of the structure to reduce the padding and so make the structure smaller. </p> </dd> <dt> + <span><code class="code">-Wredundant-decls</code><a class="copiable-link" href="#index-Wredundant-decls"> ¶</a></span> +</dt> <dd> +<p>Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing. </p> </dd> <dt> + <span><code class="code">-Wrestrict</code><a class="copiable-link" href="#index-Wrestrict"> ¶</a></span> +</dt> <dd> +<p>Warn when an object referenced by a <code class="code">restrict</code>-qualified parameter (or, in C++, a <code class="code">__restrict</code>-qualified parameter) is aliased by another argument, or when copies between such objects overlap. For example, the call to the <code class="code">strcpy</code> function below attempts to truncate the string by replacing its initial characters with the last four. However, because the call writes the terminating NUL into <code class="code">a[4]</code>, the copies overlap and the call is diagnosed. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void foo (void) +{ + char a[] = "abcd1234"; + strcpy (a, a + 4); + … +}</pre> +</div> <p>The <samp class="option">-Wrestrict</samp> option detects some instances of simple overlap even without optimization but works best at <samp class="option">-O2</samp> and above. It is included in <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wnested-externs <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wnested-externs"> ¶</a></span> +</dt> <dd> +<p>Warn if an <code class="code">extern</code> declaration is encountered within a function. </p> </dd> <dt> + <span><code class="code">-Winline</code><a class="copiable-link" href="#index-Winline"> ¶</a></span> +</dt> <dd> +<p>Warn if a function that is declared as inline cannot be inlined. Even with this option, the compiler does not warn about failures to inline functions declared in system headers. </p> <p>The compiler uses a variety of heuristics to determine whether or not to inline a function. For example, the compiler takes into account the size of the function being inlined and the amount of inlining that has already been done in the current function. Therefore, seemingly insignificant changes in the source program can cause the warnings produced by <samp class="option">-Winline</samp> to appear or disappear. </p> </dd> <dt> +<span><code class="code">-Winterference-size</code><a class="copiable-link" href="#index-Winterference-size"> ¶</a></span> +</dt> <dd> +<p>Warn about use of C++17 <code class="code">std::hardware_destructive_interference_size</code> without specifying its value with <samp class="option">--param destructive-interference-size</samp>. Also warn about questionable values for that option. </p> <p>This variable is intended to be used for controlling class layout, to avoid false sharing in concurrent code: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct independent_fields { + alignas(std::hardware_destructive_interference_size) + std::atomic<int> one; + alignas(std::hardware_destructive_interference_size) + std::atomic<int> two; +};</pre> +</div> <p>Here ‘<samp class="samp">one</samp>’ and ‘<samp class="samp">two</samp>’ are intended to be far enough apart that stores to one won’t require accesses to the other to reload the cache line. </p> <p>By default, <samp class="option">--param destructive-interference-size</samp> and <samp class="option">--param constructive-interference-size</samp> are set based on the current <samp class="option">-mtune</samp> option, typically to the L1 cache line size for the particular target CPU, sometimes to a range if tuning for a generic target. So all translation units that depend on ABI compatibility for the use of these variables must be compiled with the same <samp class="option">-mtune</samp> (or <samp class="option">-mcpu</samp>). </p> <p>If ABI stability is important, such as if the use is in a header for a library, you should probably not use the hardware interference size variables at all. Alternatively, you can force a particular value with <samp class="option">--param</samp>. </p> <p>If you are confident that your use of the variable does not affect ABI outside a single build of your project, you can turn off the warning with <samp class="option">-Wno-interference-size</samp>. </p> </dd> <dt> + <span><code class="code">-Wint-in-bool-context</code><a class="copiable-link" href="#index-Wint-in-bool-context"> ¶</a></span> +</dt> <dd> +<p>Warn for suspicious use of integer values where boolean values are expected, such as conditional expressions (?:) using non-boolean integer constants in boolean context, like <code class="code">if (a <= b ? 2 : 3)</code>. Or left shifting of signed integers in boolean context, like <code class="code">for (a = 0; 1 << a; a++);</code>. Likewise for all kinds of multiplications regardless of the data type. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-int-to-pointer-cast</code><a class="copiable-link" href="#index-Wno-int-to-pointer-cast"> ¶</a></span> +</dt> <dd> +<p>Suppress warnings from casts to pointer type of an integer of a different size. In C++, casting to a pointer type of smaller size is an error. <samp class="option">Wint-to-pointer-cast</samp> is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wno-pointer-to-int-cast <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wno-pointer-to-int-cast"> ¶</a></span> +</dt> <dd> +<p>Suppress warnings from casts from a pointer to an integer type of a different size. </p> </dd> <dt> + <span><code class="code">-Winvalid-pch</code><a class="copiable-link" href="#index-Winvalid-pch"> ¶</a></span> +</dt> <dd> +<p>Warn if a precompiled header (see <a class="pxref" href="precompiled-headers">Using Precompiled Headers</a>) is found in the search path but cannot be used. </p> </dd> <dt> + <span><code class="code">-Winvalid-utf8</code><a class="copiable-link" href="#index-Winvalid-utf8"> ¶</a></span> +</dt> <dd> +<p>Warn if an invalid UTF-8 character is found. This warning is on by default for C++23 if <samp class="option">-finput-charset=UTF-8</samp> is used and turned into error with <samp class="option">-pedantic-errors</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-unicode</code><a class="copiable-link" href="#index-Wunicode"> ¶</a></span> +</dt> <dd> +<p>Don’t diagnose invalid forms of delimited or named escape sequences which are treated as separate tokens. <samp class="option">Wunicode</samp> is enabled by default. </p> </dd> <dt> + <span><code class="code">-Wlong-long</code><a class="copiable-link" href="#index-Wlong-long"> ¶</a></span> +</dt> <dd> +<p>Warn if <code class="code">long long</code> type is used. This is enabled by either <samp class="option">-Wpedantic</samp> or <samp class="option">-Wtraditional</samp> in ISO C90 and C++98 modes. To inhibit the warning messages, use <samp class="option">-Wno-long-long</samp>. </p> </dd> <dt> + <span><code class="code">-Wvariadic-macros</code><a class="copiable-link" href="#index-Wvariadic-macros"> ¶</a></span> +</dt> <dd> +<p>Warn if variadic macros are used in ISO C90 mode, or if the GNU alternate syntax is used in ISO C99 mode. This is enabled by either <samp class="option">-Wpedantic</samp> or <samp class="option">-Wtraditional</samp>. To inhibit the warning messages, use <samp class="option">-Wno-variadic-macros</samp>. </p> </dd> <dt> + <span><code class="code">-Wno-varargs</code><a class="copiable-link" href="#index-Wvarargs"> ¶</a></span> +</dt> <dd> +<p>Do not warn upon questionable usage of the macros used to handle variable arguments like <code class="code">va_start</code>. These warnings are enabled by default. </p> </dd> <dt> + <span><code class="code">-Wvector-operation-performance</code><a class="copiable-link" href="#index-Wvector-operation-performance"> ¶</a></span> +</dt> <dd> +<p>Warn if vector operation is not implemented via SIMD capabilities of the architecture. Mainly useful for the performance tuning. Vector operation can be implemented <code class="code">piecewise</code>, which means that the scalar operation is performed on every vector element; <code class="code">in parallel</code>, which means that the vector operation is implemented using scalars of wider type, which normally is more performance efficient; and <code class="code">as a single scalar</code>, which means that vector fits into a scalar type. </p> </dd> <dt> + <span><code class="code">-Wvla</code><a class="copiable-link" href="#index-Wvla"> ¶</a></span> +</dt> <dd> +<p>Warn if a variable-length array is used in the code. <samp class="option">-Wno-vla</samp> prevents the <samp class="option">-Wpedantic</samp> warning of the variable-length array. </p> </dd> <dt> + <span><code class="code">-Wvla-larger-than=<var class="var">byte-size</var></code><a class="copiable-link" href="#index-Wvla-larger-than_003d"> ¶</a></span> +</dt> <dd> +<p>If this option is used, the compiler warns for declarations of variable-length arrays whose size is either unbounded, or bounded by an argument that allows the array size to exceed <var class="var">byte-size</var> bytes. This is similar to how <samp class="option">-Walloca-larger-than=</samp><var class="var">byte-size</var> works, but with variable-length arrays. </p> <p>Note that GCC may optimize small variable-length arrays of a known value into plain arrays, so this warning may not get triggered for such arrays. </p> <p><samp class="option">-Wvla-larger-than=</samp>‘<samp class="samp">PTRDIFF_MAX</samp>’ is enabled by default but is typically only effective when <samp class="option">-ftree-vrp</samp> is active (default for <samp class="option">-O2</samp> and above). </p> <p>See also <samp class="option">-Walloca-larger-than=<var class="var">byte-size</var></samp>. </p> </dd> <dt> +<span><code class="code">-Wno-vla-larger-than</code><a class="copiable-link" href="#index-Wno-vla-larger-than-1"> ¶</a></span> +</dt> <dd> +<p>Disable <samp class="option">-Wvla-larger-than=</samp> warnings. The option is equivalent to <samp class="option">-Wvla-larger-than=</samp>‘<samp class="samp">SIZE_MAX</samp>’ or larger. </p> </dd> <dt> +<span><code class="code">-Wvla-parameter</code><a class="copiable-link" href="#index-Wno-vla-parameter"> ¶</a></span> +</dt> <dd> +<p>Warn about redeclarations of functions involving arguments of Variable Length Array types of inconsistent kinds or forms, and enable the detection of out-of-bounds accesses to such parameters by warnings such as <samp class="option">-Warray-bounds</samp>. </p> <p>If the first function declaration uses the VLA form the bound specified in the array is assumed to be the minimum number of elements expected to be provided in calls to the function and the maximum number of elements accessed by it. Failing to provide arguments of sufficient size or accessing more than the maximum number of elements may be diagnosed. </p> <p>For example, the warning triggers for the following redeclarations because the first one allows an array of any size to be passed to <code class="code">f</code> while the second one specifies that the array argument must have at least <code class="code">n</code> elements. In addition, calling <code class="code">f</code> with the associated VLA bound parameter in excess of the actual VLA bound triggers a warning as well. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f (int n, int[n]); +// warning: argument 2 previously declared as a VLA +void f (int, int[]); + +void g (int n) +{ + if (n > 4) + return; + int a[n]; + // warning: access to a by f may be out of bounds + f (sizeof a, a); + … +}</pre> +</div> <p><samp class="option">-Wvla-parameter</samp> is included in <samp class="option">-Wall</samp>. The <samp class="option">-Warray-parameter</samp> option triggers warnings for similar problems involving ordinary array arguments. </p> </dd> <dt> + <span><code class="code">-Wvolatile-register-var</code><a class="copiable-link" href="#index-Wvolatile-register-var"> ¶</a></span> +</dt> <dd> +<p>Warn if a register variable is declared volatile. The volatile modifier does not inhibit all optimizations that may eliminate reads and/or writes to register variables. This warning is enabled by <samp class="option">-Wall</samp>. </p> </dd> <dt> + <span><code class="code">-Wxor-used-as-pow <span class="r">(C, C++, Objective-C and Objective-C++ only)</span></code><a class="copiable-link" href="#index-Wxor-used-as-pow"> ¶</a></span> +</dt> <dd> +<p>Warn about uses of <code class="code">^</code>, the exclusive or operator, where it appears the user meant exponentiation. Specifically, the warning occurs when the left-hand side is the decimal constant 2 or 10 and the right-hand side is also a decimal constant. </p> <p>In C and C++, <code class="code">^</code> means exclusive or, whereas in some other languages (e.g. TeX and some versions of BASIC) it means exponentiation. </p> <p>This warning is enabled by default. It can be silenced by converting one of the operands to hexadecimal. </p> </dd> <dt> + <span><code class="code">-Wdisabled-optimization</code><a class="copiable-link" href="#index-Wdisabled-optimization"> ¶</a></span> +</dt> <dd> +<p>Warn if a requested optimization pass is disabled. This warning does not generally indicate that there is anything wrong with your code; it merely indicates that GCC’s optimizers are unable to handle the code effectively. Often, the problem is that your code is too big or too complex; GCC refuses to optimize programs when the optimization itself is likely to take inordinate amounts of time. </p> </dd> <dt> + <span><code class="code">-Wpointer-sign <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wpointer-sign"> ¶</a></span> +</dt> <dd> +<p>Warn for pointer argument passing or assignment with different signedness. This option is only supported for C and Objective-C. It is implied by <samp class="option">-Wall</samp> and by <samp class="option">-Wpedantic</samp>, which can be disabled with <samp class="option">-Wno-pointer-sign</samp>. </p> </dd> <dt> + <span><code class="code">-Wstack-protector</code><a class="copiable-link" href="#index-Wstack-protector"> ¶</a></span> +</dt> <dd> +<p>This option is only active when <samp class="option">-fstack-protector</samp> is active. It warns about functions that are not protected against stack smashing. </p> </dd> <dt> + <span><code class="code">-Woverlength-strings</code><a class="copiable-link" href="#index-Woverlength-strings"> ¶</a></span> +</dt> <dd> +<p>Warn about string constants that are longer than the “minimum maximum” length specified in the C standard. Modern compilers generally allow string constants that are much longer than the standard’s minimum limit, but very portable programs should avoid using longer strings. </p> <p>The limit applies <em class="emph">after</em> string constant concatenation, and does not count the trailing NUL. In C90, the limit was 509 characters; in C99, it was raised to 4095. C++98 does not specify a normative minimum maximum, so we do not diagnose overlength strings in C++. </p> <p>This option is implied by <samp class="option">-Wpedantic</samp>, and can be disabled with <samp class="option">-Wno-overlength-strings</samp>. </p> </dd> <dt> + <span><code class="code">-Wunsuffixed-float-constants <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wunsuffixed-float-constants"> ¶</a></span> +</dt> <dd> <p>Issue a warning for any floating constant that does not have a suffix. When used together with <samp class="option">-Wsystem-headers</samp> it warns about such constants in system header files. This can be useful when preparing code to use with the <code class="code">FLOAT_CONST_DECIMAL64</code> pragma from the decimal floating-point extension to C99. </p> </dd> <dt> + <span><code class="code">-Wno-lto-type-mismatch</code><a class="copiable-link" href="#index-Wlto-type-mismatch"> ¶</a></span> +</dt> <dd> <p>During the link-time optimization, do not warn about type mismatches in global declarations from different compilation units. Requires <samp class="option">-flto</samp> to be enabled. Enabled by default. </p> </dd> <dt> + <span><code class="code">-Wno-designated-init <span class="r">(C and Objective-C only)</span></code><a class="copiable-link" href="#index-Wdesignated-init"> ¶</a></span> +</dt> <dd> +<p>Suppress warnings when a positional initializer is used to initialize a structure that has been marked with the <code class="code">designated_init</code> attribute. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="static-analyzer-options">Options That Control Static Analysis</a>, Previous: <a href="diagnostic-message-formatting-options">Options to Control Diagnostic Messages Formatting</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Warning-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Warning-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/warnings-and-errors.html b/devdocs/gcc~13/warnings-and-errors.html new file mode 100644 index 00000000..84b1c292 --- /dev/null +++ b/devdocs/gcc~13/warnings-and-errors.html @@ -0,0 +1,10 @@ +<div class="section-level-extent" id="Warnings-and-Errors"> <div class="nav-panel"> <p> Previous: <a href="non-bugs" accesskey="p" rel="prev">Certain Changes We Don’t Want to Make</a>, Up: <a href="trouble" accesskey="u" rel="up">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Warning-Messages-and-Error-Messages"><span>14.9 Warning Messages and Error Messages<a class="copiable-link" href="#Warning-Messages-and-Error-Messages"> ¶</a></span></h1> <p>The GNU compiler can produce two kinds of diagnostics: errors and warnings. Each kind has a different purpose: </p> <ul class="itemize mark-none"> <li> +<em class="dfn">Errors</em> report problems that make it impossible to compile your program. GCC reports errors with the source file name and line number where the problem is apparent. </li> +<li> +<em class="dfn">Warnings</em> report other unusual conditions in your code that <em class="emph">may</em> indicate a problem, although compilation can (and does) proceed. Warning messages also report the source file name and line number, but include the text ‘<samp class="samp">warning:</samp>’ to distinguish them from error messages. </li> +</ul> <p>Warnings may indicate danger points where you should check to make sure that your program really does what you intend; or the use of obsolete features; or the use of nonstandard features of GNU C or C++. Many warnings are issued only if you ask for them, with one of the <samp class="option">-W</samp> options (for instance, <samp class="option">-Wall</samp> requests a variety of useful warnings). </p> <p>GCC always tries to compile your program if possible; it never gratuitously rejects a program whose meaning is clear merely because (for instance) it fails to conform to a standard. In some cases, however, the C and C++ standards specify that certain extensions are forbidden, and a diagnostic <em class="emph">must</em> be issued by a conforming compiler. The <samp class="option">-pedantic</samp> option tells GCC to issue warnings in such cases; <samp class="option">-pedantic-errors</samp> says to make them errors instead. This does not mean that <em class="emph">all</em> non-ISO constructs get warnings or errors. </p> <p>See <a class="xref" href="warning-options">Options to Request or Suppress Warnings</a>, for more detail on these and related command-line options. </p> </div> <div class="nav-panel"> <p> Previous: <a href="non-bugs">Certain Changes We Don’t Want to Make</a>, Up: <a href="trouble">Known Causes of Trouble with GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Warnings-and-Errors.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Warnings-and-Errors.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/weak-pragmas.html b/devdocs/gcc~13/weak-pragmas.html new file mode 100644 index 00000000..04a9c865 --- /dev/null +++ b/devdocs/gcc~13/weak-pragmas.html @@ -0,0 +1,9 @@ +<div class="subsection-level-extent" id="Weak-Pragmas"> <div class="nav-panel"> <p> Next: <a href="diagnostic-pragmas" accesskey="n" rel="next">Diagnostic Pragmas</a>, Previous: <a href="structure-layout-pragmas" accesskey="p" rel="prev">Structure-Layout Pragmas</a>, Up: <a href="pragmas" accesskey="u" rel="up">Pragmas Accepted by GCC</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Weak-Pragmas-1"><span>6.62.11 Weak Pragmas<a class="copiable-link" href="#Weak-Pragmas-1"> ¶</a></span></h1> <p>For compatibility with SVR4, GCC supports a set of <code class="code">#pragma</code> directives for declaring symbols to be weak, and defining weak aliases. </p> <dl class="table"> <dt> +<span><code class="code">#pragma weak <var class="var">symbol</var></code><a class="copiable-link" href="#index-pragma_002c-weak"> ¶</a></span> +</dt> <dd> +<p>This pragma declares <var class="var">symbol</var> to be weak, as if the declaration had the attribute of the same name. The pragma may appear before or after the declaration of <var class="var">symbol</var>. It is not an error for <var class="var">symbol</var> to never be defined at all. </p> </dd> <dt><code class="code">#pragma weak <var class="var">symbol1</var> = <var class="var">symbol2</var></code></dt> <dd><p>This pragma declares <var class="var">symbol1</var> to be a weak alias of <var class="var">symbol2</var>. It is an error if <var class="var">symbol2</var> is not defined in the current translation unit. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Weak-Pragmas.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Weak-Pragmas.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/what-you-can-and-what-you-cannot-do-in-_002bload.html b/devdocs/gcc~13/what-you-can-and-what-you-cannot-do-in-_002bload.html new file mode 100644 index 00000000..1863ed91 --- /dev/null +++ b/devdocs/gcc~13/what-you-can-and-what-you-cannot-do-in-_002bload.html @@ -0,0 +1,14 @@ +<div class="subsection-level-extent" id="What-you-can-and-what-you-cannot-do-in-_002bload"> <div class="nav-panel"> <p> Up: <a href="executing-code-before-main" accesskey="u" rel="up"><code class="code">+load</code>: Executing Code before <code class="code">main</code></a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="What-You-Can-and-Cannot-Do-in-_002bload"><span>8.2.1 What You Can and Cannot Do in +load<a class="copiable-link" href="#What-You-Can-and-Cannot-Do-in-_002bload"> ¶</a></span></h1> <p><code class="code">+load</code> is to be used only as a last resort. Because it is executed very early, most of the Objective-C runtime machinery will not be ready when <code class="code">+load</code> is executed; hence <code class="code">+load</code> works best for executing C code that is independent on the Objective-C runtime. </p> <p>The <code class="code">+load</code> implementation in the GNU runtime guarantees you the following things: </p> <ul class="itemize mark-bullet"> <li>you can write whatever C code you like; </li> +<li>you can allocate and send messages to objects whose class is implemented in the same file; </li> +<li>the <code class="code">+load</code> implementation of all super classes of a class are executed before the <code class="code">+load</code> of that class is executed; </li> +<li>the <code class="code">+load</code> implementation of a class is executed before the <code class="code">+load</code> implementation of any category. </li> +</ul> <p>In particular, the following things, even if they can work in a particular case, are not guaranteed: </p> <ul class="itemize mark-bullet"> <li>allocation of or sending messages to arbitrary objects; </li> +<li>allocation of or sending messages to objects whose classes have a category implemented in the same file; </li> +<li>sending messages to Objective-C constant strings (<code class="code">@"this is a +constant string"</code>); </li> +</ul> <p>You should make no assumptions about receiving <code class="code">+load</code> in sibling classes when you write <code class="code">+load</code> of a class. The order in which sibling classes receive <code class="code">+load</code> is not guaranteed. </p> <p>The order in which <code class="code">+load</code> and <code class="code">+initialize</code> are called could be problematic if this matters. If you don’t allocate objects inside <code class="code">+load</code>, it is guaranteed that <code class="code">+load</code> is called before <code class="code">+initialize</code>. If you create an object inside <code class="code">+load</code> the <code class="code">+initialize</code> method of object’s class is invoked even if <code class="code">+load</code> was not invoked. Note if you explicitly call <code class="code">+load</code> on a class, <code class="code">+initialize</code> will be called first. To avoid possible problems try to implement only one of these methods. </p> <p>The <code class="code">+load</code> method is also invoked when a bundle is dynamically loaded into your running program. This happens automatically without any intervening operation from you. When you write bundles and you need to write <code class="code">+load</code> you can safely create and send messages to objects whose classes already exist in the running program. The same restrictions as above apply to classes defined in bundle. </p> </div> <div class="nav-panel"> <p> Up: <a href="executing-code-before-main"><code class="code">+load</code>: Executing Code before <code class="code">main</code></a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/What-you-can-and-what-you-cannot-do-in-_002bload.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/What-you-can-and-what-you-cannot-do-in-_002bload.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/x86-built-in-functions.html b/devdocs/gcc~13/x86-built-in-functions.html new file mode 100644 index 00000000..87699bbd --- /dev/null +++ b/devdocs/gcc~13/x86-built-in-functions.html @@ -0,0 +1,1153 @@ +<div class="subsection-level-extent" id="x86-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="x86-transactional-memory-intrinsics" accesskey="n" rel="next">x86 Transactional Memory Intrinsics</a>, Previous: <a href="ti-c6x-built-in-functions" accesskey="p" rel="prev">TI C6X Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="x86-Built-in-Functions-1"><span>6.60.35 x86 Built-in Functions<a class="copiable-link" href="#x86-Built-in-Functions-1"> ¶</a></span></h1> <p>These built-in functions are available for the x86-32 and x86-64 family of computers, depending on the command-line switches used. </p> <p>If you specify command-line switches such as <samp class="option">-msse</samp>, the compiler could use the extended instruction sets even if the built-ins are not used explicitly in the program. For this reason, applications that perform run-time CPU detection must compile separate files for each supported architecture, using the appropriate flags. In particular, the file containing the CPU detection code should be compiled without these options. </p> <p>The following machine modes are available for use with MMX built-in functions (see <a class="pxref" href="vector-extensions">Using Vector Instructions through Built-in Functions</a>): <code class="code">V2SI</code> for a vector of two 32-bit integers, <code class="code">V4HI</code> for a vector of four 16-bit integers, and <code class="code">V8QI</code> for a vector of eight 8-bit integers. Some of the built-in functions operate on MMX registers as a whole 64-bit entity, these use <code class="code">V1DI</code> as their mode. </p> <p>If 3DNow! extensions are enabled, <code class="code">V2SF</code> is used as a mode for a vector of two 32-bit floating-point values. </p> <p>If SSE extensions are enabled, <code class="code">V4SF</code> is used for a vector of four 32-bit floating-point values. Some instructions use a vector of four 32-bit integers, these use <code class="code">V4SI</code>. Finally, some instructions operate on an entire vector register, interpreting it as a 128-bit integer, these use mode <code class="code">TI</code>. </p> <p>The x86-32 and x86-64 family of processors use additional built-in functions for efficient use of <code class="code">TF</code> (<code class="code">__float128</code>) 128-bit floating point and <code class="code">TC</code> 128-bit complex floating-point values. </p> <p>The following floating-point built-in functions are always available: </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005ffabsq"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_fabsq</strong> <code class="def-code-arguments">(__float128 <var class="var">x</var>))</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005ffabsq"> ¶</a></span> +</dt> <dd><p>Computes the absolute value of <var class="var">x</var>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcopysignq"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_copysignq</strong> <code class="def-code-arguments">(__float128 <var class="var">x</var>, __float128 <var class="var">y</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcopysignq"> ¶</a></span> +</dt> <dd><p>Copies the sign of <var class="var">y</var> into <var class="var">x</var> and returns the new value of <var class="var">x</var>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005finfq"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_infq</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005finfq"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_inf</code>, except the return type is <code class="code">__float128</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fhuge_005fvalq"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_huge_valq</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fhuge_005fvalq"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_huge_val</code>, except the return type is <code class="code">__float128</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnanq"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_nanq</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnanq"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nan</code>, except the return type is <code class="code">__float128</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fnansq"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">__float128</code> <strong class="def-name">__builtin_nansq</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fnansq"> ¶</a></span> +</dt> <dd><p>Similar to <code class="code">__builtin_nans</code>, except the return type is <code class="code">__float128</code>. </p></dd> +</dl> <p>The following built-in function is always available. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fpause"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_ia32_pause</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fpause"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">pause</code> machine instruction with a compiler memory barrier. </p></dd> +</dl> <p>The following built-in functions are always available and can be used to check the target platform type. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcpu_005finit-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_cpu_init</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcpu_005finit-1"> ¶</a></span> +</dt> <dd> +<p>This function runs the CPU detection code to check the type of CPU and the features supported. This built-in function needs to be invoked along with the built-in functions to check CPU type and features, <code class="code">__builtin_cpu_is</code> and <code class="code">__builtin_cpu_supports</code>, only when used in a function that is executed before any constructors are called. The CPU detection code is automatically executed in a very high priority constructor. </p> <p>For example, this function has to be used in <code class="code">ifunc</code> resolvers that check for CPU type using the built-in functions <code class="code">__builtin_cpu_is</code> and <code class="code">__builtin_cpu_supports</code>, or in constructors on targets that don’t support constructor priority. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">static void (*resolve_memcpy (void)) (void) +{ + // ifunc resolvers fire before constructors, explicitly call the init + // function. + __builtin_cpu_init (); + if (__builtin_cpu_supports ("ssse3")) + return ssse3_memcpy; // super fast memcpy with ssse3 instructions. + else + return default_memcpy; +} + +void *memcpy (void *, const void *, size_t) + __attribute__ ((ifunc ("resolve_memcpy")));</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcpu_005fis-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_cpu_is</strong> <code class="def-code-arguments">(const char *<var class="var">cpuname</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcpu_005fis-1"> ¶</a></span> +</dt> <dd> +<p>This function returns a positive integer if the run-time CPU is of type <var class="var">cpuname</var> and returns <code class="code">0</code> otherwise. The following CPU names can be detected: </p> <dl class="table"> <dt>‘<samp class="samp">amd</samp>’</dt> <dd> +<p>AMD CPU. </p> </dd> <dt>‘<samp class="samp">intel</samp>’</dt> <dd> +<p>Intel CPU. </p> </dd> <dt>‘<samp class="samp">atom</samp>’</dt> <dd> +<p>Intel Atom CPU. </p> </dd> <dt>‘<samp class="samp">slm</samp>’</dt> <dd> +<p>Intel Silvermont CPU. </p> </dd> <dt>‘<samp class="samp">core2</samp>’</dt> <dd> +<p>Intel Core 2 CPU. </p> </dd> <dt>‘<samp class="samp">corei7</samp>’</dt> <dd> +<p>Intel Core i7 CPU. </p> </dd> <dt>‘<samp class="samp">nehalem</samp>’</dt> <dd> +<p>Intel Core i7 Nehalem CPU. </p> </dd> <dt>‘<samp class="samp">westmere</samp>’</dt> <dd> +<p>Intel Core i7 Westmere CPU. </p> </dd> <dt>‘<samp class="samp">sandybridge</samp>’</dt> <dd> +<p>Intel Core i7 Sandy Bridge CPU. </p> </dd> <dt>‘<samp class="samp">ivybridge</samp>’</dt> <dd> +<p>Intel Core i7 Ivy Bridge CPU. </p> </dd> <dt>‘<samp class="samp">haswell</samp>’</dt> <dd> +<p>Intel Core i7 Haswell CPU. </p> </dd> <dt>‘<samp class="samp">broadwell</samp>’</dt> <dd> +<p>Intel Core i7 Broadwell CPU. </p> </dd> <dt>‘<samp class="samp">skylake</samp>’</dt> <dd> +<p>Intel Core i7 Skylake CPU. </p> </dd> <dt>‘<samp class="samp">skylake-avx512</samp>’</dt> <dd> +<p>Intel Core i7 Skylake AVX512 CPU. </p> </dd> <dt>‘<samp class="samp">cannonlake</samp>’</dt> <dd> +<p>Intel Core i7 Cannon Lake CPU. </p> </dd> <dt>‘<samp class="samp">icelake-client</samp>’</dt> <dd> +<p>Intel Core i7 Ice Lake Client CPU. </p> </dd> <dt>‘<samp class="samp">icelake-server</samp>’</dt> <dd> +<p>Intel Core i7 Ice Lake Server CPU. </p> </dd> <dt>‘<samp class="samp">cascadelake</samp>’</dt> <dd> +<p>Intel Core i7 Cascadelake CPU. </p> </dd> <dt>‘<samp class="samp">tigerlake</samp>’</dt> <dd> +<p>Intel Core i7 Tigerlake CPU. </p> </dd> <dt>‘<samp class="samp">cooperlake</samp>’</dt> <dd> +<p>Intel Core i7 Cooperlake CPU. </p> </dd> <dt>‘<samp class="samp">sapphirerapids</samp>’</dt> <dd> +<p>Intel Core i7 sapphirerapids CPU. </p> </dd> <dt>‘<samp class="samp">alderlake</samp>’</dt> <dd> +<p>Intel Core i7 Alderlake CPU. </p> </dd> <dt>‘<samp class="samp">rocketlake</samp>’</dt> <dd> +<p>Intel Core i7 Rocketlake CPU. </p> </dd> <dt>‘<samp class="samp">graniterapids</samp>’</dt> <dd> +<p>Intel Core i7 graniterapids CPU. </p> </dd> <dt>‘<samp class="samp">bonnell</samp>’</dt> <dd> +<p>Intel Atom Bonnell CPU. </p> </dd> <dt>‘<samp class="samp">silvermont</samp>’</dt> <dd> +<p>Intel Atom Silvermont CPU. </p> </dd> <dt>‘<samp class="samp">goldmont</samp>’</dt> <dd> +<p>Intel Atom Goldmont CPU. </p> </dd> <dt>‘<samp class="samp">goldmont-plus</samp>’</dt> <dd> +<p>Intel Atom Goldmont Plus CPU. </p> </dd> <dt>‘<samp class="samp">tremont</samp>’</dt> <dd> +<p>Intel Atom Tremont CPU. </p> </dd> <dt>‘<samp class="samp">sierraforest</samp>’</dt> <dd> +<p>Intel Atom Sierra Forest CPU. </p> </dd> <dt>‘<samp class="samp">grandridge</samp>’</dt> <dd> +<p>Intel Atom Grand Ridge CPU. </p> </dd> <dt>‘<samp class="samp">knl</samp>’</dt> <dd> +<p>Intel Knights Landing CPU. </p> </dd> <dt>‘<samp class="samp">knm</samp>’</dt> <dd> +<p>Intel Knights Mill CPU. </p> </dd> <dt>‘<samp class="samp">lujiazui</samp>’</dt> <dd> +<p>ZHAOXIN lujiazui CPU. </p> </dd> <dt>‘<samp class="samp">amdfam10h</samp>’</dt> <dd> +<p>AMD Family 10h CPU. </p> </dd> <dt>‘<samp class="samp">barcelona</samp>’</dt> <dd> +<p>AMD Family 10h Barcelona CPU. </p> </dd> <dt>‘<samp class="samp">shanghai</samp>’</dt> <dd> +<p>AMD Family 10h Shanghai CPU. </p> </dd> <dt>‘<samp class="samp">istanbul</samp>’</dt> <dd> +<p>AMD Family 10h Istanbul CPU. </p> </dd> <dt>‘<samp class="samp">btver1</samp>’</dt> <dd> +<p>AMD Family 14h CPU. </p> </dd> <dt>‘<samp class="samp">amdfam15h</samp>’</dt> <dd> +<p>AMD Family 15h CPU. </p> </dd> <dt>‘<samp class="samp">bdver1</samp>’</dt> <dd> +<p>AMD Family 15h Bulldozer version 1. </p> </dd> <dt>‘<samp class="samp">bdver2</samp>’</dt> <dd> +<p>AMD Family 15h Bulldozer version 2. </p> </dd> <dt>‘<samp class="samp">bdver3</samp>’</dt> <dd> +<p>AMD Family 15h Bulldozer version 3. </p> </dd> <dt>‘<samp class="samp">bdver4</samp>’</dt> <dd> +<p>AMD Family 15h Bulldozer version 4. </p> </dd> <dt>‘<samp class="samp">btver2</samp>’</dt> <dd> +<p>AMD Family 16h CPU. </p> </dd> <dt>‘<samp class="samp">amdfam17h</samp>’</dt> <dd> +<p>AMD Family 17h CPU. </p> </dd> <dt>‘<samp class="samp">znver1</samp>’</dt> <dd> +<p>AMD Family 17h Zen version 1. </p> </dd> <dt>‘<samp class="samp">znver2</samp>’</dt> <dd> +<p>AMD Family 17h Zen version 2. </p> </dd> <dt>‘<samp class="samp">amdfam19h</samp>’</dt> <dd> +<p>AMD Family 19h CPU. </p> </dd> <dt>‘<samp class="samp">znver3</samp>’</dt> <dd> +<p>AMD Family 19h Zen version 3. </p> </dd> <dt>‘<samp class="samp">znver4</samp>’</dt> <dd><p>AMD Family 19h Zen version 4. </p></dd> </dl> <p>Here is an example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (__builtin_cpu_is ("corei7")) + { + do_corei7 (); // Core i7 specific implementation. + } +else + { + do_generic (); // Generic implementation. + }</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fcpu_005fsupports-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_cpu_supports</strong> <code class="def-code-arguments">(const char *<var class="var">feature</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fcpu_005fsupports-1"> ¶</a></span> +</dt> <dd> +<p>This function returns a positive integer if the run-time CPU supports <var class="var">feature</var> and returns <code class="code">0</code> otherwise. The following features can be detected: </p> <dl class="table"> <dt>‘<samp class="samp">cmov</samp>’</dt> <dd><p>CMOV instruction. </p></dd> <dt>‘<samp class="samp">mmx</samp>’</dt> <dd><p>MMX instructions. </p></dd> <dt>‘<samp class="samp">popcnt</samp>’</dt> <dd><p>POPCNT instruction. </p></dd> <dt>‘<samp class="samp">sse</samp>’</dt> <dd><p>SSE instructions. </p></dd> <dt>‘<samp class="samp">sse2</samp>’</dt> <dd><p>SSE2 instructions. </p></dd> <dt>‘<samp class="samp">sse3</samp>’</dt> <dd><p>SSE3 instructions. </p></dd> <dt>‘<samp class="samp">ssse3</samp>’</dt> <dd><p>SSSE3 instructions. </p></dd> <dt>‘<samp class="samp">sse4.1</samp>’</dt> <dd><p>SSE4.1 instructions. </p></dd> <dt>‘<samp class="samp">sse4.2</samp>’</dt> <dd><p>SSE4.2 instructions. </p></dd> <dt>‘<samp class="samp">avx</samp>’</dt> <dd><p>AVX instructions. </p></dd> <dt>‘<samp class="samp">avx2</samp>’</dt> <dd><p>AVX2 instructions. </p></dd> <dt>‘<samp class="samp">sse4a</samp>’</dt> <dd><p>SSE4A instructions. </p></dd> <dt>‘<samp class="samp">fma4</samp>’</dt> <dd><p>FMA4 instructions. </p></dd> <dt>‘<samp class="samp">xop</samp>’</dt> <dd><p>XOP instructions. </p></dd> <dt>‘<samp class="samp">fma</samp>’</dt> <dd><p>FMA instructions. </p></dd> <dt>‘<samp class="samp">avx512f</samp>’</dt> <dd><p>AVX512F instructions. </p></dd> <dt>‘<samp class="samp">bmi</samp>’</dt> <dd><p>BMI instructions. </p></dd> <dt>‘<samp class="samp">bmi2</samp>’</dt> <dd><p>BMI2 instructions. </p></dd> <dt>‘<samp class="samp">aes</samp>’</dt> <dd><p>AES instructions. </p></dd> <dt>‘<samp class="samp">pclmul</samp>’</dt> <dd><p>PCLMUL instructions. </p></dd> <dt>‘<samp class="samp">avx512vl</samp>’</dt> <dd><p>AVX512VL instructions. </p></dd> <dt>‘<samp class="samp">avx512bw</samp>’</dt> <dd><p>AVX512BW instructions. </p></dd> <dt>‘<samp class="samp">avx512dq</samp>’</dt> <dd><p>AVX512DQ instructions. </p></dd> <dt>‘<samp class="samp">avx512cd</samp>’</dt> <dd><p>AVX512CD instructions. </p></dd> <dt>‘<samp class="samp">avx512er</samp>’</dt> <dd><p>AVX512ER instructions. </p></dd> <dt>‘<samp class="samp">avx512pf</samp>’</dt> <dd><p>AVX512PF instructions. </p></dd> <dt>‘<samp class="samp">avx512vbmi</samp>’</dt> <dd><p>AVX512VBMI instructions. </p></dd> <dt>‘<samp class="samp">avx512ifma</samp>’</dt> <dd><p>AVX512IFMA instructions. </p></dd> <dt>‘<samp class="samp">avx5124vnniw</samp>’</dt> <dd><p>AVX5124VNNIW instructions. </p></dd> <dt>‘<samp class="samp">avx5124fmaps</samp>’</dt> <dd><p>AVX5124FMAPS instructions. </p></dd> <dt>‘<samp class="samp">avx512vpopcntdq</samp>’</dt> <dd><p>AVX512VPOPCNTDQ instructions. </p></dd> <dt>‘<samp class="samp">avx512vbmi2</samp>’</dt> <dd><p>AVX512VBMI2 instructions. </p></dd> <dt>‘<samp class="samp">gfni</samp>’</dt> <dd><p>GFNI instructions. </p></dd> <dt>‘<samp class="samp">vpclmulqdq</samp>’</dt> <dd><p>VPCLMULQDQ instructions. </p></dd> <dt>‘<samp class="samp">avx512vnni</samp>’</dt> <dd><p>AVX512VNNI instructions. </p></dd> <dt>‘<samp class="samp">avx512bitalg</samp>’</dt> <dd><p>AVX512BITALG instructions. </p></dd> <dt>‘<samp class="samp">x86-64</samp>’</dt> <dd><p>Baseline x86-64 microarchitecture level (as defined in x86-64 psABI). </p></dd> <dt>‘<samp class="samp">x86-64-v2</samp>’</dt> <dd><p>x86-64-v2 microarchitecture level. </p></dd> <dt>‘<samp class="samp">x86-64-v3</samp>’</dt> <dd><p>x86-64-v3 microarchitecture level. </p></dd> <dt>‘<samp class="samp">x86-64-v4</samp>’</dt> <dd> +<p>x86-64-v4 microarchitecture level. </p> </dd> </dl> <p>Here is an example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">if (__builtin_cpu_supports ("popcnt")) + { + asm("popcnt %1,%0" : "=r"(count) : "rm"(n) : "cc"); + } +else + { + count = generic_countbits (n); //generic implementation. + }</pre> +</div> </dd> +</dl> <p>The following built-in functions are made available by <samp class="option">-mmmx</samp>. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v8qi __builtin_ia32_paddb (v8qi, v8qi); +v4hi __builtin_ia32_paddw (v4hi, v4hi); +v2si __builtin_ia32_paddd (v2si, v2si); +v8qi __builtin_ia32_psubb (v8qi, v8qi); +v4hi __builtin_ia32_psubw (v4hi, v4hi); +v2si __builtin_ia32_psubd (v2si, v2si); +v8qi __builtin_ia32_paddsb (v8qi, v8qi); +v4hi __builtin_ia32_paddsw (v4hi, v4hi); +v8qi __builtin_ia32_psubsb (v8qi, v8qi); +v4hi __builtin_ia32_psubsw (v4hi, v4hi); +v8qi __builtin_ia32_paddusb (v8qi, v8qi); +v4hi __builtin_ia32_paddusw (v4hi, v4hi); +v8qi __builtin_ia32_psubusb (v8qi, v8qi); +v4hi __builtin_ia32_psubusw (v4hi, v4hi); +v4hi __builtin_ia32_pmullw (v4hi, v4hi); +v4hi __builtin_ia32_pmulhw (v4hi, v4hi); +di __builtin_ia32_pand (di, di); +di __builtin_ia32_pandn (di,di); +di __builtin_ia32_por (di, di); +di __builtin_ia32_pxor (di, di); +v8qi __builtin_ia32_pcmpeqb (v8qi, v8qi); +v4hi __builtin_ia32_pcmpeqw (v4hi, v4hi); +v2si __builtin_ia32_pcmpeqd (v2si, v2si); +v8qi __builtin_ia32_pcmpgtb (v8qi, v8qi); +v4hi __builtin_ia32_pcmpgtw (v4hi, v4hi); +v2si __builtin_ia32_pcmpgtd (v2si, v2si); +v8qi __builtin_ia32_punpckhbw (v8qi, v8qi); +v4hi __builtin_ia32_punpckhwd (v4hi, v4hi); +v2si __builtin_ia32_punpckhdq (v2si, v2si); +v8qi __builtin_ia32_punpcklbw (v8qi, v8qi); +v4hi __builtin_ia32_punpcklwd (v4hi, v4hi); +v2si __builtin_ia32_punpckldq (v2si, v2si); +v8qi __builtin_ia32_packsswb (v4hi, v4hi); +v4hi __builtin_ia32_packssdw (v2si, v2si); +v8qi __builtin_ia32_packuswb (v4hi, v4hi); + +v4hi __builtin_ia32_psllw (v4hi, v4hi); +v2si __builtin_ia32_pslld (v2si, v2si); +v1di __builtin_ia32_psllq (v1di, v1di); +v4hi __builtin_ia32_psrlw (v4hi, v4hi); +v2si __builtin_ia32_psrld (v2si, v2si); +v1di __builtin_ia32_psrlq (v1di, v1di); +v4hi __builtin_ia32_psraw (v4hi, v4hi); +v2si __builtin_ia32_psrad (v2si, v2si); +v4hi __builtin_ia32_psllwi (v4hi, int); +v2si __builtin_ia32_pslldi (v2si, int); +v1di __builtin_ia32_psllqi (v1di, int); +v4hi __builtin_ia32_psrlwi (v4hi, int); +v2si __builtin_ia32_psrldi (v2si, int); +v1di __builtin_ia32_psrlqi (v1di, int); +v4hi __builtin_ia32_psrawi (v4hi, int); +v2si __builtin_ia32_psradi (v2si, int);</pre> +</div> <p>The following built-in functions are made available either with <samp class="option">-msse</samp>, or with <samp class="option">-m3dnowa</samp>. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v4hi __builtin_ia32_pmulhuw (v4hi, v4hi); +v8qi __builtin_ia32_pavgb (v8qi, v8qi); +v4hi __builtin_ia32_pavgw (v4hi, v4hi); +v1di __builtin_ia32_psadbw (v8qi, v8qi); +v8qi __builtin_ia32_pmaxub (v8qi, v8qi); +v4hi __builtin_ia32_pmaxsw (v4hi, v4hi); +v8qi __builtin_ia32_pminub (v8qi, v8qi); +v4hi __builtin_ia32_pminsw (v4hi, v4hi); +int __builtin_ia32_pmovmskb (v8qi); +void __builtin_ia32_maskmovq (v8qi, v8qi, char *); +void __builtin_ia32_movntq (di *, di); +void __builtin_ia32_sfence (void);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-msse</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int __builtin_ia32_comieq (v4sf, v4sf); +int __builtin_ia32_comineq (v4sf, v4sf); +int __builtin_ia32_comilt (v4sf, v4sf); +int __builtin_ia32_comile (v4sf, v4sf); +int __builtin_ia32_comigt (v4sf, v4sf); +int __builtin_ia32_comige (v4sf, v4sf); +int __builtin_ia32_ucomieq (v4sf, v4sf); +int __builtin_ia32_ucomineq (v4sf, v4sf); +int __builtin_ia32_ucomilt (v4sf, v4sf); +int __builtin_ia32_ucomile (v4sf, v4sf); +int __builtin_ia32_ucomigt (v4sf, v4sf); +int __builtin_ia32_ucomige (v4sf, v4sf); +v4sf __builtin_ia32_addps (v4sf, v4sf); +v4sf __builtin_ia32_subps (v4sf, v4sf); +v4sf __builtin_ia32_mulps (v4sf, v4sf); +v4sf __builtin_ia32_divps (v4sf, v4sf); +v4sf __builtin_ia32_addss (v4sf, v4sf); +v4sf __builtin_ia32_subss (v4sf, v4sf); +v4sf __builtin_ia32_mulss (v4sf, v4sf); +v4sf __builtin_ia32_divss (v4sf, v4sf); +v4sf __builtin_ia32_cmpeqps (v4sf, v4sf); +v4sf __builtin_ia32_cmpltps (v4sf, v4sf); +v4sf __builtin_ia32_cmpleps (v4sf, v4sf); +v4sf __builtin_ia32_cmpgtps (v4sf, v4sf); +v4sf __builtin_ia32_cmpgeps (v4sf, v4sf); +v4sf __builtin_ia32_cmpunordps (v4sf, v4sf); +v4sf __builtin_ia32_cmpneqps (v4sf, v4sf); +v4sf __builtin_ia32_cmpnltps (v4sf, v4sf); +v4sf __builtin_ia32_cmpnleps (v4sf, v4sf); +v4sf __builtin_ia32_cmpngtps (v4sf, v4sf); +v4sf __builtin_ia32_cmpngeps (v4sf, v4sf); +v4sf __builtin_ia32_cmpordps (v4sf, v4sf); +v4sf __builtin_ia32_cmpeqss (v4sf, v4sf); +v4sf __builtin_ia32_cmpltss (v4sf, v4sf); +v4sf __builtin_ia32_cmpless (v4sf, v4sf); +v4sf __builtin_ia32_cmpunordss (v4sf, v4sf); +v4sf __builtin_ia32_cmpneqss (v4sf, v4sf); +v4sf __builtin_ia32_cmpnltss (v4sf, v4sf); +v4sf __builtin_ia32_cmpnless (v4sf, v4sf); +v4sf __builtin_ia32_cmpordss (v4sf, v4sf); +v4sf __builtin_ia32_maxps (v4sf, v4sf); +v4sf __builtin_ia32_maxss (v4sf, v4sf); +v4sf __builtin_ia32_minps (v4sf, v4sf); +v4sf __builtin_ia32_minss (v4sf, v4sf); +v4sf __builtin_ia32_andps (v4sf, v4sf); +v4sf __builtin_ia32_andnps (v4sf, v4sf); +v4sf __builtin_ia32_orps (v4sf, v4sf); +v4sf __builtin_ia32_xorps (v4sf, v4sf); +v4sf __builtin_ia32_movss (v4sf, v4sf); +v4sf __builtin_ia32_movhlps (v4sf, v4sf); +v4sf __builtin_ia32_movlhps (v4sf, v4sf); +v4sf __builtin_ia32_unpckhps (v4sf, v4sf); +v4sf __builtin_ia32_unpcklps (v4sf, v4sf); +v4sf __builtin_ia32_cvtpi2ps (v4sf, v2si); +v4sf __builtin_ia32_cvtsi2ss (v4sf, int); +v2si __builtin_ia32_cvtps2pi (v4sf); +int __builtin_ia32_cvtss2si (v4sf); +v2si __builtin_ia32_cvttps2pi (v4sf); +int __builtin_ia32_cvttss2si (v4sf); +v4sf __builtin_ia32_rcpps (v4sf); +v4sf __builtin_ia32_rsqrtps (v4sf); +v4sf __builtin_ia32_sqrtps (v4sf); +v4sf __builtin_ia32_rcpss (v4sf); +v4sf __builtin_ia32_rsqrtss (v4sf); +v4sf __builtin_ia32_sqrtss (v4sf); +v4sf __builtin_ia32_shufps (v4sf, v4sf, int); +void __builtin_ia32_movntps (float *, v4sf); +int __builtin_ia32_movmskps (v4sf);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-msse</samp> is used. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005floadups"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">v4sf</code> <strong class="def-name">__builtin_ia32_loadups</strong> <code class="def-code-arguments">(float *)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005floadups"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">movups</code> machine instruction as a load from memory. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fstoreups"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_ia32_storeups</strong> <code class="def-code-arguments">(float *, v4sf)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fstoreups"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">movups</code> machine instruction as a store to memory. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005floadss"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">v4sf</code> <strong class="def-name">__builtin_ia32_loadss</strong> <code class="def-code-arguments">(float *)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005floadss"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">movss</code> machine instruction as a load from memory. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005floadhps"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">v4sf</code> <strong class="def-name">__builtin_ia32_loadhps</strong> <code class="def-code-arguments">(v4sf, const v2sf *)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005floadhps"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">movhps</code> machine instruction as a load from memory. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005floadlps"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">v4sf</code> <strong class="def-name">__builtin_ia32_loadlps</strong> <code class="def-code-arguments">(v4sf, const v2sf *)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005floadlps"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">movlps</code> machine instruction as a load from memory </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fstorehps"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_ia32_storehps</strong> <code class="def-code-arguments">(v2sf *, v4sf)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fstorehps"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">movhps</code> machine instruction as a store to memory. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fstorelps"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_ia32_storelps</strong> <code class="def-code-arguments">(v2sf *, v4sf)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fstorelps"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">movlps</code> machine instruction as a store to memory. </p></dd> +</dl> <p>The following built-in functions are available when <samp class="option">-msse2</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int __builtin_ia32_comisdeq (v2df, v2df); +int __builtin_ia32_comisdlt (v2df, v2df); +int __builtin_ia32_comisdle (v2df, v2df); +int __builtin_ia32_comisdgt (v2df, v2df); +int __builtin_ia32_comisdge (v2df, v2df); +int __builtin_ia32_comisdneq (v2df, v2df); +int __builtin_ia32_ucomisdeq (v2df, v2df); +int __builtin_ia32_ucomisdlt (v2df, v2df); +int __builtin_ia32_ucomisdle (v2df, v2df); +int __builtin_ia32_ucomisdgt (v2df, v2df); +int __builtin_ia32_ucomisdge (v2df, v2df); +int __builtin_ia32_ucomisdneq (v2df, v2df); +v2df __builtin_ia32_cmpeqpd (v2df, v2df); +v2df __builtin_ia32_cmpltpd (v2df, v2df); +v2df __builtin_ia32_cmplepd (v2df, v2df); +v2df __builtin_ia32_cmpgtpd (v2df, v2df); +v2df __builtin_ia32_cmpgepd (v2df, v2df); +v2df __builtin_ia32_cmpunordpd (v2df, v2df); +v2df __builtin_ia32_cmpneqpd (v2df, v2df); +v2df __builtin_ia32_cmpnltpd (v2df, v2df); +v2df __builtin_ia32_cmpnlepd (v2df, v2df); +v2df __builtin_ia32_cmpngtpd (v2df, v2df); +v2df __builtin_ia32_cmpngepd (v2df, v2df); +v2df __builtin_ia32_cmpordpd (v2df, v2df); +v2df __builtin_ia32_cmpeqsd (v2df, v2df); +v2df __builtin_ia32_cmpltsd (v2df, v2df); +v2df __builtin_ia32_cmplesd (v2df, v2df); +v2df __builtin_ia32_cmpunordsd (v2df, v2df); +v2df __builtin_ia32_cmpneqsd (v2df, v2df); +v2df __builtin_ia32_cmpnltsd (v2df, v2df); +v2df __builtin_ia32_cmpnlesd (v2df, v2df); +v2df __builtin_ia32_cmpordsd (v2df, v2df); +v2di __builtin_ia32_paddq (v2di, v2di); +v2di __builtin_ia32_psubq (v2di, v2di); +v2df __builtin_ia32_addpd (v2df, v2df); +v2df __builtin_ia32_subpd (v2df, v2df); +v2df __builtin_ia32_mulpd (v2df, v2df); +v2df __builtin_ia32_divpd (v2df, v2df); +v2df __builtin_ia32_addsd (v2df, v2df); +v2df __builtin_ia32_subsd (v2df, v2df); +v2df __builtin_ia32_mulsd (v2df, v2df); +v2df __builtin_ia32_divsd (v2df, v2df); +v2df __builtin_ia32_minpd (v2df, v2df); +v2df __builtin_ia32_maxpd (v2df, v2df); +v2df __builtin_ia32_minsd (v2df, v2df); +v2df __builtin_ia32_maxsd (v2df, v2df); +v2df __builtin_ia32_andpd (v2df, v2df); +v2df __builtin_ia32_andnpd (v2df, v2df); +v2df __builtin_ia32_orpd (v2df, v2df); +v2df __builtin_ia32_xorpd (v2df, v2df); +v2df __builtin_ia32_movsd (v2df, v2df); +v2df __builtin_ia32_unpckhpd (v2df, v2df); +v2df __builtin_ia32_unpcklpd (v2df, v2df); +v16qi __builtin_ia32_paddb128 (v16qi, v16qi); +v8hi __builtin_ia32_paddw128 (v8hi, v8hi); +v4si __builtin_ia32_paddd128 (v4si, v4si); +v2di __builtin_ia32_paddq128 (v2di, v2di); +v16qi __builtin_ia32_psubb128 (v16qi, v16qi); +v8hi __builtin_ia32_psubw128 (v8hi, v8hi); +v4si __builtin_ia32_psubd128 (v4si, v4si); +v2di __builtin_ia32_psubq128 (v2di, v2di); +v8hi __builtin_ia32_pmullw128 (v8hi, v8hi); +v8hi __builtin_ia32_pmulhw128 (v8hi, v8hi); +v2di __builtin_ia32_pand128 (v2di, v2di); +v2di __builtin_ia32_pandn128 (v2di, v2di); +v2di __builtin_ia32_por128 (v2di, v2di); +v2di __builtin_ia32_pxor128 (v2di, v2di); +v16qi __builtin_ia32_pavgb128 (v16qi, v16qi); +v8hi __builtin_ia32_pavgw128 (v8hi, v8hi); +v16qi __builtin_ia32_pcmpeqb128 (v16qi, v16qi); +v8hi __builtin_ia32_pcmpeqw128 (v8hi, v8hi); +v4si __builtin_ia32_pcmpeqd128 (v4si, v4si); +v16qi __builtin_ia32_pcmpgtb128 (v16qi, v16qi); +v8hi __builtin_ia32_pcmpgtw128 (v8hi, v8hi); +v4si __builtin_ia32_pcmpgtd128 (v4si, v4si); +v16qi __builtin_ia32_pmaxub128 (v16qi, v16qi); +v8hi __builtin_ia32_pmaxsw128 (v8hi, v8hi); +v16qi __builtin_ia32_pminub128 (v16qi, v16qi); +v8hi __builtin_ia32_pminsw128 (v8hi, v8hi); +v16qi __builtin_ia32_punpckhbw128 (v16qi, v16qi); +v8hi __builtin_ia32_punpckhwd128 (v8hi, v8hi); +v4si __builtin_ia32_punpckhdq128 (v4si, v4si); +v2di __builtin_ia32_punpckhqdq128 (v2di, v2di); +v16qi __builtin_ia32_punpcklbw128 (v16qi, v16qi); +v8hi __builtin_ia32_punpcklwd128 (v8hi, v8hi); +v4si __builtin_ia32_punpckldq128 (v4si, v4si); +v2di __builtin_ia32_punpcklqdq128 (v2di, v2di); +v16qi __builtin_ia32_packsswb128 (v8hi, v8hi); +v8hi __builtin_ia32_packssdw128 (v4si, v4si); +v16qi __builtin_ia32_packuswb128 (v8hi, v8hi); +v8hi __builtin_ia32_pmulhuw128 (v8hi, v8hi); +void __builtin_ia32_maskmovdqu (v16qi, v16qi); +v2df __builtin_ia32_loadupd (double *); +void __builtin_ia32_storeupd (double *, v2df); +v2df __builtin_ia32_loadhpd (v2df, double const *); +v2df __builtin_ia32_loadlpd (v2df, double const *); +int __builtin_ia32_movmskpd (v2df); +int __builtin_ia32_pmovmskb128 (v16qi); +void __builtin_ia32_movnti (int *, int); +void __builtin_ia32_movnti64 (long long int *, long long int); +void __builtin_ia32_movntpd (double *, v2df); +void __builtin_ia32_movntdq (v2df *, v2df); +v4si __builtin_ia32_pshufd (v4si, int); +v8hi __builtin_ia32_pshuflw (v8hi, int); +v8hi __builtin_ia32_pshufhw (v8hi, int); +v2di __builtin_ia32_psadbw128 (v16qi, v16qi); +v2df __builtin_ia32_sqrtpd (v2df); +v2df __builtin_ia32_sqrtsd (v2df); +v2df __builtin_ia32_shufpd (v2df, v2df, int); +v2df __builtin_ia32_cvtdq2pd (v4si); +v4sf __builtin_ia32_cvtdq2ps (v4si); +v4si __builtin_ia32_cvtpd2dq (v2df); +v2si __builtin_ia32_cvtpd2pi (v2df); +v4sf __builtin_ia32_cvtpd2ps (v2df); +v4si __builtin_ia32_cvttpd2dq (v2df); +v2si __builtin_ia32_cvttpd2pi (v2df); +v2df __builtin_ia32_cvtpi2pd (v2si); +int __builtin_ia32_cvtsd2si (v2df); +int __builtin_ia32_cvttsd2si (v2df); +long long __builtin_ia32_cvtsd2si64 (v2df); +long long __builtin_ia32_cvttsd2si64 (v2df); +v4si __builtin_ia32_cvtps2dq (v4sf); +v2df __builtin_ia32_cvtps2pd (v4sf); +v4si __builtin_ia32_cvttps2dq (v4sf); +v2df __builtin_ia32_cvtsi2sd (v2df, int); +v2df __builtin_ia32_cvtsi642sd (v2df, long long); +v4sf __builtin_ia32_cvtsd2ss (v4sf, v2df); +v2df __builtin_ia32_cvtss2sd (v2df, v4sf); +void __builtin_ia32_clflush (const void *); +void __builtin_ia32_lfence (void); +void __builtin_ia32_mfence (void); +v16qi __builtin_ia32_loaddqu (const char *); +void __builtin_ia32_storedqu (char *, v16qi); +v1di __builtin_ia32_pmuludq (v2si, v2si); +v2di __builtin_ia32_pmuludq128 (v4si, v4si); +v8hi __builtin_ia32_psllw128 (v8hi, v8hi); +v4si __builtin_ia32_pslld128 (v4si, v4si); +v2di __builtin_ia32_psllq128 (v2di, v2di); +v8hi __builtin_ia32_psrlw128 (v8hi, v8hi); +v4si __builtin_ia32_psrld128 (v4si, v4si); +v2di __builtin_ia32_psrlq128 (v2di, v2di); +v8hi __builtin_ia32_psraw128 (v8hi, v8hi); +v4si __builtin_ia32_psrad128 (v4si, v4si); +v2di __builtin_ia32_pslldqi128 (v2di, int); +v8hi __builtin_ia32_psllwi128 (v8hi, int); +v4si __builtin_ia32_pslldi128 (v4si, int); +v2di __builtin_ia32_psllqi128 (v2di, int); +v2di __builtin_ia32_psrldqi128 (v2di, int); +v8hi __builtin_ia32_psrlwi128 (v8hi, int); +v4si __builtin_ia32_psrldi128 (v4si, int); +v2di __builtin_ia32_psrlqi128 (v2di, int); +v8hi __builtin_ia32_psrawi128 (v8hi, int); +v4si __builtin_ia32_psradi128 (v4si, int); +v4si __builtin_ia32_pmaddwd128 (v8hi, v8hi); +v2di __builtin_ia32_movq128 (v2di);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-msse3</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2df __builtin_ia32_addsubpd (v2df, v2df); +v4sf __builtin_ia32_addsubps (v4sf, v4sf); +v2df __builtin_ia32_haddpd (v2df, v2df); +v4sf __builtin_ia32_haddps (v4sf, v4sf); +v2df __builtin_ia32_hsubpd (v2df, v2df); +v4sf __builtin_ia32_hsubps (v4sf, v4sf); +v16qi __builtin_ia32_lddqu (char const *); +void __builtin_ia32_monitor (void *, unsigned int, unsigned int); +v4sf __builtin_ia32_movshdup (v4sf); +v4sf __builtin_ia32_movsldup (v4sf); +void __builtin_ia32_mwait (unsigned int, unsigned int);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mssse3</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2si __builtin_ia32_phaddd (v2si, v2si); +v4hi __builtin_ia32_phaddw (v4hi, v4hi); +v4hi __builtin_ia32_phaddsw (v4hi, v4hi); +v2si __builtin_ia32_phsubd (v2si, v2si); +v4hi __builtin_ia32_phsubw (v4hi, v4hi); +v4hi __builtin_ia32_phsubsw (v4hi, v4hi); +v4hi __builtin_ia32_pmaddubsw (v8qi, v8qi); +v4hi __builtin_ia32_pmulhrsw (v4hi, v4hi); +v8qi __builtin_ia32_pshufb (v8qi, v8qi); +v8qi __builtin_ia32_psignb (v8qi, v8qi); +v2si __builtin_ia32_psignd (v2si, v2si); +v4hi __builtin_ia32_psignw (v4hi, v4hi); +v1di __builtin_ia32_palignr (v1di, v1di, int); +v8qi __builtin_ia32_pabsb (v8qi); +v2si __builtin_ia32_pabsd (v2si); +v4hi __builtin_ia32_pabsw (v4hi);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mssse3</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v4si __builtin_ia32_phaddd128 (v4si, v4si); +v8hi __builtin_ia32_phaddw128 (v8hi, v8hi); +v8hi __builtin_ia32_phaddsw128 (v8hi, v8hi); +v4si __builtin_ia32_phsubd128 (v4si, v4si); +v8hi __builtin_ia32_phsubw128 (v8hi, v8hi); +v8hi __builtin_ia32_phsubsw128 (v8hi, v8hi); +v8hi __builtin_ia32_pmaddubsw128 (v16qi, v16qi); +v8hi __builtin_ia32_pmulhrsw128 (v8hi, v8hi); +v16qi __builtin_ia32_pshufb128 (v16qi, v16qi); +v16qi __builtin_ia32_psignb128 (v16qi, v16qi); +v4si __builtin_ia32_psignd128 (v4si, v4si); +v8hi __builtin_ia32_psignw128 (v8hi, v8hi); +v2di __builtin_ia32_palignr128 (v2di, v2di, int); +v16qi __builtin_ia32_pabsb128 (v16qi); +v4si __builtin_ia32_pabsd128 (v4si); +v8hi __builtin_ia32_pabsw128 (v8hi);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-msse4.1</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2df __builtin_ia32_blendpd (v2df, v2df, const int); +v4sf __builtin_ia32_blendps (v4sf, v4sf, const int); +v2df __builtin_ia32_blendvpd (v2df, v2df, v2df); +v4sf __builtin_ia32_blendvps (v4sf, v4sf, v4sf); +v2df __builtin_ia32_dppd (v2df, v2df, const int); +v4sf __builtin_ia32_dpps (v4sf, v4sf, const int); +v4sf __builtin_ia32_insertps128 (v4sf, v4sf, const int); +v2di __builtin_ia32_movntdqa (v2di *); +v16qi __builtin_ia32_mpsadbw128 (v16qi, v16qi, const int); +v8hi __builtin_ia32_packusdw128 (v4si, v4si); +v16qi __builtin_ia32_pblendvb128 (v16qi, v16qi, v16qi); +v8hi __builtin_ia32_pblendw128 (v8hi, v8hi, const int); +v2di __builtin_ia32_pcmpeqq (v2di, v2di); +v8hi __builtin_ia32_phminposuw128 (v8hi); +v16qi __builtin_ia32_pmaxsb128 (v16qi, v16qi); +v4si __builtin_ia32_pmaxsd128 (v4si, v4si); +v4si __builtin_ia32_pmaxud128 (v4si, v4si); +v8hi __builtin_ia32_pmaxuw128 (v8hi, v8hi); +v16qi __builtin_ia32_pminsb128 (v16qi, v16qi); +v4si __builtin_ia32_pminsd128 (v4si, v4si); +v4si __builtin_ia32_pminud128 (v4si, v4si); +v8hi __builtin_ia32_pminuw128 (v8hi, v8hi); +v4si __builtin_ia32_pmovsxbd128 (v16qi); +v2di __builtin_ia32_pmovsxbq128 (v16qi); +v8hi __builtin_ia32_pmovsxbw128 (v16qi); +v2di __builtin_ia32_pmovsxdq128 (v4si); +v4si __builtin_ia32_pmovsxwd128 (v8hi); +v2di __builtin_ia32_pmovsxwq128 (v8hi); +v4si __builtin_ia32_pmovzxbd128 (v16qi); +v2di __builtin_ia32_pmovzxbq128 (v16qi); +v8hi __builtin_ia32_pmovzxbw128 (v16qi); +v2di __builtin_ia32_pmovzxdq128 (v4si); +v4si __builtin_ia32_pmovzxwd128 (v8hi); +v2di __builtin_ia32_pmovzxwq128 (v8hi); +v2di __builtin_ia32_pmuldq128 (v4si, v4si); +v4si __builtin_ia32_pmulld128 (v4si, v4si); +int __builtin_ia32_ptestc128 (v2di, v2di); +int __builtin_ia32_ptestnzc128 (v2di, v2di); +int __builtin_ia32_ptestz128 (v2di, v2di); +v2df __builtin_ia32_roundpd (v2df, const int); +v4sf __builtin_ia32_roundps (v4sf, const int); +v2df __builtin_ia32_roundsd (v2df, v2df, const int); +v4sf __builtin_ia32_roundss (v4sf, v4sf, const int);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-msse4.1</samp> is used. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fvec_005fset_005fv4sf"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">v4sf</code> <strong class="def-name">__builtin_ia32_vec_set_v4sf</strong> <code class="def-code-arguments">(v4sf, float, const int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fvec_005fset_005fv4sf"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">insertps</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fvec_005fext_005fv16qi"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_ia32_vec_ext_v16qi</strong> <code class="def-code-arguments">(v16qi, const int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fvec_005fext_005fv16qi"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">pextrb</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fvec_005fset_005fv16qi"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">v16qi</code> <strong class="def-name">__builtin_ia32_vec_set_v16qi</strong> <code class="def-code-arguments">(v16qi, int, const int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fvec_005fset_005fv16qi"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">pinsrb</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fvec_005fset_005fv4si"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">v4si</code> <strong class="def-name">__builtin_ia32_vec_set_v4si</strong> <code class="def-code-arguments">(v4si, int, const int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fvec_005fset_005fv4si"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">pinsrd</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fvec_005fset_005fv2di"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">v2di</code> <strong class="def-name">__builtin_ia32_vec_set_v2di</strong> <code class="def-code-arguments">(v2di, long long, const int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fvec_005fset_005fv2di"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">pinsrq</code> machine instruction in 64bit mode. </p></dd> +</dl> <p>The following built-in functions are changed to generate new SSE4.1 instructions when <samp class="option">-msse4.1</samp> is used. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fvec_005fext_005fv4sf"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">float</code> <strong class="def-name">__builtin_ia32_vec_ext_v4sf</strong> <code class="def-code-arguments">(v4sf, const int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fvec_005fext_005fv4sf"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">extractps</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fvec_005fext_005fv4si"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_ia32_vec_ext_v4si</strong> <code class="def-code-arguments">(v4si, const int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fvec_005fext_005fv4si"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">pextrd</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-long-2"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">long</code> <strong class="def-name">long</strong> <code class="def-code-arguments">__builtin_ia32_vec_ext_v2di (v2di, const int)</code><a class="copiable-link" href="#index-long-2"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">pextrq</code> machine instruction in 64bit mode. </p></dd> +</dl> <p>The following built-in functions are available when <samp class="option">-msse4.2</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v16qi __builtin_ia32_pcmpestrm128 (v16qi, int, v16qi, int, const int); +int __builtin_ia32_pcmpestri128 (v16qi, int, v16qi, int, const int); +int __builtin_ia32_pcmpestria128 (v16qi, int, v16qi, int, const int); +int __builtin_ia32_pcmpestric128 (v16qi, int, v16qi, int, const int); +int __builtin_ia32_pcmpestrio128 (v16qi, int, v16qi, int, const int); +int __builtin_ia32_pcmpestris128 (v16qi, int, v16qi, int, const int); +int __builtin_ia32_pcmpestriz128 (v16qi, int, v16qi, int, const int); +v16qi __builtin_ia32_pcmpistrm128 (v16qi, v16qi, const int); +int __builtin_ia32_pcmpistri128 (v16qi, v16qi, const int); +int __builtin_ia32_pcmpistria128 (v16qi, v16qi, const int); +int __builtin_ia32_pcmpistric128 (v16qi, v16qi, const int); +int __builtin_ia32_pcmpistrio128 (v16qi, v16qi, const int); +int __builtin_ia32_pcmpistris128 (v16qi, v16qi, const int); +int __builtin_ia32_pcmpistriz128 (v16qi, v16qi, const int); +v2di __builtin_ia32_pcmpgtq (v2di, v2di);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-msse4.2</samp> is used. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-int"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">int</strong> <code class="def-code-arguments">__builtin_ia32_crc32qi (unsigned int, unsigned char)</code><a class="copiable-link" href="#index-int"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">crc32b</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-int-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">int</strong> <code class="def-code-arguments">__builtin_ia32_crc32hi (unsigned int, unsigned short)</code><a class="copiable-link" href="#index-int-1"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">crc32w</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-int-2"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">int</strong> <code class="def-code-arguments">__builtin_ia32_crc32si (unsigned int, unsigned int)</code><a class="copiable-link" href="#index-int-2"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">crc32l</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-long-3"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">long</strong> <code class="def-code-arguments">long __builtin_ia32_crc32di (unsigned long long, unsigned long long)</code><a class="copiable-link" href="#index-long-3"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">crc32q</code> machine instruction. </p></dd> +</dl> <p>The following built-in functions are changed to generate new SSE4.2 instructions when <samp class="option">-msse4.2</samp> is used. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpopcount-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_popcount</strong> <code class="def-code-arguments">(unsigned int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpopcount-1"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">popcntl</code> machine instruction. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpopcountl-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_popcountl</strong> <code class="def-code-arguments">(unsigned long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpopcountl-1"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">popcntl</code> or <code class="code">popcntq</code> machine instruction, depending on the size of <code class="code">unsigned long</code>. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fpopcountll-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">int</code> <strong class="def-name">__builtin_popcountll</strong> <code class="def-code-arguments">(unsigned long long)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fpopcountll-1"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">popcntq</code> machine instruction. </p></dd> +</dl> <p>The following built-in functions are available when <samp class="option">-mavx</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v4df __builtin_ia32_addpd256 (v4df,v4df); +v8sf __builtin_ia32_addps256 (v8sf,v8sf); +v4df __builtin_ia32_addsubpd256 (v4df,v4df); +v8sf __builtin_ia32_addsubps256 (v8sf,v8sf); +v4df __builtin_ia32_andnpd256 (v4df,v4df); +v8sf __builtin_ia32_andnps256 (v8sf,v8sf); +v4df __builtin_ia32_andpd256 (v4df,v4df); +v8sf __builtin_ia32_andps256 (v8sf,v8sf); +v4df __builtin_ia32_blendpd256 (v4df,v4df,int); +v8sf __builtin_ia32_blendps256 (v8sf,v8sf,int); +v4df __builtin_ia32_blendvpd256 (v4df,v4df,v4df); +v8sf __builtin_ia32_blendvps256 (v8sf,v8sf,v8sf); +v2df __builtin_ia32_cmppd (v2df,v2df,int); +v4df __builtin_ia32_cmppd256 (v4df,v4df,int); +v4sf __builtin_ia32_cmpps (v4sf,v4sf,int); +v8sf __builtin_ia32_cmpps256 (v8sf,v8sf,int); +v2df __builtin_ia32_cmpsd (v2df,v2df,int); +v4sf __builtin_ia32_cmpss (v4sf,v4sf,int); +v4df __builtin_ia32_cvtdq2pd256 (v4si); +v8sf __builtin_ia32_cvtdq2ps256 (v8si); +v4si __builtin_ia32_cvtpd2dq256 (v4df); +v4sf __builtin_ia32_cvtpd2ps256 (v4df); +v8si __builtin_ia32_cvtps2dq256 (v8sf); +v4df __builtin_ia32_cvtps2pd256 (v4sf); +v4si __builtin_ia32_cvttpd2dq256 (v4df); +v8si __builtin_ia32_cvttps2dq256 (v8sf); +v4df __builtin_ia32_divpd256 (v4df,v4df); +v8sf __builtin_ia32_divps256 (v8sf,v8sf); +v8sf __builtin_ia32_dpps256 (v8sf,v8sf,int); +v4df __builtin_ia32_haddpd256 (v4df,v4df); +v8sf __builtin_ia32_haddps256 (v8sf,v8sf); +v4df __builtin_ia32_hsubpd256 (v4df,v4df); +v8sf __builtin_ia32_hsubps256 (v8sf,v8sf); +v32qi __builtin_ia32_lddqu256 (pcchar); +v32qi __builtin_ia32_loaddqu256 (pcchar); +v4df __builtin_ia32_loadupd256 (pcdouble); +v8sf __builtin_ia32_loadups256 (pcfloat); +v2df __builtin_ia32_maskloadpd (pcv2df,v2df); +v4df __builtin_ia32_maskloadpd256 (pcv4df,v4df); +v4sf __builtin_ia32_maskloadps (pcv4sf,v4sf); +v8sf __builtin_ia32_maskloadps256 (pcv8sf,v8sf); +void __builtin_ia32_maskstorepd (pv2df,v2df,v2df); +void __builtin_ia32_maskstorepd256 (pv4df,v4df,v4df); +void __builtin_ia32_maskstoreps (pv4sf,v4sf,v4sf); +void __builtin_ia32_maskstoreps256 (pv8sf,v8sf,v8sf); +v4df __builtin_ia32_maxpd256 (v4df,v4df); +v8sf __builtin_ia32_maxps256 (v8sf,v8sf); +v4df __builtin_ia32_minpd256 (v4df,v4df); +v8sf __builtin_ia32_minps256 (v8sf,v8sf); +v4df __builtin_ia32_movddup256 (v4df); +int __builtin_ia32_movmskpd256 (v4df); +int __builtin_ia32_movmskps256 (v8sf); +v8sf __builtin_ia32_movshdup256 (v8sf); +v8sf __builtin_ia32_movsldup256 (v8sf); +v4df __builtin_ia32_mulpd256 (v4df,v4df); +v8sf __builtin_ia32_mulps256 (v8sf,v8sf); +v4df __builtin_ia32_orpd256 (v4df,v4df); +v8sf __builtin_ia32_orps256 (v8sf,v8sf); +v2df __builtin_ia32_pd_pd256 (v4df); +v4df __builtin_ia32_pd256_pd (v2df); +v4sf __builtin_ia32_ps_ps256 (v8sf); +v8sf __builtin_ia32_ps256_ps (v4sf); +int __builtin_ia32_ptestc256 (v4di,v4di,ptest); +int __builtin_ia32_ptestnzc256 (v4di,v4di,ptest); +int __builtin_ia32_ptestz256 (v4di,v4di,ptest); +v8sf __builtin_ia32_rcpps256 (v8sf); +v4df __builtin_ia32_roundpd256 (v4df,int); +v8sf __builtin_ia32_roundps256 (v8sf,int); +v8sf __builtin_ia32_rsqrtps_nr256 (v8sf); +v8sf __builtin_ia32_rsqrtps256 (v8sf); +v4df __builtin_ia32_shufpd256 (v4df,v4df,int); +v8sf __builtin_ia32_shufps256 (v8sf,v8sf,int); +v4si __builtin_ia32_si_si256 (v8si); +v8si __builtin_ia32_si256_si (v4si); +v4df __builtin_ia32_sqrtpd256 (v4df); +v8sf __builtin_ia32_sqrtps_nr256 (v8sf); +v8sf __builtin_ia32_sqrtps256 (v8sf); +void __builtin_ia32_storedqu256 (pchar,v32qi); +void __builtin_ia32_storeupd256 (pdouble,v4df); +void __builtin_ia32_storeups256 (pfloat,v8sf); +v4df __builtin_ia32_subpd256 (v4df,v4df); +v8sf __builtin_ia32_subps256 (v8sf,v8sf); +v4df __builtin_ia32_unpckhpd256 (v4df,v4df); +v8sf __builtin_ia32_unpckhps256 (v8sf,v8sf); +v4df __builtin_ia32_unpcklpd256 (v4df,v4df); +v8sf __builtin_ia32_unpcklps256 (v8sf,v8sf); +v4df __builtin_ia32_vbroadcastf128_pd256 (pcv2df); +v8sf __builtin_ia32_vbroadcastf128_ps256 (pcv4sf); +v4df __builtin_ia32_vbroadcastsd256 (pcdouble); +v4sf __builtin_ia32_vbroadcastss (pcfloat); +v8sf __builtin_ia32_vbroadcastss256 (pcfloat); +v2df __builtin_ia32_vextractf128_pd256 (v4df,int); +v4sf __builtin_ia32_vextractf128_ps256 (v8sf,int); +v4si __builtin_ia32_vextractf128_si256 (v8si,int); +v4df __builtin_ia32_vinsertf128_pd256 (v4df,v2df,int); +v8sf __builtin_ia32_vinsertf128_ps256 (v8sf,v4sf,int); +v8si __builtin_ia32_vinsertf128_si256 (v8si,v4si,int); +v4df __builtin_ia32_vperm2f128_pd256 (v4df,v4df,int); +v8sf __builtin_ia32_vperm2f128_ps256 (v8sf,v8sf,int); +v8si __builtin_ia32_vperm2f128_si256 (v8si,v8si,int); +v2df __builtin_ia32_vpermil2pd (v2df,v2df,v2di,int); +v4df __builtin_ia32_vpermil2pd256 (v4df,v4df,v4di,int); +v4sf __builtin_ia32_vpermil2ps (v4sf,v4sf,v4si,int); +v8sf __builtin_ia32_vpermil2ps256 (v8sf,v8sf,v8si,int); +v2df __builtin_ia32_vpermilpd (v2df,int); +v4df __builtin_ia32_vpermilpd256 (v4df,int); +v4sf __builtin_ia32_vpermilps (v4sf,int); +v8sf __builtin_ia32_vpermilps256 (v8sf,int); +v2df __builtin_ia32_vpermilvarpd (v2df,v2di); +v4df __builtin_ia32_vpermilvarpd256 (v4df,v4di); +v4sf __builtin_ia32_vpermilvarps (v4sf,v4si); +v8sf __builtin_ia32_vpermilvarps256 (v8sf,v8si); +int __builtin_ia32_vtestcpd (v2df,v2df,ptest); +int __builtin_ia32_vtestcpd256 (v4df,v4df,ptest); +int __builtin_ia32_vtestcps (v4sf,v4sf,ptest); +int __builtin_ia32_vtestcps256 (v8sf,v8sf,ptest); +int __builtin_ia32_vtestnzcpd (v2df,v2df,ptest); +int __builtin_ia32_vtestnzcpd256 (v4df,v4df,ptest); +int __builtin_ia32_vtestnzcps (v4sf,v4sf,ptest); +int __builtin_ia32_vtestnzcps256 (v8sf,v8sf,ptest); +int __builtin_ia32_vtestzpd (v2df,v2df,ptest); +int __builtin_ia32_vtestzpd256 (v4df,v4df,ptest); +int __builtin_ia32_vtestzps (v4sf,v4sf,ptest); +int __builtin_ia32_vtestzps256 (v8sf,v8sf,ptest); +void __builtin_ia32_vzeroall (void); +void __builtin_ia32_vzeroupper (void); +v4df __builtin_ia32_xorpd256 (v4df,v4df); +v8sf __builtin_ia32_xorps256 (v8sf,v8sf);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mavx2</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v32qi __builtin_ia32_mpsadbw256 (v32qi,v32qi,int); +v32qi __builtin_ia32_pabsb256 (v32qi); +v16hi __builtin_ia32_pabsw256 (v16hi); +v8si __builtin_ia32_pabsd256 (v8si); +v16hi __builtin_ia32_packssdw256 (v8si,v8si); +v32qi __builtin_ia32_packsswb256 (v16hi,v16hi); +v16hi __builtin_ia32_packusdw256 (v8si,v8si); +v32qi __builtin_ia32_packuswb256 (v16hi,v16hi); +v32qi __builtin_ia32_paddb256 (v32qi,v32qi); +v16hi __builtin_ia32_paddw256 (v16hi,v16hi); +v8si __builtin_ia32_paddd256 (v8si,v8si); +v4di __builtin_ia32_paddq256 (v4di,v4di); +v32qi __builtin_ia32_paddsb256 (v32qi,v32qi); +v16hi __builtin_ia32_paddsw256 (v16hi,v16hi); +v32qi __builtin_ia32_paddusb256 (v32qi,v32qi); +v16hi __builtin_ia32_paddusw256 (v16hi,v16hi); +v4di __builtin_ia32_palignr256 (v4di,v4di,int); +v4di __builtin_ia32_andsi256 (v4di,v4di); +v4di __builtin_ia32_andnotsi256 (v4di,v4di); +v32qi __builtin_ia32_pavgb256 (v32qi,v32qi); +v16hi __builtin_ia32_pavgw256 (v16hi,v16hi); +v32qi __builtin_ia32_pblendvb256 (v32qi,v32qi,v32qi); +v16hi __builtin_ia32_pblendw256 (v16hi,v16hi,int); +v32qi __builtin_ia32_pcmpeqb256 (v32qi,v32qi); +v16hi __builtin_ia32_pcmpeqw256 (v16hi,v16hi); +v8si __builtin_ia32_pcmpeqd256 (c8si,v8si); +v4di __builtin_ia32_pcmpeqq256 (v4di,v4di); +v32qi __builtin_ia32_pcmpgtb256 (v32qi,v32qi); +v16hi __builtin_ia32_pcmpgtw256 (16hi,v16hi); +v8si __builtin_ia32_pcmpgtd256 (v8si,v8si); +v4di __builtin_ia32_pcmpgtq256 (v4di,v4di); +v16hi __builtin_ia32_phaddw256 (v16hi,v16hi); +v8si __builtin_ia32_phaddd256 (v8si,v8si); +v16hi __builtin_ia32_phaddsw256 (v16hi,v16hi); +v16hi __builtin_ia32_phsubw256 (v16hi,v16hi); +v8si __builtin_ia32_phsubd256 (v8si,v8si); +v16hi __builtin_ia32_phsubsw256 (v16hi,v16hi); +v32qi __builtin_ia32_pmaddubsw256 (v32qi,v32qi); +v16hi __builtin_ia32_pmaddwd256 (v16hi,v16hi); +v32qi __builtin_ia32_pmaxsb256 (v32qi,v32qi); +v16hi __builtin_ia32_pmaxsw256 (v16hi,v16hi); +v8si __builtin_ia32_pmaxsd256 (v8si,v8si); +v32qi __builtin_ia32_pmaxub256 (v32qi,v32qi); +v16hi __builtin_ia32_pmaxuw256 (v16hi,v16hi); +v8si __builtin_ia32_pmaxud256 (v8si,v8si); +v32qi __builtin_ia32_pminsb256 (v32qi,v32qi); +v16hi __builtin_ia32_pminsw256 (v16hi,v16hi); +v8si __builtin_ia32_pminsd256 (v8si,v8si); +v32qi __builtin_ia32_pminub256 (v32qi,v32qi); +v16hi __builtin_ia32_pminuw256 (v16hi,v16hi); +v8si __builtin_ia32_pminud256 (v8si,v8si); +int __builtin_ia32_pmovmskb256 (v32qi); +v16hi __builtin_ia32_pmovsxbw256 (v16qi); +v8si __builtin_ia32_pmovsxbd256 (v16qi); +v4di __builtin_ia32_pmovsxbq256 (v16qi); +v8si __builtin_ia32_pmovsxwd256 (v8hi); +v4di __builtin_ia32_pmovsxwq256 (v8hi); +v4di __builtin_ia32_pmovsxdq256 (v4si); +v16hi __builtin_ia32_pmovzxbw256 (v16qi); +v8si __builtin_ia32_pmovzxbd256 (v16qi); +v4di __builtin_ia32_pmovzxbq256 (v16qi); +v8si __builtin_ia32_pmovzxwd256 (v8hi); +v4di __builtin_ia32_pmovzxwq256 (v8hi); +v4di __builtin_ia32_pmovzxdq256 (v4si); +v4di __builtin_ia32_pmuldq256 (v8si,v8si); +v16hi __builtin_ia32_pmulhrsw256 (v16hi, v16hi); +v16hi __builtin_ia32_pmulhuw256 (v16hi,v16hi); +v16hi __builtin_ia32_pmulhw256 (v16hi,v16hi); +v16hi __builtin_ia32_pmullw256 (v16hi,v16hi); +v8si __builtin_ia32_pmulld256 (v8si,v8si); +v4di __builtin_ia32_pmuludq256 (v8si,v8si); +v4di __builtin_ia32_por256 (v4di,v4di); +v16hi __builtin_ia32_psadbw256 (v32qi,v32qi); +v32qi __builtin_ia32_pshufb256 (v32qi,v32qi); +v8si __builtin_ia32_pshufd256 (v8si,int); +v16hi __builtin_ia32_pshufhw256 (v16hi,int); +v16hi __builtin_ia32_pshuflw256 (v16hi,int); +v32qi __builtin_ia32_psignb256 (v32qi,v32qi); +v16hi __builtin_ia32_psignw256 (v16hi,v16hi); +v8si __builtin_ia32_psignd256 (v8si,v8si); +v4di __builtin_ia32_pslldqi256 (v4di,int); +v16hi __builtin_ia32_psllwi256 (16hi,int); +v16hi __builtin_ia32_psllw256(v16hi,v8hi); +v8si __builtin_ia32_pslldi256 (v8si,int); +v8si __builtin_ia32_pslld256(v8si,v4si); +v4di __builtin_ia32_psllqi256 (v4di,int); +v4di __builtin_ia32_psllq256(v4di,v2di); +v16hi __builtin_ia32_psrawi256 (v16hi,int); +v16hi __builtin_ia32_psraw256 (v16hi,v8hi); +v8si __builtin_ia32_psradi256 (v8si,int); +v8si __builtin_ia32_psrad256 (v8si,v4si); +v4di __builtin_ia32_psrldqi256 (v4di, int); +v16hi __builtin_ia32_psrlwi256 (v16hi,int); +v16hi __builtin_ia32_psrlw256 (v16hi,v8hi); +v8si __builtin_ia32_psrldi256 (v8si,int); +v8si __builtin_ia32_psrld256 (v8si,v4si); +v4di __builtin_ia32_psrlqi256 (v4di,int); +v4di __builtin_ia32_psrlq256(v4di,v2di); +v32qi __builtin_ia32_psubb256 (v32qi,v32qi); +v32hi __builtin_ia32_psubw256 (v16hi,v16hi); +v8si __builtin_ia32_psubd256 (v8si,v8si); +v4di __builtin_ia32_psubq256 (v4di,v4di); +v32qi __builtin_ia32_psubsb256 (v32qi,v32qi); +v16hi __builtin_ia32_psubsw256 (v16hi,v16hi); +v32qi __builtin_ia32_psubusb256 (v32qi,v32qi); +v16hi __builtin_ia32_psubusw256 (v16hi,v16hi); +v32qi __builtin_ia32_punpckhbw256 (v32qi,v32qi); +v16hi __builtin_ia32_punpckhwd256 (v16hi,v16hi); +v8si __builtin_ia32_punpckhdq256 (v8si,v8si); +v4di __builtin_ia32_punpckhqdq256 (v4di,v4di); +v32qi __builtin_ia32_punpcklbw256 (v32qi,v32qi); +v16hi __builtin_ia32_punpcklwd256 (v16hi,v16hi); +v8si __builtin_ia32_punpckldq256 (v8si,v8si); +v4di __builtin_ia32_punpcklqdq256 (v4di,v4di); +v4di __builtin_ia32_pxor256 (v4di,v4di); +v4di __builtin_ia32_movntdqa256 (pv4di); +v4sf __builtin_ia32_vbroadcastss_ps (v4sf); +v8sf __builtin_ia32_vbroadcastss_ps256 (v4sf); +v4df __builtin_ia32_vbroadcastsd_pd256 (v2df); +v4di __builtin_ia32_vbroadcastsi256 (v2di); +v4si __builtin_ia32_pblendd128 (v4si,v4si); +v8si __builtin_ia32_pblendd256 (v8si,v8si); +v32qi __builtin_ia32_pbroadcastb256 (v16qi); +v16hi __builtin_ia32_pbroadcastw256 (v8hi); +v8si __builtin_ia32_pbroadcastd256 (v4si); +v4di __builtin_ia32_pbroadcastq256 (v2di); +v16qi __builtin_ia32_pbroadcastb128 (v16qi); +v8hi __builtin_ia32_pbroadcastw128 (v8hi); +v4si __builtin_ia32_pbroadcastd128 (v4si); +v2di __builtin_ia32_pbroadcastq128 (v2di); +v8si __builtin_ia32_permvarsi256 (v8si,v8si); +v4df __builtin_ia32_permdf256 (v4df,int); +v8sf __builtin_ia32_permvarsf256 (v8sf,v8sf); +v4di __builtin_ia32_permdi256 (v4di,int); +v4di __builtin_ia32_permti256 (v4di,v4di,int); +v4di __builtin_ia32_extract128i256 (v4di,int); +v4di __builtin_ia32_insert128i256 (v4di,v2di,int); +v8si __builtin_ia32_maskloadd256 (pcv8si,v8si); +v4di __builtin_ia32_maskloadq256 (pcv4di,v4di); +v4si __builtin_ia32_maskloadd (pcv4si,v4si); +v2di __builtin_ia32_maskloadq (pcv2di,v2di); +void __builtin_ia32_maskstored256 (pv8si,v8si,v8si); +void __builtin_ia32_maskstoreq256 (pv4di,v4di,v4di); +void __builtin_ia32_maskstored (pv4si,v4si,v4si); +void __builtin_ia32_maskstoreq (pv2di,v2di,v2di); +v8si __builtin_ia32_psllv8si (v8si,v8si); +v4si __builtin_ia32_psllv4si (v4si,v4si); +v4di __builtin_ia32_psllv4di (v4di,v4di); +v2di __builtin_ia32_psllv2di (v2di,v2di); +v8si __builtin_ia32_psrav8si (v8si,v8si); +v4si __builtin_ia32_psrav4si (v4si,v4si); +v8si __builtin_ia32_psrlv8si (v8si,v8si); +v4si __builtin_ia32_psrlv4si (v4si,v4si); +v4di __builtin_ia32_psrlv4di (v4di,v4di); +v2di __builtin_ia32_psrlv2di (v2di,v2di); +v2df __builtin_ia32_gathersiv2df (v2df, pcdouble,v4si,v2df,int); +v4df __builtin_ia32_gathersiv4df (v4df, pcdouble,v4si,v4df,int); +v2df __builtin_ia32_gatherdiv2df (v2df, pcdouble,v2di,v2df,int); +v4df __builtin_ia32_gatherdiv4df (v4df, pcdouble,v4di,v4df,int); +v4sf __builtin_ia32_gathersiv4sf (v4sf, pcfloat,v4si,v4sf,int); +v8sf __builtin_ia32_gathersiv8sf (v8sf, pcfloat,v8si,v8sf,int); +v4sf __builtin_ia32_gatherdiv4sf (v4sf, pcfloat,v2di,v4sf,int); +v4sf __builtin_ia32_gatherdiv4sf256 (v4sf, pcfloat,v4di,v4sf,int); +v2di __builtin_ia32_gathersiv2di (v2di, pcint64,v4si,v2di,int); +v4di __builtin_ia32_gathersiv4di (v4di, pcint64,v4si,v4di,int); +v2di __builtin_ia32_gatherdiv2di (v2di, pcint64,v2di,v2di,int); +v4di __builtin_ia32_gatherdiv4di (v4di, pcint64,v4di,v4di,int); +v4si __builtin_ia32_gathersiv4si (v4si, pcint,v4si,v4si,int); +v8si __builtin_ia32_gathersiv8si (v8si, pcint,v8si,v8si,int); +v4si __builtin_ia32_gatherdiv4si (v4si, pcint,v2di,v4si,int); +v4si __builtin_ia32_gatherdiv4si256 (v4si, pcint,v4di,v4si,int);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-maes</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2di __builtin_ia32_aesenc128 (v2di, v2di); +v2di __builtin_ia32_aesenclast128 (v2di, v2di); +v2di __builtin_ia32_aesdec128 (v2di, v2di); +v2di __builtin_ia32_aesdeclast128 (v2di, v2di); +v2di __builtin_ia32_aeskeygenassist128 (v2di, const int); +v2di __builtin_ia32_aesimc128 (v2di);</pre> +</div> <p>The following built-in function is available when <samp class="option">-mpclmul</samp> is used. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fia32_005fpclmulqdq128"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">v2di</code> <strong class="def-name">__builtin_ia32_pclmulqdq128</strong> <code class="def-code-arguments">(v2di, v2di, const int)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fia32_005fpclmulqdq128"> ¶</a></span> +</dt> <dd><p>Generates the <code class="code">pclmulqdq</code> machine instruction. </p></dd> +</dl> <p>The following built-in function is available when <samp class="option">-mfsgsbase</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_ia32_rdfsbase32 (void); +unsigned long long __builtin_ia32_rdfsbase64 (void); +unsigned int __builtin_ia32_rdgsbase32 (void); +unsigned long long __builtin_ia32_rdgsbase64 (void); +void _writefsbase_u32 (unsigned int); +void _writefsbase_u64 (unsigned long long); +void _writegsbase_u32 (unsigned int); +void _writegsbase_u64 (unsigned long long);</pre> +</div> <p>The following built-in function is available when <samp class="option">-mrdrnd</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_ia32_rdrand16_step (unsigned short *); +unsigned int __builtin_ia32_rdrand32_step (unsigned int *); +unsigned int __builtin_ia32_rdrand64_step (unsigned long long *);</pre> +</div> <p>The following built-in function is available when <samp class="option">-mptwrite</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_ia32_ptwrite32 (unsigned); +void __builtin_ia32_ptwrite64 (unsigned long long);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-msse4a</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_ia32_movntsd (double *, v2df); +void __builtin_ia32_movntss (float *, v4sf); +v2di __builtin_ia32_extrq (v2di, v16qi); +v2di __builtin_ia32_extrqi (v2di, const unsigned int, const unsigned int); +v2di __builtin_ia32_insertq (v2di, v2di); +v2di __builtin_ia32_insertqi (v2di, v2di, const unsigned int, const unsigned int);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mxop</samp> is used. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2df __builtin_ia32_vfrczpd (v2df); +v4sf __builtin_ia32_vfrczps (v4sf); +v2df __builtin_ia32_vfrczsd (v2df); +v4sf __builtin_ia32_vfrczss (v4sf); +v4df __builtin_ia32_vfrczpd256 (v4df); +v8sf __builtin_ia32_vfrczps256 (v8sf); +v2di __builtin_ia32_vpcmov (v2di, v2di, v2di); +v2di __builtin_ia32_vpcmov_v2di (v2di, v2di, v2di); +v4si __builtin_ia32_vpcmov_v4si (v4si, v4si, v4si); +v8hi __builtin_ia32_vpcmov_v8hi (v8hi, v8hi, v8hi); +v16qi __builtin_ia32_vpcmov_v16qi (v16qi, v16qi, v16qi); +v2df __builtin_ia32_vpcmov_v2df (v2df, v2df, v2df); +v4sf __builtin_ia32_vpcmov_v4sf (v4sf, v4sf, v4sf); +v4di __builtin_ia32_vpcmov_v4di256 (v4di, v4di, v4di); +v8si __builtin_ia32_vpcmov_v8si256 (v8si, v8si, v8si); +v16hi __builtin_ia32_vpcmov_v16hi256 (v16hi, v16hi, v16hi); +v32qi __builtin_ia32_vpcmov_v32qi256 (v32qi, v32qi, v32qi); +v4df __builtin_ia32_vpcmov_v4df256 (v4df, v4df, v4df); +v8sf __builtin_ia32_vpcmov_v8sf256 (v8sf, v8sf, v8sf); +v16qi __builtin_ia32_vpcomeqb (v16qi, v16qi); +v8hi __builtin_ia32_vpcomeqw (v8hi, v8hi); +v4si __builtin_ia32_vpcomeqd (v4si, v4si); +v2di __builtin_ia32_vpcomeqq (v2di, v2di); +v16qi __builtin_ia32_vpcomequb (v16qi, v16qi); +v4si __builtin_ia32_vpcomequd (v4si, v4si); +v2di __builtin_ia32_vpcomequq (v2di, v2di); +v8hi __builtin_ia32_vpcomequw (v8hi, v8hi); +v8hi __builtin_ia32_vpcomeqw (v8hi, v8hi); +v16qi __builtin_ia32_vpcomfalseb (v16qi, v16qi); +v4si __builtin_ia32_vpcomfalsed (v4si, v4si); +v2di __builtin_ia32_vpcomfalseq (v2di, v2di); +v16qi __builtin_ia32_vpcomfalseub (v16qi, v16qi); +v4si __builtin_ia32_vpcomfalseud (v4si, v4si); +v2di __builtin_ia32_vpcomfalseuq (v2di, v2di); +v8hi __builtin_ia32_vpcomfalseuw (v8hi, v8hi); +v8hi __builtin_ia32_vpcomfalsew (v8hi, v8hi); +v16qi __builtin_ia32_vpcomgeb (v16qi, v16qi); +v4si __builtin_ia32_vpcomged (v4si, v4si); +v2di __builtin_ia32_vpcomgeq (v2di, v2di); +v16qi __builtin_ia32_vpcomgeub (v16qi, v16qi); +v4si __builtin_ia32_vpcomgeud (v4si, v4si); +v2di __builtin_ia32_vpcomgeuq (v2di, v2di); +v8hi __builtin_ia32_vpcomgeuw (v8hi, v8hi); +v8hi __builtin_ia32_vpcomgew (v8hi, v8hi); +v16qi __builtin_ia32_vpcomgtb (v16qi, v16qi); +v4si __builtin_ia32_vpcomgtd (v4si, v4si); +v2di __builtin_ia32_vpcomgtq (v2di, v2di); +v16qi __builtin_ia32_vpcomgtub (v16qi, v16qi); +v4si __builtin_ia32_vpcomgtud (v4si, v4si); +v2di __builtin_ia32_vpcomgtuq (v2di, v2di); +v8hi __builtin_ia32_vpcomgtuw (v8hi, v8hi); +v8hi __builtin_ia32_vpcomgtw (v8hi, v8hi); +v16qi __builtin_ia32_vpcomleb (v16qi, v16qi); +v4si __builtin_ia32_vpcomled (v4si, v4si); +v2di __builtin_ia32_vpcomleq (v2di, v2di); +v16qi __builtin_ia32_vpcomleub (v16qi, v16qi); +v4si __builtin_ia32_vpcomleud (v4si, v4si); +v2di __builtin_ia32_vpcomleuq (v2di, v2di); +v8hi __builtin_ia32_vpcomleuw (v8hi, v8hi); +v8hi __builtin_ia32_vpcomlew (v8hi, v8hi); +v16qi __builtin_ia32_vpcomltb (v16qi, v16qi); +v4si __builtin_ia32_vpcomltd (v4si, v4si); +v2di __builtin_ia32_vpcomltq (v2di, v2di); +v16qi __builtin_ia32_vpcomltub (v16qi, v16qi); +v4si __builtin_ia32_vpcomltud (v4si, v4si); +v2di __builtin_ia32_vpcomltuq (v2di, v2di); +v8hi __builtin_ia32_vpcomltuw (v8hi, v8hi); +v8hi __builtin_ia32_vpcomltw (v8hi, v8hi); +v16qi __builtin_ia32_vpcomneb (v16qi, v16qi); +v4si __builtin_ia32_vpcomned (v4si, v4si); +v2di __builtin_ia32_vpcomneq (v2di, v2di); +v16qi __builtin_ia32_vpcomneub (v16qi, v16qi); +v4si __builtin_ia32_vpcomneud (v4si, v4si); +v2di __builtin_ia32_vpcomneuq (v2di, v2di); +v8hi __builtin_ia32_vpcomneuw (v8hi, v8hi); +v8hi __builtin_ia32_vpcomnew (v8hi, v8hi); +v16qi __builtin_ia32_vpcomtrueb (v16qi, v16qi); +v4si __builtin_ia32_vpcomtrued (v4si, v4si); +v2di __builtin_ia32_vpcomtrueq (v2di, v2di); +v16qi __builtin_ia32_vpcomtrueub (v16qi, v16qi); +v4si __builtin_ia32_vpcomtrueud (v4si, v4si); +v2di __builtin_ia32_vpcomtrueuq (v2di, v2di); +v8hi __builtin_ia32_vpcomtrueuw (v8hi, v8hi); +v8hi __builtin_ia32_vpcomtruew (v8hi, v8hi); +v4si __builtin_ia32_vphaddbd (v16qi); +v2di __builtin_ia32_vphaddbq (v16qi); +v8hi __builtin_ia32_vphaddbw (v16qi); +v2di __builtin_ia32_vphadddq (v4si); +v4si __builtin_ia32_vphaddubd (v16qi); +v2di __builtin_ia32_vphaddubq (v16qi); +v8hi __builtin_ia32_vphaddubw (v16qi); +v2di __builtin_ia32_vphaddudq (v4si); +v4si __builtin_ia32_vphadduwd (v8hi); +v2di __builtin_ia32_vphadduwq (v8hi); +v4si __builtin_ia32_vphaddwd (v8hi); +v2di __builtin_ia32_vphaddwq (v8hi); +v8hi __builtin_ia32_vphsubbw (v16qi); +v2di __builtin_ia32_vphsubdq (v4si); +v4si __builtin_ia32_vphsubwd (v8hi); +v4si __builtin_ia32_vpmacsdd (v4si, v4si, v4si); +v2di __builtin_ia32_vpmacsdqh (v4si, v4si, v2di); +v2di __builtin_ia32_vpmacsdql (v4si, v4si, v2di); +v4si __builtin_ia32_vpmacssdd (v4si, v4si, v4si); +v2di __builtin_ia32_vpmacssdqh (v4si, v4si, v2di); +v2di __builtin_ia32_vpmacssdql (v4si, v4si, v2di); +v4si __builtin_ia32_vpmacsswd (v8hi, v8hi, v4si); +v8hi __builtin_ia32_vpmacssww (v8hi, v8hi, v8hi); +v4si __builtin_ia32_vpmacswd (v8hi, v8hi, v4si); +v8hi __builtin_ia32_vpmacsww (v8hi, v8hi, v8hi); +v4si __builtin_ia32_vpmadcsswd (v8hi, v8hi, v4si); +v4si __builtin_ia32_vpmadcswd (v8hi, v8hi, v4si); +v16qi __builtin_ia32_vpperm (v16qi, v16qi, v16qi); +v16qi __builtin_ia32_vprotb (v16qi, v16qi); +v4si __builtin_ia32_vprotd (v4si, v4si); +v2di __builtin_ia32_vprotq (v2di, v2di); +v8hi __builtin_ia32_vprotw (v8hi, v8hi); +v16qi __builtin_ia32_vpshab (v16qi, v16qi); +v4si __builtin_ia32_vpshad (v4si, v4si); +v2di __builtin_ia32_vpshaq (v2di, v2di); +v8hi __builtin_ia32_vpshaw (v8hi, v8hi); +v16qi __builtin_ia32_vpshlb (v16qi, v16qi); +v4si __builtin_ia32_vpshld (v4si, v4si); +v2di __builtin_ia32_vpshlq (v2di, v2di); +v8hi __builtin_ia32_vpshlw (v8hi, v8hi);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mfma4</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2df __builtin_ia32_vfmaddpd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfmaddps (v4sf, v4sf, v4sf); +v2df __builtin_ia32_vfmaddsd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfmaddss (v4sf, v4sf, v4sf); +v2df __builtin_ia32_vfmsubpd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfmsubps (v4sf, v4sf, v4sf); +v2df __builtin_ia32_vfmsubsd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfmsubss (v4sf, v4sf, v4sf); +v2df __builtin_ia32_vfnmaddpd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfnmaddps (v4sf, v4sf, v4sf); +v2df __builtin_ia32_vfnmaddsd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfnmaddss (v4sf, v4sf, v4sf); +v2df __builtin_ia32_vfnmsubpd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfnmsubps (v4sf, v4sf, v4sf); +v2df __builtin_ia32_vfnmsubsd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfnmsubss (v4sf, v4sf, v4sf); +v2df __builtin_ia32_vfmaddsubpd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfmaddsubps (v4sf, v4sf, v4sf); +v2df __builtin_ia32_vfmsubaddpd (v2df, v2df, v2df); +v4sf __builtin_ia32_vfmsubaddps (v4sf, v4sf, v4sf); +v4df __builtin_ia32_vfmaddpd256 (v4df, v4df, v4df); +v8sf __builtin_ia32_vfmaddps256 (v8sf, v8sf, v8sf); +v4df __builtin_ia32_vfmsubpd256 (v4df, v4df, v4df); +v8sf __builtin_ia32_vfmsubps256 (v8sf, v8sf, v8sf); +v4df __builtin_ia32_vfnmaddpd256 (v4df, v4df, v4df); +v8sf __builtin_ia32_vfnmaddps256 (v8sf, v8sf, v8sf); +v4df __builtin_ia32_vfnmsubpd256 (v4df, v4df, v4df); +v8sf __builtin_ia32_vfnmsubps256 (v8sf, v8sf, v8sf); +v4df __builtin_ia32_vfmaddsubpd256 (v4df, v4df, v4df); +v8sf __builtin_ia32_vfmaddsubps256 (v8sf, v8sf, v8sf); +v4df __builtin_ia32_vfmsubaddpd256 (v4df, v4df, v4df); +v8sf __builtin_ia32_vfmsubaddps256 (v8sf, v8sf, v8sf);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mlwp</samp> is used. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_ia32_llwpcb16 (void *); +void __builtin_ia32_llwpcb32 (void *); +void __builtin_ia32_llwpcb64 (void *); +void * __builtin_ia32_llwpcb16 (void); +void * __builtin_ia32_llwpcb32 (void); +void * __builtin_ia32_llwpcb64 (void); +void __builtin_ia32_lwpval16 (unsigned short, unsigned int, unsigned short); +void __builtin_ia32_lwpval32 (unsigned int, unsigned int, unsigned int); +void __builtin_ia32_lwpval64 (unsigned __int64, unsigned int, unsigned int); +unsigned char __builtin_ia32_lwpins16 (unsigned short, unsigned int, unsigned short); +unsigned char __builtin_ia32_lwpins32 (unsigned int, unsigned int, unsigned int); +unsigned char __builtin_ia32_lwpins64 (unsigned __int64, unsigned int, unsigned int);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mbmi</samp> is used. All of them generate the machine instruction that is part of the name. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_ia32_bextr_u32(unsigned int, unsigned int); +unsigned long long __builtin_ia32_bextr_u64 (unsigned long long, unsigned long long);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mbmi2</samp> is used. All of them generate the machine instruction that is part of the name. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int _bzhi_u32 (unsigned int, unsigned int); +unsigned int _pdep_u32 (unsigned int, unsigned int); +unsigned int _pext_u32 (unsigned int, unsigned int); +unsigned long long _bzhi_u64 (unsigned long long, unsigned long long); +unsigned long long _pdep_u64 (unsigned long long, unsigned long long); +unsigned long long _pext_u64 (unsigned long long, unsigned long long);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mlzcnt</samp> is used. All of them generate the machine instruction that is part of the name. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned short __builtin_ia32_lzcnt_u16(unsigned short); +unsigned int __builtin_ia32_lzcnt_u32(unsigned int); +unsigned long long __builtin_ia32_lzcnt_u64 (unsigned long long);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mfxsr</samp> is used. All of them generate the machine instruction that is part of the name. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_ia32_fxsave (void *); +void __builtin_ia32_fxrstor (void *); +void __builtin_ia32_fxsave64 (void *); +void __builtin_ia32_fxrstor64 (void *);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mxsave</samp> is used. All of them generate the machine instruction that is part of the name. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_ia32_xsave (void *, long long); +void __builtin_ia32_xrstor (void *, long long); +void __builtin_ia32_xsave64 (void *, long long); +void __builtin_ia32_xrstor64 (void *, long long);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mxsaveopt</samp> is used. All of them generate the machine instruction that is part of the name. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_ia32_xsaveopt (void *, long long); +void __builtin_ia32_xsaveopt64 (void *, long long);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mtbm</samp> is used. Both of them generate the immediate form of the bextr machine instruction. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_ia32_bextri_u32 (unsigned int, + const unsigned int); +unsigned long long __builtin_ia32_bextri_u64 (unsigned long long, + const unsigned long long);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-m3dnow</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_ia32_femms (void); +v8qi __builtin_ia32_pavgusb (v8qi, v8qi); +v2si __builtin_ia32_pf2id (v2sf); +v2sf __builtin_ia32_pfacc (v2sf, v2sf); +v2sf __builtin_ia32_pfadd (v2sf, v2sf); +v2si __builtin_ia32_pfcmpeq (v2sf, v2sf); +v2si __builtin_ia32_pfcmpge (v2sf, v2sf); +v2si __builtin_ia32_pfcmpgt (v2sf, v2sf); +v2sf __builtin_ia32_pfmax (v2sf, v2sf); +v2sf __builtin_ia32_pfmin (v2sf, v2sf); +v2sf __builtin_ia32_pfmul (v2sf, v2sf); +v2sf __builtin_ia32_pfrcp (v2sf); +v2sf __builtin_ia32_pfrcpit1 (v2sf, v2sf); +v2sf __builtin_ia32_pfrcpit2 (v2sf, v2sf); +v2sf __builtin_ia32_pfrsqrt (v2sf); +v2sf __builtin_ia32_pfsub (v2sf, v2sf); +v2sf __builtin_ia32_pfsubr (v2sf, v2sf); +v2sf __builtin_ia32_pi2fd (v2si); +v4hi __builtin_ia32_pmulhrw (v4hi, v4hi);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-m3dnowa</samp> is used. All of them generate the machine instruction that is part of the name. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">v2si __builtin_ia32_pf2iw (v2sf); +v2sf __builtin_ia32_pfnacc (v2sf, v2sf); +v2sf __builtin_ia32_pfpnacc (v2sf, v2sf); +v2sf __builtin_ia32_pi2fw (v2si); +v2sf __builtin_ia32_pswapdsf (v2sf); +v2si __builtin_ia32_pswapdsi (v2si);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mrtm</samp> is used They are used for restricted transactional memory. These are the internal low level functions. Normally the functions in <a class="ref" href="x86-transactional-memory-intrinsics">x86 Transactional Memory Intrinsics</a> should be used instead. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">int __builtin_ia32_xbegin (); +void __builtin_ia32_xend (); +void __builtin_ia32_xabort (status); +int __builtin_ia32_xtest ();</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mmwaitx</samp> is used. All of them generate the machine instruction that is part of the name. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_ia32_monitorx (void *, unsigned int, unsigned int); +void __builtin_ia32_mwaitx (unsigned int, unsigned int, unsigned int);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mclzero</samp> is used. All of them generate the machine instruction that is part of the name. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_i32_clzero (void *);</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mpku</samp> is used. They generate reads and writes to PKRU. </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void __builtin_ia32_wrpkru (unsigned int); +unsigned int __builtin_ia32_rdpkru ();</pre> +</div> <p>The following built-in functions are available when <samp class="option">-mshstk</samp> option is used. They support shadow stack machine instructions from Intel Control-flow Enforcement Technology (CET). Each built-in function generates the machine instruction that is part of the function’s name. These are the internal low-level functions. Normally the functions in <a class="ref" href="x86-control-flow-protection-intrinsics">x86 Control-Flow Protection Intrinsics</a> should be used instead. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">unsigned int __builtin_ia32_rdsspd (void); +unsigned long long __builtin_ia32_rdsspq (void); +void __builtin_ia32_incsspd (unsigned int); +void __builtin_ia32_incsspq (unsigned long long); +void __builtin_ia32_saveprevssp(void); +void __builtin_ia32_rstorssp(void *); +void __builtin_ia32_wrssd(unsigned int, void *); +void __builtin_ia32_wrssq(unsigned long long, void *); +void __builtin_ia32_wrussd(unsigned int, void *); +void __builtin_ia32_wrussq(unsigned long long, void *); +void __builtin_ia32_setssbsy(void); +void __builtin_ia32_clrssbsy(void *);</pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="x86-transactional-memory-intrinsics">x86 Transactional Memory Intrinsics</a>, Previous: <a href="ti-c6x-built-in-functions">TI C6X Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-Built-in-Functions.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/x86-control-flow-protection-intrinsics.html b/devdocs/gcc~13/x86-control-flow-protection-intrinsics.html new file mode 100644 index 00000000..51992c58 --- /dev/null +++ b/devdocs/gcc~13/x86-control-flow-protection-intrinsics.html @@ -0,0 +1,31 @@ +<div class="subsection-level-extent" id="x86-control-flow-protection-intrinsics"> <div class="nav-panel"> <p> Previous: <a href="x86-transactional-memory-intrinsics" accesskey="p" rel="prev">x86 Transactional Memory Intrinsics</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="x86-Control-Flow-Protection-Intrinsics"><span>6.60.37 x86 Control-Flow Protection Intrinsics<a class="copiable-link" href="#x86-Control-Flow-Protection-Intrinsics"> ¶</a></span></h1> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005fget_005fssp"> +<span class="category-def">CET Function: </span><span><code class="def-type">ret_type</code> <strong class="def-name">_get_ssp</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005fget_005fssp"> ¶</a></span> +</dt> <dd><p>Get the current value of shadow stack pointer if shadow stack support from Intel CET is enabled in the hardware or <code class="code">0</code> otherwise. The <code class="code">ret_type</code> is <code class="code">unsigned long long</code> for 64-bit targets and <code class="code">unsigned int</code> for 32-bit targets. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005finc_005fssp"> +<span class="category-def">CET Function: </span><span><code class="def-type">void</code> <strong class="def-name">_inc_ssp</strong> <code class="def-code-arguments">(unsigned int)</code><a class="copiable-link" href="#index-_005finc_005fssp"> ¶</a></span> +</dt> <dd><p>Increment the current shadow stack pointer by the size specified by the function argument. The argument is masked to a byte value for security reasons, so to increment by more than 255 bytes you must call the function multiple times. </p></dd> +</dl> <p>The shadow stack unwind code looks like: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <immintrin.h> + +/* Unwind the shadow stack for EH. */ +#define _Unwind_Frames_Extra(x) \ + do \ + { \ + _Unwind_Word ssp = _get_ssp (); \ + if (ssp != 0) \ + { \ + _Unwind_Word tmp = (x); \ + while (tmp > 255) \ + { \ + _inc_ssp (tmp); \ + tmp -= 255; \ + } \ + _inc_ssp (tmp); \ + } \ + } \ + while (0)</pre> +</div> <p>This code runs unconditionally on all 64-bit processors. For 32-bit processors the code runs on those that support multi-byte NOP instructions. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-control-flow-protection-intrinsics.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-control-flow-protection-intrinsics.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/x86-function-attributes.html b/devdocs/gcc~13/x86-function-attributes.html new file mode 100644 index 00000000..a2a01333 --- /dev/null +++ b/devdocs/gcc~13/x86-function-attributes.html @@ -0,0 +1,444 @@ +<div class="subsection-level-extent" id="x86-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="xstormy16-function-attributes" accesskey="n" rel="next">Xstormy16 Function Attributes</a>, Previous: <a href="visium-function-attributes" accesskey="p" rel="prev">Visium Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="x86-Function-Attributes-1"><span>6.33.33 x86 Function Attributes<a class="copiable-link" href="#x86-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the x86 back end: </p> <dl class="table"> <dt> + <span><code class="code">cdecl</code><a class="copiable-link" href="#index-cdecl-function-attribute_002c-x86-32"> ¶</a></span> +</dt> <dd> +<p>On the x86-32 targets, the <code class="code">cdecl</code> attribute causes the compiler to assume that the calling function pops off the stack space used to pass arguments. This is useful to override the effects of the <samp class="option">-mrtd</samp> switch. </p> </dd> <dt> + <span><code class="code">fastcall</code><a class="copiable-link" href="#index-fastcall-function-attribute_002c-x86-32"> ¶</a></span> +</dt> <dd> +<p>On x86-32 targets, the <code class="code">fastcall</code> attribute causes the compiler to pass the first argument (if of integral type) in the register ECX and the second argument (if of integral type) in the register EDX. Subsequent and other typed arguments are passed on the stack. The called function pops the arguments off the stack. If the number of arguments is variable all arguments are pushed on the stack. </p> </dd> <dt> + <span><code class="code">thiscall</code><a class="copiable-link" href="#index-thiscall-function-attribute_002c-x86-32"> ¶</a></span> +</dt> <dd> +<p>On x86-32 targets, the <code class="code">thiscall</code> attribute causes the compiler to pass the first argument (if of integral type) in the register ECX. Subsequent and other typed arguments are passed on the stack. The called function pops the arguments off the stack. If the number of arguments is variable all arguments are pushed on the stack. The <code class="code">thiscall</code> attribute is intended for C++ non-static member functions. As a GCC extension, this calling convention can be used for C functions and for static member methods. </p> </dd> <dt> + <span><code class="code">ms_abi</code><a class="copiable-link" href="#index-ms_005fabi-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt><code class="code">sysv_abi</code></dt> <dd> <p>On 32-bit and 64-bit x86 targets, you can use an ABI attribute to indicate which calling convention should be used for a function. The <code class="code">ms_abi</code> attribute tells the compiler to use the Microsoft ABI, while the <code class="code">sysv_abi</code> attribute tells the compiler to use the System V ELF ABI, which is used on GNU/Linux and other systems. The default is to use the Microsoft ABI when targeting Windows. On all other systems, the default is the System V ELF ABI. </p> <p>Note, the <code class="code">ms_abi</code> attribute for Microsoft Windows 64-bit targets currently requires the <samp class="option">-maccumulate-outgoing-args</samp> option. </p> </dd> <dt> +<span><code class="code">callee_pop_aggregate_return (<var class="var">number</var>)</code><a class="copiable-link" href="#index-callee_005fpop_005faggregate_005freturn-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> <p>On x86-32 targets, you can use this attribute to control how aggregates are returned in memory. If the caller is responsible for popping the hidden pointer together with the rest of the arguments, specify <var class="var">number</var> equal to zero. If callee is responsible for popping the hidden pointer, specify <var class="var">number</var> equal to one. </p> <p>The default x86-32 ABI assumes that the callee pops the stack for hidden pointer. However, on x86-32 Microsoft Windows targets, the compiler assumes that the caller pops the stack for hidden pointer. </p> </dd> <dt> +<span><code class="code">ms_hook_prologue</code><a class="copiable-link" href="#index-ms_005fhook_005fprologue-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> <p>On 32-bit and 64-bit x86 targets, you can use this function attribute to make GCC generate the “hot-patching” function prologue used in Win32 API functions in Microsoft Windows XP Service Pack 2 and newer. </p> </dd> <dt> +<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p> </dd> <dt> + <span><code class="code">regparm (<var class="var">number</var>)</code><a class="copiable-link" href="#index-regparm-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>On x86-32 targets, the <code class="code">regparm</code> attribute causes the compiler to pass arguments number one to <var class="var">number</var> if they are of integral type in registers EAX, EDX, and ECX instead of on the stack. Functions that take a variable number of arguments continue to be passed all of their arguments on the stack. </p> <p>Beware that on some ELF systems this attribute is unsuitable for global functions in shared libraries with lazy binding (which is the default). Lazy binding sends the first call via resolving code in the loader, which might assume EAX, EDX and ECX can be clobbered, as per the standard calling conventions. Solaris 8 is affected by this. Systems with the GNU C Library version 2.1 or higher and FreeBSD are believed to be safe since the loaders there save EAX, EDX and ECX. (Lazy binding can be disabled with the linker or the loader if desired, to avoid the problem.) </p> </dd> <dt> +<span><code class="code">sseregparm</code><a class="copiable-link" href="#index-sseregparm-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>On x86-32 targets with SSE support, the <code class="code">sseregparm</code> attribute causes the compiler to pass up to 3 floating-point arguments in SSE registers instead of on the stack. Functions that take a variable number of arguments continue to pass all of their floating-point arguments on the stack. </p> </dd> <dt> +<span><code class="code">force_align_arg_pointer</code><a class="copiable-link" href="#index-force_005falign_005farg_005fpointer-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>On x86 targets, the <code class="code">force_align_arg_pointer</code> attribute may be applied to individual function definitions, generating an alternate prologue and epilogue that realigns the run-time stack if necessary. This supports mixing legacy codes that run with a 4-byte aligned stack with modern codes that keep a 16-byte stack for SSE compatibility. </p> </dd> <dt> + <span><code class="code">stdcall</code><a class="copiable-link" href="#index-stdcall-function-attribute_002c-x86-32"> ¶</a></span> +</dt> <dd> +<p>On x86-32 targets, the <code class="code">stdcall</code> attribute causes the compiler to assume that the called function pops off the stack space used to pass arguments, unless it takes a variable number of arguments. </p> </dd> <dt> +<span><code class="code">no_caller_saved_registers</code><a class="copiable-link" href="#index-no_005fcaller_005fsaved_005fregisters-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function has no caller-saved registers. That is, all registers are callee-saved. For example, this attribute can be used for a function called from an interrupt handler. The compiler generates proper function entry and exit sequences to save and restore any modified registers, except for the EFLAGS register. Since GCC doesn’t preserve SSE, MMX nor x87 states, the GCC option <samp class="option">-mgeneral-regs-only</samp> should be used to compile functions with <code class="code">no_caller_saved_registers</code> attribute. </p> </dd> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>Use this attribute to indicate that the specified function is an interrupt handler or an exception handler (depending on parameters passed to the function, explained further). The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. The <code class="code">IRET</code> instruction, instead of the <code class="code">RET</code> instruction, is used to return from interrupt handlers. All registers, except for the EFLAGS register which is restored by the <code class="code">IRET</code> instruction, are preserved by the compiler. Since GCC doesn’t preserve SSE, MMX nor x87 states, the GCC option <samp class="option">-mgeneral-regs-only</samp> should be used to compile interrupt and exception handlers. </p> <p>Any interruptible-without-stack-switch code must be compiled with <samp class="option">-mno-red-zone</samp> since interrupt handlers can and will, because of the hardware design, touch the red zone. </p> <p>An interrupt handler must be declared with a mandatory pointer argument: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct interrupt_frame; + +__attribute__ ((interrupt)) +void +f (struct interrupt_frame *frame) +{ +}</pre> +</div> <p>and you must define <code class="code">struct interrupt_frame</code> as described in the processor’s manual. </p> <p>Exception handlers differ from interrupt handlers because the system pushes an error code on the stack. An exception handler declaration is similar to that for an interrupt handler, but with a different mandatory function signature. The compiler arranges to pop the error code off the stack before the <code class="code">IRET</code> instruction. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#ifdef __x86_64__ +typedef unsigned long long int uword_t; +#else +typedef unsigned int uword_t; +#endif + +struct interrupt_frame; + +__attribute__ ((interrupt)) +void +f (struct interrupt_frame *frame, uword_t error_code) +{ + ... +}</pre> +</div> <p>Exception handlers should only be used for exceptions that push an error code; you should use an interrupt handler in other cases. The system will crash if the wrong kind of handler is used. </p> </dd> <dt> +<span><code class="code">target (<var class="var">options</var>)</code><a class="copiable-link" href="#index-target-function-attribute-5"> ¶</a></span> +</dt> <dd> +<p>As discussed in <a class="ref" href="common-function-attributes">Common Function Attributes</a>, this attribute allows specification of target-specific compilation options. </p> <p>On the x86, the following options are allowed: </p> +<dl class="table"> <dt> +<span>‘<samp class="samp">3dnow</samp>’<a class="copiable-link" href="#index-target_0028_00223dnow_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-3dnow</samp>’</dt> <dd> +<p>Enable/disable the generation of the 3DNow! instructions. </p> </dd> <dt> +<span>‘<samp class="samp">3dnowa</samp>’<a class="copiable-link" href="#index-target_0028_00223dnowa_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-3dnowa</samp>’</dt> <dd> +<p>Enable/disable the generation of the enhanced 3DNow! instructions. </p> </dd> <dt> +<span>‘<samp class="samp">abm</samp>’<a class="copiable-link" href="#index-target_0028_0022abm_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-abm</samp>’</dt> <dd> +<p>Enable/disable the generation of the advanced bit instructions. </p> </dd> <dt> +<span>‘<samp class="samp">adx</samp>’<a class="copiable-link" href="#index-target_0028_0022adx_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-adx</samp>’</dt> <dd> +<p>Enable/disable the generation of the ADX instructions. </p> </dd> <dt> +<span>‘<samp class="samp">aes</samp>’<a class="copiable-link" href="#index-target_0028_0022aes_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-aes</samp>’</dt> <dd> +<p>Enable/disable the generation of the AES instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx</samp>’<a class="copiable-link" href="#index-target_0028_0022avx_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx2</samp>’<a class="copiable-link" href="#index-target_0028_0022avx2_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx2</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX2 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx5124fmaps</samp>’<a class="copiable-link" href="#index-target_0028_0022avx5124fmaps_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx5124fmaps</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX5124FMAPS instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx5124vnniw</samp>’<a class="copiable-link" href="#index-target_0028_0022avx5124vnniw_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx5124vnniw</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX5124VNNIW instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512bitalg</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512bitalg_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512bitalg</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512BITALG instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512bw</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512bw_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512bw</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512BW instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512cd</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512cd_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512cd</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512CD instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512dq</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512dq_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512dq</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512DQ instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512er</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512er_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512er</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512ER instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512f</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512f_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512f</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512F instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512ifma</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512ifma_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512ifma</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512IFMA instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512pf</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512pf_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512pf</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512PF instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512vbmi</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512vbmi_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512vbmi</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512VBMI instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512vbmi2</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512vbmi2_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512vbmi2</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512VBMI2 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512vl</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512vl_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512vl</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512VL instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512vnni</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512vnni_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512vnni</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512VNNI instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avx512vpopcntdq</samp>’<a class="copiable-link" href="#index-target_0028_0022avx512vpopcntdq_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avx512vpopcntdq</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVX512VPOPCNTDQ instructions. </p> </dd> <dt> +<span>‘<samp class="samp">bmi</samp>’<a class="copiable-link" href="#index-target_0028_0022bmi_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-bmi</samp>’</dt> <dd> +<p>Enable/disable the generation of the BMI instructions. </p> </dd> <dt> +<span>‘<samp class="samp">bmi2</samp>’<a class="copiable-link" href="#index-target_0028_0022bmi2_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-bmi2</samp>’</dt> <dd> +<p>Enable/disable the generation of the BMI2 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">cldemote</samp>’<a class="copiable-link" href="#index-target_0028_0022cldemote_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-cldemote</samp>’</dt> <dd> +<p>Enable/disable the generation of the CLDEMOTE instructions. </p> </dd> <dt> +<span>‘<samp class="samp">clflushopt</samp>’<a class="copiable-link" href="#index-target_0028_0022clflushopt_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-clflushopt</samp>’</dt> <dd> +<p>Enable/disable the generation of the CLFLUSHOPT instructions. </p> </dd> <dt> +<span>‘<samp class="samp">clwb</samp>’<a class="copiable-link" href="#index-target_0028_0022clwb_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-clwb</samp>’</dt> <dd> +<p>Enable/disable the generation of the CLWB instructions. </p> </dd> <dt> +<span>‘<samp class="samp">clzero</samp>’<a class="copiable-link" href="#index-target_0028_0022clzero_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-clzero</samp>’</dt> <dd> +<p>Enable/disable the generation of the CLZERO instructions. </p> </dd> <dt> +<span>‘<samp class="samp">crc32</samp>’<a class="copiable-link" href="#index-target_0028_0022crc32_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-crc32</samp>’</dt> <dd> +<p>Enable/disable the generation of the CRC32 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">cx16</samp>’<a class="copiable-link" href="#index-target_0028_0022cx16_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-cx16</samp>’</dt> <dd> +<p>Enable/disable the generation of the CMPXCHG16B instructions. </p> </dd> <dt> +<span>‘<samp class="samp">default</samp>’<a class="copiable-link" href="#index-target_0028_0022default_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>See <a class="xref" href="function-multiversioning">Function Multiversioning</a>, where it is used to specify the default function version. </p> </dd> <dt> +<span>‘<samp class="samp">f16c</samp>’<a class="copiable-link" href="#index-target_0028_0022f16c_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-f16c</samp>’</dt> <dd> +<p>Enable/disable the generation of the F16C instructions. </p> </dd> <dt> +<span>‘<samp class="samp">fma</samp>’<a class="copiable-link" href="#index-target_0028_0022fma_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-fma</samp>’</dt> <dd> +<p>Enable/disable the generation of the FMA instructions. </p> </dd> <dt> +<span>‘<samp class="samp">fma4</samp>’<a class="copiable-link" href="#index-target_0028_0022fma4_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-fma4</samp>’</dt> <dd> +<p>Enable/disable the generation of the FMA4 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">fsgsbase</samp>’<a class="copiable-link" href="#index-target_0028_0022fsgsbase_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-fsgsbase</samp>’</dt> <dd> +<p>Enable/disable the generation of the FSGSBASE instructions. </p> </dd> <dt> +<span>‘<samp class="samp">fxsr</samp>’<a class="copiable-link" href="#index-target_0028_0022fxsr_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-fxsr</samp>’</dt> <dd> +<p>Enable/disable the generation of the FXSR instructions. </p> </dd> <dt> +<span>‘<samp class="samp">gfni</samp>’<a class="copiable-link" href="#index-target_0028_0022gfni_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-gfni</samp>’</dt> <dd> +<p>Enable/disable the generation of the GFNI instructions. </p> </dd> <dt> +<span>‘<samp class="samp">hle</samp>’<a class="copiable-link" href="#index-target_0028_0022hle_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-hle</samp>’</dt> <dd> +<p>Enable/disable the generation of the HLE instruction prefixes. </p> </dd> <dt> +<span>‘<samp class="samp">lwp</samp>’<a class="copiable-link" href="#index-target_0028_0022lwp_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-lwp</samp>’</dt> <dd> +<p>Enable/disable the generation of the LWP instructions. </p> </dd> <dt> +<span>‘<samp class="samp">lzcnt</samp>’<a class="copiable-link" href="#index-target_0028_0022lzcnt_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-lzcnt</samp>’</dt> <dd> +<p>Enable/disable the generation of the LZCNT instructions. </p> </dd> <dt> +<span>‘<samp class="samp">mmx</samp>’<a class="copiable-link" href="#index-target_0028_0022mmx_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-mmx</samp>’</dt> <dd> +<p>Enable/disable the generation of the MMX instructions. </p> </dd> <dt> +<span>‘<samp class="samp">movbe</samp>’<a class="copiable-link" href="#index-target_0028_0022movbe_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-movbe</samp>’</dt> <dd> +<p>Enable/disable the generation of the MOVBE instructions. </p> </dd> <dt> +<span>‘<samp class="samp">movdir64b</samp>’<a class="copiable-link" href="#index-target_0028_0022movdir64b_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-movdir64b</samp>’</dt> <dd> +<p>Enable/disable the generation of the MOVDIR64B instructions. </p> </dd> <dt> +<span>‘<samp class="samp">movdiri</samp>’<a class="copiable-link" href="#index-target_0028_0022movdiri_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-movdiri</samp>’</dt> <dd> +<p>Enable/disable the generation of the MOVDIRI instructions. </p> </dd> <dt> +<span>‘<samp class="samp">mwait</samp>’<a class="copiable-link" href="#index-target_0028_0022mwait_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-mwait</samp>’</dt> <dd> +<p>Enable/disable the generation of the MWAIT and MONITOR instructions. </p> </dd> <dt> +<span>‘<samp class="samp">mwaitx</samp>’<a class="copiable-link" href="#index-target_0028_0022mwaitx_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-mwaitx</samp>’</dt> <dd> +<p>Enable/disable the generation of the MWAITX instructions. </p> </dd> <dt> +<span>‘<samp class="samp">pclmul</samp>’<a class="copiable-link" href="#index-target_0028_0022pclmul_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-pclmul</samp>’</dt> <dd> +<p>Enable/disable the generation of the PCLMUL instructions. </p> </dd> <dt> +<span>‘<samp class="samp">pconfig</samp>’<a class="copiable-link" href="#index-target_0028_0022pconfig_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-pconfig</samp>’</dt> <dd> +<p>Enable/disable the generation of the PCONFIG instructions. </p> </dd> <dt> +<span>‘<samp class="samp">pku</samp>’<a class="copiable-link" href="#index-target_0028_0022pku_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-pku</samp>’</dt> <dd> +<p>Enable/disable the generation of the PKU instructions. </p> </dd> <dt> +<span>‘<samp class="samp">popcnt</samp>’<a class="copiable-link" href="#index-target_0028_0022popcnt_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-popcnt</samp>’</dt> <dd> +<p>Enable/disable the generation of the POPCNT instruction. </p> </dd> <dt> +<span>‘<samp class="samp">prefetchwt1</samp>’<a class="copiable-link" href="#index-target_0028_0022prefetchwt1_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-prefetchwt1</samp>’</dt> <dd> +<p>Enable/disable the generation of the PREFETCHWT1 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">prfchw</samp>’<a class="copiable-link" href="#index-target_0028_0022prfchw_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-prfchw</samp>’</dt> <dd> +<p>Enable/disable the generation of the PREFETCHW instruction. </p> </dd> <dt> +<span>‘<samp class="samp">ptwrite</samp>’<a class="copiable-link" href="#index-target_0028_0022ptwrite_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-ptwrite</samp>’</dt> <dd> +<p>Enable/disable the generation of the PTWRITE instructions. </p> </dd> <dt> +<span>‘<samp class="samp">rdpid</samp>’<a class="copiable-link" href="#index-target_0028_0022rdpid_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-rdpid</samp>’</dt> <dd> +<p>Enable/disable the generation of the RDPID instructions. </p> </dd> <dt> +<span>‘<samp class="samp">rdrnd</samp>’<a class="copiable-link" href="#index-target_0028_0022rdrnd_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-rdrnd</samp>’</dt> <dd> +<p>Enable/disable the generation of the RDRND instructions. </p> </dd> <dt> +<span>‘<samp class="samp">rdseed</samp>’<a class="copiable-link" href="#index-target_0028_0022rdseed_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-rdseed</samp>’</dt> <dd> +<p>Enable/disable the generation of the RDSEED instructions. </p> </dd> <dt> +<span>‘<samp class="samp">rtm</samp>’<a class="copiable-link" href="#index-target_0028_0022rtm_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-rtm</samp>’</dt> <dd> +<p>Enable/disable the generation of the RTM instructions. </p> </dd> <dt> +<span>‘<samp class="samp">sahf</samp>’<a class="copiable-link" href="#index-target_0028_0022sahf_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sahf</samp>’</dt> <dd> +<p>Enable/disable the generation of the SAHF instructions. </p> </dd> <dt> +<span>‘<samp class="samp">sgx</samp>’<a class="copiable-link" href="#index-target_0028_0022sgx_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sgx</samp>’</dt> <dd> +<p>Enable/disable the generation of the SGX instructions. </p> </dd> <dt> +<span>‘<samp class="samp">sha</samp>’<a class="copiable-link" href="#index-target_0028_0022sha_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sha</samp>’</dt> <dd> +<p>Enable/disable the generation of the SHA instructions. </p> </dd> <dt> +<span>‘<samp class="samp">shstk</samp>’<a class="copiable-link" href="#index-target_0028_0022shstk_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-shstk</samp>’</dt> <dd> +<p>Enable/disable the shadow stack built-in functions from CET. </p> </dd> <dt> +<span>‘<samp class="samp">sse</samp>’<a class="copiable-link" href="#index-target_0028_0022sse_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sse</samp>’</dt> <dd> +<p>Enable/disable the generation of the SSE instructions. </p> </dd> <dt> +<span>‘<samp class="samp">sse2</samp>’<a class="copiable-link" href="#index-target_0028_0022sse2_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sse2</samp>’</dt> <dd> +<p>Enable/disable the generation of the SSE2 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">sse3</samp>’<a class="copiable-link" href="#index-target_0028_0022sse3_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sse3</samp>’</dt> <dd> +<p>Enable/disable the generation of the SSE3 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">sse4</samp>’<a class="copiable-link" href="#index-target_0028_0022sse4_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sse4</samp>’</dt> <dd> +<p>Enable/disable the generation of the SSE4 instructions (both SSE4.1 and SSE4.2). </p> </dd> <dt> +<span>‘<samp class="samp">sse4.1</samp>’<a class="copiable-link" href="#index-target_0028_0022sse4_002e1_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sse4.1</samp>’</dt> <dd> +<p>Enable/disable the generation of the SSE4.1 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">sse4.2</samp>’<a class="copiable-link" href="#index-target_0028_0022sse4_002e2_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sse4.2</samp>’</dt> <dd> +<p>Enable/disable the generation of the SSE4.2 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">sse4a</samp>’<a class="copiable-link" href="#index-target_0028_0022sse4a_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-sse4a</samp>’</dt> <dd> +<p>Enable/disable the generation of the SSE4A instructions. </p> </dd> <dt> +<span>‘<samp class="samp">ssse3</samp>’<a class="copiable-link" href="#index-target_0028_0022ssse3_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-ssse3</samp>’</dt> <dd> +<p>Enable/disable the generation of the SSSE3 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">tbm</samp>’<a class="copiable-link" href="#index-target_0028_0022tbm_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-tbm</samp>’</dt> <dd> +<p>Enable/disable the generation of the TBM instructions. </p> </dd> <dt> +<span>‘<samp class="samp">vaes</samp>’<a class="copiable-link" href="#index-target_0028_0022vaes_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-vaes</samp>’</dt> <dd> +<p>Enable/disable the generation of the VAES instructions. </p> </dd> <dt> +<span>‘<samp class="samp">vpclmulqdq</samp>’<a class="copiable-link" href="#index-target_0028_0022vpclmulqdq_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-vpclmulqdq</samp>’</dt> <dd> +<p>Enable/disable the generation of the VPCLMULQDQ instructions. </p> </dd> <dt> +<span>‘<samp class="samp">waitpkg</samp>’<a class="copiable-link" href="#index-target_0028_0022waitpkg_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-waitpkg</samp>’</dt> <dd> +<p>Enable/disable the generation of the WAITPKG instructions. </p> </dd> <dt> +<span>‘<samp class="samp">wbnoinvd</samp>’<a class="copiable-link" href="#index-target_0028_0022wbnoinvd_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-wbnoinvd</samp>’</dt> <dd> +<p>Enable/disable the generation of the WBNOINVD instructions. </p> </dd> <dt> +<span>‘<samp class="samp">xop</samp>’<a class="copiable-link" href="#index-target_0028_0022xop_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-xop</samp>’</dt> <dd> +<p>Enable/disable the generation of the XOP instructions. </p> </dd> <dt> +<span>‘<samp class="samp">xsave</samp>’<a class="copiable-link" href="#index-target_0028_0022xsave_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-xsave</samp>’</dt> <dd> +<p>Enable/disable the generation of the XSAVE instructions. </p> </dd> <dt> +<span>‘<samp class="samp">xsavec</samp>’<a class="copiable-link" href="#index-target_0028_0022xsavec_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-xsavec</samp>’</dt> <dd> +<p>Enable/disable the generation of the XSAVEC instructions. </p> </dd> <dt> +<span>‘<samp class="samp">xsaveopt</samp>’<a class="copiable-link" href="#index-target_0028_0022xsaveopt_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-xsaveopt</samp>’</dt> <dd> +<p>Enable/disable the generation of the XSAVEOPT instructions. </p> </dd> <dt> +<span>‘<samp class="samp">xsaves</samp>’<a class="copiable-link" href="#index-target_0028_0022xsaves_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-xsaves</samp>’</dt> <dd> +<p>Enable/disable the generation of the XSAVES instructions. </p> </dd> <dt> +<span>‘<samp class="samp">amx-tile</samp>’<a class="copiable-link" href="#index-target_0028_0022amx-tile_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-amx-tile</samp>’</dt> <dd> +<p>Enable/disable the generation of the AMX-TILE instructions. </p> </dd> <dt> +<span>‘<samp class="samp">amx-int8</samp>’<a class="copiable-link" href="#index-target_0028_0022amx-int8_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-amx-int8</samp>’</dt> <dd> +<p>Enable/disable the generation of the AMX-INT8 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">amx-bf16</samp>’<a class="copiable-link" href="#index-target_0028_0022amx-bf16_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-amx-bf16</samp>’</dt> <dd> +<p>Enable/disable the generation of the AMX-BF16 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">uintr</samp>’<a class="copiable-link" href="#index-target_0028_0022uintr_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-uintr</samp>’</dt> <dd> +<p>Enable/disable the generation of the UINTR instructions. </p> </dd> <dt> +<span>‘<samp class="samp">hreset</samp>’<a class="copiable-link" href="#index-target_0028_0022hreset_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-hreset</samp>’</dt> <dd> +<p>Enable/disable the generation of the HRESET instruction. </p> </dd> <dt> +<span>‘<samp class="samp">kl</samp>’<a class="copiable-link" href="#index-target_0028_0022kl_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-kl</samp>’</dt> <dd> +<p>Enable/disable the generation of the KEYLOCKER instructions. </p> </dd> <dt> +<span>‘<samp class="samp">widekl</samp>’<a class="copiable-link" href="#index-target_0028_0022widekl_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-widekl</samp>’</dt> <dd> +<p>Enable/disable the generation of the WIDEKL instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avxvnni</samp>’<a class="copiable-link" href="#index-target_0028_0022avxvnni_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avxvnni</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVXVNNI instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avxifma</samp>’<a class="copiable-link" href="#index-target_0028_0022avxifma_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avxifma</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVXIFMA instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avxvnniint8</samp>’<a class="copiable-link" href="#index-target_0028_0022avxvnniint8_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avxvnniint8</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVXVNNIINT8 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">avxneconvert</samp>’<a class="copiable-link" href="#index-target_0028_0022avxneconvert_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-avxneconvert</samp>’</dt> <dd> +<p>Enable/disable the generation of the AVXNECONVERT instructions. </p> </dd> <dt> +<span>‘<samp class="samp">cmpccxadd</samp>’<a class="copiable-link" href="#index-target_0028_0022cmpccxadd_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-cmpccxadd</samp>’</dt> <dd> +<p>Enable/disable the generation of the CMPccXADD instructions. </p> </dd> <dt> +<span>‘<samp class="samp">amx-fp16</samp>’<a class="copiable-link" href="#index-target_0028_0022amx-fp16_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-amx-fp16</samp>’</dt> <dd> +<p>Enable/disable the generation of the AMX-FP16 instructions. </p> </dd> <dt> +<span>‘<samp class="samp">prefetchi</samp>’<a class="copiable-link" href="#index-target_0028_0022prefetchi_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-prefetchi</samp>’</dt> <dd> +<p>Enable/disable the generation of the PREFETCHI instructions. </p> </dd> <dt> +<span>‘<samp class="samp">raoint</samp>’<a class="copiable-link" href="#index-target_0028_0022raoint_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-raoint</samp>’</dt> <dd> +<p>Enable/disable the generation of the RAOINT instructions. </p> </dd> <dt> +<span>‘<samp class="samp">amx-complex</samp>’<a class="copiable-link" href="#index-target_0028_0022amx-complex_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-amx-complex</samp>’</dt> <dd> +<p>Enable/disable the generation of the AMX-COMPLEX instructions. </p> </dd> <dt> +<span>‘<samp class="samp">cld</samp>’<a class="copiable-link" href="#index-target_0028_0022cld_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-cld</samp>’</dt> <dd> +<p>Enable/disable the generation of the CLD before string moves. </p> </dd> <dt> +<span>‘<samp class="samp">fancy-math-387</samp>’<a class="copiable-link" href="#index-target_0028_0022fancy-math-387_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-fancy-math-387</samp>’</dt> <dd> +<p>Enable/disable the generation of the <code class="code">sin</code>, <code class="code">cos</code>, and <code class="code">sqrt</code> instructions on the 387 floating-point unit. </p> </dd> <dt> +<span>‘<samp class="samp">ieee-fp</samp>’<a class="copiable-link" href="#index-target_0028_0022ieee-fp_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-ieee-fp</samp>’</dt> <dd> +<p>Enable/disable the generation of floating point that depends on IEEE arithmetic. </p> </dd> <dt> +<span>‘<samp class="samp">inline-all-stringops</samp>’<a class="copiable-link" href="#index-target_0028_0022inline-all-stringops_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-inline-all-stringops</samp>’</dt> <dd> +<p>Enable/disable inlining of string operations. </p> </dd> <dt> +<span>‘<samp class="samp">inline-stringops-dynamically</samp>’<a class="copiable-link" href="#index-target_0028_0022inline-stringops-dynamically_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-inline-stringops-dynamically</samp>’</dt> <dd> +<p>Enable/disable the generation of the inline code to do small string operations and calling the library routines for large operations. </p> </dd> <dt> +<span>‘<samp class="samp">align-stringops</samp>’<a class="copiable-link" href="#index-target_0028_0022align-stringops_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-align-stringops</samp>’</dt> <dd> +<p>Do/do not align destination of inlined string operations. </p> </dd> <dt> +<span>‘<samp class="samp">recip</samp>’<a class="copiable-link" href="#index-target_0028_0022recip_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dt>‘<samp class="samp">no-recip</samp>’</dt> <dd> +<p>Enable/disable the generation of RCPSS, RCPPS, RSQRTSS and RSQRTPS instructions followed an additional Newton-Raphson step instead of doing a floating-point division. </p> </dd> <dt> +<span>‘<samp class="samp">general-regs-only</samp>’<a class="copiable-link" href="#index-target_0028_0022general-regs-only_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>Generate code which uses only the general registers. </p> </dd> <dt> +<span>‘<samp class="samp">arch=<var class="var">ARCH</var></samp>’<a class="copiable-link" href="#index-target_0028_0022arch_003dARCH_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>Specify the architecture to generate code for in compiling the function. </p> </dd> <dt> +<span>‘<samp class="samp">tune=<var class="var">TUNE</var></samp>’<a class="copiable-link" href="#index-target_0028_0022tune_003dTUNE_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>Specify the architecture to tune for in compiling the function. </p> </dd> <dt> +<span>‘<samp class="samp">fpmath=<var class="var">FPMATH</var></samp>’<a class="copiable-link" href="#index-target_0028_0022fpmath_003dFPMATH_0022_0029-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>Specify which floating-point unit to use. You must specify the <code class="code">target("fpmath=sse,387")</code> option as <code class="code">target("fpmath=sse+387")</code> because the comma would separate different options. </p> </dd> <dt> +<span>‘<samp class="samp">prefer-vector-width=<var class="var">OPT</var></samp>’<a class="copiable-link" href="#index-prefer-vector-width-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>On x86 targets, the <code class="code">prefer-vector-width</code> attribute informs the compiler to use <var class="var">OPT</var>-bit vector width in instructions instead of the default on the selected platform. </p> <p>Valid <var class="var">OPT</var> values are: </p> <dl class="table"> <dt>‘<samp class="samp">none</samp>’</dt> <dd> +<p>No extra limitations applied to GCC other than defined by the selected platform. </p> </dd> <dt>‘<samp class="samp">128</samp>’</dt> <dd> +<p>Prefer 128-bit vector width for instructions. </p> </dd> <dt>‘<samp class="samp">256</samp>’</dt> <dd> +<p>Prefer 256-bit vector width for instructions. </p> </dd> <dt>‘<samp class="samp">512</samp>’</dt> <dd><p>Prefer 512-bit vector width for instructions. </p></dd> </dl> <p>On the x86, the inliner does not inline a function that has different target options than the caller, unless the callee has a subset of the target options of the caller. For example a function declared with <code class="code">target("sse3")</code> can inline a function with <code class="code">target("sse2")</code>, since <code class="code">-msse3</code> implies <code class="code">-msse2</code>. </p> +</dd> </dl> </dd> <dt> +<span><code class="code">indirect_branch("<var class="var">choice</var>")</code><a class="copiable-link" href="#index-indirect_005fbranch-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>On x86 targets, the <code class="code">indirect_branch</code> attribute causes the compiler to convert indirect call and jump with <var class="var">choice</var>. ‘<samp class="samp">keep</samp>’ keeps indirect call and jump unmodified. ‘<samp class="samp">thunk</samp>’ converts indirect call and jump to call and return thunk. ‘<samp class="samp">thunk-inline</samp>’ converts indirect call and jump to inlined call and return thunk. ‘<samp class="samp">thunk-extern</samp>’ converts indirect call and jump to external call and return thunk provided in a separate object file. </p> </dd> <dt> +<span><code class="code">function_return("<var class="var">choice</var>")</code><a class="copiable-link" href="#index-function_005freturn-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>On x86 targets, the <code class="code">function_return</code> attribute causes the compiler to convert function return with <var class="var">choice</var>. ‘<samp class="samp">keep</samp>’ keeps function return unmodified. ‘<samp class="samp">thunk</samp>’ converts function return to call and return thunk. ‘<samp class="samp">thunk-inline</samp>’ converts function return to inlined call and return thunk. ‘<samp class="samp">thunk-extern</samp>’ converts function return to external call and return thunk provided in a separate object file. </p> </dd> <dt> +<span><code class="code">nocf_check</code><a class="copiable-link" href="#index-nocf_005fcheck-function-attribute"> ¶</a></span> +</dt> <dd> +<p>The <code class="code">nocf_check</code> attribute on a function is used to inform the compiler that the function’s prologue should not be instrumented when compiled with the <samp class="option">-fcf-protection=branch</samp> option. The compiler assumes that the function’s address is a valid target for a control-flow transfer. </p> <p>The <code class="code">nocf_check</code> attribute on a type of pointer to function is used to inform the compiler that a call through the pointer should not be instrumented when compiled with the <samp class="option">-fcf-protection=branch</samp> option. The compiler assumes that the function’s address from the pointer is a valid target for a control-flow transfer. A direct function call through a function name is assumed to be a safe call thus direct calls are not instrumented by the compiler. </p> <p>The <code class="code">nocf_check</code> attribute is applied to an object’s type. In case of assignment of a function address or a function pointer to another pointer, the attribute is not carried over from the right-hand object’s type; the type of left-hand object stays unchanged. The compiler checks for <code class="code">nocf_check</code> attribute mismatch and reports a warning in case of mismatch. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">{ +int foo (void) __attribute__(nocf_check); +void (*foo1)(void) __attribute__(nocf_check); +void (*foo2)(void); + +/* foo's address is assumed to be valid. */ +int +foo (void) + + /* This call site is not checked for control-flow + validity. */ + (*foo1)(); + + /* A warning is issued about attribute mismatch. */ + foo1 = foo2; + + /* This call site is still not checked. */ + (*foo1)(); + + /* This call site is checked. */ + (*foo2)(); + + /* A warning is issued about attribute mismatch. */ + foo2 = foo1; + + /* This call site is still checked. */ + (*foo2)(); + + return 0; +}</pre> +</div> </dd> <dt> +<span><code class="code">cf_check</code><a class="copiable-link" href="#index-cf_005fcheck-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> <p>The <code class="code">cf_check</code> attribute on a function is used to inform the compiler that ENDBR instruction should be placed at the function entry when <samp class="option">-fcf-protection=branch</samp> is enabled. </p> </dd> <dt> +<span><code class="code">indirect_return</code><a class="copiable-link" href="#index-indirect_005freturn-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> <p>The <code class="code">indirect_return</code> attribute can be applied to a function, as well as variable or type of function pointer to inform the compiler that the function may return via indirect branch. </p> </dd> <dt> +<span><code class="code">fentry_name("<var class="var">name</var>")</code><a class="copiable-link" href="#index-fentry_005fname-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>On x86 targets, the <code class="code">fentry_name</code> attribute sets the function to call on function entry when function instrumentation is enabled with <samp class="option">-pg -mfentry</samp>. When <var class="var">name</var> is nop then a 5 byte nop sequence is generated. </p> </dd> <dt> +<span><code class="code">fentry_section("<var class="var">name</var>")</code><a class="copiable-link" href="#index-fentry_005fsection-function-attribute_002c-x86"> ¶</a></span> +</dt> <dd> +<p>On x86 targets, the <code class="code">fentry_section</code> attribute sets the name of the section to record function entry instrumentation calls in when enabled with <samp class="option">-pg -mrecord-mcount</samp> </p> </dd> <dt> + <span><code class="code">nodirect_extern_access</code><a class="copiable-link" href="#index-nodirect_005fextern_005faccess-function-attribute"> ¶</a></span> +</dt> <dd> +<p>This attribute, attached to a global variable or function, is the counterpart to option <samp class="option">-mno-direct-extern-access</samp>. </p> </dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="xstormy16-function-attributes">Xstormy16 Function Attributes</a>, Previous: <a href="visium-function-attributes">Visium Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/x86-options.html b/devdocs/gcc~13/x86-options.html new file mode 100644 index 00000000..4181df90 --- /dev/null +++ b/devdocs/gcc~13/x86-options.html @@ -0,0 +1,413 @@ +<div class="subsection-level-extent" id="x86-Options"> <div class="nav-panel"> <p> Next: <a href="x86-windows-options" accesskey="n" rel="next">x86 Windows Options</a>, Previous: <a href="vxworks-options" accesskey="p" rel="prev">VxWorks Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="x86-Options-1"><span>3.19.54 x86 Options<a class="copiable-link" href="#x86-Options-1"> ¶</a></span></h1> <p>These ‘<samp class="samp">-m</samp>’ options are defined for the x86 family of computers. </p> <dl class="table"> <dt> +<span><code class="code">-march=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-march-16"> ¶</a></span> +</dt> <dd> +<p>Generate instructions for the machine type <var class="var">cpu-type</var>. In contrast to <samp class="option">-mtune=<var class="var">cpu-type</var></samp>, which merely tunes the generated code for the specified <var class="var">cpu-type</var>, <samp class="option">-march=<var class="var">cpu-type</var></samp> allows GCC to generate code that may not run at all on processors other than the one indicated. Specifying <samp class="option">-march=<var class="var">cpu-type</var></samp> implies <samp class="option">-mtune=<var class="var">cpu-type</var></samp>, except where noted otherwise. </p> <p>The choices for <var class="var">cpu-type</var> are: </p> <dl class="table"> <dt>‘<samp class="samp">native</samp>’</dt> <dd> +<p>This selects the CPU to generate code for at compilation time by determining the processor type of the compiling machine. Using <samp class="option">-march=native</samp> enables all instruction subsets supported by the local machine (hence the result might not run on different machines). Using <samp class="option">-mtune=native</samp> produces code optimized for the local machine under the constraints of the selected instruction set. </p> </dd> <dt>‘<samp class="samp">x86-64</samp>’</dt> <dd> +<p>A generic CPU with 64-bit extensions. </p> </dd> <dt>‘<samp class="samp">x86-64-v2</samp>’</dt> <dt>‘<samp class="samp">x86-64-v3</samp>’</dt> <dt>‘<samp class="samp">x86-64-v4</samp>’</dt> <dd> +<p>These choices for <var class="var">cpu-type</var> select the corresponding micro-architecture level from the x86-64 psABI. On ABIs other than the x86-64 psABI they select the same CPU features as the x86-64 psABI documents for the particular micro-architecture level. </p> <p>Since these <var class="var">cpu-type</var> values do not have a corresponding <samp class="option">-mtune</samp> setting, using <samp class="option">-march</samp> with these values enables generic tuning. Specific tuning can be enabled using the <samp class="option">-mtune=<var class="var">other-cpu-type</var></samp> option with an appropriate <var class="var">other-cpu-type</var> value. </p> </dd> <dt>‘<samp class="samp">i386</samp>’</dt> <dd> +<p>Original Intel i386 CPU. </p> </dd> <dt>‘<samp class="samp">i486</samp>’</dt> <dd> +<p>Intel i486 CPU. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">i586</samp>’</dt> <dt>‘<samp class="samp">pentium</samp>’</dt> <dd> +<p>Intel Pentium CPU with no MMX support. </p> </dd> <dt>‘<samp class="samp">lakemont</samp>’</dt> <dd> +<p>Intel Lakemont MCU, based on Intel Pentium CPU. </p> </dd> <dt>‘<samp class="samp">pentium-mmx</samp>’</dt> <dd> +<p>Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support. </p> </dd> <dt>‘<samp class="samp">pentiumpro</samp>’</dt> <dd> +<p>Intel Pentium Pro CPU. </p> </dd> <dt>‘<samp class="samp">i686</samp>’</dt> <dd> +<p>When used with <samp class="option">-march</samp>, the Pentium Pro instruction set is used, so the code runs on all i686 family chips. When used with <samp class="option">-mtune</samp>, it has the same meaning as ‘<samp class="samp">generic</samp>’. </p> </dd> <dt>‘<samp class="samp">pentium2</samp>’</dt> <dd> +<p>Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction set support. </p> </dd> <dt>‘<samp class="samp">pentium3</samp>’</dt> <dt>‘<samp class="samp">pentium3m</samp>’</dt> <dd> +<p>Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE instruction set support. </p> </dd> <dt>‘<samp class="samp">pentium-m</samp>’</dt> <dd> +<p>Intel Pentium M; low-power version of Intel Pentium III CPU with MMX, SSE, SSE2 and FXSR instruction set support. Used by Centrino notebooks. </p> </dd> <dt>‘<samp class="samp">pentium4</samp>’</dt> <dt>‘<samp class="samp">pentium4m</samp>’</dt> <dd> +<p>Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support. </p> </dd> <dt>‘<samp class="samp">prescott</samp>’</dt> <dd> +<p>Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR instruction set support. </p> </dd> <dt>‘<samp class="samp">nocona</samp>’</dt> <dd> +<p>Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and FXSR instruction set support. </p> </dd> <dt>‘<samp class="samp">core2</samp>’</dt> <dd> +<p>Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16, SAHF and FXSR instruction set support. </p> </dd> <dt>‘<samp class="samp">nehalem</samp>’</dt> <dd> +<p>Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support. </p> </dd> <dt>‘<samp class="samp">westmere</samp>’</dt> <dd> +<p>Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support. </p> </dd> <dt>‘<samp class="samp">sandybridge</samp>’</dt> <dd> +<p>Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set support. </p> </dd> <dt>‘<samp class="samp">ivybridge</samp>’</dt> <dd> +<p>Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set support. </p> </dd> <dt>‘<samp class="samp">haswell</samp>’</dt> <dd> +<p>Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support. </p> </dd> <dt>‘<samp class="samp">broadwell</samp>’</dt> <dd> +<p>Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction set support. </p> </dd> <dt>‘<samp class="samp">skylake</samp>’</dt> <dd> +<p>Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support. </p> </dd> <dt>‘<samp class="samp">bonnell</samp>’</dt> <dd> +<p>Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support. </p> </dd> <dt>‘<samp class="samp">silvermont</samp>’</dt> <dd> +<p>Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND instruction set support. </p> </dd> <dt>‘<samp class="samp">goldmont</samp>’</dt> <dd> +<p>Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set support. </p> </dd> <dt>‘<samp class="samp">goldmont-plus</samp>’</dt> <dd> +<p>Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID and SGX instruction set support. </p> </dd> <dt>‘<samp class="samp">tremont</samp>’</dt> <dd> +<p>Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set support. </p> </dd> <dt>‘<samp class="samp">sierraforest</samp>’</dt> <dd> +<p>Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set support. </p> </dd> <dt>‘<samp class="samp">grandridge</samp>’</dt> <dd> +<p>Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD and RAOINT instruction set support. </p> </dd> <dt>‘<samp class="samp">knl</samp>’</dt> <dd> +<p>Intel Knight’s Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support. </p> </dd> <dt>‘<samp class="samp">knm</samp>’</dt> <dd> +<p>Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support. </p> </dd> <dt>‘<samp class="samp">skylake-avx512</samp>’</dt> <dd> +<p>Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support. </p> </dd> <dt>‘<samp class="samp">cannonlake</samp>’</dt> <dd> +<p>Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set support. </p> </dd> <dt>‘<samp class="samp">icelake-client</samp>’</dt> <dd> +<p>Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support. </p> </dd> <dt>‘<samp class="samp">icelake-server</samp>’</dt> <dd> +<p>Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction set support. </p> </dd> <dt>‘<samp class="samp">cascadelake</samp>’</dt> <dd> +<p>Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support. </p> </dd> <dt>‘<samp class="samp">cooperlake</samp>’</dt> <dd> +<p>Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction set support. </p> </dd> <dt>‘<samp class="samp">tigerlake</samp>’</dt> <dd> +<p>Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB, AVX512VP2INTERSECT and KEYLOCKER instruction set support. </p> </dd> <dt>‘<samp class="samp">sapphirerapids</samp>’</dt> <dd> +<p>Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16 instruction set support. </p> </dd> <dt>‘<samp class="samp">alderlake</samp>’</dt> <dd> +<p>Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set support. </p> </dd> <dt>‘<samp class="samp">rocketlake</samp>’</dt> <dd> +<p>Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support. </p> </dd> <dt>‘<samp class="samp">graniterapids</samp>’</dt> <dd> +<p>Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16 and PREFETCHI instruction set support. </p> </dd> <dt>‘<samp class="samp">k6</samp>’</dt> <dd> +<p>AMD K6 CPU with MMX instruction set support. </p> </dd> <dt>‘<samp class="samp">k6-2</samp>’</dt> <dt>‘<samp class="samp">k6-3</samp>’</dt> <dd> +<p>Improved versions of AMD K6 CPU with MMX and 3DNow! instruction set support. </p> </dd> <dt>‘<samp class="samp">athlon</samp>’</dt> <dt>‘<samp class="samp">athlon-tbird</samp>’</dt> <dd> +<p>AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE prefetch instructions support. </p> </dd> <dt>‘<samp class="samp">athlon-4</samp>’</dt> <dt>‘<samp class="samp">athlon-xp</samp>’</dt> <dt>‘<samp class="samp">athlon-mp</samp>’</dt> <dd> +<p>Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and full SSE instruction set support. </p> </dd> <dt>‘<samp class="samp">k8</samp>’</dt> <dt>‘<samp class="samp">opteron</samp>’</dt> <dt>‘<samp class="samp">athlon64</samp>’</dt> <dt>‘<samp class="samp">athlon-fx</samp>’</dt> <dd> +<p>Processors based on the AMD K8 core with x86-64 instruction set support, including the AMD Opteron, Athlon 64, and Athlon 64 FX processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow! and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">k8-sse3</samp>’</dt> <dt>‘<samp class="samp">opteron-sse3</samp>’</dt> <dt>‘<samp class="samp">athlon64-sse3</samp>’</dt> <dd> +<p>Improved versions of AMD K8 cores with SSE3 instruction set support. </p> </dd> <dt>‘<samp class="samp">amdfam10</samp>’</dt> <dt>‘<samp class="samp">barcelona</samp>’</dt> <dd> +<p>CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">bdver1</samp>’</dt> <dd> +<p>CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">bdver2</samp>’</dt> <dd> +<p>AMD Family 15h core based CPUs with x86-64 instruction set support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">bdver3</samp>’</dt> <dd> +<p>AMD Family 15h core based CPUs with x86-64 instruction set support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">bdver4</samp>’</dt> <dd> +<p>AMD Family 15h core based CPUs with x86-64 instruction set support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">znver1</samp>’</dt> <dd> +<p>AMD Family 17h core based CPUs with x86-64 instruction set support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">znver2</samp>’</dt> <dd> +<p>AMD Family 17h core based CPUs with x86-64 instruction set support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID, WBNOINVD, and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">znver3</samp>’</dt> <dd> +<p>AMD Family 19h core based CPUs with x86-64 instruction set support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID, WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">znver4</samp>’</dt> <dd> +<p>AMD Family 19h core based CPUs with x86-64 instruction set support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID, WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD, AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI, AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">btver1</samp>’</dt> <dd> +<p>CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit instruction set extensions.) </p> </dd> <dt>‘<samp class="samp">btver2</samp>’</dt> <dd> +<p>CPUs based on AMD Family 16h cores with x86-64 instruction set support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions. </p> </dd> <dt>‘<samp class="samp">winchip-c6</samp>’</dt> <dd> +<p>IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction set support. </p> </dd> <dt>‘<samp class="samp">winchip2</samp>’</dt> <dd> +<p>IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow! instruction set support. </p> </dd> <dt>‘<samp class="samp">c3</samp>’</dt> <dd> +<p>VIA C3 CPU with MMX and 3DNow! instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">c3-2</samp>’</dt> <dd> +<p>VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">c7</samp>’</dt> <dd> +<p>VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">samuel-2</samp>’</dt> <dd> +<p>VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">nehemiah</samp>’</dt> <dd> +<p>VIA Eden Nehemiah CPU with MMX and SSE instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">esther</samp>’</dt> <dd> +<p>VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">eden-x2</samp>’</dt> <dd> +<p>VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">eden-x4</samp>’</dt> <dd> +<p>VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">nano</samp>’</dt> <dd> +<p>Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">nano-1000</samp>’</dt> <dd> +<p>VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">nano-2000</samp>’</dt> <dd> +<p>VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">nano-3000</samp>’</dt> <dd> +<p>VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">nano-x2</samp>’</dt> <dd> +<p>VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">nano-x4</samp>’</dt> <dd> +<p>VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 instruction set support. (No scheduling is implemented for this chip.) </p> </dd> <dt>‘<samp class="samp">lujiazui</samp>’</dt> <dd> +<p>ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16, ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support. </p> </dd> <dt>‘<samp class="samp">geode</samp>’</dt> <dd><p>AMD Geode embedded processor with MMX and 3DNow! instruction set support. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mtune=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-mtune-17"> ¶</a></span> +</dt> <dd> +<p>Tune to <var class="var">cpu-type</var> everything applicable about the generated code, except for the ABI and the set of available instructions. While picking a specific <var class="var">cpu-type</var> schedules things appropriately for that particular chip, the compiler does not generate any code that cannot run on the default machine type unless you use a <samp class="option">-march=<var class="var">cpu-type</var></samp> option. For example, if GCC is configured for i686-pc-linux-gnu then <samp class="option">-mtune=pentium4</samp> generates code that is tuned for Pentium 4 but still runs on i686 machines. </p> <p>The choices for <var class="var">cpu-type</var> are the same as for <samp class="option">-march</samp>. In addition, <samp class="option">-mtune</samp> supports 2 extra choices for <var class="var">cpu-type</var>: </p> <dl class="table"> <dt>‘<samp class="samp">generic</samp>’</dt> <dd> +<p>Produce code optimized for the most common IA32/AMD64/EM64T processors. If you know the CPU on which your code will run, then you should use the corresponding <samp class="option">-mtune</samp> or <samp class="option">-march</samp> option instead of <samp class="option">-mtune=generic</samp>. But, if you do not know exactly what CPU users of your application will have, then you should use this option. </p> <p>As new processors are deployed in the marketplace, the behavior of this option will change. Therefore, if you upgrade to a newer version of GCC, code generation controlled by this option will change to reflect the processors that are most common at the time that version of GCC is released. </p> <p>There is no <samp class="option">-march=generic</samp> option because <samp class="option">-march</samp> indicates the instruction set the compiler can use, and there is no generic instruction set applicable to all processors. In contrast, <samp class="option">-mtune</samp> indicates the processor (or, in this case, collection of processors) for which the code is optimized. </p> </dd> <dt>‘<samp class="samp">intel</samp>’</dt> <dd> +<p>Produce code optimized for the most current Intel processors, which are Haswell and Silvermont for this version of GCC. If you know the CPU on which your code will run, then you should use the corresponding <samp class="option">-mtune</samp> or <samp class="option">-march</samp> option instead of <samp class="option">-mtune=intel</samp>. But, if you want your application performs better on both Haswell and Silvermont, then you should use this option. </p> <p>As new Intel processors are deployed in the marketplace, the behavior of this option will change. Therefore, if you upgrade to a newer version of GCC, code generation controlled by this option will change to reflect the most current Intel processors at the time that version of GCC is released. </p> <p>There is no <samp class="option">-march=intel</samp> option because <samp class="option">-march</samp> indicates the instruction set the compiler can use, and there is no common instruction set applicable to all processors. In contrast, <samp class="option">-mtune</samp> indicates the processor (or, in this case, collection of processors) for which the code is optimized. </p> +</dd> </dl> </dd> <dt> +<span><code class="code">-mcpu=<var class="var">cpu-type</var></code><a class="copiable-link" href="#index-mcpu-14"> ¶</a></span> +</dt> <dd> +<p>A deprecated synonym for <samp class="option">-mtune</samp>. </p> </dd> <dt> +<span><code class="code">-mfpmath=<var class="var">unit</var></code><a class="copiable-link" href="#index-mfpmath-1"> ¶</a></span> +</dt> <dd> +<p>Generate floating-point arithmetic for selected unit <var class="var">unit</var>. The choices for <var class="var">unit</var> are: </p> <dl class="table"> <dt>‘<samp class="samp">387</samp>’</dt> <dd> +<p>Use the standard 387 floating-point coprocessor present on the majority of chips and emulated otherwise. Code compiled with this option runs almost everywhere. The temporary results are computed in 80-bit precision instead of the precision specified by the type, resulting in slightly different results compared to most of other chips. See <samp class="option">-ffloat-store</samp> for more detailed description. </p> <p>This is the default choice for non-Darwin x86-32 targets. </p> </dd> <dt>‘<samp class="samp">sse</samp>’</dt> <dd> +<p>Use scalar floating-point instructions present in the SSE instruction set. This instruction set is supported by Pentium III and newer chips, and in the AMD line by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE instruction set supports only single-precision arithmetic, thus the double and extended-precision arithmetic are still done using 387. A later version, present only in Pentium 4 and AMD x86-64 chips, supports double-precision arithmetic too. </p> <p>For the x86-32 compiler, you must use <samp class="option">-march=<var class="var">cpu-type</var></samp>, <samp class="option">-msse</samp> or <samp class="option">-msse2</samp> switches to enable SSE extensions and make this option effective. For the x86-64 compiler, these extensions are enabled by default. </p> <p>The resulting code should be considerably faster in the majority of cases and avoid the numerical instability problems of 387 code, but may break some existing code that expects temporaries to be 80 bits. </p> <p>This is the default choice for the x86-64 compiler, Darwin x86-32 targets, and the default choice for x86-32 targets with the SSE2 instruction set when <samp class="option">-ffast-math</samp> is enabled. </p> </dd> <dt>‘<samp class="samp">sse,387</samp>’</dt> <dt>‘<samp class="samp">sse+387</samp>’</dt> <dt>‘<samp class="samp">both</samp>’</dt> <dd><p>Attempt to utilize both instruction sets at once. This effectively doubles the amount of available registers, and on chips with separate execution units for 387 and SSE the execution resources too. Use this option with care, as it is still experimental, because the GCC register allocator does not model separate functional units well, resulting in unstable performance. </p></dd> </dl> </dd> <dt> +<span><code class="code">-masm=<var class="var">dialect</var></code><a class="copiable-link" href="#index-masm_003ddialect"> ¶</a></span> +</dt> <dd> +<p>Output assembly instructions using selected <var class="var">dialect</var>. Also affects which dialect is used for basic <code class="code">asm</code> (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>) and extended <code class="code">asm</code> (see <a class="pxref" href="extended-asm">Extended Asm - Assembler Instructions with C Expression Operands</a>). Supported choices (in dialect order) are ‘<samp class="samp">att</samp>’ or ‘<samp class="samp">intel</samp>’. The default is ‘<samp class="samp">att</samp>’. Darwin does not support ‘<samp class="samp">intel</samp>’. </p> </dd> <dt> + <span><code class="code">-mieee-fp</code><a class="copiable-link" href="#index-mieee-fp"> ¶</a></span> +</dt> <dt><code class="code">-mno-ieee-fp</code></dt> <dd> +<p>Control whether or not the compiler uses IEEE floating-point comparisons. These correctly handle the case where the result of a comparison is unordered. </p> </dd> <dt> + <span><code class="code">-m80387</code><a class="copiable-link" href="#index-m80387"> ¶</a></span> +</dt> <dt><code class="code">-mhard-float</code></dt> <dd> +<p>Generate output containing 80387 instructions for floating point. </p> </dd> <dt> + <span><code class="code">-mno-80387</code><a class="copiable-link" href="#index-no-80387"> ¶</a></span> +</dt> <dt><code class="code">-msoft-float</code></dt> <dd> +<p>Generate output containing library calls for floating point. </p> <p><strong class="strong">Warning:</strong> the requisite libraries are not part of GCC. Normally the facilities of the machine’s usual C compiler are used, but this cannot be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for cross-compilation. </p> <p>On machines where a function returns floating-point results in the 80387 register stack, some floating-point opcodes may be emitted even if <samp class="option">-msoft-float</samp> is used. </p> </dd> <dt> + <span><code class="code">-mno-fp-ret-in-387</code><a class="copiable-link" href="#index-mno-fp-ret-in-387"> ¶</a></span> +</dt> <dd> +<p>Do not use the FPU registers for return values of functions. </p> <p>The usual calling convention has functions return values of types <code class="code">float</code> and <code class="code">double</code> in an FPU register, even if there is no FPU. The idea is that the operating system should emulate an FPU. </p> <p>The option <samp class="option">-mno-fp-ret-in-387</samp> causes such values to be returned in ordinary CPU registers instead. </p> </dd> <dt> + <span><code class="code">-mno-fancy-math-387</code><a class="copiable-link" href="#index-mno-fancy-math-387"> ¶</a></span> +</dt> <dd> +<p>Some 387 emulators do not support the <code class="code">sin</code>, <code class="code">cos</code> and <code class="code">sqrt</code> instructions for the 387. Specify this option to avoid generating those instructions. This option is overridden when <samp class="option">-march</samp> indicates that the target CPU always has an FPU and so the instruction does not need emulation. These instructions are not generated unless you also use the <samp class="option">-funsafe-math-optimizations</samp> switch. </p> </dd> <dt> + <span><code class="code">-malign-double</code><a class="copiable-link" href="#index-malign-double"> ¶</a></span> +</dt> <dt><code class="code">-mno-align-double</code></dt> <dd> +<p>Control whether GCC aligns <code class="code">double</code>, <code class="code">long double</code>, and <code class="code">long long</code> variables on a two-word boundary or a one-word boundary. Aligning <code class="code">double</code> variables on a two-word boundary produces code that runs somewhat faster on a Pentium at the expense of more memory. </p> <p>On x86-64, <samp class="option">-malign-double</samp> is enabled by default. </p> <p><strong class="strong">Warning:</strong> if you use the <samp class="option">-malign-double</samp> switch, structures containing the above types are aligned differently than the published application binary interface specifications for the x86-32 and are not binary compatible with structures in code compiled without that switch. </p> </dd> <dt> + <span><code class="code">-m96bit-long-double</code><a class="copiable-link" href="#index-m96bit-long-double"> ¶</a></span> +</dt> <dt><code class="code">-m128bit-long-double</code></dt> <dd> +<p>These switches control the size of <code class="code">long double</code> type. The x86-32 application binary interface specifies the size to be 96 bits, so <samp class="option">-m96bit-long-double</samp> is the default in 32-bit mode. </p> <p>Modern architectures (Pentium and newer) prefer <code class="code">long double</code> to be aligned to an 8- or 16-byte boundary. In arrays or structures conforming to the ABI, this is not possible. So specifying <samp class="option">-m128bit-long-double</samp> aligns <code class="code">long double</code> to a 16-byte boundary by padding the <code class="code">long double</code> with an additional 32-bit zero. </p> <p>In the x86-64 compiler, <samp class="option">-m128bit-long-double</samp> is the default choice as its ABI specifies that <code class="code">long double</code> is aligned on 16-byte boundary. </p> <p>Notice that neither of these options enable any extra precision over the x87 standard of 80 bits for a <code class="code">long double</code>. </p> <p><strong class="strong">Warning:</strong> if you override the default value for your target ABI, this changes the size of structures and arrays containing <code class="code">long double</code> variables, as well as modifying the function calling convention for functions taking <code class="code">long double</code>. Hence they are not binary-compatible with code compiled without that switch. </p> </dd> <dt> + <span><code class="code">-mlong-double-64</code><a class="copiable-link" href="#index-mlong-double-64-1"> ¶</a></span> +</dt> <dt><code class="code">-mlong-double-80</code></dt> <dt><code class="code">-mlong-double-128</code></dt> <dd> +<p>These switches control the size of <code class="code">long double</code> type. A size of 64 bits makes the <code class="code">long double</code> type equivalent to the <code class="code">double</code> type. This is the default for 32-bit Bionic C library. A size of 128 bits makes the <code class="code">long double</code> type equivalent to the <code class="code">__float128</code> type. This is the default for 64-bit Bionic C library. </p> <p><strong class="strong">Warning:</strong> if you override the default value for your target ABI, this changes the size of structures and arrays containing <code class="code">long double</code> variables, as well as modifying the function calling convention for functions taking <code class="code">long double</code>. Hence they are not binary-compatible with code compiled without that switch. </p> </dd> <dt> +<span><code class="code">-malign-data=<var class="var">type</var></code><a class="copiable-link" href="#index-malign-data-1"> ¶</a></span> +</dt> <dd> +<p>Control how GCC aligns variables. Supported values for <var class="var">type</var> are ‘<samp class="samp">compat</samp>’ uses increased alignment value compatible uses GCC 4.8 and earlier, ‘<samp class="samp">abi</samp>’ uses alignment value as specified by the psABI, and ‘<samp class="samp">cacheline</samp>’ uses increased alignment value to match the cache line size. ‘<samp class="samp">compat</samp>’ is the default. </p> </dd> <dt> +<span><code class="code">-mlarge-data-threshold=<var class="var">threshold</var></code><a class="copiable-link" href="#index-mlarge-data-threshold"> ¶</a></span> +</dt> <dd> +<p>When <samp class="option">-mcmodel=medium</samp> is specified, data objects larger than <var class="var">threshold</var> are placed in the large data section. This value must be the same across all objects linked into the binary, and defaults to 65535. </p> </dd> <dt> +<span><code class="code">-mrtd</code><a class="copiable-link" href="#index-mrtd-1"> ¶</a></span> +</dt> <dd> +<p>Use a different function-calling convention, in which functions that take a fixed number of arguments return with the <code class="code">ret <var class="var">num</var></code> instruction, which pops their arguments while returning. This saves one instruction in the caller since there is no need to pop the arguments there. </p> <p>You can specify that an individual function is called with this calling sequence with the function attribute <code class="code">stdcall</code>. You can also override the <samp class="option">-mrtd</samp> option by using the function attribute <code class="code">cdecl</code>. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> <p><strong class="strong">Warning:</strong> this calling convention is incompatible with the one normally used on Unix, so you cannot use it if you need to call libraries compiled with the Unix compiler. </p> <p>Also, you must provide function prototypes for all functions that take variable numbers of arguments (including <code class="code">printf</code>); otherwise incorrect code is generated for calls to those functions. </p> <p>In addition, seriously incorrect code results if you call a function with too many arguments. (Normally, extra arguments are harmlessly ignored.) </p> </dd> <dt> +<span><code class="code">-mregparm=<var class="var">num</var></code><a class="copiable-link" href="#index-mregparm"> ¶</a></span> +</dt> <dd> +<p>Control how many registers are used to pass integer arguments. By default, no registers are used to pass arguments, and at most 3 registers can be used. You can control this behavior for a specific function by using the function attribute <code class="code">regparm</code>. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> <p><strong class="strong">Warning:</strong> if you use this switch, and <var class="var">num</var> is nonzero, then you must build all modules with the same value, including any libraries. This includes the system libraries and startup modules. </p> </dd> <dt> +<span><code class="code">-msseregparm</code><a class="copiable-link" href="#index-msseregparm"> ¶</a></span> +</dt> <dd> +<p>Use SSE register passing conventions for float and double arguments and return values. You can control this behavior for a specific function by using the function attribute <code class="code">sseregparm</code>. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> <p><strong class="strong">Warning:</strong> if you use this switch then you must build all modules with the same value, including any libraries. This includes the system libraries and startup modules. </p> </dd> <dt> +<span><code class="code">-mvect8-ret-in-mem</code><a class="copiable-link" href="#index-mvect8-ret-in-mem"> ¶</a></span> +</dt> <dd> +<p>Return 8-byte vectors in memory instead of MMX registers. This is the default on VxWorks to match the ABI of the Sun Studio compilers until version 12. <em class="emph">Only</em> use this option if you need to remain compatible with existing code produced by those previous compiler versions or older versions of GCC. </p> </dd> <dt> + <span><code class="code">-mpc32</code><a class="copiable-link" href="#index-mpc32"> ¶</a></span> +</dt> <dt><code class="code">-mpc64</code></dt> <dt><code class="code">-mpc80</code></dt> <dd> <p>Set 80387 floating-point precision to 32, 64 or 80 bits. When <samp class="option">-mpc32</samp> is specified, the significands of results of floating-point operations are rounded to 24 bits (single precision); <samp class="option">-mpc64</samp> rounds the significands of results of floating-point operations to 53 bits (double precision) and <samp class="option">-mpc80</samp> rounds the significands of results of floating-point operations to 64 bits (extended double precision), which is the default. When this option is used, floating-point operations in higher precisions are not available to the programmer without setting the FPU control word explicitly. </p> <p>Setting the rounding of floating-point operations to less than the default 80 bits can speed some programs by 2% or more. Note that some mathematical libraries assume that extended-precision (80-bit) floating-point operations are enabled by default; routines in such libraries could suffer significant loss of accuracy, typically through so-called “catastrophic cancellation”, when this option is used to set the precision to less than extended precision. </p> </dd> <dt> +<span><code class="code">-mdaz-ftz</code><a class="copiable-link" href="#index-mdaz-ftz"> ¶</a></span> +</dt> <dd> <p>The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register are used to control floating-point calculations.SSE and AVX instructions including scalar and vector instructions could benefit from enabling the FTZ and DAZ flags when <samp class="option">-mdaz-ftz</samp> is specified. Don’t set FTZ/DAZ flags when <samp class="option">-mno-daz-ftz</samp> or <samp class="option">-shared</samp> is specified, <samp class="option">-mdaz-ftz</samp> will set FTZ/DAZ flags even with <samp class="option">-shared</samp>. </p> </dd> <dt> +<span><code class="code">-mstackrealign</code><a class="copiable-link" href="#index-mstackrealign"> ¶</a></span> +</dt> <dd> +<p>Realign the stack at entry. On the x86, the <samp class="option">-mstackrealign</samp> option generates an alternate prologue and epilogue that realigns the run-time stack if necessary. This supports mixing legacy codes that keep 4-byte stack alignment with modern codes that keep 16-byte stack alignment for SSE compatibility. See also the attribute <code class="code">force_align_arg_pointer</code>, applicable to individual functions. </p> </dd> <dt> +<span><code class="code">-mpreferred-stack-boundary=<var class="var">num</var></code><a class="copiable-link" href="#index-mpreferred-stack-boundary-1"> ¶</a></span> +</dt> <dd> +<p>Attempt to keep the stack boundary aligned to a 2 raised to <var class="var">num</var> byte boundary. If <samp class="option">-mpreferred-stack-boundary</samp> is not specified, the default is 4 (16 bytes or 128 bits). </p> <p><strong class="strong">Warning:</strong> When generating code for the x86-64 architecture with SSE extensions disabled, <samp class="option">-mpreferred-stack-boundary=3</samp> can be used to keep the stack boundary aligned to 8 byte boundary. Since x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and intended to be used in controlled environment where stack space is important limitation. This option leads to wrong code when functions compiled with 16 byte stack alignment (such as functions from a standard library) are called with misaligned stack. In this case, SSE instructions may lead to misaligned memory access traps. In addition, variable arguments are handled incorrectly for 16 byte aligned objects (including x87 long double and __int128), leading to wrong results. You must build all modules with <samp class="option">-mpreferred-stack-boundary=3</samp>, including any libraries. This includes the system libraries and startup modules. </p> </dd> <dt> +<span><code class="code">-mincoming-stack-boundary=<var class="var">num</var></code><a class="copiable-link" href="#index-mincoming-stack-boundary"> ¶</a></span> +</dt> <dd> +<p>Assume the incoming stack is aligned to a 2 raised to <var class="var">num</var> byte boundary. If <samp class="option">-mincoming-stack-boundary</samp> is not specified, the one specified by <samp class="option">-mpreferred-stack-boundary</samp> is used. </p> <p>On Pentium and Pentium Pro, <code class="code">double</code> and <code class="code">long double</code> values should be aligned to an 8-byte boundary (see <samp class="option">-malign-double</samp>) or suffer significant run time performance penalties. On Pentium III, the Streaming SIMD Extension (SSE) data type <code class="code">__m128</code> may not work properly if it is not 16-byte aligned. </p> <p>To ensure proper alignment of this values on the stack, the stack boundary must be as aligned as that required by any value stored on the stack. Further, every function must be generated such that it keeps the stack aligned. Thus calling a function compiled with a higher preferred stack boundary from a function compiled with a lower preferred stack boundary most likely misaligns the stack. It is recommended that libraries that use callbacks always use the default setting. </p> <p>This extra alignment does consume extra stack space, and generally increases code size. Code that is sensitive to stack space usage, such as embedded systems and operating system kernels, may want to reduce the preferred alignment to <samp class="option">-mpreferred-stack-boundary=2</samp>. </p> </dd> <dt> +<span><code class="code">-mmmx</code><a class="copiable-link" href="#index-mmmx"> ¶</a></span> +</dt> <dt><code class="code">-msse</code></dt> <dt><code class="code">-msse2</code></dt> <dt><code class="code">-msse3</code></dt> <dt><code class="code">-mssse3</code></dt> <dt><code class="code">-msse4</code></dt> <dt><code class="code">-msse4a</code></dt> <dt><code class="code">-msse4.1</code></dt> <dt><code class="code">-msse4.2</code></dt> <dt><code class="code">-mavx</code></dt> <dt><code class="code">-mavx2</code></dt> <dt><code class="code">-mavx512f</code></dt> <dt><code class="code">-mavx512pf</code></dt> <dt><code class="code">-mavx512er</code></dt> <dt><code class="code">-mavx512cd</code></dt> <dt><code class="code">-mavx512vl</code></dt> <dt><code class="code">-mavx512bw</code></dt> <dt><code class="code">-mavx512dq</code></dt> <dt><code class="code">-mavx512ifma</code></dt> <dt><code class="code">-mavx512vbmi</code></dt> <dt><code class="code">-msha</code></dt> <dt><code class="code">-maes</code></dt> <dt><code class="code">-mpclmul</code></dt> <dt><code class="code">-mclflushopt</code></dt> <dt><code class="code">-mclwb</code></dt> <dt><code class="code">-mfsgsbase</code></dt> <dt><code class="code">-mptwrite</code></dt> <dt><code class="code">-mrdrnd</code></dt> <dt><code class="code">-mf16c</code></dt> <dt><code class="code">-mfma</code></dt> <dt><code class="code">-mpconfig</code></dt> <dt><code class="code">-mwbnoinvd</code></dt> <dt><code class="code">-mfma4</code></dt> <dt><code class="code">-mprfchw</code></dt> <dt><code class="code">-mrdpid</code></dt> <dt><code class="code">-mprefetchwt1</code></dt> <dt><code class="code">-mrdseed</code></dt> <dt><code class="code">-msgx</code></dt> <dt><code class="code">-mxop</code></dt> <dt><code class="code">-mlwp</code></dt> <dt><code class="code">-m3dnow</code></dt> <dt><code class="code">-m3dnowa</code></dt> <dt><code class="code">-mpopcnt</code></dt> <dt><code class="code">-mabm</code></dt> <dt><code class="code">-madx</code></dt> <dt><code class="code">-mbmi</code></dt> <dt><code class="code">-mbmi2</code></dt> <dt><code class="code">-mlzcnt</code></dt> <dt><code class="code">-mfxsr</code></dt> <dt><code class="code">-mxsave</code></dt> <dt><code class="code">-mxsaveopt</code></dt> <dt><code class="code">-mxsavec</code></dt> <dt><code class="code">-mxsaves</code></dt> <dt><code class="code">-mrtm</code></dt> <dt><code class="code">-mhle</code></dt> <dt><code class="code">-mtbm</code></dt> <dt><code class="code">-mmwaitx</code></dt> <dt><code class="code">-mclzero</code></dt> <dt><code class="code">-mpku</code></dt> <dt><code class="code">-mavx512vbmi2</code></dt> <dt><code class="code">-mavx512bf16</code></dt> <dt><code class="code">-mavx512fp16</code></dt> <dt><code class="code">-mgfni</code></dt> <dt><code class="code">-mvaes</code></dt> <dt><code class="code">-mwaitpkg</code></dt> <dt><code class="code">-mvpclmulqdq</code></dt> <dt><code class="code">-mavx512bitalg</code></dt> <dt><code class="code">-mmovdiri</code></dt> <dt><code class="code">-mmovdir64b</code></dt> <dt><code class="code">-menqcmd</code></dt> <dt><code class="code">-muintr</code></dt> <dt><code class="code">-mtsxldtrk</code></dt> <dt><code class="code">-mavx512vpopcntdq</code></dt> <dt><code class="code">-mavx512vp2intersect</code></dt> <dt><code class="code">-mavx5124fmaps</code></dt> <dt><code class="code">-mavx512vnni</code></dt> <dt><code class="code">-mavxvnni</code></dt> <dt><code class="code">-mavx5124vnniw</code></dt> <dt><code class="code">-mcldemote</code></dt> <dt><code class="code">-mserialize</code></dt> <dt><code class="code">-mamx-tile</code></dt> <dt><code class="code">-mamx-int8</code></dt> <dt><code class="code">-mamx-bf16</code></dt> <dt><code class="code">-mhreset</code></dt> <dt><code class="code">-mkl</code></dt> <dt><code class="code">-mwidekl</code></dt> <dt><code class="code">-mavxifma</code></dt> <dt><code class="code">-mavxvnniint8</code></dt> <dt><code class="code">-mavxneconvert</code></dt> <dt><code class="code">-mcmpccxadd</code></dt> <dt><code class="code">-mamx-fp16</code></dt> <dt><code class="code">-mprefetchi</code></dt> <dt><code class="code">-mraoint</code></dt> <dt><code class="code">-mamx-complex</code></dt> <dd> +<p>These switches enable the use of instructions in the MMX, SSE, SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!, enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE, XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT, AMX-COMPLEX or CLDEMOTE extended instruction sets. Each has a corresponding <samp class="option">-mno-</samp> option to disable use of these instructions. </p> <p>These extensions are also available as built-in functions: see <a class="ref" href="x86-built-in-functions">x86 Built-in Functions</a>, for details of the functions enabled and disabled by these switches. </p> <p>To generate SSE/SSE2 instructions automatically from floating-point code (as opposed to 387 instructions), see <samp class="option">-mfpmath=sse</samp>. </p> <p>GCC depresses SSEx instructions when <samp class="option">-mavx</samp> is used. Instead, it generates new AVX instructions or AVX equivalence for all SSEx instructions when needed. </p> <p>These options enable GCC to use these extended instructions in generated code, even without <samp class="option">-mfpmath=sse</samp>. Applications that perform run-time CPU detection must compile separate files for each supported architecture, using the appropriate flags. In particular, the file containing the CPU detection code should be compiled without these options. </p> </dd> <dt> +<span><code class="code">-mdump-tune-features</code><a class="copiable-link" href="#index-mdump-tune-features"> ¶</a></span> +</dt> <dd> +<p>This option instructs GCC to dump the names of the x86 performance tuning features and default settings. The names can be used in <samp class="option">-mtune-ctrl=<var class="var">feature-list</var></samp>. </p> </dd> <dt> +<span><code class="code">-mtune-ctrl=<var class="var">feature-list</var></code><a class="copiable-link" href="#index-mtune-ctrl_003dfeature-list"> ¶</a></span> +</dt> <dd> +<p>This option is used to do fine grain control of x86 code generation features. <var class="var">feature-list</var> is a comma separated list of <var class="var">feature</var> names. See also <samp class="option">-mdump-tune-features</samp>. When specified, the <var class="var">feature</var> is turned on if it is not preceded with ‘<samp class="samp">^</samp>’, otherwise, it is turned off. <samp class="option">-mtune-ctrl=<var class="var">feature-list</var></samp> is intended to be used by GCC developers. Using it may lead to code paths not covered by testing and can potentially result in compiler ICEs or runtime errors. </p> </dd> <dt> +<span><code class="code">-mno-default</code><a class="copiable-link" href="#index-mno-default"> ¶</a></span> +</dt> <dd> +<p>This option instructs GCC to turn off all tunable features. See also <samp class="option">-mtune-ctrl=<var class="var">feature-list</var></samp> and <samp class="option">-mdump-tune-features</samp>. </p> </dd> <dt> +<span><code class="code">-mcld</code><a class="copiable-link" href="#index-mcld"> ¶</a></span> +</dt> <dd> +<p>This option instructs GCC to emit a <code class="code">cld</code> instruction in the prologue of functions that use string instructions. String instructions depend on the DF flag to select between autoincrement or autodecrement mode. While the ABI specifies the DF flag to be cleared on function entry, some operating systems violate this specification by not clearing the DF flag in their exception dispatchers. The exception handler can be invoked with the DF flag set, which leads to wrong direction mode when string instructions are used. This option can be enabled by default on 32-bit x86 targets by configuring GCC with the <samp class="option">--enable-cld</samp> configure option. Generation of <code class="code">cld</code> instructions can be suppressed with the <samp class="option">-mno-cld</samp> compiler option in this case. </p> </dd> <dt> +<span><code class="code">-mvzeroupper</code><a class="copiable-link" href="#index-mvzeroupper"> ¶</a></span> +</dt> <dd> +<p>This option instructs GCC to emit a <code class="code">vzeroupper</code> instruction before a transfer of control flow out of the function to minimize the AVX to SSE transition penalty as well as remove unnecessary <code class="code">zeroupper</code> intrinsics. </p> </dd> <dt> +<span><code class="code">-mprefer-avx128</code><a class="copiable-link" href="#index-mprefer-avx128"> ¶</a></span> +</dt> <dd> +<p>This option instructs GCC to use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer. </p> </dd> <dt> +<span><code class="code">-mprefer-vector-width=<var class="var">opt</var></code><a class="copiable-link" href="#index-mprefer-vector-width"> ¶</a></span> +</dt> <dd> +<p>This option instructs GCC to use <var class="var">opt</var>-bit vector width in instructions instead of default on the selected platform. </p> </dd> <dt> +<span><code class="code">-mmove-max=<var class="var">bits</var></code><a class="copiable-link" href="#index-mmove-max"> ¶</a></span> +</dt> <dd> +<p>This option instructs GCC to set the maximum number of bits can be moved from memory to memory efficiently to <var class="var">bits</var>. The valid <var class="var">bits</var> are 128, 256 and 512. </p> </dd> <dt> +<span><code class="code">-mstore-max=<var class="var">bits</var></code><a class="copiable-link" href="#index-mstore-max"> ¶</a></span> +</dt> <dd> +<p>This option instructs GCC to set the maximum number of bits can be stored to memory efficiently to <var class="var">bits</var>. The valid <var class="var">bits</var> are 128, 256 and 512. </p> <dl class="table"> <dt>‘<samp class="samp">none</samp>’</dt> <dd> +<p>No extra limitations applied to GCC other than defined by the selected platform. </p> </dd> <dt>‘<samp class="samp">128</samp>’</dt> <dd> +<p>Prefer 128-bit vector width for instructions. </p> </dd> <dt>‘<samp class="samp">256</samp>’</dt> <dd> +<p>Prefer 256-bit vector width for instructions. </p> </dd> <dt>‘<samp class="samp">512</samp>’</dt> <dd><p>Prefer 512-bit vector width for instructions. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mcx16</code><a class="copiable-link" href="#index-mcx16"> ¶</a></span> +</dt> <dd> +<p>This option enables GCC to generate <code class="code">CMPXCHG16B</code> instructions in 64-bit code to implement compare-and-exchange operations on 16-byte aligned 128-bit objects. This is useful for atomic updates of data structures exceeding one machine word in size. The compiler uses this instruction to implement <a class="ref" href="_005f_005fsync-builtins">Legacy <code class="code">__sync</code> Built-in Functions for Atomic Memory Access</a>. However, for <a class="ref" href="_005f_005fatomic-builtins">Built-in Functions for Memory Model Aware Atomic Operations</a> operating on 128-bit integers, a library call is always used. </p> </dd> <dt> +<span><code class="code">-msahf</code><a class="copiable-link" href="#index-msahf"> ¶</a></span> +</dt> <dd> +<p>This option enables generation of <code class="code">SAHF</code> instructions in 64-bit code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to the introduction of Pentium 4 G1 step in December 2005, lacked the <code class="code">LAHF</code> and <code class="code">SAHF</code> instructions which are supported by AMD64. These are load and store instructions, respectively, for certain status flags. In 64-bit mode, the <code class="code">SAHF</code> instruction is used to optimize <code class="code">fmod</code>, <code class="code">drem</code>, and <code class="code">remainder</code> built-in functions; see <a class="ref" href="other-builtins">Other Built-in Functions Provided by GCC</a> for details. </p> </dd> <dt> +<span><code class="code">-mmovbe</code><a class="copiable-link" href="#index-mmovbe"> ¶</a></span> +</dt> <dd> +<p>This option enables use of the <code class="code">movbe</code> instruction to implement <code class="code">__builtin_bswap32</code> and <code class="code">__builtin_bswap64</code>. </p> </dd> <dt> +<span><code class="code">-mshstk</code><a class="copiable-link" href="#index-mshstk"> ¶</a></span> +</dt> <dd> +<p>The <samp class="option">-mshstk</samp> option enables shadow stack built-in functions from x86 Control-flow Enforcement Technology (CET). </p> </dd> <dt> +<span><code class="code">-mcrc32</code><a class="copiable-link" href="#index-mcrc32"> ¶</a></span> +</dt> <dd> +<p>This option enables built-in functions <code class="code">__builtin_ia32_crc32qi</code>, <code class="code">__builtin_ia32_crc32hi</code>, <code class="code">__builtin_ia32_crc32si</code> and <code class="code">__builtin_ia32_crc32di</code> to generate the <code class="code">crc32</code> machine instruction. </p> </dd> <dt> +<span><code class="code">-mmwait</code><a class="copiable-link" href="#index-mmwait"> ¶</a></span> +</dt> <dd> +<p>This option enables built-in functions <code class="code">__builtin_ia32_monitor</code>, and <code class="code">__builtin_ia32_mwait</code> to generate the <code class="code">monitor</code> and <code class="code">mwait</code> machine instructions. </p> </dd> <dt> +<span><code class="code">-mrecip</code><a class="copiable-link" href="#index-mrecip-1"> ¶</a></span> +</dt> <dd> +<p>This option enables use of <code class="code">RCPSS</code> and <code class="code">RSQRTSS</code> instructions (and their vectorized variants <code class="code">RCPPS</code> and <code class="code">RSQRTPS</code>) with an additional Newton-Raphson step to increase precision instead of <code class="code">DIVSS</code> and <code class="code">SQRTSS</code> (and their vectorized variants) for single-precision floating-point arguments. These instructions are generated only when <samp class="option">-funsafe-math-optimizations</samp> is enabled together with <samp class="option">-ffinite-math-only</samp> and <samp class="option">-fno-trapping-math</samp>. Note that while the throughput of the sequence is higher than the throughput of the non-reciprocal instruction, the precision of the sequence can be decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994). </p> <p>Note that GCC implements <code class="code">1.0f/sqrtf(<var class="var">x</var>)</code> in terms of <code class="code">RSQRTSS</code> (or <code class="code">RSQRTPS</code>) already with <samp class="option">-ffast-math</samp> (or the above option combination), and doesn’t need <samp class="option">-mrecip</samp>. </p> <p>Also note that GCC emits the above sequence with additional Newton-Raphson step for vectorized single-float division and vectorized <code class="code">sqrtf(<var class="var">x</var>)</code> already with <samp class="option">-ffast-math</samp> (or the above option combination), and doesn’t need <samp class="option">-mrecip</samp>. </p> </dd> <dt> +<span><code class="code">-mrecip=<var class="var">opt</var></code><a class="copiable-link" href="#index-mrecip_003dopt-1"> ¶</a></span> +</dt> <dd> +<p>This option controls which reciprocal estimate instructions may be used. <var class="var">opt</var> is a comma-separated list of options, which may be preceded by a ‘<samp class="samp">!</samp>’ to invert the option: </p> <dl class="table"> <dt>‘<samp class="samp">all</samp>’</dt> <dd> +<p>Enable all estimate instructions. </p> </dd> <dt>‘<samp class="samp">default</samp>’</dt> <dd> +<p>Enable the default instructions, equivalent to <samp class="option">-mrecip</samp>. </p> </dd> <dt>‘<samp class="samp">none</samp>’</dt> <dd> +<p>Disable all estimate instructions, equivalent to <samp class="option">-mno-recip</samp>. </p> </dd> <dt>‘<samp class="samp">div</samp>’</dt> <dd> +<p>Enable the approximation for scalar division. </p> </dd> <dt>‘<samp class="samp">vec-div</samp>’</dt> <dd> +<p>Enable the approximation for vectorized division. </p> </dd> <dt>‘<samp class="samp">sqrt</samp>’</dt> <dd> +<p>Enable the approximation for scalar square root. </p> </dd> <dt>‘<samp class="samp">vec-sqrt</samp>’</dt> <dd><p>Enable the approximation for vectorized square root. </p></dd> </dl> <p>So, for example, <samp class="option">-mrecip=all,!sqrt</samp> enables all of the reciprocal approximations, except for square root. </p> </dd> <dt> +<span><code class="code">-mveclibabi=<var class="var">type</var></code><a class="copiable-link" href="#index-mveclibabi-1"> ¶</a></span> +</dt> <dd> +<p>Specifies the ABI type to use for vectorizing intrinsics using an external library. Supported values for <var class="var">type</var> are ‘<samp class="samp">svml</samp>’ for the Intel short vector math library and ‘<samp class="samp">acml</samp>’ for the AMD math core library. To use this option, both <samp class="option">-ftree-vectorize</samp> and <samp class="option">-funsafe-math-optimizations</samp> have to be enabled, and an SVML or ACML ABI-compatible library must be specified at link time. </p> <p>GCC currently emits calls to <code class="code">vmldExp2</code>, <code class="code">vmldLn2</code>, <code class="code">vmldLog102</code>, <code class="code">vmldPow2</code>, <code class="code">vmldTanh2</code>, <code class="code">vmldTan2</code>, <code class="code">vmldAtan2</code>, <code class="code">vmldAtanh2</code>, <code class="code">vmldCbrt2</code>, <code class="code">vmldSinh2</code>, <code class="code">vmldSin2</code>, <code class="code">vmldAsinh2</code>, <code class="code">vmldAsin2</code>, <code class="code">vmldCosh2</code>, <code class="code">vmldCos2</code>, <code class="code">vmldAcosh2</code>, <code class="code">vmldAcos2</code>, <code class="code">vmlsExp4</code>, <code class="code">vmlsLn4</code>, <code class="code">vmlsLog104</code>, <code class="code">vmlsPow4</code>, <code class="code">vmlsTanh4</code>, <code class="code">vmlsTan4</code>, <code class="code">vmlsAtan4</code>, <code class="code">vmlsAtanh4</code>, <code class="code">vmlsCbrt4</code>, <code class="code">vmlsSinh4</code>, <code class="code">vmlsSin4</code>, <code class="code">vmlsAsinh4</code>, <code class="code">vmlsAsin4</code>, <code class="code">vmlsCosh4</code>, <code class="code">vmlsCos4</code>, <code class="code">vmlsAcosh4</code> and <code class="code">vmlsAcos4</code> for corresponding function type when <samp class="option">-mveclibabi=svml</samp> is used, and <code class="code">__vrd2_sin</code>, <code class="code">__vrd2_cos</code>, <code class="code">__vrd2_exp</code>, <code class="code">__vrd2_log</code>, <code class="code">__vrd2_log2</code>, <code class="code">__vrd2_log10</code>, <code class="code">__vrs4_sinf</code>, <code class="code">__vrs4_cosf</code>, <code class="code">__vrs4_expf</code>, <code class="code">__vrs4_logf</code>, <code class="code">__vrs4_log2f</code>, <code class="code">__vrs4_log10f</code> and <code class="code">__vrs4_powf</code> for the corresponding function type when <samp class="option">-mveclibabi=acml</samp> is used. </p> </dd> <dt> +<span><code class="code">-mabi=<var class="var">name</var></code><a class="copiable-link" href="#index-mabi-6"> ¶</a></span> +</dt> <dd> +<p>Generate code for the specified calling convention. Permissible values are ‘<samp class="samp">sysv</samp>’ for the ABI used on GNU/Linux and other systems, and ‘<samp class="samp">ms</samp>’ for the Microsoft ABI. The default is to use the Microsoft ABI when targeting Microsoft Windows and the SysV ABI on all other systems. You can control this behavior for specific functions by using the function attributes <code class="code">ms_abi</code> and <code class="code">sysv_abi</code>. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> </dd> <dt> +<span><code class="code">-mforce-indirect-call</code><a class="copiable-link" href="#index-mforce-indirect-call"> ¶</a></span> +</dt> <dd> +<p>Force all calls to functions to be indirect. This is useful when using Intel Processor Trace where it generates more precise timing information for function calls. </p> </dd> <dt> +<span><code class="code">-mmanual-endbr</code><a class="copiable-link" href="#index-mmanual-endbr"> ¶</a></span> +</dt> <dd> +<p>Insert ENDBR instruction at function entry only via the <code class="code">cf_check</code> function attribute. This is useful when used with the option <samp class="option">-fcf-protection=branch</samp> to control ENDBR insertion at the function entry. </p> </dd> <dt> +<span><code class="code">-mcet-switch</code><a class="copiable-link" href="#index-mcet-switch"> ¶</a></span> +</dt> <dd> +<p>By default, CET instrumentation is turned off on switch statements that use a jump table and indirect branch track is disabled. Since jump tables are stored in read-only memory, this does not result in a direct loss of hardening. But if the jump table index is attacker-controlled, the indirect jump may not be constrained by CET. This option turns on CET instrumentation to enable indirect branch track for switch statements with jump tables which leads to the jump targets reachable via any indirect jumps. </p> </dd> <dt> + <span><code class="code">-mcall-ms2sysv-xlogues</code><a class="copiable-link" href="#index-mcall-ms2sysv-xlogues"> ¶</a></span> +</dt> <dd> +<p>Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By default, the code for saving and restoring these registers is emitted inline, resulting in fairly lengthy prologues and epilogues. Using <samp class="option">-mcall-ms2sysv-xlogues</samp> emits prologues and epilogues that use stubs in the static portion of libgcc to perform these saves and restores, thus reducing function size at the cost of a few extra instructions. </p> </dd> <dt> +<span><code class="code">-mtls-dialect=<var class="var">type</var></code><a class="copiable-link" href="#index-mtls-dialect-1"> ¶</a></span> +</dt> <dd> +<p>Generate code to access thread-local storage using the ‘<samp class="samp">gnu</samp>’ or ‘<samp class="samp">gnu2</samp>’ conventions. ‘<samp class="samp">gnu</samp>’ is the conservative default; ‘<samp class="samp">gnu2</samp>’ is more efficient, but it may add compile- and run-time requirements that cannot be satisfied on all systems. </p> </dd> <dt> + <span><code class="code">-mpush-args</code><a class="copiable-link" href="#index-mpush-args"> ¶</a></span> +</dt> <dt><code class="code">-mno-push-args</code></dt> <dd> +<p>Use PUSH operations to store outgoing parameters. This method is shorter and usually equally fast as method using SUB/MOV operations and is enabled by default. In some cases disabling it may improve performance because of improved scheduling and reduced dependencies. </p> </dd> <dt> +<span><code class="code">-maccumulate-outgoing-args</code><a class="copiable-link" href="#index-maccumulate-outgoing-args-1"> ¶</a></span> +</dt> <dd> +<p>If enabled, the maximum amount of space required for outgoing arguments is computed in the function prologue. This is faster on most modern CPUs because of reduced dependencies, improved scheduling and reduced stack usage when the preferred stack boundary is not equal to 2. The drawback is a notable increase in code size. This switch implies <samp class="option">-mno-push-args</samp>. </p> </dd> <dt> +<span><code class="code">-mthreads</code><a class="copiable-link" href="#index-mthreads"> ¶</a></span> +</dt> <dd> +<p>Support thread-safe exception handling on MinGW. Programs that rely on thread-safe exception handling must compile and link all code with the <samp class="option">-mthreads</samp> option. When compiling, <samp class="option">-mthreads</samp> defines <samp class="option">-D_MT</samp>; when linking, it links in a special thread helper library <samp class="option">-lmingwthrd</samp> which cleans up per-thread exception-handling data. </p> </dd> <dt> + <span><code class="code">-mms-bitfields</code><a class="copiable-link" href="#index-mms-bitfields"> ¶</a></span> +</dt> <dt><code class="code">-mno-ms-bitfields</code></dt> <dd> <p>Enable/disable bit-field layout compatible with the native Microsoft Windows compiler. </p> <p>If <code class="code">packed</code> is used on a structure, or if bit-fields are used, it may be that the Microsoft ABI lays out the structure differently than the way GCC normally does. Particularly when moving packed data between functions compiled with GCC and the native Microsoft compiler (either via function call or as data in a file), it may be necessary to access either format. </p> <p>This option is enabled by default for Microsoft Windows targets. This behavior can also be controlled locally by use of variable or type attributes. For more information, see <a class="ref" href="variable-attributes">x86 Variable Attributes</a> and <a class="ref" href="type-attributes">x86 Type Attributes</a>. </p> <p>The Microsoft structure layout algorithm is fairly simple with the exception of the bit-field packing. The padding and alignment of members of structures and whether a bit-field can straddle a storage-unit boundary are determine by these rules: </p> <ol class="enumerate"> <li> Structure members are stored sequentially in the order in which they are declared: the first member has the lowest memory address and the last member the highest. </li> +<li> Every data object has an alignment requirement. The alignment requirement for all data except structures, unions, and arrays is either the size of the object or the current packing size (specified with either the <code class="code">aligned</code> attribute or the <code class="code">pack</code> pragma), whichever is less. For structures, unions, and arrays, the alignment requirement is the largest alignment requirement of its members. Every object is allocated an offset so that: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">offset % alignment_requirement == 0</pre> +</div> </li> +<li> Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation unit if the integral types are the same size and if the next bit-field fits into the current allocation unit without crossing the boundary imposed by the common alignment requirements of the bit-fields. </li> +</ol> <p>MSVC interprets zero-length bit-fields in the following ways: </p> <ol class="enumerate"> <li> If a zero-length bit-field is inserted between two bit-fields that are normally coalesced, the bit-fields are not coalesced. <p>For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct + { + unsigned long bf_1 : 12; + unsigned long : 0; + unsigned long bf_2 : 12; + } t1;</pre> +</div> <p>The size of <code class="code">t1</code> is 8 bytes with the zero-length bit-field. If the zero-length bit-field were removed, <code class="code">t1</code>’s size would be 4 bytes. </p> </li> +<li> If a zero-length bit-field is inserted after a bit-field, <code class="code">foo</code>, and the alignment of the zero-length bit-field is greater than the member that follows it, <code class="code">bar</code>, <code class="code">bar</code> is aligned as the type of the zero-length bit-field. <p>For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct + { + char foo : 4; + short : 0; + char bar; + } t2; + +struct + { + char foo : 4; + short : 0; + double bar; + } t3;</pre> +</div> <p>For <code class="code">t2</code>, <code class="code">bar</code> is placed at offset 2, rather than offset 1. Accordingly, the size of <code class="code">t2</code> is 4. For <code class="code">t3</code>, the zero-length bit-field does not affect the alignment of <code class="code">bar</code> or, as a result, the size of the structure. </p> <p>Taking this into account, it is important to note the following: </p> <ol class="enumerate"> <li> If a zero-length bit-field follows a normal bit-field, the type of the zero-length bit-field may affect the alignment of the structure as whole. For example, <code class="code">t2</code> has a size of 4 bytes, since the zero-length bit-field follows a normal bit-field, and is of type short. </li> +<li> Even if a zero-length bit-field is not followed by a normal bit-field, it may still affect the alignment of the structure: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct + { + char foo : 6; + long : 0; + } t4;</pre> +</div> <p>Here, <code class="code">t4</code> takes up 4 bytes. </p> +</li> +</ol> </li> +<li> Zero-length bit-fields following non-bit-field members are ignored: <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct + { + char foo; + long : 0; + char bar; + } t5;</pre> +</div> <p>Here, <code class="code">t5</code> takes up 2 bytes. </p> +</li> +</ol> </dd> <dt> + <span><code class="code">-mno-align-stringops</code><a class="copiable-link" href="#index-mno-align-stringops"> ¶</a></span> +</dt> <dd> +<p>Do not align the destination of inlined string operations. This switch reduces code size and improves performance in case the destination is already aligned, but GCC doesn’t know about it. </p> </dd> <dt> +<span><code class="code">-minline-all-stringops</code><a class="copiable-link" href="#index-minline-all-stringops"> ¶</a></span> +</dt> <dd> +<p>By default GCC inlines string operations only when the destination is known to be aligned to least a 4-byte boundary. This enables more inlining and increases code size, but may improve performance of code that depends on fast <code class="code">memcpy</code> and <code class="code">memset</code> for short lengths. The option enables inline expansion of <code class="code">strlen</code> for all pointer alignments. </p> </dd> <dt> +<span><code class="code">-minline-stringops-dynamically</code><a class="copiable-link" href="#index-minline-stringops-dynamically"> ¶</a></span> +</dt> <dd> +<p>For string operations of unknown size, use run-time checks with inline code for small blocks and a library call for large blocks. </p> </dd> <dt> +<span><code class="code">-mstringop-strategy=<var class="var">alg</var></code><a class="copiable-link" href="#index-mstringop-strategy_003dalg"> ¶</a></span> +</dt> <dd> +<p>Override the internal decision heuristic for the particular algorithm to use for inlining string operations. The allowed values for <var class="var">alg</var> are: </p> <dl class="table"> <dt>‘<samp class="samp">rep_byte</samp>’</dt> <dt>‘<samp class="samp">rep_4byte</samp>’</dt> <dt>‘<samp class="samp">rep_8byte</samp>’</dt> <dd> +<p>Expand using i386 <code class="code">rep</code> prefix of the specified size. </p> </dd> <dt>‘<samp class="samp">byte_loop</samp>’</dt> <dt>‘<samp class="samp">loop</samp>’</dt> <dt>‘<samp class="samp">unrolled_loop</samp>’</dt> <dd> +<p>Expand into an inline loop. </p> </dd> <dt>‘<samp class="samp">libcall</samp>’</dt> <dd><p>Always use a library call. </p></dd> </dl> </dd> <dt> +<span><code class="code">-mmemcpy-strategy=<var class="var">strategy</var></code><a class="copiable-link" href="#index-mmemcpy-strategy_003dstrategy"> ¶</a></span> +</dt> <dd> +<p>Override the internal decision heuristic to decide if <code class="code">__builtin_memcpy</code> should be inlined and what inline algorithm to use when the expected size of the copy operation is known. <var class="var">strategy</var> is a comma-separated list of <var class="var">alg</var>:<var class="var">max_size</var>:<var class="var">dest_align</var> triplets. <var class="var">alg</var> is specified in <samp class="option">-mstringop-strategy</samp>, <var class="var">max_size</var> specifies the max byte size with which inline algorithm <var class="var">alg</var> is allowed. For the last triplet, the <var class="var">max_size</var> must be <code class="code">-1</code>. The <var class="var">max_size</var> of the triplets in the list must be specified in increasing order. The minimal byte size for <var class="var">alg</var> is <code class="code">0</code> for the first triplet and <code class="code"><var class="var">max_size</var> + 1</code> of the preceding range. </p> </dd> <dt> +<span><code class="code">-mmemset-strategy=<var class="var">strategy</var></code><a class="copiable-link" href="#index-mmemset-strategy_003dstrategy"> ¶</a></span> +</dt> <dd> +<p>The option is similar to <samp class="option">-mmemcpy-strategy=</samp> except that it is to control <code class="code">__builtin_memset</code> expansion. </p> </dd> <dt> +<span><code class="code">-momit-leaf-frame-pointer</code><a class="copiable-link" href="#index-momit-leaf-frame-pointer-2"> ¶</a></span> +</dt> <dd> +<p>Don’t keep the frame pointer in a register for leaf functions. This avoids the instructions to save, set up, and restore frame pointers and makes an extra register available in leaf functions. The option <samp class="option">-fomit-leaf-frame-pointer</samp> removes the frame pointer for leaf functions, which might make debugging harder. </p> </dd> <dt> +<span><code class="code">-mtls-direct-seg-refs</code><a class="copiable-link" href="#index-mtls-direct-seg-refs"> ¶</a></span> +</dt> <dt><code class="code">-mno-tls-direct-seg-refs</code></dt> <dd> +<p>Controls whether TLS variables may be accessed with offsets from the TLS segment register (<code class="code">%gs</code> for 32-bit, <code class="code">%fs</code> for 64-bit), or whether the thread base pointer must be added. Whether or not this is valid depends on the operating system, and whether it maps the segment to cover the entire TLS area. </p> <p>For systems that use the GNU C Library, the default is on. </p> </dd> <dt> +<span><code class="code">-msse2avx</code><a class="copiable-link" href="#index-msse2avx"> ¶</a></span> +</dt> <dt><code class="code">-mno-sse2avx</code></dt> <dd> +<p>Specify that the assembler should encode SSE instructions with VEX prefix. The option <samp class="option">-mavx</samp> turns this on by default. </p> </dd> <dt> +<span><code class="code">-mfentry</code><a class="copiable-link" href="#index-mfentry"> ¶</a></span> +</dt> <dt><code class="code">-mno-fentry</code></dt> <dd> +<p>If profiling is active (<samp class="option">-pg</samp>), put the profiling counter call before the prologue. Note: On x86 architectures the attribute <code class="code">ms_hook_prologue</code> isn’t possible at the moment for <samp class="option">-mfentry</samp> and <samp class="option">-pg</samp>. </p> </dd> <dt> +<span><code class="code">-mrecord-mcount</code><a class="copiable-link" href="#index-mrecord-mcount"> ¶</a></span> +</dt> <dt><code class="code">-mno-record-mcount</code></dt> <dd> +<p>If profiling is active (<samp class="option">-pg</samp>), generate a __mcount_loc section that contains pointers to each profiling call. This is useful for automatically patching and out calls. </p> </dd> <dt> +<span><code class="code">-mnop-mcount</code><a class="copiable-link" href="#index-mnop-mcount"> ¶</a></span> +</dt> <dt><code class="code">-mno-nop-mcount</code></dt> <dd> +<p>If profiling is active (<samp class="option">-pg</samp>), generate the calls to the profiling functions as NOPs. This is useful when they should be patched in later dynamically. This is likely only useful together with <samp class="option">-mrecord-mcount</samp>. </p> </dd> <dt> +<span><code class="code">-minstrument-return=<var class="var">type</var></code><a class="copiable-link" href="#index-minstrument-return"> ¶</a></span> +</dt> <dd> +<p>Instrument function exit in -pg -mfentry instrumented functions with call to specified function. This only instruments true returns ending with ret, but not sibling calls ending with jump. Valid types are <var class="var">none</var> to not instrument, <var class="var">call</var> to generate a call to __return__, or <var class="var">nop5</var> to generate a 5 byte nop. </p> </dd> <dt> +<span><code class="code">-mrecord-return</code><a class="copiable-link" href="#index-mrecord-return"> ¶</a></span> +</dt> <dt><code class="code">-mno-record-return</code></dt> <dd> +<p>Generate a __return_loc section pointing to all return instrumentation code. </p> </dd> <dt> +<span><code class="code">-mfentry-name=<var class="var">name</var></code><a class="copiable-link" href="#index-mfentry-name"> ¶</a></span> +</dt> <dd> +<p>Set name of __fentry__ symbol called at function entry for -pg -mfentry functions. </p> </dd> <dt> +<span><code class="code">-mfentry-section=<var class="var">name</var></code><a class="copiable-link" href="#index-mfentry-section"> ¶</a></span> +</dt> <dd> +<p>Set name of section to record -mrecord-mcount calls (default __mcount_loc). </p> </dd> <dt> +<span><code class="code">-mskip-rax-setup</code><a class="copiable-link" href="#index-mskip-rax-setup"> ¶</a></span> +</dt> <dt><code class="code">-mno-skip-rax-setup</code></dt> <dd> +<p>When generating code for the x86-64 architecture with SSE extensions disabled, <samp class="option">-mskip-rax-setup</samp> can be used to skip setting up RAX register when there are no variable arguments passed in vector registers. </p> <p><strong class="strong">Warning:</strong> Since RAX register is used to avoid unnecessarily saving vector registers on stack when passing variable arguments, the impacts of this option are callees may waste some stack space, misbehave or jump to a random location. GCC 4.4 or newer don’t have those issues, regardless the RAX register value. </p> </dd> <dt> +<span><code class="code">-m8bit-idiv</code><a class="copiable-link" href="#index-m8bit-idiv"> ¶</a></span> +</dt> <dt><code class="code">-mno-8bit-idiv</code></dt> <dd> +<p>On some processors, like Intel Atom, 8-bit unsigned integer divide is much faster than 32-bit/64-bit integer divide. This option generates a run-time check. If both dividend and divisor are within range of 0 to 255, 8-bit unsigned integer divide is used instead of 32-bit/64-bit integer divide. </p> </dd> <dt> + <span><code class="code">-mavx256-split-unaligned-load</code><a class="copiable-link" href="#index-mavx256-split-unaligned-load"> ¶</a></span> +</dt> <dt><code class="code">-mavx256-split-unaligned-store</code></dt> <dd> +<p>Split 32-byte AVX unaligned load and store. </p> </dd> <dt> + <span><code class="code">-mstack-protector-guard=<var class="var">guard</var></code><a class="copiable-link" href="#index-mstack-protector-guard-4"> ¶</a></span> +</dt> <dt><code class="code">-mstack-protector-guard-reg=<var class="var">reg</var></code></dt> <dt><code class="code">-mstack-protector-guard-offset=<var class="var">offset</var></code></dt> <dd> +<p>Generate stack protection code using canary at <var class="var">guard</var>. Supported locations are ‘<samp class="samp">global</samp>’ for global canary or ‘<samp class="samp">tls</samp>’ for per-thread canary in the TLS block (the default). This option has effect only when <samp class="option">-fstack-protector</samp> or <samp class="option">-fstack-protector-all</samp> is specified. </p> <p>With the latter choice the options <samp class="option">-mstack-protector-guard-reg=<var class="var">reg</var></samp> and <samp class="option">-mstack-protector-guard-offset=<var class="var">offset</var></samp> furthermore specify which segment register (<code class="code">%fs</code> or <code class="code">%gs</code>) to use as base register for reading the canary, and from what offset from that base register. The default for those is as specified in the relevant ABI. </p> </dd> <dt> +<span><code class="code">-mgeneral-regs-only</code><a class="copiable-link" href="#index-mgeneral-regs-only-2"> ¶</a></span> +</dt> <dd> +<p>Generate code that uses only the general-purpose registers. This prevents the compiler from using floating-point, vector, mask and bound registers. </p> </dd> <dt> +<span><code class="code">-mrelax-cmpxchg-loop</code><a class="copiable-link" href="#index-mrelax-cmpxchg-loop"> ¶</a></span> +</dt> <dd> +<p>When emitting a compare-and-swap loop for <a class="ref" href="_005f_005fsync-builtins">Legacy <code class="code">__sync</code> Built-in Functions for Atomic Memory Access</a> and <a class="ref" href="_005f_005fatomic-builtins">Built-in Functions for Memory Model Aware Atomic Operations</a> lacking a native instruction, optimize for the highly contended case by issuing an atomic load before the <code class="code">CMPXCHG</code> instruction, and using the <code class="code">PAUSE</code> instruction to save CPU power when restarting the loop. </p> </dd> <dt> +<span><code class="code">-mindirect-branch=<var class="var">choice</var></code><a class="copiable-link" href="#index-mindirect-branch"> ¶</a></span> +</dt> <dd> +<p>Convert indirect call and jump with <var class="var">choice</var>. The default is ‘<samp class="samp">keep</samp>’, which keeps indirect call and jump unmodified. ‘<samp class="samp">thunk</samp>’ converts indirect call and jump to call and return thunk. ‘<samp class="samp">thunk-inline</samp>’ converts indirect call and jump to inlined call and return thunk. ‘<samp class="samp">thunk-extern</samp>’ converts indirect call and jump to external call and return thunk provided in a separate object file. You can control this behavior for a specific function by using the function attribute <code class="code">indirect_branch</code>. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> <p>Note that <samp class="option">-mcmodel=large</samp> is incompatible with <samp class="option">-mindirect-branch=thunk</samp> and <samp class="option">-mindirect-branch=thunk-extern</samp> since the thunk function may not be reachable in the large code model. </p> <p>Note that <samp class="option">-mindirect-branch=thunk-extern</samp> is compatible with <samp class="option">-fcf-protection=branch</samp> since the external thunk can be made to enable control-flow check. </p> </dd> <dt> +<span><code class="code">-mfunction-return=<var class="var">choice</var></code><a class="copiable-link" href="#index-mfunction-return"> ¶</a></span> +</dt> <dd> +<p>Convert function return with <var class="var">choice</var>. The default is ‘<samp class="samp">keep</samp>’, which keeps function return unmodified. ‘<samp class="samp">thunk</samp>’ converts function return to call and return thunk. ‘<samp class="samp">thunk-inline</samp>’ converts function return to inlined call and return thunk. ‘<samp class="samp">thunk-extern</samp>’ converts function return to external call and return thunk provided in a separate object file. You can control this behavior for a specific function by using the function attribute <code class="code">function_return</code>. See <a class="xref" href="function-attributes">Declaring Attributes of Functions</a>. </p> <p>Note that <samp class="option">-mindirect-return=thunk-extern</samp> is compatible with <samp class="option">-fcf-protection=branch</samp> since the external thunk can be made to enable control-flow check. </p> <p>Note that <samp class="option">-mcmodel=large</samp> is incompatible with <samp class="option">-mfunction-return=thunk</samp> and <samp class="option">-mfunction-return=thunk-extern</samp> since the thunk function may not be reachable in the large code model. </p> </dd> <dt> +<span><code class="code">-mindirect-branch-register</code><a class="copiable-link" href="#index-mindirect-branch-register"> ¶</a></span> +</dt> <dd> +<p>Force indirect call and jump via register. </p> </dd> <dt> +<span><code class="code">-mharden-sls=<var class="var">choice</var></code><a class="copiable-link" href="#index-mharden-sls-1"> ¶</a></span> +</dt> <dd> +<p>Generate code to mitigate against straight line speculation (SLS) with <var class="var">choice</var>. The default is ‘<samp class="samp">none</samp>’ which disables all SLS hardening. ‘<samp class="samp">return</samp>’ enables SLS hardening for function returns. ‘<samp class="samp">indirect-jmp</samp>’ enables SLS hardening for indirect jumps. ‘<samp class="samp">all</samp>’ enables all SLS hardening. </p> </dd> <dt> +<span><code class="code">-mindirect-branch-cs-prefix</code><a class="copiable-link" href="#index-mindirect-branch-cs-prefix"> ¶</a></span> +</dt> <dd> +<p>Add CS prefix to call and jmp to indirect thunk with branch target in r8-r15 registers so that the call and jmp instruction length is 6 bytes to allow them to be replaced with ‘<samp class="samp">lfence; call *%r8-r15</samp>’ or ‘<samp class="samp">lfence; jmp *%r8-r15</samp>’ at run-time. </p> </dd> </dl> <p>These ‘<samp class="samp">-m</samp>’ switches are supported in addition to the above on x86-64 processors in 64-bit environments. </p> <dl class="table"> <dt> + <span><code class="code">-m32</code><a class="copiable-link" href="#index-m32-2"> ¶</a></span> +</dt> <dt><code class="code">-m64</code></dt> <dt><code class="code">-mx32</code></dt> <dt><code class="code">-m16</code></dt> <dt><code class="code">-miamcu</code></dt> <dd> +<p>Generate code for a 16-bit, 32-bit or 64-bit environment. The <samp class="option">-m32</samp> option sets <code class="code">int</code>, <code class="code">long</code>, and pointer types to 32 bits, and generates code that runs on any i386 system. </p> <p>The <samp class="option">-m64</samp> option sets <code class="code">int</code> to 32 bits and <code class="code">long</code> and pointer types to 64 bits, and generates code for the x86-64 architecture. For Darwin only the <samp class="option">-m64</samp> option also turns off the <samp class="option">-fno-pic</samp> and <samp class="option">-mdynamic-no-pic</samp> options. </p> <p>The <samp class="option">-mx32</samp> option sets <code class="code">int</code>, <code class="code">long</code>, and pointer types to 32 bits, and generates code for the x86-64 architecture. </p> <p>The <samp class="option">-m16</samp> option is the same as <samp class="option">-m32</samp>, except for that it outputs the <code class="code">.code16gcc</code> assembly directive at the beginning of the assembly output so that the binary can run in 16-bit mode. </p> <p>The <samp class="option">-miamcu</samp> option generates code which conforms to Intel MCU psABI. It requires the <samp class="option">-m32</samp> option to be turned on. </p> </dd> <dt> + <span><code class="code">-mno-red-zone</code><a class="copiable-link" href="#index-mno-red-zone"> ¶</a></span> +</dt> <dd> +<p>Do not use a so-called “red zone” for x86-64 code. The red zone is mandated by the x86-64 ABI; it is a 128-byte area beyond the location of the stack pointer that is not modified by signal or interrupt handlers and therefore can be used for temporary data without adjusting the stack pointer. The flag <samp class="option">-mno-red-zone</samp> disables this red zone. </p> </dd> <dt> +<span><code class="code">-mcmodel=small</code><a class="copiable-link" href="#index-mcmodel_003dsmall-3"> ¶</a></span> +</dt> <dd> +<p>Generate code for the small code model: the program and its symbols must be linked in the lower 2 GB of the address space. Pointers are 64 bits. Programs can be statically or dynamically linked. This is the default code model. </p> </dd> <dt> +<span><code class="code">-mcmodel=kernel</code><a class="copiable-link" href="#index-mcmodel_003dkernel"> ¶</a></span> +</dt> <dd> +<p>Generate code for the kernel code model. The kernel runs in the negative 2 GB of the address space. This model has to be used for Linux kernel code. </p> </dd> <dt> +<span><code class="code">-mcmodel=medium</code><a class="copiable-link" href="#index-mcmodel_003dmedium-1"> ¶</a></span> +</dt> <dd> +<p>Generate code for the medium model: the program is linked in the lower 2 GB of the address space. Small symbols are also placed there. Symbols with sizes larger than <samp class="option">-mlarge-data-threshold</samp> are put into large data or BSS sections and can be located above 2GB. Programs can be statically or dynamically linked. </p> </dd> <dt> +<span><code class="code">-mcmodel=large</code><a class="copiable-link" href="#index-mcmodel_003dlarge-3"> ¶</a></span> +</dt> <dd> +<p>Generate code for the large model. This model makes no assumptions about addresses and sizes of sections. </p> </dd> <dt> +<span><code class="code">-maddress-mode=long</code><a class="copiable-link" href="#index-maddress-mode_003dlong"> ¶</a></span> +</dt> <dd> +<p>Generate code for long address mode. This is only supported for 64-bit and x32 environments. It is the default address mode for 64-bit environments. </p> </dd> <dt> +<span><code class="code">-maddress-mode=short</code><a class="copiable-link" href="#index-maddress-mode_003dshort"> ¶</a></span> +</dt> <dd> +<p>Generate code for short address mode. This is only supported for 32-bit and x32 environments. It is the default address mode for 32-bit and x32 environments. </p> </dd> <dt> +<span><code class="code">-mneeded</code><a class="copiable-link" href="#index-mneeded"> ¶</a></span> +</dt> <dt><code class="code">-mno-needed</code></dt> <dd> +<p>Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to indicate the micro-architecture ISA level required to execute the binary. </p> </dd> <dt> + <span><code class="code">-mno-direct-extern-access</code><a class="copiable-link" href="#index-mno-direct-extern-access"> ¶</a></span> +</dt> <dd> +<p>Without <samp class="option">-fpic</samp> nor <samp class="option">-fPIC</samp>, always use the GOT pointer to access external symbols. With <samp class="option">-fpic</samp> or <samp class="option">-fPIC</samp>, treat access to protected symbols as local symbols. The default is <samp class="option">-mdirect-extern-access</samp>. </p> <p><strong class="strong">Warning:</strong> shared libraries compiled with <samp class="option">-mno-direct-extern-access</samp> and executable compiled with <samp class="option">-mdirect-extern-access</samp> may not be binary compatible if protected symbols are used in shared libraries and executable. </p> </dd> <dt> + <span><code class="code">-munroll-only-small-loops</code><a class="copiable-link" href="#index-munroll-only-small-loops"> ¶</a></span> +</dt> <dd> +<p>Controls conservative small loop unrolling. It is default enabled by O2, and unrolls loop with less than 4 insns by 1 time. Explicit -f[no-]unroll-[all-]loops would disable this flag to avoid any unintended unrolling behavior that user does not want. </p> </dd> <dt> +<span><code class="code">-mlam=<var class="var">choice</var></code><a class="copiable-link" href="#index-mlam"> ¶</a></span> +</dt> <dd><p>LAM(linear-address masking) allows special bits in the pointer to be used for metadata. The default is ‘<samp class="samp">none</samp>’. With ‘<samp class="samp">u48</samp>’, pointer bits in positions 62:48 can be used for metadata; With ‘<samp class="samp">u57</samp>’, pointer bits in positions 62:57 can be used for metadata. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="x86-windows-options">x86 Windows Options</a>, Previous: <a href="vxworks-options">VxWorks Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/x86-specific-memory-model-extensions-for-transactional-memory.html b/devdocs/gcc~13/x86-specific-memory-model-extensions-for-transactional-memory.html new file mode 100644 index 00000000..daa8ebea --- /dev/null +++ b/devdocs/gcc~13/x86-specific-memory-model-extensions-for-transactional-memory.html @@ -0,0 +1,16 @@ +<div class="section-level-extent" id="x86-specific-memory-model-extensions-for-transactional-memory"> <div class="nav-panel"> <p> Next: <a href="object-size-checking" accesskey="n" rel="next">Object Size Checking</a>, Previous: <a href="integer-overflow-builtins" accesskey="p" rel="prev">Built-in Functions to Perform Arithmetic with Overflow Checking</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="x86-Specific-Memory-Model-Extensions-for-Transactional-Memory"><span>6.57 x86-Specific Memory Model Extensions for Transactional Memory<a class="copiable-link" href="#x86-Specific-Memory-Model-Extensions-for-Transactional-Memory"> ¶</a></span></h1> <p>The x86 architecture supports additional memory ordering flags to mark critical sections for hardware lock elision. These must be specified in addition to an existing memory order to atomic intrinsics. </p> <dl class="table"> <dt><code class="code">__ATOMIC_HLE_ACQUIRE</code></dt> <dd><p>Start lock elision on a lock variable. Memory order must be <code class="code">__ATOMIC_ACQUIRE</code> or stronger. </p></dd> <dt><code class="code">__ATOMIC_HLE_RELEASE</code></dt> <dd><p>End lock elision on a lock variable. Memory order must be <code class="code">__ATOMIC_RELEASE</code> or stronger. </p></dd> </dl> <p>When a lock acquire fails, it is required for good performance to abort the transaction quickly. This can be done with a <code class="code">_mm_pause</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <immintrin.h> // For _mm_pause + +int lockvar; + +/* Acquire lock with lock elision */ +while (__atomic_exchange_n(&lockvar, 1, __ATOMIC_ACQUIRE|__ATOMIC_HLE_ACQUIRE)) + _mm_pause(); /* Abort failed transaction */ +... +/* Free lock with lock elision */ +__atomic_store_n(&lockvar, 0, __ATOMIC_RELEASE|__ATOMIC_HLE_RELEASE);</pre> +</div> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-specific-memory-model-extensions-for-transactional-memory.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-specific-memory-model-extensions-for-transactional-memory.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/x86-transactional-memory-intrinsics.html b/devdocs/gcc~13/x86-transactional-memory-intrinsics.html new file mode 100644 index 00000000..9572c6d7 --- /dev/null +++ b/devdocs/gcc~13/x86-transactional-memory-intrinsics.html @@ -0,0 +1,59 @@ +<div class="subsection-level-extent" id="x86-transactional-memory-intrinsics"> <div class="nav-panel"> <p> Next: <a href="x86-control-flow-protection-intrinsics" accesskey="n" rel="next">x86 Control-Flow Protection Intrinsics</a>, Previous: <a href="x86-built-in-functions" accesskey="p" rel="prev">x86 Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="x86-Transactional-Memory-Intrinsics"><span>6.60.36 x86 Transactional Memory Intrinsics<a class="copiable-link" href="#x86-Transactional-Memory-Intrinsics"> ¶</a></span></h1> <p>These hardware transactional memory intrinsics for x86 allow you to use memory transactions with RTM (Restricted Transactional Memory). This support is enabled with the <samp class="option">-mrtm</samp> option. For using HLE (Hardware Lock Elision) see <a class="ref" href="x86-specific-memory-model-extensions-for-transactional-memory">x86-Specific Memory Model Extensions for Transactional Memory</a> instead. </p> <p>A memory transaction commits all changes to memory in an atomic way, as visible to other threads. If the transaction fails it is rolled back and all side effects discarded. </p> <p>Generally there is no guarantee that a memory transaction ever succeeds and suitable fallback code always needs to be supplied. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005fxbegin"> +<span class="category-def">RTM Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">_xbegin</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-_005fxbegin"> ¶</a></span> +</dt> <dd> +<p>Start a RTM (Restricted Transactional Memory) transaction. Returns <code class="code">_XBEGIN_STARTED</code> when the transaction started successfully (note this is not 0, so the constant has to be explicitly tested). </p> <p>If the transaction aborts, all side effects are undone and an abort code encoded as a bit mask is returned. The following macros are defined: </p> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fXABORT_005fEXPLICIT"> +<span class="category-def">Macro: </span><span><strong class="def-name">_XABORT_EXPLICIT</strong><a class="copiable-link" href="#index-_005fXABORT_005fEXPLICIT"> ¶</a></span> +</dt> <dd><p>Transaction was explicitly aborted with <code class="code">_xabort</code>. The parameter passed to <code class="code">_xabort</code> is available with <code class="code">_XABORT_CODE(status)</code>. </p></dd> +</dl> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fXABORT_005fRETRY"> +<span class="category-def">Macro: </span><span><strong class="def-name">_XABORT_RETRY</strong><a class="copiable-link" href="#index-_005fXABORT_005fRETRY"> ¶</a></span> +</dt> <dd><p>Transaction retry is possible. </p></dd> +</dl> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fXABORT_005fCONFLICT"> +<span class="category-def">Macro: </span><span><strong class="def-name">_XABORT_CONFLICT</strong><a class="copiable-link" href="#index-_005fXABORT_005fCONFLICT"> ¶</a></span> +</dt> <dd><p>Transaction abort due to a memory conflict with another thread. </p></dd> +</dl> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fXABORT_005fCAPACITY"> +<span class="category-def">Macro: </span><span><strong class="def-name">_XABORT_CAPACITY</strong><a class="copiable-link" href="#index-_005fXABORT_005fCAPACITY"> ¶</a></span> +</dt> <dd><p>Transaction abort due to the transaction using too much memory. </p></dd> +</dl> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fXABORT_005fDEBUG"> +<span class="category-def">Macro: </span><span><strong class="def-name">_XABORT_DEBUG</strong><a class="copiable-link" href="#index-_005fXABORT_005fDEBUG"> ¶</a></span> +</dt> <dd><p>Transaction abort due to a debug trap. </p></dd> +</dl> <dl class="first-deffn first-defmac-alias-first-deffn"> <dt class="deffn defmac-alias-deffn" id="index-_005fXABORT_005fNESTED"> +<span class="category-def">Macro: </span><span><strong class="def-name">_XABORT_NESTED</strong><a class="copiable-link" href="#index-_005fXABORT_005fNESTED"> ¶</a></span> +</dt> <dd><p>Transaction abort in an inner nested transaction. </p></dd> +</dl> <p>There is no guarantee any transaction ever succeeds, so there always needs to be a valid fallback path. </p> +</dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005fxend"> +<span class="category-def">RTM Function: </span><span><code class="def-type">void</code> <strong class="def-name">_xend</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-_005fxend"> ¶</a></span> +</dt> <dd><p>Commit the current transaction. When no transaction is active this faults. All memory side effects of the transaction become visible to other threads in an atomic manner. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005fxtest"> +<span class="category-def">RTM Function: </span><span><code class="def-type">int</code> <strong class="def-name">_xtest</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-_005fxtest"> ¶</a></span> +</dt> <dd><p>Return a nonzero value if a transaction is currently active, otherwise 0. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005fxabort"> +<span class="category-def">RTM Function: </span><span><code class="def-type">void</code> <strong class="def-name">_xabort</strong> <code class="def-code-arguments">(status)</code><a class="copiable-link" href="#index-_005fxabort"> ¶</a></span> +</dt> <dd><p>Abort the current transaction. When no transaction is active this is a no-op. The <var class="var">status</var> is an 8-bit constant; its value is encoded in the return value from <code class="code">_xbegin</code>. </p></dd> +</dl> <p>Here is an example showing handling for <code class="code">_XABORT_RETRY</code> and a fallback path for other failures: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#include <immintrin.h> + +int n_tries, max_tries; +unsigned status = _XABORT_EXPLICIT; +... + +for (n_tries = 0; n_tries < max_tries; n_tries++) + { + status = _xbegin (); + if (status == _XBEGIN_STARTED || !(status & _XABORT_RETRY)) + break; + } +if (status == _XBEGIN_STARTED) + { + ... transaction code... + _xend (); + } +else + { + ... non-transactional fallback path... + }</pre> +</div> <p>Note that, in most cases, the transactional and non-transactional code must synchronize together to ensure consistency. </p> </div> <div class="nav-panel"> <p> Next: <a href="x86-control-flow-protection-intrinsics">x86 Control-Flow Protection Intrinsics</a>, Previous: <a href="x86-built-in-functions">x86 Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-transactional-memory-intrinsics.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-transactional-memory-intrinsics.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/x86-windows-options.html b/devdocs/gcc~13/x86-windows-options.html new file mode 100644 index 00000000..95ba4099 --- /dev/null +++ b/devdocs/gcc~13/x86-windows-options.html @@ -0,0 +1,35 @@ +<div class="subsection-level-extent" id="x86-Windows-Options"> <div class="nav-panel"> <p> Next: <a href="xstormy16-options" accesskey="n" rel="next">Xstormy16 Options</a>, Previous: <a href="x86-options" accesskey="p" rel="prev">x86 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="x86-Windows-Options-1"><span>3.19.55 x86 Windows Options<a class="copiable-link" href="#x86-Windows-Options-1"> ¶</a></span></h1> <p>These additional options are available for Microsoft Windows targets: </p> <dl class="table"> <dt> +<span><code class="code">-mconsole</code><a class="copiable-link" href="#index-mconsole"> ¶</a></span> +</dt> <dd> +<p>This option specifies that a console application is to be generated, by instructing the linker to set the PE header subsystem type required for console applications. This option is available for Cygwin and MinGW targets and is enabled by default on those targets. </p> </dd> <dt> +<span><code class="code">-mdll</code><a class="copiable-link" href="#index-mdll"> ¶</a></span> +</dt> <dd> +<p>This option is available for Cygwin and MinGW targets. It specifies that a DLL—a dynamic link library—is to be generated, enabling the selection of the required runtime startup object and entry point. </p> </dd> <dt> +<span><code class="code">-mnop-fun-dllimport</code><a class="copiable-link" href="#index-mnop-fun-dllimport"> ¶</a></span> +</dt> <dd> +<p>This option is available for Cygwin and MinGW targets. It specifies that the <code class="code">dllimport</code> attribute should be ignored. </p> </dd> <dt> +<span><code class="code">-mthreads</code><a class="copiable-link" href="#index-mthreads-1"> ¶</a></span> +</dt> <dd> +<p>This option is available for MinGW targets. It specifies that MinGW-specific thread support is to be used. </p> </dd> <dt> +<span><code class="code">-municode</code><a class="copiable-link" href="#index-municode"> ¶</a></span> +</dt> <dd> +<p>This option is available for MinGW-w64 targets. It causes the <code class="code">UNICODE</code> preprocessor macro to be predefined, and chooses Unicode-capable runtime startup code. </p> </dd> <dt> +<span><code class="code">-mwin32</code><a class="copiable-link" href="#index-mwin32"> ¶</a></span> +</dt> <dd> +<p>This option is available for Cygwin and MinGW targets. It specifies that the typical Microsoft Windows predefined macros are to be set in the pre-processor, but does not influence the choice of runtime library/startup code. </p> </dd> <dt> +<span><code class="code">-mwindows</code><a class="copiable-link" href="#index-mwindows"> ¶</a></span> +</dt> <dd> +<p>This option is available for Cygwin and MinGW targets. It specifies that a GUI application is to be generated by instructing the linker to set the PE header subsystem type appropriately. </p> </dd> <dt> + <span><code class="code">-fno-set-stack-executable</code><a class="copiable-link" href="#index-fno-set-stack-executable"> ¶</a></span> +</dt> <dd> +<p>This option is available for MinGW targets. It specifies that the executable flag for the stack used by nested functions isn’t set. This is necessary for binaries running in kernel mode of Microsoft Windows, as there the User32 API, which is used to set executable privileges, isn’t available. </p> </dd> <dt> + <span><code class="code">-fwritable-relocated-rdata</code><a class="copiable-link" href="#index-fno-writable-relocated-rdata"> ¶</a></span> +</dt> <dd> +<p>This option is available for MinGW and Cygwin targets. It specifies that relocated-data in read-only section is put into the <code class="code">.data</code> section. This is a necessary for older runtimes not supporting modification of <code class="code">.rdata</code> sections for pseudo-relocation. </p> </dd> <dt> +<span><code class="code">-mpe-aligned-commons</code><a class="copiable-link" href="#index-mpe-aligned-commons"> ¶</a></span> +</dt> <dd><p>This option is available for Cygwin and MinGW targets. It specifies that the GNU extension to the PE file format that permits the correct alignment of COMMON variables should be used when generating code. It is enabled by default if GCC detects that the target assembler found during configuration supports the feature. </p></dd> </dl> <p>See also under <a class="ref" href="x86-options">x86 Options</a> for standard options. </p> </div> <div class="nav-panel"> <p> Next: <a href="xstormy16-options">Xstormy16 Options</a>, Previous: <a href="x86-options">x86 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-Windows-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/x86-Windows-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/xstormy16-function-attributes.html b/devdocs/gcc~13/xstormy16-function-attributes.html new file mode 100644 index 00000000..08302d6e --- /dev/null +++ b/devdocs/gcc~13/xstormy16-function-attributes.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="Xstormy16-Function-Attributes"> <div class="nav-panel"> <p> Previous: <a href="x86-function-attributes" accesskey="p" rel="prev">x86 Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Xstormy16-Function-Attributes-1"><span>6.33.34 Xstormy16 Function Attributes<a class="copiable-link" href="#Xstormy16-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the Xstormy16 back end: </p> <dl class="table"> <dt> +<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-Xstormy16"> ¶</a></span> +</dt> <dd><p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Xstormy16-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Xstormy16-Function-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/xstormy16-options.html b/devdocs/gcc~13/xstormy16-options.html new file mode 100644 index 00000000..958f29a2 --- /dev/null +++ b/devdocs/gcc~13/xstormy16-options.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="Xstormy16-Options"> <div class="nav-panel"> <p> Next: <a href="xtensa-options" accesskey="n" rel="next">Xtensa Options</a>, Previous: <a href="x86-windows-options" accesskey="p" rel="prev">x86 Windows Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Xstormy16-Options-1"><span>3.19.56 Xstormy16 Options<a class="copiable-link" href="#Xstormy16-Options-1"> ¶</a></span></h1> <p>These options are defined for Xstormy16: </p> <dl class="table"> <dt> +<span><code class="code">-msim</code><a class="copiable-link" href="#index-msim-10"> ¶</a></span> +</dt> <dd><p>Choose startup files and linker script suitable for the simulator. </p></dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Xstormy16-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Xstormy16-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/xstormy16-variable-attributes.html b/devdocs/gcc~13/xstormy16-variable-attributes.html new file mode 100644 index 00000000..da9cda5f --- /dev/null +++ b/devdocs/gcc~13/xstormy16-variable-attributes.html @@ -0,0 +1,8 @@ +<div class="subsection-level-extent" id="Xstormy16-Variable-Attributes"> <div class="nav-panel"> <p> Previous: <a href="variable-attributes" accesskey="p" rel="prev">x86 Variable Attributes</a>, Up: <a href="variable-attributes" accesskey="u" rel="up">Specifying Attributes of Variables</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Xstormy16-Variable-Attributes-1"><span>6.34.16 Xstormy16 Variable Attributes<a class="copiable-link" href="#Xstormy16-Variable-Attributes-1"> ¶</a></span></h1> <p>One attribute is currently defined for xstormy16 configurations: <code class="code">below100</code>. </p> <dl class="table"> <dt> +<span><code class="code">below100</code><a class="copiable-link" href="#index-below100-variable-attribute_002c-Xstormy16"> ¶</a></span> +</dt> <dd> <p>If a variable has the <code class="code">below100</code> attribute (<code class="code">BELOW100</code> is allowed also), GCC places the variable in the first 0x100 bytes of memory and use special opcodes to access it. Such variables are placed in either the <code class="code">.bss_below100</code> section or the <code class="code">.data_below100</code> section. </p> </dd> </dl> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Xstormy16-Variable-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Xstormy16-Variable-Attributes.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/xtensa-options.html b/devdocs/gcc~13/xtensa-options.html new file mode 100644 index 00000000..27ba54c1 --- /dev/null +++ b/devdocs/gcc~13/xtensa-options.html @@ -0,0 +1,41 @@ +<div class="subsection-level-extent" id="Xtensa-Options"> <div class="nav-panel"> <p> Next: <a href="zseries-options" accesskey="n" rel="next">zSeries Options</a>, Previous: <a href="xstormy16-options" accesskey="p" rel="prev">Xstormy16 Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="Xtensa-Options-1"><span>3.19.57 Xtensa Options<a class="copiable-link" href="#Xtensa-Options-1"> ¶</a></span></h1> <p>These options are supported for Xtensa targets: </p> <dl class="table"> <dt> + <span><code class="code">-mconst16</code><a class="copiable-link" href="#index-mconst16"> ¶</a></span> +</dt> <dt><code class="code">-mno-const16</code></dt> <dd> +<p>Enable or disable use of <code class="code">CONST16</code> instructions for loading constant values. The <code class="code">CONST16</code> instruction is currently not a standard option from Tensilica. When enabled, <code class="code">CONST16</code> instructions are always used in place of the standard <code class="code">L32R</code> instructions. The use of <code class="code">CONST16</code> is enabled by default only if the <code class="code">L32R</code> instruction is not available. </p> </dd> <dt> + <span><code class="code">-mfused-madd</code><a class="copiable-link" href="#index-mfused-madd-5"> ¶</a></span> +</dt> <dt><code class="code">-mno-fused-madd</code></dt> <dd> +<p>Enable or disable use of fused multiply/add and multiply/subtract instructions in the floating-point option. This has no effect if the floating-point option is not also enabled. Disabling fused multiply/add and multiply/subtract instructions forces the compiler to use separate instructions for the multiply and add/subtract operations. This may be desirable in some cases where strict IEEE 754-compliant results are required: the fused multiply add/subtract instructions do not round the intermediate result, thereby producing results with <em class="emph">more</em> bits of precision than specified by the IEEE standard. Disabling fused multiply add/subtract instructions also ensures that the program output is not sensitive to the compiler’s ability to combine multiply and add/subtract operations. </p> </dd> <dt> + <span><code class="code">-mserialize-volatile</code><a class="copiable-link" href="#index-mserialize-volatile"> ¶</a></span> +</dt> <dt><code class="code">-mno-serialize-volatile</code></dt> <dd> +<p>When this option is enabled, GCC inserts <code class="code">MEMW</code> instructions before <code class="code">volatile</code> memory references to guarantee sequential consistency. The default is <samp class="option">-mserialize-volatile</samp>. Use <samp class="option">-mno-serialize-volatile</samp> to omit the <code class="code">MEMW</code> instructions. </p> </dd> <dt> +<span><code class="code">-mforce-no-pic</code><a class="copiable-link" href="#index-mforce-no-pic"> ¶</a></span> +</dt> <dd> +<p>For targets, like GNU/Linux, where all user-mode Xtensa code must be position-independent code (PIC), this option disables PIC for compiling kernel code. </p> </dd> <dt> + <span><code class="code">-mtext-section-literals</code><a class="copiable-link" href="#index-mtext-section-literals"> ¶</a></span> +</dt> <dt><code class="code">-mno-text-section-literals</code></dt> <dd> +<p>These options control the treatment of literal pools. The default is <samp class="option">-mno-text-section-literals</samp>, which places literals in a separate section in the output file. This allows the literal pool to be placed in a data RAM/ROM, and it also allows the linker to combine literal pools from separate object files to remove redundant literals and improve code size. With <samp class="option">-mtext-section-literals</samp>, the literals are interspersed in the text section in order to keep them as close as possible to their references. This may be necessary for large assembly files. Literals for each function are placed right before that function. </p> </dd> <dt> + <span><code class="code">-mauto-litpools</code><a class="copiable-link" href="#index-mauto-litpools"> ¶</a></span> +</dt> <dt><code class="code">-mno-auto-litpools</code></dt> <dd> +<p>These options control the treatment of literal pools. The default is <samp class="option">-mno-auto-litpools</samp>, which places literals in a separate section in the output file unless <samp class="option">-mtext-section-literals</samp> is used. With <samp class="option">-mauto-litpools</samp> the literals are interspersed in the text section by the assembler. Compiler does not produce explicit <code class="code">.literal</code> directives and loads literals into registers with <code class="code">MOVI</code> instructions instead of <code class="code">L32R</code> to let the assembler do relaxation and place literals as necessary. This option allows assembler to create several literal pools per function and assemble very big functions, which may not be possible with <samp class="option">-mtext-section-literals</samp>. </p> </dd> <dt> + <span><code class="code">-mtarget-align</code><a class="copiable-link" href="#index-mtarget-align"> ¶</a></span> +</dt> <dt><code class="code">-mno-target-align</code></dt> <dd> +<p>When this option is enabled, GCC instructs the assembler to automatically align instructions to reduce branch penalties at the expense of some code density. The assembler attempts to widen density instructions to align branch targets and the instructions following call instructions. If there are not enough preceding safe density instructions to align a target, no widening is performed. The default is <samp class="option">-mtarget-align</samp>. These options do not affect the treatment of auto-aligned instructions like <code class="code">LOOP</code>, which the assembler always aligns, either by widening density instructions or by inserting NOP instructions. </p> </dd> <dt> + <span><code class="code">-mlongcalls</code><a class="copiable-link" href="#index-mlongcalls"> ¶</a></span> +</dt> <dt><code class="code">-mno-longcalls</code></dt> <dd> +<p>When this option is enabled, GCC instructs the assembler to translate direct calls to indirect calls unless it can determine that the target of a direct call is in the range allowed by the call instruction. This translation typically occurs for calls to functions in other source files. Specifically, the assembler translates a direct <code class="code">CALL</code> instruction into an <code class="code">L32R</code> followed by a <code class="code">CALLX</code> instruction. The default is <samp class="option">-mno-longcalls</samp>. This option should be used in programs where the call target can potentially be out of range. This option is implemented in the assembler, not the compiler, so the assembly code generated by GCC still shows direct call instructions—look at the disassembled object code to see the actual instructions. Note that the assembler uses an indirect call for every cross-file call, not just those that really are out of range. </p> </dd> <dt> +<span><code class="code">-mabi=<var class="var">name</var></code><a class="copiable-link" href="#index-mabi-7"> ¶</a></span> +</dt> <dd> +<p>Generate code for the specified ABI. Permissible values are: ‘<samp class="samp">call0</samp>’, ‘<samp class="samp">windowed</samp>’. Default ABI is chosen by the Xtensa core configuration. </p> </dd> <dt> +<span><code class="code">-mabi=call0</code><a class="copiable-link" href="#index-mabi_003dcall0"> ¶</a></span> +</dt> <dd> +<p>When this option is enabled function parameters are passed in registers <code class="code">a2</code> through <code class="code">a7</code>, registers <code class="code">a12</code> through <code class="code">a15</code> are caller-saved, and register <code class="code">a15</code> may be used as a frame pointer. When this version of the ABI is enabled the C preprocessor symbol <code class="code">__XTENSA_CALL0_ABI__</code> is defined. </p> </dd> <dt> +<span><code class="code">-mabi=windowed</code><a class="copiable-link" href="#index-mabi_003dwindowed"> ¶</a></span> +</dt> <dd> +<p>When this option is enabled function parameters are passed in registers <code class="code">a10</code> through <code class="code">a15</code>, and called function rotates register window by 8 registers on entry so that its arguments are found in registers <code class="code">a2</code> through <code class="code">a7</code>. Register <code class="code">a7</code> may be used as a frame pointer. Register window is rotated 8 registers back upon return. When this version of the ABI is enabled the C preprocessor symbol <code class="code">__XTENSA_WINDOWED_ABI__</code> is defined. </p> </dd> <dt> +<span><code class="code">-mextra-l32r-costs=<var class="var">n</var></code><a class="copiable-link" href="#index-mextra-l32r-costs"> ¶</a></span> +</dt> <dd><p>Specify an extra cost of instruction RAM/ROM access for <code class="code">L32R</code> instructions, in clock cycles. This affects, when optimizing for speed, whether loading a constant from literal pool using <code class="code">L32R</code> or synthesizing the constant from a small one with a couple of arithmetic instructions. The default value is 0. </p></dd> </dl> </div> <div class="nav-panel"> <p> Next: <a href="zseries-options">zSeries Options</a>, Previous: <a href="xstormy16-options">Xstormy16 Options</a>, Up: <a href="submodel-options">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Xtensa-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Xtensa-Options.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/zero-length.html b/devdocs/gcc~13/zero-length.html new file mode 100644 index 00000000..bd200933 --- /dev/null +++ b/devdocs/gcc~13/zero-length.html @@ -0,0 +1,32 @@ +<div class="section-level-extent" id="Zero-Length"> <div class="nav-panel"> <p> Next: <a href="empty-structures" accesskey="n" rel="next">Structures with No Members</a>, Previous: <a href="named-address-spaces" accesskey="p" rel="prev">Named Address Spaces</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Arrays-of-Length-Zero"><span>6.18 Arrays of Length Zero<a class="copiable-link" href="#Arrays-of-Length-Zero"> ¶</a></span></h1> <p>Declaring zero-length arrays is allowed in GNU C as an extension. A zero-length array can be useful as the last element of a structure that is really a header for a variable-length object: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct line { + int length; + char contents[0]; +}; + +struct line *thisline = (struct line *) + malloc (sizeof (struct line) + this_length); +thisline->length = this_length;</pre> +</div> <p>Although the size of a zero-length array is zero, an array member of this kind may increase the size of the enclosing type as a result of tail padding. The offset of a zero-length array member from the beginning of the enclosing structure is the same as the offset of an array with one or more elements of the same type. The alignment of a zero-length array is the same as the alignment of its elements. </p> <p>Declaring zero-length arrays in other contexts, including as interior members of structure objects or as non-member objects, is discouraged. Accessing elements of zero-length arrays declared in such contexts is undefined and may be diagnosed. </p> <p>In the absence of the zero-length array extension, in ISO C90 the <code class="code">contents</code> array in the example above would typically be declared to have a single element. Unlike a zero-length array which only contributes to the size of the enclosing structure for the purposes of alignment, a one-element array always occupies at least as much space as a single object of the type. Although using one-element arrays this way is discouraged, GCC handles accesses to trailing one-element array members analogously to zero-length arrays. </p> <p>The preferred mechanism to declare variable-length types like <code class="code">struct line</code> above is the ISO C99 <em class="dfn">flexible array member</em>, with slightly different syntax and semantics: </p> <ul class="itemize mark-bullet"> <li>Flexible array members are written as <code class="code">contents[]</code> without the <code class="code">0</code>. </li> +<li>Flexible array members have incomplete type, and so the <code class="code">sizeof</code> operator may not be applied. As a quirk of the original implementation of zero-length arrays, <code class="code">sizeof</code> evaluates to zero. </li> +<li>Flexible array members may only appear as the last member of a <code class="code">struct</code> that is otherwise non-empty. </li> +<li>A structure containing a flexible array member, or a union containing such a structure (possibly recursively), may not be a member of a structure or an element of an array. (However, these uses are permitted by GCC as extensions.) </li> +</ul> <p>Non-empty initialization of zero-length arrays is treated like any case where there are more initializer elements than the array holds, in that a suitable warning about “excess elements in array” is given, and the excess elements (all of them, in this case) are ignored. </p> <p>GCC allows static initialization of flexible array members. This is equivalent to defining a new structure containing the original structure followed by an array of sufficient size to contain the data. E.g. in the following, <code class="code">f1</code> is constructed as if it were declared like <code class="code">f2</code>. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct f1 { + int x; int y[]; +} f1 = { 1, { 2, 3, 4 } }; + +struct f2 { + struct f1 f1; int data[3]; +} f2 = { { 1 }, { 2, 3, 4 } };</pre> +</div> <p>The convenience of this extension is that <code class="code">f1</code> has the desired type, eliminating the need to consistently refer to <code class="code">f2.f1</code>. </p> <p>This has symmetry with normal static arrays, in that an array of unknown size is also written with <code class="code">[]</code>. </p> <p>Of course, this extension only makes sense if the extra data comes at the end of a top-level object, as otherwise we would be overwriting data at subsequent offsets. To avoid undue complication and confusion with initialization of deeply nested arrays, we simply disallow any non-empty initialization except when the structure is the top-level object. For example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct foo { int x; int y[]; }; +struct bar { struct foo z; }; + +struct foo a = { 1, { 2, 3, 4 } }; // <span class="r">Valid.</span> +struct bar b = { { 1, { 2, 3, 4 } } }; // <span class="r">Invalid.</span> +struct bar c = { { 1, { } } }; // <span class="r">Valid.</span> +struct foo d[1] = { { 1, { 2, 3, 4 } } }; // <span class="r">Invalid.</span></pre> +</div> </div> <div class="nav-panel"> <p> Next: <a href="empty-structures">Structures with No Members</a>, Previous: <a href="named-address-spaces">Named Address Spaces</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Zero-Length.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Zero-Length.html</a> + </p> +</div> diff --git a/devdocs/gcc~13/zseries-options.html b/devdocs/gcc~13/zseries-options.html new file mode 100644 index 00000000..0de96c9c --- /dev/null +++ b/devdocs/gcc~13/zseries-options.html @@ -0,0 +1,6 @@ +<div class="subsection-level-extent" id="zSeries-Options"> <div class="nav-panel"> <p> Previous: <a href="xtensa-options" accesskey="p" rel="prev">Xtensa Options</a>, Up: <a href="submodel-options" accesskey="u" rel="up">Machine-Dependent Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="zSeries-Options-1"><span>3.19.58 zSeries Options<a class="copiable-link" href="#zSeries-Options-1"> ¶</a></span></h1> <p>These are listed under See <a class="xref" href="s_002f390-and-zseries-options">S/390 and zSeries Options</a>. </p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/zSeries-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/zSeries-Options.html</a> + </p> +</div> |
