[LLVMdev] load/store in IR without stack/heap
Kangkook Jee
aixer77 at gmail.com
Wed Jul 6 03:50:18 PDT 2011
did you try mem2reg optimization pass?
this transform load/store operations to cheaper operations with virtual registers.
On Jul 5, 2011, at 2:12 PM, Sungjin Kim wrote:
> 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 _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list