[LLVMdev] CollectorRegistry

Gordon Henriksen malichus at mac.com
Thu Jul 24 05:24:21 PDT 2008


On Jul 24, 2008, at 03:10, Simon Ask Ulsnes wrote:

>> I would say that accurate GC would generally require considerable  
>> cooperation from the front-end compiler, which GCC does not  
>> particularly provide. But you could experiment with it. Simply  
>> adding a GC attribute to an existing function should generally be  
>> harmless (e.g., the inliner will do so inlining a function with GC  
>> into a function without), but doing so won't annotate the roots in  
>> the function.
>
> Hm, it seems this will be more interesting than I had initially  
> expected. I had assumed that the annotation took place at the IR  
> level, so frontend compilers would not need to be modified. Would  
> this be a viable alternative in the future?

Unlikely.

> If not, do you think it would require very significant changes to  
> the GCC frontend to make it annotate roots on the stack etc.?
>
> I'm thinking along the lines of a command-line option a la:
>
> llvm-gcc --emit-llvm -c myfile.c -o myfile.bc --garbage-collector=mygc
>
> This could be a fun project, if the GCC code is not too hard to  
> modify like this. :-)


Indeed, llvm-gcc can emit llvm.gcroot, but the source program must  
request it. Someone at Apple starting working with LLVM did this for  
fun circa January, IIRC. Unclear whether it's useful.

— Gordon





More information about the llvm-dev mailing list