backend handles "return" instruction

Hi,

I want to implement a backend. In my backend, there is no stack. For the “return” instruction, if I have LLVM IR looks like this “%1 = add i32 %2, %3” and “ret i32 %1”. I hope my backend can print something like “add v1, v2, v3” and “return v1”. I checked some tutorials such as “OpenRISC”, “MSP430” and “LEG” backend, they all “return” to a particular register. However, this is not what I want.

I appreciate it if you could any me any suggestion how to handle the “return” instruction here? I guess I need to change both InstInfo.td and ISelLowing.cpp file. However, I have no idea right now.

Thanks,

Xiangyang