diff --git a/docs/FAQ.html b/docs/FAQ.html index ad08f10cfa2..d94c368d0c7 100644 --- a/docs/FAQ.html +++ b/docs/FAQ.html @@ -87,6 +87,8 @@
  • Can I use LLVM to convert C++ code to C code?
  • +
  • Can I compile C or C++ code to platform-independent LLVM bitcode?
  • + @@ -629,6 +631,31 @@ with standard C++ libraries.

    +
    +

    +Can I compile C or C++ code to platform-independent LLVM bitcode? +

    +
    + +
    + +

    No. C and C++ are inherently platform-dependent languages. The most +obvious example of this is the preprocessor. A very common way that C code +is made portable is by using the preprocessor to include platform-specific +code. In practice, information about other platforms is lost after +preprocessing, so the result is inherently dependent on the platform that +the preprocessing was targetting.

    + +

    Another example is sizeof. It's common for sizeof(long) +to vary between platforms. In most C front-ends, sizeof is expanded +to a constant immediately, thus hardwaring a platform-specific detail.

    + +

    Also, since many platforms define their ABIs in terms of C, and since +LLVM is lower-level than C, front-ends currently must emit platform-specific +IR in order to have the result conform to the platform ABI.

    + +
    +
    Questions about code generated by the GCC front-end