[LLVMdev] how to declare that two registers must be different

Chris Lattner sabre at nondot.org
Sun Sep 17 11:15:13 PDT 2006

On Sun, 17 Sep 2006, [UTF-8] Rafael Esp?ndola wrote:
> The ARM has a multiply instruction of the form Rd=Rm*Rs where Rd != Rm. 
> How can I add this requirement to the instruction definition?

Unfortunately there is currently no great way to do this.  Some options 

1. Pin one operand to a specific register, one that isn't allocated (e.g.
    R12).  Use copyto/fromreg to get to it.  They other would be allocated
    to some different reg.
2. Allocate like normal, and then do a post-pass.  The post-pass would
    scan for the bad instruction, and if found insert compensation code to
    copy in/out of some other reg (again, R12 would a natural choice).

I'd like to make the regalloc interfaces more powerful to be able to 
capture this sort of thing, but I'm not very familiar with ARM.  What 
specific instructions are problematic?  MUL looks ok in my copy of the ARM 



More information about the llvm-dev mailing list