[LLVMdev] Question about SPARC target status

Chris Lattner clattner at apple.com
Tue Nov 11 11:01:23 PST 2008


On Nov 11, 2008, at 10:48 AM, Luke K. Dalessandro wrote:

> On Tue, 11 Nov 2008, Peter Shugalev wrote:
>
>> Hi,
>>
>> 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.

I'd expect llvm-gcc to get the structure layout rules "for free".  You  
could write some testcases to verify this.  The case that requires a  
bit of work are the various parameter passing cases if there is  
weirdness.  When I was working on the sparc backend, just about  
everything was passing in llvm-test, so I think it is pretty close to  
good.

-Chris



More information about the llvm-dev mailing list