[cfe-dev] How to add target to Clang?

Anton Smirnov dev at antonsmirnov.name
Wed Nov 26 11:22:23 PST 2014


Hi, Reid.

Thanks for replying.

I've found Attr.td and Targets.cpp filse to add AVR-specific attributes and
AVR TargetInfo.
You're absolutely right and i should just consult AVR datasheets to write
correct types sizes and so on.

Are there any other files to modufy to add AVR support?

Regards, Anton.


2014-11-26 23:25 GMT+06:00 Reid Kleckner <rnk at google.com>:

> LLVM IR isn't portable, and you will need to teach Clang about your
> target. The two big things it needs to know are record layout rules and
> calling convention lowering rules. Record layout should be easy, it is just
> the size and alignment of basic types like pointers and i64 (4 or 8 byte
> aligned?). Calling convention lowering is tricky, as you need to understand
> the ABI rules for struct passing, and how you implemented them in LLVM.
>
> On Wed, Nov 26, 2014 at 9:13 AM, Anton Smirnov <dev at antonsmirnov.name>
> wrote:
>
>> Hi.
>>
>> I'm working on AVR backend/target and it's almost working:
>> https://github.com/dylanmckay/llvm
>>
>> I've read how to add LLVM backend/Target:
>> http://llvm.org/docs/WritingAnLLVMBackend.html
>>
>> But how can i add target (AVR) to Clang?
>> Is it designed to add targets easily or should i hack the sources?
>>
>> That makes sense as some information is lost at the moment, f.e.
>> attribute:
>> __attribute__ ((section .. ))
>>
>> Regards, Anton.
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141127/e377783e/attachment.html>


More information about the cfe-dev mailing list