[M3devel] use of LLVM

Hendrik Boom hendrik at topoi.pooq.com
Tue May 22 05:32:16 CEST 2012


On Fri, May 18, 2012 at 06:16:59PM +0100, Daniel Alejandro Benavides D. wrote:
> Hi all:
> After ESC we do need much debugger at all, in fact it was designed for that for avoiding put much time on it.
> Still if we generate C is for super-optimization (but verified also mechanically), so I don't mind that, but for code quality I prefer C, I agree absolutely in that we should support it again for that purpose (as originally).
> As for not verified code we should stick with C--, as it is written for that purposes, but for portability specially with implicit safety.
> And for not verified nor optimal and not common use code (like mentor) we should make them source packages (in fact If they are written in Obliq we don't want to redistribute that as non-source), instead part of m3-demo package subdirectory or so.
> I think for M3CG is that we need a LLVM or so back-end for JIT.

The problem I had with LLVM for Algol 68 was that I couldn't use a type 
before it was completely defined.  THis means that there are stark 
constraints on the use of incomplete types.  I wanted to build a 
structure to represent a stack frame, containing local variables and 
the like, and having the field offsets afailable for type descriptors 
for the garbage collector.  But even though LLVM could have computed 
field offsets along the way, as they were contributed to the structure, 
instead it decided to diallow all use of the structure until its 
definition was complete.  UNfortunately, I didn't know what all the 
fields would be until I got to finish generating the code that used the 
stack frame.

This was a restriction in using LLVM as a JIT.  You get to build the 
LLVM abstract syntax in pretty well any order you want, sticking extra 
bits in here, there, everywhere, except for this one bizarre 
restriction.  I have to build all the abstract syntax for a type 
definition before I can refer to any of it elsewhere in the parse tree.  
Well, thare are a few exceptions for defining recursive types, but they 
don't do enough to make this work.

It's different when writing LLVM code as an ASCII text file.  Then you 
can write out the type definitions on one file and the code that uses 
then in an other file, and cocatenate them before passing them too 
LLVM.

Mind you that's not a lot worse than in C--, where you *have* to write 
out text file (and I do write it out of order).  But it irks to 
have the entire LLVM JIT interface reduced to uselessness.  At least 
with C-- you're not *expecting* to get a JIT.

-- hendrik



More information about the M3devel mailing list