[LLVMdev] question on difference of bitcode between C and C++

Fei Jia j.jiafei at gmail.com
Wed Sep 21 19:01:11 PDT 2011


Hi Bill,

Thanks for reply! I am sorry I didn't express my question clearly.

Examples may explain well. Now I am trying to analyze the data flow of
programs. I first compile the C code to bitcode, and then apply our
algorithm to the bitcode to find the dependency between statements. But as
to C++ code, there are class, vector, reference, I may need to revise my
algorithm to analyze bitcode from C++.

I am trying to find such difference of bitcode between C and C++.

--
Best Regards,
Fei Jia




On Wed, Sep 21, 2011 at 6:26 PM, Bill Wendling <wendling at apple.com> wrote:

> On Sep 21, 2011, at 6:13 PM, Fei Jia wrote:
>
> > Could anybody provide me some links or pages or infos of the difference
> of bitcodes of C and C++? We have implemented an optimization pass on
> bitcode generated from C, and we are trying to find out whether it will work
> on bitcode from C++. Thanks!
> >
> Hi Fei,
>
> There isn't a difference in the bitcode format of a C as opposed to a C++
> program. There are differences in how functions are linked, but that's a
> function of the language and not the bitcode. E.g., if you want to call a C
> function from C++, you need to do this:
>
> extern "C" {
>  void foo();
> }
>
> void bar() {
>  foo();
> }
>
> -bw
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110921/2f130848/attachment.html>


More information about the llvm-dev mailing list