[LLVMdev] load/store in IR without stack/heap

Sungjin Kim trijin77 at gmail.com
Tue Jul 5 11:12:14 PDT 2011


Hi all,

Can anyone give an idea to solve my problem? I'm implementing backend part
using LLVM for my research architecture. The main issue is that this
architecture
cannot use stack/heap. So, all the value should be stored in the register.
Given that architecture, load/store instruction in IR uses virtual register
to load/
store the value. For example:
C source code is:

if(...) {
    a = 1;
}
else {
    a = 0;
}
c = a;

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

;<label>:5
%6 = load i16 *a, align 2
store i16 %6, i16 c

I used getCopyToReg in SelectionDAG for store instruction to store value,
and getCopyFromReg
for load instruction. So, storage values in block '<label>:3' and
'<label>:4' are stored in VR0 and
VR1 respectively. However, load instruction in block '<label>:5' cannot
choose which register
should be read.
Can anybody give an idea to overcome such a case?

Thanks.

Jin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110705/5d4b5182/attachment.html>


More information about the llvm-dev mailing list