[LLVMdev] About register allocation

Jakob Stoklund Olesen stoklund at 2pi.dk
Sat Jan 15 19:22:46 PST 2011


On Jan 15, 2011, at 7:15 PM, Qingan Li wrote:

> I have tested the register allocation in llvm, using: $llc -debug test.bc
> where, test.c is like:
> 
>         int a, b, c, d, x;
>         a = 3;
>         b = 5;
>         d = 4;
>         x = 100;
>         if ( a > b ) 
>         ......

>  It seems only variables named "reg<num>" are allocated into registers. My problem is, why not allocate the local variables "a", "b", .etc into registers instead of into stack frame? Is there any problem for allocating "a" into register file rather than stack frame with offset of 2? 

You need to optimize your bitcode first, llc doesn't do that.

Run the bitcode through "opt -O2", or create it with "llvm-gcc -O2 -emit-llvm".

/jakob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110115/2ec71e37/attachment.bin>


More information about the llvm-dev mailing list