Page 1 of 1

LCC Replacement

Posted: Mon Jan 31, 2011 4:03 pm
by Teapot
LCC[1] is the compiler used by Quake 3 [2] (and afaik, all derivatives) to create Q3 assembly. It is non-free software[2][3] because it doesn't allow all four freedoms[4].
Does anyone know of any effort to create a free software alternative? (preferably generating Q3 bytecode/asm, as opposed to replacing the VM)

My knowledge of compilers is limited, but if a suitable replacement does not exist, I will be attempting to create my own (preferably from a derivative of an existing attempt).

[1] http://sites.google.com/site/lccretargetablecompiler/
[2] http://en.wikipedia.org/wiki/LCC_(compiler)
[3] https://github.com/drh/lcc/blob/master/CPYRIGHT
[4] http://www.gnu.org/philosophy/free-sw.html

Re: LCC Replacement

Posted: Mon Jan 31, 2011 4:58 pm
by ^misantropia^
I did some work on a gcc backend in 2005 or 2006 but the results were universally poor. The Q3 VM is stack based while gcc assumes that target architectures have many registers (coincidentally, this is the reason why gcc has trouble producing good i386 code).

Nowadays, I'd probably use LLVM. It's register based like gcc but it uses SSA (static single assignment) and that's easier to transform into stack based operations.

Re: LCC Replacement

Posted: Tue Feb 01, 2011 7:51 am
by Teapot
Thanks for your input. Do you still have the code for your gcc backend?

Re: LCC Replacement

Posted: Tue Feb 01, 2011 9:38 am
by ^misantropia^
Don't think so. I do a full rsync of my home dir when I buy a new laptop and it's not on my current machine.

Re: LCC Replacement

Posted: Tue Feb 01, 2011 9:45 am
by Teapot
Aw, okay. Thanks anyway.