You are of course right. I wanted to output "good looking" Python code though. (if its possible) I see that NVPTX backend is really big project. Is there any hello world "common codegen infrastructure"? 2012/11/21 Eli Bendersky <eliben at google.com>> On Tue, Nov 20, 2012 at 4:10 PM, Wojciech Daniło > <wojtek.danilo.ml at gmail.com> wrote: > > I will take a look into NVPTX. > > > > I don't want to deconstruct C++ classes to generate Python code - I want > to > > generate Python backend :) > > 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). > > > > 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? > > What I was trying to say is that I don't see why you need Python > classes in the generated code. LLVM IR is much lower than the concept > of classes, so if you want to translate it to some executable form > (such as Python) you don't need classes there. Functions to represent > IR functions should be enough. > > Eli >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121121/08a25ae2/attachment.html>
On Tue, Nov 20, 2012 at 4:23 PM, Wojciech Daniło <wojtek.danilo.ml at gmail.com> wrote:> You are of course right. I wanted to output "good looking" Python code > though. > (if its possible) >Good looking Python code means no classes when you don't need classes, but this is getting off-topic. Putting that aside for a moment, I'm not sure why you would want to generate Python source from LLVM IR at all. But if you want to go that way, looking at the defunct C backend will be useful even as a code reference (I mean, if you can't get it to actually work with trunk LLVM). Eli
Maybe you're right with the Python code generation without classes. I need this because I want to write compiler with multi output language support (LLVM has got the javascript backend, so why not Python one?) It seems that http://llvm.org/docs/WritingAnLLVMBackend.html is strongly focused on hardware backend writing (registers, target machine architecture, assembly instructions etc) - so it will be not suitable for writing Python backend. I know that this code could be usefull as code reference, but I stuck on the beginning, so I would love to have a really "minimal working version of it" to mess with it :) 2012/11/21 Eli Bendersky <eliben at google.com>> On Tue, Nov 20, 2012 at 4:23 PM, Wojciech Daniło > <wojtek.danilo.ml at gmail.com> wrote: > > You are of course right. I wanted to output "good looking" Python code > > though. > > (if its possible) > > > > Good looking Python code means no classes when you don't need classes, > but this is getting off-topic. Putting that aside for a moment, I'm > not sure why you would want to generate Python source from LLVM IR at > all. But if you want to go that way, looking at the defunct C backend > will be useful even as a code reference (I mean, if you can't get it > to actually work with trunk LLVM). > > Eli >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121121/cd14aefd/attachment.html>