Hi All, 2 of my summer interns (Aimee Dipietro and Greg Simpson) used their time over the summer to resurrect the LLVM C Backend: https://github.com/draperlaboratory/llvm-cbe Improvements include recovery of simple for/while loops (instead of goto), better variable naming, inline asm support, and making it work on a more recent version of llvm. I believe they used the repository here as a starting point: https://github.com/glycerine/llvm/tree/cbe_revival Feedback is welcomed. I would like to see this feature put back into LLVM, and any help on how to make that happen would be appreciated. Thanks, -Rick -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140818/df5cf6e8/attachment.html>
On Mon, Aug 18, 2014 at 7:18 AM, Carback, Richard T., III <rcarback at draper.com> wrote:> Hi All, > > > > 2 of my summer interns (Aimee Dipietro and Greg Simpson) used their time > over the summer to resurrect the LLVM C Backend: > > > > https://github.com/draperlaboratory/llvm-cbe > > > > Improvements include recovery of simple for/while loops (instead of goto), > better variable naming, inline asm support, and making it work on a more > recent version of llvm. I believe they used the repository here as a > starting point: > > > > https://github.com/glycerine/llvm/tree/cbe_revival > > > > Feedback is welcomed. I would like to see this feature put back into LLVM, > and any help on how to make that happen would be appreciated.While I've no particular dog in this race, I will say that the usual objection/point of contention here is: who will maintain it? It was removed because it was bitrotting and unmaintained. Given the burden it places on active developers to fix API changes, etc, in it, there's a general expectation that whoever wants this feature must be actively contributing to the project to, in some sense, pay in kind for the work that will be necessary on the part of others over time. - David
> -----Original Message----- > From: David Blaikie [mailto:dblaikie at gmail.com] > Sent: Monday, August 18, 2014 10:58 AM > To: Carback, Richard T., III > Cc: llvmdev at cs.uiuc.edu > Subject: Re: [LLVMdev] C Backend Ressurected >(snip)> While I've no particular dog in this race, I will say that the usual > objection/point of contention here is: who will maintain it?I'm happy to sign up to do it.
On Mon, Aug 18, 2014 at 9:18 PM, Carback, Richard T., III < rcarback at draper.com> wrote:> Hi All, > > > > 2 of my summer interns (Aimee Dipietro and Greg Simpson) used their time > over the summer to resurrect the LLVM C Backend: > > > > https://github.com/draperlaboratory/llvm-cbe > > > > Improvements include recovery of simple for/while loops (instead of goto), > better variable naming, inline asm support, and making it work on a more > recent version of llvm. I believe they used the repository here as a > starting point: > > > > https://github.com/glycerine/llvm/tree/cbe_revival > > > > Feedback is welcomed. I would like to see this feature put back into LLVM, > and any help on how to make that happen would be appreciated. >would you mind explaining what this backend is for, and its applications? i guess it is to get the C code at the output of the backend, but dont get why we need it. thanks, Jun -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140819/4656b38d/attachment.html>
I don't know how good it is, but the applications seem obvious. e.g. compiling programs in any of a number of original formats to run natively on CPUs that have a working simple C compiler (maybe only K&R or C89) but don't have an LLVM back end. The source program could be in modern C, C++, or any other high level language or assembly language with a translator to LLVM. On Tue, Aug 19, 2014 at 1:40 PM, Jun Koi <junkoi2004 at gmail.com> wrote:> > > > On Mon, Aug 18, 2014 at 9:18 PM, Carback, Richard T., III < > rcarback at draper.com> wrote: > >> Hi All, >> >> >> >> 2 of my summer interns (Aimee Dipietro and Greg Simpson) used their time >> over the summer to resurrect the LLVM C Backend: >> >> >> >> https://github.com/draperlaboratory/llvm-cbe >> >> >> >> Improvements include recovery of simple for/while loops (instead of >> goto), better variable naming, inline asm support, and making it work on a >> more recent version of llvm. I believe they used the repository here as a >> starting point: >> >> >> >> https://github.com/glycerine/llvm/tree/cbe_revival >> >> >> >> Feedback is welcomed. I would like to see this feature put back into >> LLVM, and any help on how to make that happen would be appreciated. >> > > would you mind explaining what this backend is for, and its applications? > > i guess it is to get the C code at the output of the backend, but dont get > why we need it. > > thanks, > Jun > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140819/46632a32/attachment.html>
Dear LVVM developers, On Monday, August 18, 2014 14:18:51 Carback, Richard T., III wrote:> 2 of my summer interns (Aimee Dipietro and Greg Simpson) used theirtime> over the summer to resurrect the LLVM C Backend:> https://github.com/draperlaboratory/llvm-cbe > > Improvements include recovery of simple for/while loops (instead ofgoto),> better variable naming, inline asm support, and making it work on amore> recent version of llvm. I believe they used the repository here as a > starting point:> https://github.com/glycerine/llvm/tree/cbe_revival > > Feedback is welcomed. I would like to see this feature put back intoLLVM,> and any help on how to make that happen would be appreciated.I would like to ask you about phase of development Last summer I was to try to do about the same but I was to to some else academic projects istead My work was trial to port CBackend for LLVM3.3 or later and I was to mention four stages 1. To be able to compile CBackend form LLVM 2.9 for new LLVM- that was finished 2. To be able to run CBackend to produce output - I was not finished, yet because of segfaults 3. To be able to run CBackend to produce compilable output - not started 4. To be able to run CBackend to produce compilable and correctly working output - not started I wish you to finish $th stage as soon as possible My idea was to use CBackend to analyze code from several languages using C language LLVM based analysis tools. Your work is great information for me. McSema make my iodea more usable A New Program Exists To Translate x86 Machine Code Into LLVM Bitcode Compiler Published on 11 August 2014 08:18 AM EDT Written by Michael Larabel in Compiler McSema has been officially open-sourced as an advanced program for translating x86 machine code into LLVM bitcode. McSema is the latest program trying to allow taking x86 binaries and turning them back into LLVM bitcode. http://www.phoronix.com/scan.php?page=homeom/scan.php?page=home I look forward hearing from you Yours faithfully Peter Fodrek -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140819/1bf17660/attachment.html>
Hi Rick, Good to see that you've got it working this far! I've added a link to your repository from my old page that listed the patches that went into what became your starting point. Cheers, Roel On 18/08/14 16:18, Carback, Richard T., III wrote:> Hi All, > > 2 of my summer interns (Aimee Dipietro and Greg Simpson) used their time > over the summer to resurrect the LLVM C Backend: > > https://github.com/draperlaboratory/llvm-cbe > > Improvements include recovery of simple for/while loops (instead of > goto), better variable naming, inline asm support, and making it work on > a more recent version of llvm. I believe they used the repository here > as a starting point: > > https://github.com/glycerine/llvm/tree/cbe_revival > > Feedback is welcomed. I would like to see this feature put back into > LLVM, and any help on how to make that happen would be appreciated. > > Thanks, > > -Rick > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On 18 August 2014 15:18, Carback, Richard T., III <rcarback at draper.com> wrote:> Hi All, > > 2 of my summer interns (Aimee Dipietro and Greg Simpson) used their time > over the summer to resurrect the LLVM C Backend: > > https://github.com/draperlaboratory/llvm-cbe > > Improvements include recovery of simple for/while loops (instead of goto), > better variable naming, inline asm support, and making it work on a more > recent version of llvm. I believe they used the repository here as a > starting point: > > https://github.com/glycerine/llvm/tree/cbe_revival > > Feedback is welcomed. I would like to see this feature put back into LLVM, > and any help on how to make that happen would be appreciated. > >I am not sure implementing a C backend is really what you want. LLVM IR is in SSA CFG form. I would have thought that the next step would have been trying to convert it into AST, i.e. The format CLANG uses. Once it is in AST, it is trivial to output in C or whatever other language/format you wish. I know going from CFG to AST is hard, but I think that would be a better problem to solve. As building AST from CFG is very different from building a C backend, I would have though that it might have been good to use LLVM as a library to read the LLVM IR format, manipulate the CFG into other forms that are more AST friendly, and then write your own classes to then convert that to AST. Once in AST form, you could then use existing refactoring tools to then output more readable C source code. Well, that is just my idea, I am currently writing a tool to go from Binary to LLVM IR. Once I have that done, I was going to do the next tool to go from LLVM IR to AST. Kind Regards James
James - you should check out fracture (Binary -> LLVM IR open source project): https://github.com/draperlaboratory/fracture Another tool of this type is McSema: https://github.com/trailofbits/mcsema And yet another is Dagger: http://dagger.repzret.org/ I'm biased towards the first as it's mine, and I know we're looking for contributors! Thanks, -R> -----Original Message----- > From: James Courtier-Dutton [mailto:james.dutton at gmail.com] > Sent: Wednesday, September 03, 2014 5:13 PM > To: Carback, Richard T., III > Cc: llvmdev at cs.uiuc.edu > Subject: Re: [LLVMdev] C Backend Ressurected > > On 18 August 2014 15:18, Carback, Richard T., III <rcarback at draper.com> > wrote: > > Hi All, > > > > 2 of my summer interns (Aimee Dipietro and Greg Simpson) used their > > time over the summer to resurrect the LLVM C Backend: > > > > https://github.com/draperlaboratory/llvm-cbe > > > > Improvements include recovery of simple for/while loops (instead of > > goto), better variable naming, inline asm support, and making it work > > on a more recent version of llvm. I believe they used the repository > > here as a starting point: > > > > https://github.com/glycerine/llvm/tree/cbe_revival > > > > Feedback is welcomed. I would like to see this feature put back into > > LLVM, and any help on how to make that happen would be appreciated. > > > > > I am not sure implementing a C backend is really what you want. > LLVM IR is in SSA CFG form. > I would have thought that the next step would have been trying to > convert it into AST, i.e. The format CLANG uses. > Once it is in AST, it is trivial to output in C or whatever other > language/format you wish. > I know going from CFG to AST is hard, but I think that would be a better > problem to solve. > As building AST from CFG is very different from building a C backend, I > would have though that it might have been good to use LLVM as a library > to read the LLVM IR format, manipulate the CFG into other forms that are > more AST friendly, and then write your own classes to then convert that > to AST. > Once in AST form, you could then use existing refactoring tools to then > output more readable C source code. > > Well, that is just my idea, I am currently writing a tool to go from > Binary to LLVM IR. Once I have that done, I was going to do the next > tool to go from LLVM IR to AST. > > Kind Regards > > James