[LLVMdev] Adding Intrinsics for custom processor (frotend problem)

Chris Lattner clattner at apple.com
Sun Mar 8 21:14:33 PDT 2009


On Mar 4, 2009, at 1:03 AM, Gil Dogon wrote:

> Chris Lattner wrote:
>> As others have mentioned, hacking the front-end isn't that hard.  In
>> any case though, please be aware that a precompiled binary for a non-
>> MIPS target won't produce correct code if you are (for example) using
>> an x86 front-end and forcing llc to generate mips code with llc -
>> march=mips.  The front-end does type layout and knows very ABI things
>> that have to be right for mips.
>>
>> -Chris
>>
>>
> Thanks for your reply Chris.
> I would still like to use the 'standard' precompiled binary for llvm- 
> gcc
> front end unless its really impossible.

If you want 100% correctness, it is.

> Actually I thought that the
> whole idea of LLVM was to have an abstract middle level so that front
> end does not have to know 'very ABI things' :-) .

Yes it is.  LLVM continues to keep getting better in that respect, but  
at the end of the day, LLVM is defined to be independent of source  
language and ABIs are typically defined in terms of C.  There is a  
many to one mapping between C constructs and LLVM IR, so things that  
depending on the distinctions in C cannot currently be regurgitated by  
the code generator.

> Actually, the strategy of using only the precompiled binary front end
> worked for us satisfactorily in our previous processor iteration, a  
> very
> non-standard stack machine architecture so I doubt we would have an
> insurmountable problem doing the same now, with the new little endian
> MIPS like architecture.

If you don't care about the ABI (because you compile everything with  
llvm) and don't care about processor predefines (e.g. __i386__) then  
you can probably get a way with this.

-Chris



More information about the llvm-dev mailing list