Share via


MIPS Inline Assembly Language

9/7/2007

Inline assembly language allows you to embed assembly-language instructions in your C and C++ source programs without extra assembly and link steps.

The inline assembler is built into the compiler and does not require separate assembly.

Because the inline assembler requires no extra steps, it is sometimes more convenient than using a separate assembler, especially in situations where you require access to processor resources.

Inline assembly code disables compiler optimization for the inline assembler function. If optimization is important for your program, you should consider using intrinsic functions.

To use inline assembly code, you must select the appropriate compiler switches for the specific Instruction Set Architecture (ISA).

For more information about these switches, see /QMmipsNN - Generate Code for Specific MIPS ISA.

Restrictions

The string specified in the __asm statement can be any valid assembly code accepted by the stand-alone assembler. You can use any of the pseudo-ops supported, as long as you do not use pseudo-ops to define separate procedures or functions.

To create complete assembly-language procedures, use the stand-alone assembler, as explained in Stand-alone MIPS Assembler.

See Also

Reference

MIPS Compiler Options

Other Resources

MIPS Calling Sequence Specification