-Amir


On Tue, Oct 21, 2014 at 7:51 PM, Markus Timpl <tima0900@googlemail.com> wrote:
You can use llvm-dis to turn .bc files into .ll files.

Am 22.10.2014 01:44 schrieb "Amir H. Ashouri" <amirhossein.ashouri@gmail.com>:
Thanks for the answer John.

I checked the llvm-extract and it works, but my concern is if the output of the extract could be saved as .ll instead of .bc. Sort of human-readable format so that I can parse it. Otherwise, it is better to parse the foo.ll file right away instead of using the extract tool. 

Please correct me if I am wrong.

Thanks,

-Amir

On Tue, Oct 21, 2014 at 7:02 PM, John Criswell <jtcriswel@gmail.com> wrote:
">

(original) (raw)



On Tue, Oct 21, 2014 at 5:22 PM, Amiir H. Ashouri <amirhossein.ashouri@gmail.com> wrote:
Thanks Markus.

Having llvm-as to turn the extracted function.bc file to .ll caused an error saying:


llvm-as is for converting bitcode (.bc) to readable LLVM IR (.ll)
llvm-dis is for the other direction

Eli

llvm-as-3.4: function\_bc:1:1: error: expected top-level entity

BC! #AI29bEBB2I (some more binary)

This error is just the same error that I received while using llvm-extract on a .c file (not .bc or .ll).


Do I have to include other things in the command ? I mean generating a function.ll without anything as header, Module ID, etc might be wrong. right ?


-Amir


On Tue, Oct 21, 2014 at 7:51 PM, Markus Timpl <tima0900@googlemail.com> wrote:

You can use llvm-dis to turn .bc files into .ll files.

Am 22.10.2014 01:44 schrieb "Amir H. Ashouri" <amirhossein.ashouri@gmail.com>:

Thanks for the answer John.

I checked the llvm-extract and it works, but my concern is if the output of the extract could be saved as .ll instead of .bc. Sort of human-readable format so that I can parse it. Otherwise, it is better to parse the foo.ll file right away instead of using the extract tool.

Please correct me if I am wrong.

Thanks,

-Amir

On Tue, Oct 21, 2014 at 7:02 PM, John Criswell <jtcriswel@gmail.com> wrote:
On 10/21/14, 5:27 PM, Amir H. Ashouri wrote:
Hello Everyone,

Just subscribed to the mailing list.

I was wondering how I am going to fetch each functions of a specific source code file (c/c++) using the LLVM framework. For instance, I would like to apply certain passes using llvm-opt on certain functions not the whole file.

I would appreciate any hints or idea leading me about the starting point.

You might be able to use the llvm-extract tool to pull out the functions you want into a separate bitcode file and then use opt to optimize them. You'd then need to create a second bitcode file that contains the remaining functions (using llvm-extract again). Finally, you'd take the optimized bitcode file and the bitcode file containing the other functions and link them together using clang and libLTO or the llvm-link tool.

Regards,

John Criswell


Regards,

-Amir


\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
LLVM Developers mailing list  
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu  
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev  


--   
John Criswell  
Assistant Professor  
Department of Computer Science, University of Rochester  
http://www.cs.rochester.edu/u/criswell


\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev