Blx
Colin (478) 2433 posts |
In the C inline assembler in etherusb there’s the following line:
When I’ve looked for the definition of blx I can only find ‘blx label’ I know what blx does but what do the register lists signify? Is it a real blx instruction or an assembler macro? |
Jeffrey Lee (213) 6048 posts |
That’s the input, output, and clobber list for the instruction. Unlike other compilers like GCC, Norcroft needs the register lists to be specified on a per-instruction basis where necessary (i.e. SWIs and branches). I think it’s done like this because Norcroft doesn’t treat blocks of inline assembler as a black box like other compilers – it actually has to know what each instruction does so that it can convert them to jopcodes. The upside is that it allows you to reference C variables directly instead of passing in values via the register list. It also allows the compiler to optimise your assembler for you. The downside is that it may no longer be exactly the same code you wrote!
There’s also ‘blx <reg>’ |