GC interface suggestions

Hello,

I have a few suggestions for the GC interface. First, initialization of roots fails if the root isn't just a pointer. Some implementations require more data than just the pointer for handling references to the interior of an aggregate. On my end it just required changing ConstantPointerNull::get() to Constant::GetNullValue() to support fat pointers. The roots that were being initialized also weren't added to the InitedRoots set so the generated code would be multiply-initializing the same roots if they were rooted more than once.

@@ -178,10 +180,10 @@
   
   for (AllocaInst **I = Roots, **E = Roots + Count; I != E; ++I)
     if (!InitedRoots.count(*I)) {
- new StoreInst(ConstantPointerNull::get(cast<PointerType>(
- cast<PointerType>((*I)->getType())->getElementType())),
- *I, IP);
+ const PointerType *PT = cast<PointerType>((*I)->getType());
+ new StoreInst(Constant::getNullValue(PT->getElementType()), *I, IP);
       MadeChange = true;
+ InitedRoots.insert(*I);
     }

Secondly, it would be great to have the ability to add custom safe points similarly to how the GC interface can specify custom read/write barriers and custom roots. Being able to specify safe points at the IR level is hugely preferable to doing it at the machine instruction level.

Cheers,
-Max