Hi all,<br><br>Can anyone give an idea to solve my problem? I'm implementing backend part <br>using LLVM for my research architecture. The main issue is that this architecture<br>cannot use stack/heap. So, all the value should be stored in the register.<br>


Given that architecture, load/store instruction in IR uses virtual register to load/<br>store the value. For example:<br>C source code is:<br><br>if(...) {<br>    a = 1;<br>} <br>else {<br>    a = 0;<br>}<br>c = a;<br><br>


It's IR from the front-end is:<br>...<br>;<label>:3<br>store i16 1, i16 *a, align 2<br>br label %5<br>;<label>:4<br>store i16 0, i16 *a, align 2<br>br label %5<br><br>;<label>:5<br>%6 = load i16 *a, align 2<br>


store i16 %6, i16 c<br><br>I used getCopyToReg in SelectionDAG for store instruction to store value, and getCopyFromReg <br>for load instruction. So, storage values in block '<label>:3' and '<label>:4' are stored in VR0 and <br>
VR1 respectively.

However, load instruction in block '<label>:5' cannot choose which register <br>should be read.<br>Can anybody give an idea to overcome such a case?<br><br>Thanks.<br><br>Jin