<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 9:15 AM, Ahmed Taj elsir <span dir="ltr"><<a href="mailto:meedo456123@gmail.com" target="_blank">meedo456123@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks you for help , David.<br>
<br>
Can you briefly  explain this:<br>
<span class="">" Most of the architecture-specific code is in LLVM, away from<br>
anything you'll have to worry about. </span></blockquote><div><br>Most of this is in LLVM's backends - that's where things like CPU instruction set, register files, etc, etc, are - so your frontend doesn't need to know about much of that.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Some stuff ends up leaking up<br>
into your front-end "<br></span></blockquote><div><br>The stuff that you end up having to worry about in the frontend mostly relates to the ABI things I mentioned earlier - knowing that on certain platforms you need to put the function parameters in a certain order/structure so you can interoperate with existing C code, etc.<br><br>If you don't need that interoperability, you don't have to worry about that.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
</span>Thanks again.<br>
<div class="HOEnZb"><div class="h5"><br>
On 2/18/15, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
> On Wed, Feb 18, 2015 at 8:34 AM, Ahmed Taj elsir <<a href="mailto:meedo456123@gmail.com">meedo456123@gmail.com</a>><br>
> wrote:<br>
><br>
>> Hi,<br>
>><br>
>> I'm new in LLVM project , I have to write a compiler frond-end (based<br>
>> on LLVM) in C++ to support my programming language .Am I have to<br>
>> implement support for each architecture or LLVM has libraries  that<br>
>> can do this for me ? (btw I don't want to support architecture that<br>
>> LLVM don't) .<br>
>><br>
><br>
> Most of the architecture-specific code is in LLVM, away from anything<br>
> you'll have to worry about. Some stuff ends up leaking up into your<br>
> front-end, but not much if you're starting with a simple language and don't<br>
> need to interoperate with existing C libraries, for example. (if your<br>
> language needs to be able to call into existing C (or, worse, C++)<br>
> libraries then you'll need to worry about the ABI, and that's a fair amount<br>
> of work/code/knowledge that needs to reside in your frontend)<br>
><br>
><br>
>> does LLVM has helper functions to create objects in heap ?<br>
><br>
><br>
> In your target program? No, there's not much/any help there - you just call<br>
> malloc/free (or op new/delete) in your LLVM IR like you would in a simple C<br>
> program.<br>
><br>
><br>
>> if not is it good idea to use C++11 smart pointer to do memory management<br>
>> operations (at least in the first versions of my language ) ?<br>
>><br>
><br>
> Inside your target program? You won't, presumably, have access to the C++<br>
> standard library in your language so you won't be able to use its<br>
> convenient smart pointers. You can make your own in your new programming<br>
> language, depending on what language features you have to work with.<br>
><br>
> The LLVM Kaleidoscope tutorials might give you some idea of how to get<br>
> started writing a compiler using LLVM.<br>
><br>
> - David<br>
><br>
><br>
>><br>
>> Sorry,if some questions are silly , but I'm still beginner in compiler's<br>
>> world .<br>
>><br>
>> Thanks.<br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
>><br>
><br>
</div></div></blockquote></div><br></div></div>