I tried using the mem2reg pass with opt,
e.g. opt -reg2mem x.bc > x2.bc
where x.bc was produced with:
llvm-gcc -O2 -emit-llvm -c x.c -o x.bc
This did not reduce the # of variables in x2.bc
I use -O2 because it produces the least # of instructions and hence the
least # of new SSA virtual registers.
Do you have a set of options to give to llvm-gcc or opt in mind ?
My goal is to take a .c file and obtain a .bc file with the smallest #
(or as small as possible) of variables.
Thanks
Reid Kleckner wrote:>
> LLVM IR is always in SSA form. If you *really* don't want it to be,
> use allocas for everything and then don't run the mem2reg optimization
> pass. This will represent all of your variables as stack locations
> instead of registers, and it will not be SSA.
>
> Reid
>
> On Sat, Sep 26, 2009 at 3:55 PM, ivtm <martinaide1 at yahoo.com>
wrote:
>>
>> I tried the -O0 option and I am still getting output in SSA form:
>>
>> I do:
>> llvm-gcc -O0 -emit-llvm -c x.c -o x.bc,
>>
>> and then:
>>
>> llvm-dis x.bc
>>
>>
>>
>>
>> Anton Korobeynikov-2 wrote:
>>>
>>>> At any rate, is there an option to the llvm-gcc --emit-llvm to
tell it
>>>> to
>>>> produce .bc files that are at least space optimized (or even
better,
>>>> not
>>>> in
>>>> SSA form) ?
>>> Yes, -O0
>>>
>>> --
>>> With best regards, Anton Korobeynikov
>>> Faculty of Mathematics and Mechanics, Saint Petersburg State
University
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/LLVM-SSA-tp25621668p25628356.html
>> Sent from the LLVM - Dev mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
--
View this message in context:
http://www.nabble.com/LLVM-SSA-tp25621668p25628606.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.