And of course I will tak a look into <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)"> </span><a href="http://llvm.org/docs/WritingAnLLVMBackend.html" target="_blank" style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:13.333333969116211px;background-color:rgb(255,255,255)">http://llvm.org/docs/WritingAnLLVMBackend.html</a> - I have somehow overlooked that document.<br>
<br><div class="gmail_quote">2012/11/21 Wojciech Daniło <span dir="ltr"><<a href="mailto:wojtek.danilo.ml@gmail.com" target="_blank">wojtek.danilo.ml@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I will take a look into <span style="color:rgb(34,34,34);font-size:13.333333969116211px;font-family:arial,sans-serif">NVPTX.</span><div><font color="#222222" face="arial, sans-serif"><br></font><div>
<font color="#222222" face="arial, sans-serif">I don't want to </font><span style="color:rgb(34,34,34);font-size:13.333333969116211px;font-family:arial,sans-serif">deconstruct C++ classes to generate Python code - I want to generate Python backend :)</span></div>

<div><font color="#222222" face="arial, sans-serif">Its purpose is to be able to generate Python code from LLVM IR code (not C++ code! - C++ code is needed for me only to get a sample IR code).</font></div><div><font color="#222222" face="arial, sans-serif"><br>

</font></div><div><font color="#222222" face="arial, sans-serif">I want to write my custom compiler in the future and I want to be able to output Python code from it (of course not only Python code - I want to be able to output IR or bytecode also), so I though that writing Python Backend (as a function pass) is the best solution. Am I wrong?<br>

</font><div><div class="h5"><br><div class="gmail_quote">2012/11/21 Eli Bendersky <span dir="ltr"><<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div>> ----------------------------------------------------------------------------------<br>
> 2)<br>
> Maybe this question I will answer myself by analising some examples you'll<br>
> provide as answer to the first question, but maybe it will worth asking it<br>
> now.<br>
> So I want to know when to generate a class in Python. So far I know, that in<br>
> LLVM there are no classes, only functions, but when using the online LLVM<br>
> generator I can see, that when generating IR from C++ code, the "class"<br>
> keyword is stored inside of name (or something like name) of function:<br>
><br>
> #include <stdio.h><br>
> #include <stdlib.h><br>
> class X{<br>
> public:<br>
> void f();<br>
> };<br>
> void X::f() { printf("inside f");}<br>
> int main() {  X x;  x.f();}<br>
><br>
> translates into:<br>
><br>
> [...]<br>
><br>
> define void @_ZN1X1fEv(%class.X* nocapture %this) nounwind uwtable align 2 {<br>
>   %1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x<br>
> i8]* @.str, i64 0, i64 0))<br>
>   ret void<br>
> }<br>
><br>
> [...]<br>
><br>
><br>
> How can I access it inside of my function Pass to get know if it was class<br>
> or not?<br>
<br>
</div></div>Why do you need to deconstruct C++ classes to generate Python code<br>
from LLVM IR? What will you gain from that?<br>
<div><br>
> 3)<br>
><br>
> Is there any manual that will help me discover all these advanced LLVM<br>
> features needed to write such backend? I have read LLVM Kaleidoscope<br>
> tutorials, some LLVM tutorials from IBM and lot of articles, but I still<br>
> feel that I have not knowledge enough.<br>
<br>
</div>I hope you ran into <a href="http://llvm.org/docs/WritingAnLLVMBackend.html" target="_blank">http://llvm.org/docs/WritingAnLLVMBackend.html</a><br>
<span><font color="#888888"><br>
Eli<br>
</font></span></blockquote></div><br></div></div></div></div>
</blockquote></div><br>