summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/size-of-an-asm.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/gcc~13/size-of-an-asm.html')
-rw-r--r--devdocs/gcc~13/size-of-an-asm.html6
1 files changed, 6 insertions, 0 deletions
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">
+ &copy; Free Software Foundation<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>