Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    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!

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment


        • #5
          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".

          Comment


          • #6
            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).

            Comment


            • #7
              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.

              Comment

              Working...
              X