diff options
| author | Dan Gohman <gohman@apple.com> | 2009-02-10 17:26:53 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-02-10 17:26:53 +0000 |
| commit | 1093e9a02187797610e9678312170f061278defb (patch) | |
| tree | 2ad74d7d9c0e0f4376e274d27110a01f609d6ed9 /llvm/docs/FAQ.html | |
| parent | 9403cd6d85d581dcead55ab56114830fa8f0652d (diff) | |
| download | bcm5719-llvm-1093e9a02187797610e9678312170f061278defb.tar.gz bcm5719-llvm-1093e9a02187797610e9678312170f061278defb.zip | |
Answer a common FAQ:
"Can I compile C or C++ code to platform-independent LLVM bitcode?"
llvm-svn: 64222
Diffstat (limited to 'llvm/docs/FAQ.html')
| -rw-r--r-- | llvm/docs/FAQ.html | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/docs/FAQ.html b/llvm/docs/FAQ.html index ad08f10cfa2..d94c368d0c7 100644 --- a/llvm/docs/FAQ.html +++ b/llvm/docs/FAQ.html @@ -87,6 +87,8 @@ <li><a href="#translatecxx">Can I use LLVM to convert C++ code to C code?</a></li> + <li><a href="#platformindependent">Can I compile C or C++ code to platform-independent LLVM bitcode?</a></li> + </ol> </li> @@ -629,6 +631,31 @@ with standard C++ libraries.</p> </div> +<div class="question"> +<p> +<a name="platformindependent">Can I compile C or C++ code to platform-independent LLVM bitcode?</a> +</p> +</div> + +<div class="answer"> + +<p>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.</p> + +<p>Another example is <tt>sizeof</tt>. It's common for <tt>sizeof(long)</tt> +to vary between platforms. In most C front-ends, <tt>sizeof</tt> is expanded +to a constant immediately, thus hardwaring a platform-specific detail.</p> + +<p>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.</p> + +</div> + <!-- *********************************************************************** --> <div class="doc_section"> <a name="cfe_code">Questions about code generated by the GCC front-end</a> |

