On 9/28/07, Chris Lattner <sabre at nondot.org>
wrote:>
> > MachineCodeEmitter [3] is obtainable from the JIT class, and it
> > contains "BufferBegin", "BufferEnd", and
"CurBufferPtr" as protected
> > members; if they were available, determining the generated code size
> > might be possible via some pointer arithmetic. Is there another way I
> > might be missing? Or would I have to subclass JITEmitter and add a
> > method to perform this calculation?
>
> You could do that, it will tell you the size of all of the machine
> code jit'd.
Right, unless I do it before and after jitting the new function and
subtract them, in which case I'll get the size of the new function
which I can then book to the agent.
> > Finally, can I free the memory used by the in-memory IR after the code
> > is generated?
>
> Yes, you can call F->deleteBody() after JIT'ing F.
Sorry, I meant to ask whether it's still necessary to keep F around,
ie. to delete generated code. Is there a standard approach to garbage
collecting code in LLVM?
Sandro