[LLVMdev] How to disable register allocate optimization?

Yang Yang geraint0923 at gmail.com
Sat Jul 21 11:41:06 PDT 2012


Hi everyone,

I am trying to expand one instruction into multiple instructions on MIPS.
For example, I try to expand:
	sh	src, imm(dst)
into:
(1)	sb	src, imm(dst)
(2)	srl	reg0, src, 8
(3)	sb	reg0, (imm+1)(dst)
Here, reg0 are created with createVirtualRegister.

However, instr(2) will not be emitted because reg0 is useless before reg0 is defined in instr(3), it is wrong!
So how to prevent the expansion from being optimized?
Is there any method to disable register allocate optimization?

Thanks in advance.

Yang






More information about the llvm-dev mailing list