13.07.2015 Views

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>ARM</strong> <strong>User</strong> <strong>Guide</strong>C_expressionregister_save_listregister_nameAny C expression. For output parameters it must be an lvalue, thatis, something that is legal to have on the left side of an assignment.[["register_name"],...]Name of the register you want to reserve. Note that saving too manyregisters can make register allocation impossible.Specifying registers <strong>for</strong> C variablesWith a constraint character you specify the register type <strong>for</strong> a parameter.You can reserve the registers that are used in the assembly instructions, either in the parameter lists orin the reserved register list (register_save_list). The compiler takes account of these lists, so nounnecessary register saves and restores are placed around the inline assembly instructions.ConstraintcharacterrnumberTypegeneral purpose registertype of operand it isassociated withOperandr0 .. r11, lrRemarkThumb mode r0 .. r7same as %number Input constraint only. The number mustrefer to an output parameter. Indicatesthat %number and number are the sameregister.If an input parameter is modified by the inline assembly then this input parameter must also beadded to the list of output parameters (see Example 6). If this is not the case, the resulting codemay behave differently than expected since the compiler assumes that an input parameter is notbeing changed by the inline assembly.Loops and conditional jumpsThe compiler does not detect loops with multiple __asm() statements or (conditional) jumps across__asm() statements and will generate incorrect code <strong>for</strong> the registers involved.If you want to create a loop with __asm(), the whole loop must be contained in a single __asm()statement. The same counts <strong>for</strong> (conditional) jumps. As a rule of thumb, all references to a label in an__asm() statement must be in that same statement. You can use numeric labels <strong>for</strong> these purposes.Example 1: no input or outputA simple example without input or output parameters. You can use any instruction or label. When it isrequired that a sequence of __asm() statements generates a contiguous sequence of instructions, thenthey can be best combined to a single __asm() statement. Compiler optimizations can insert instruction(s)in between __asm() statements. Note that you can use standard C escape sequences. Use newlinecharacters ‘\n’ to continue on a new line in a __asm() statement. For multi-line output, use tab characters'\t' to indent instructions.__asm( "nop\n""\tnop" );6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!