<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>Hi,<br><br></div>I need to force all variables of a basic block to spill, i.e., I can't allow basic blocks to share registers. I would like to know where is the most appropriate approach to implement that policy in LLVM. <br>

<br></div>Looking at the LLVM source, it seems that the register allocator is the best choice because it controls the spilling, but I need to guarantee that this policy is not violated by post RA passes.<br><br></div>To illustrate the policy, let us suppose two BBs A and B:<br>

<br></div>BB A:<br></div>    a = x + y<br><br></div>BB B:<br></div>    b = a * x<br><br></div>In a pseudo machine code, I need to generate this:<br><br></div>BB A:<br></div>    load x;<br></div>    load y;<br></div>    add a, x, y<br>

</div>    store a<br><br></div>BB B:<br></div>    load a;<br></div>    load x;<br></div>    mul b, a, x;<br></div>    store b;<br><br><br></div>Any help is much appreciated!<br><br></div>Thanks,<br>Ronaldo<br></div>