Compiler should use LLVM #13

Closed
opened 2026-01-21 12:49:36 +11:00 by SpookyDervish · 2 comments
Member

This is better than raw assembly because:

  1. LLVM can optimize code
  2. LLVM's backend can help you write cleaner coe
  3. it's funny that gorund is an IR which gets compiled to an IR lmao
  4. LLVM can compile to any platform

ut it's not better in all ways too:

  1. LLVM can be slow
  2. Everytime you make a new feature you have to figure out the LLVM syntax to add it (less control)
  3. It may be overkill for what's pretty much an assembly language with a bunch of extra features
  4. You don't learn ASM (and LLVM is less cool than writing your own compiler)

(writing this while on break at work lmao)

This is better than raw assembly because: 1. LLVM can optimize code 2. LLVM's backend can help you write cleaner coe 3. it's funny that gorund is an IR which gets compiled to an IR lmao 4. LLVM can compile to any platform ut it's not better in all ways too: 1. LLVM can be slow 2. Everytime you make a new feature you have to figure out the LLVM syntax to add it (less control) 3. It may be overkill for what's pretty much an assembly language with a bunch of extra features 4. You don't learn ASM (and LLVM is less cool than writing your own compiler) (writing this while on break at work lmao)
SpookyDervish added reference unstable 2026-01-21 12:49:52 +11:00
SpookyDervish added the enhancement label 2026-01-21 12:50:32 +11:00
Author
Member

at the end of the day its good and bad in different ways so ill leave it up to you

at the end of the day its good and bad in different ways so ill leave it up to you
Owner

Me personally I don't like LLVM very much. Generating ASM seems to work well so far and it compiles very fast.

Also doing "code -> ir -> another ir -> assembly" rather than "code -> ir -> assembly" seems weird

Another thing: Name an alternative to LLVM. I can think of only one (QBE). We should give LLVM some more competition. We may not be able to optimize to their extent, but we can make it easier to use. Ground's bytecode generation API is much more user-friendly than LLVM's generation API, which could mean in future we compete with LLVM which would be fun

Maybe in future we can add an LLVM backend but not today. Today is the day for assembly it seems.

Me personally I don't like LLVM very much. Generating ASM seems to work well so far and it compiles very fast. Also doing "code -> ir -> another ir -> assembly" rather than "code -> ir -> assembly" seems weird Another thing: Name an alternative to LLVM. I can think of only one (QBE). We should give LLVM some more competition. We may not be able to optimize to their extent, but we can make it easier to use. Ground's bytecode generation API is much more user-friendly than LLVM's generation API, which could mean in future we compete with LLVM which would be fun Maybe in future we can add an LLVM backend but not today. Today is the day for assembly it seems.
max closed this issue 2026-01-21 15:26:54 +11:00
Sign in to join this conversation.