[LLVMdev] A number of newbie questions

Marcel Weiher marcel at metaobject.com
Sun Jan 8 16:43:42 PST 2006


Hi,

I am currently experimenting with LLVM to provide native code  
compilation services for a project of mine I call Objective- 
Smalltalk, and so far quite pleased with the results.  I was able to  
JIT-compile some functions that send Objective-C messages, and now  
look forward to compiling full methods.

I do have a couple of questions that I haven't been able to answer  
after looking through what I think is the available documentation:

1.	Executable size

Executables appear to be gargantuan, a framework that wraps the parts  
required for the above functionality weighs in at 13 MB fully  
stripped ( -x ) and at 72 MB (!) with debugging symbols.  Is there  
any way of significantly reducing this size, at present or planned in  
the future?

2.	Global (Function) naming

It appears that I have to give 'functions' a global/module visible  
name in order to create them, which is a bit odd for the case of  
compiling methods, as their "name" is really more a function of where  
they get stuffed in the method table of the class in question,  
something I might not even know at the time I am compiling the  
method.  Also these names seem to actually exist in the global  
function/symbol namespace of the running program, or at least  
interact with it.

I currently just synthesize a dummy name from the address of the  
object in question, but that's really a bit of a hack.  Is there some  
way of interacting with LLVM without having to interact with this  
global namespace?

3.	Modules / JITs / functions

As far as I can tell, I need a 'Module' in order to create a  
function, at least that's the only way I've been able to make it work  
so far, but I am not really clear why this should be the case.  Of  
course, I also need this Module to create the JIT (or do I?).  I've  
now made the Module (or rather my wrapper) a singleton, effectively a  
global, but I don't feel very comfortable about it.   Also, I also  
remember some issues with not being able to create a second JIT  
later, so it seems like one module per lifetime of a process that  
wants to do jitting.

Is this correct or am I missing something?

4.	Jitted functions / ownership / memory

Once a function is jitted I can get a function pointer to it and call  
it, that's great.  Can I also find out how long it is, for example if  
I wanted to write an object file?  All in all, the jit-result seems  
to be fairly opaque and hidden.  Is this intentional, or is there  
more I am missing?


Thanks,

Marcel




More information about the llvm-dev mailing list