Results 1 to 7 of 7

Thread: The C Back-End To LLVM Is Back To Being Revived

  1. #1
    Join Date
    Jan 2007
    Posts
    14,305

    Default The C Back-End To LLVM Is Back To Being Revived

    Phoronix: The C Back-End To LLVM Is Back To Being Revived

    Work on the C back-end to LLVM has been resurrected with hopefully a brighter future ahead...

    http://www.phoronix.com/vr.php?view=MTE2OTg

  2. #2
    Join Date
    Jan 2010
    Posts
    87

    Default GCC

    Since gcc is now being written in C++ it will no longer be possible to compile it on platforms that only have a C compiler (although cross compiling may be possible). This leads to the possibility of gcc being ported to some platforms by compiling it with llvm to C, and then using that C output to bootstrap the compilation of gcc!

  3. #3
    Join Date
    Oct 2010
    Posts
    85

    Default

    Quote Originally Posted by grotgrot View Post
    Since gcc is now being written in C++ it will no longer be possible to compile it on platforms that only have a C compiler (although cross compiling may be possible). This leads to the possibility of gcc being ported to some platforms by compiling it with llvm to C, and then using that C output to bootstrap the compilation of gcc!
    That ... could actually work. It's simultaneously a horrid hack, rather neat, and has a historical precedent (at least one ancient C++ compiler translated to C and passed that to an existing C compiler).


    I do wonder what performance one would get out of a llvm → C → gcc pipeline, too... worth testing at some later point, though I don't expect anything earth-shattering.

  4. #4
    Join Date
    Jan 2010
    Posts
    87

    Default

    If you want to put gcc on a new machine you have to compile it 3 times.

    1. Compile gcc using the platform compiler. No optimizations and assumption that the platform compiler can't be trusted that much
    2. Compile gcc with the stage 1 binary. Again no optimisations, but at least gcc has been compiled with gcc.
    3. Compile gcc with stage 2 which can now be trusted, full optimizations


    The problem is that gcc now requires stage 1 compilation to be possible with a C++ compiler.

  5. #5
    Join Date
    Oct 2010
    Posts
    85

    Default

    Quote Originally Posted by grotgrot View Post
    The problem is that gcc now requires stage 1 compilation to be possible with a C++ compiler.
    We know - that was sort of the point of wondering if stage one could be "use llvm to compile the relevant parts of gcc to plain C, then feed that to the system C compiler".

  6. #6
    Join Date
    Nov 2009
    Location
    Madrid, Spain
    Posts
    398

    Default

    Quote Originally Posted by dnebdal View Post
    We know - that was sort of the point of wondering if stage one could be "use llvm to compile the relevant parts of gcc to plain C, then feed that to the system C compiler".
    You may try to see the bookkeeping code size of your final code! As C describes fairly well what the final processor does, you can see if your code is really efficient or has a lot of hidden copying, conversions and stuff as such.
    Another use I think is for projects like Mono: they are in need to generate C# wrappers starting from C++ ones. Maybe if the C generated code header generates C#-friendly code, it may be a way for a lot of languages that work in a VM with a C based interface: Python, Java, C# to import C++ interface of C++ libraries of physics, big frameworks like Qt, extensions for Firefox (they will likely need just C++ soon, as the new JS/GC implementations will make use of it).

  7. #7
    Join Date
    Oct 2007
    Location
    OH, USA
    Posts
    33

    Cool dropping support wrong originally!

    The C back-end was one of the most unique LLVM features, it should have never been dropped originally! I was literally fuming when I heard it was dropped, thank god it's coming back.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •