[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] How to add target to Clang?
From:       Anton Smirnov <dev () antonsmirnov ! name>
Date:       2014-11-26 19:22:23
Message-ID: CAE9+sCPJD1idz-xJQCz6XKKDV0FK3McwjXimUN8QfRq3H_FE-A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@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@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@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>

[Attachment #5 (text/html)]

<div dir="ltr">Hi, Reid.<div><br></div><div>Thanks for \
replying.</div><div><br></div><div>I&#39;ve found Attr.td and Targets.cpp filse to \
add AVR-specific attributes and AVR TargetInfo.</div><div>You&#39;re absolutely right \
and i should just consult AVR datasheets to write correct types sizes and so \
on.</div><div><br></div><div>Are there any other files to modufy to add AVR \
support?</div><div><br></div><div>Regards, Anton.</div><div><br></div></div><div \
class="gmail_extra"><br><div class="gmail_quote">2014-11-26 23:25 GMT+06:00 Reid \
Kleckner <span dir="ltr">&lt;<a href="mailto:rnk@google.com" \
target="_blank">rnk@google.com</a>&gt;</span>:<br><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div \
dir="ltr">LLVM IR isn&#39;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.</div><div class="gmail_extra"><br><div \
class="gmail_quote"><div><div class="h5">On Wed, Nov 26, 2014 at 9:13 AM, Anton \
Smirnov <span dir="ltr">&lt;<a href="mailto:dev@antonsmirnov.name" \
target="_blank">dev@antonsmirnov.name</a>&gt;</span> \
wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div \
dir="ltr">Hi.<div><br></div><div><div>I&#39;m working on AVR backend/target and \
it&#39;s almost working:</div><div><a href="https://github.com/dylanmckay/llvm" \
target="_blank">https://github.com/dylanmckay/llvm</a></div></div><div><br></div><div>I&#39;ve \
read how to add LLVM backend/Target:</div><div><a \
href="http://llvm.org/docs/WritingAnLLVMBackend.html" \
target="_blank">http://llvm.org/docs/WritingAnLLVMBackend.html</a><br></div><div><br></div><div>But \
how can i add target (AVR) to Clang?</div><div>Is it designed to add targets easily \
or should i hack the sources?</div><div><br></div><div>That makes sense as some \
information is lost at the moment, f.e. attribute:</div><div>__attribute__ ((section \
.. ))<br></div><div><br></div><div>Regards, Anton.</div><div><br></div></div> \
<br></div></div>_______________________________________________<br> cfe-dev mailing \
list<br> <a href="mailto:cfe-dev@cs.uiuc.edu" \
target="_blank">cfe-dev@cs.uiuc.edu</a><br> <a \
href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" \
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br> \
<br></blockquote></div><br></div> </blockquote></div><br></div>



_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic