This specifies inline expansion of a function written in the assembly language.
The calling conventions for an inline function with embedded assembly are the same as for ordinary function calls. |
The compiler passes the character strings written in the functions specified with #pragma inline_asm to the assembler without change. |
The codes written in assembly language are processed by the preprocessor. Therefore, special care must be taken when the same names as the instructions or registers used in the assembly language are defined as the names of macros with #define. When including iodefine.h, the function written in the assembly language should be written before inclusion of iodefine.h. |
Assembler control instructions are not usable in assembly code for functions specified as inline_asm. In addition, only the directives listed below are usable. Specifying any other directive will lead to an error. |
In the .PUBLIC directive in the function specified with inline_asm, only the labels defined in the function specified with inline_asm can be used. Using any other labels will lead to errors. |
When a label is written in an assembly-language function, labels having the same name are generated for the number of times the function is expanded inline. In this case, take any of the following actions.
Use a local label written in the assembly language. A local label has a single name in the assembly-language code, but the assembler automatically converts it into separate names. |
See ".LOCAL" for local labels.
When calling an assembly-language function within the current source file, define the assembly-language function as static and call it only from a single location. Do not obtain the address of the assembly-language function. |
When not calling an assembly-language function within the current source file, code the function as an external function. |
The following shows a sample C source code.
The following shows the assembly source output by compiler.