[LLVMdev] mips16 puzzle

Reed Kotler rkotler at mips.com
Thu Sep 20 22:48:27 PDT 2012

Trying to think of a clever way to do something....

On Mips 16, the SP (stack pointer) is not a directly accessible register 
in most instructions.
There is a way to move to and from mips 16 registers (subset of mips32) 
and mips32 registers.

For the load/store word instructions, there are forms which implicitly 
take SP.

However, for store/load byte and store/load halfword, there is no such 

In such cases, if I were writing assembly language code, I would move SP 
to a mips 16 register and then use it to do the store/load byte/haflword.

It also then becomes a common subexpression because there may be 
multiple such accesses.

It's like a temporary register alias.

Add, Sub also have a way to reference memory using mips16 registers as a 
base address, so various operators on stack data are simplified.

Any thoughts?

Many ways to do this but I like simple ways. :)



More information about the llvm-dev mailing list