From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/gcc~13/size-of-an-asm.html | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 devdocs/gcc~13/size-of-an-asm.html (limited to 'devdocs/gcc~13/size-of-an-asm.html') 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 @@ +

6.47.6 Size of an asm

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 asm 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 asm 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 ‘;’ — indicates the end of an instruction.)

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.

This size is also used for inlining decisions. If you use asm inline instead of just asm, then for inlining purposes the size of the asm is taken as the minimum size, ignoring how many instructions GCC thinks it is.

+

+ © Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
+ https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Size-of-an-asm.html +

+
-- cgit v1.2.3