开发者

Make LLVM inline a function from a library

开发者 https://www.devze.com 2022-12-27 19:16 出处:网络
I am trying to make LLVM inline a function from a l开发者_如何学Goibrary. I have LLVM bitcode files (manually generated) that I linked together with llvm-link, and I also have a library (written in

I am trying to make LLVM inline a function from a l开发者_如何学Goibrary.

I have LLVM bitcode files (manually generated) that I linked together with llvm-link, and I also have a library (written in C) compiled into bitcode by clang and archived with llvm-ar. I manage to link everything together and to execute but I can't manage to get LLVM to inline a function from the library. Any clue about how this should be done?


After you link the bitcode files together with the library, do you run an Internalize pass on the linked bitcode? The internalize pass makes all functions (besides main()) static and tells optimizer/code generator that the functions can be safely inlined without keeping a copy available for some (non-existent) external reference.

I manually link my bitcode files and bitcode libraries together using code borrowed from llvm-ld and I do the internalize pass, but I'm not sure if llvm-link does the internalize pass or not.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号