<div dir="ltr"><div><div>Ahmed,<br><br></div>You do not have to write code for each target architecture. Rather, when you invoke LLVM to generate your code, you specify the requested target. The best way to proceed here is to look at the sources for llc and opt. There is no well-defined API for ahead-of-time code generation, so you'll need to use llc/opt as examples. Be aware that the API will change from release to release. In particular, the change from 3.5.1 to 3.6.0 is significant.<br><br><br></div><div>For my project I call out to my own runtime to perform tasks such as memory allocation. You can't really use C++ smart pointers in your generated code. What you are generating most closely resembles assembly language - you have nothing high-level. Here, I would recommend that you define the interface between your generated code and runtime library in terms of plain C functions using the standard C calling convention. You would then implement your own garbage collector in your runtime. If you don't want to do that, then consider using the Boehm-Demers-Weiser conservative collector. It requires no special support from LLVM.<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 11:34 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">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>
does LLVM has helper functions to create objects in heap ? if not is<br>
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>
Sorry,if some questions are silly , but I'm still beginner in compiler's 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>
</blockquote></div><br></div>