[LLVMdev] CollectorRegistry

Simon Ask Ulsnes vinterbleg at gmail.com
Wed Jul 23 08:48:48 PDT 2008


Thank you for that clarification.

> The framework decides which Collector to use based upon the 'gc'
> attribute of a function:
>
> define void @f() gc "mygc" {
>   ...
> }

OK, so for instance if I wanted to be able to use the GC from a C
frontend (presumably by using llvm_gc_allocate?), do the C functions
need this attribute as well?

And if so, can this attribute be applied to functions in bitcode
compiled by llvm-gcc, without modifications to the C compiler or the
output bitcode?
I.e., I use a custom driver program similar to lli that loads in
bitcode and my GC, and executes it, and ideally programs would be able
to use the GC without needing bitcode-level modifications (it's
perfectly ok to have to replace calls to malloc, though).

>
> This string must correspond to the first argument to the
> CollectorRegistry::Add<> constructor.
>
> The second argument to the constructor is, I think, "purely
> informational" for collectors. For the related TargetMachineRegistry,
> the second argument appears in --help output.
>
> Hope that helps,
> Gordon

It helps a lot. Thank you for your time. :-)

Simon



More information about the llvm-dev mailing list