[LLVMdev] Question about SPARC target status
Luke K. Dalessandro
luked at cs.rochester.edu
Tue Nov 11 10:48:32 PST 2008
On Tue, 11 Nov 2008, Peter Shugalev wrote:
> Anton Korobeynikov wrote:
>>> I thought llvm-gcc isn't meant to compile for specific target (at least
>>> with -emit-llvm flag I'm using).
>> No, it is not. C language is highly target-specific, thus LLVM IR
>> obtained from such sources also has the same nice 'property'
> I can see only one reason for such dependence: inclusion of system
> headers in /usr/include. If I compile llvm-gcc with predefined set of
> Linux headers (the way cross-compilers are usually made) will the IR
> output be the same no matter which platform is used for compilation?
I had trouble with this too -- I still haven't entirely figured it out.
Try browsing through http://www.gaisler.com/doc/sparc-abi.pdf which is
the SPARC ABI. It explains things like structure padding and stack
layout/function calling. llvm-gcc has to make lots of decisions dependent
on this ABI when converting C/C++ to IR. I imagine that every platform has
its own rules.
The SPARC rules actually seem relatively straightforward.
More information about the llvm-dev