I'm very interested in this patch. Could you, Roel, upload it somewhere or maybe put your code to github or something simmilar?<div><br><div>Additional - you're fixing it - could you please provide a little more information - what should I read to get more informations about writing not hardware but software backend in LLVM? (Of course the code analysis is one way, but maybe there is other also).</div>
<div><br><br><div class="gmail_quote">2012/11/21 Roel Jordans <span dir="ltr"><<a href="mailto:r.jordans@tue.nl" target="_blank">r.jordans@tue.nl</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">Hi,<br>
<br>
I have a version of the old CBackend which is working with the current<br>
trunk.<br>
<br>
I am in the progress of rewriting it into a new version but that project<br>
is not going as fast as I would hope as I have been distracted by other<br>
tasks with higher priority lately.<br>
<br>
Anyway, for those interested, I can provide patches, optionally<br>
separated into several parts (core, testing, misc).<br>
<br>
I am afraid that the main patch is larger than the LLVM mailing lists<br>
allows me to send over the list directly<br>
<br>
Cheers,<br>
 Roel<br>
<br>
On 21/11/12 00:46, Wojciech Dani³o wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi!<br>
I'm trying to write LLVM Python Backend (to generate Python code out of<br>
LLVM IR)<br>
I'm still learning LLVM and for now it is very hard to me to even create<br>
simple taksk. I want you to ask 3 questions:<br>
<br>
------------------------------<u></u>------------------------------<u></u>----------------------<br>
1)<br>
  I want to base on some existing code to learn how it was build. I<br>
wanted to base on CBackend (which is no longer available from LLVM 3.0<br>
up) and of course it does not compile with LLVM 3.2 - giving a lot of<br>
errors:<br>
(the code is taken from source of LLVM 3.0 and put into<br>
$LLVMSRC/projects/<copy of sample project>/lib/Target/CBackend - I hope<br>
this is good method to do it)<br>
<a href="http://pastebin.com/dkbJWpgP" target="_blank">http://pastebin.com/dkbJWpgP</a><br>
Does anybody have this example working under LLVM3.2? I have found on<br>
some old mailing lists that CBackend was never working as  it should but<br>
it was working for some simple examples - I'm looking for somethingl ike<br>
that in LLVM 3.2.<br>
If not, what is the best minimal example I can base onto writing my backend?<br>
<br>
------------------------------<u></u>------------------------------<u></u>----------------------<br>
2)<br>
Maybe this question I will answer myself by analising some examples<br>
you'll provide as answer to the first question, but maybe it will worth<br>
asking it now.<br>
So I want to know when to generate a class in Python. So far I know,<br>
that in LLVM there are no classes, only functions, but when using the<br>
online LLVM generator I can see, that when generating IR from C++ code,<br>
the "class" keyword is stored inside of name (or something like name) of<br>
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  uwtablealign  2 {<br>
   %1 =tail  call  i32  (i8*, ...)* @printf(i8*getelementptr  inbounds ([9 xi8]* @.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 or not?<br>
<br>
<br>
<br>
------------------------------<u></u>------------------------------<u></u>----------------------<br>
<br>
3)<br>
<br>
<br>
Is there any manual that will help me discover all these advanced LLVM features needed to write such backend? I have read LLVM Kaleidoscope tutorials, some LLVM tutorials from IBM and lot of articles, but I still feel that I have not knowledge enough.<br>

<br>
<br>
<br>
Thank you :)<br>
<br>
<br>
</blockquote>
<br>
<br></div></div><div class="HOEnZb"><div class="h5">
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">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/<u></u>mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div></div>