Remove the Module pointer from GCStrategy and GCMetadataPrinter
authorPhilip Reames <listmail@philipreames.com>
Tue, 9 Dec 2014 23:57:54 +0000 (23:57 +0000)
committerPhilip Reames <listmail@philipreames.com>
Tue, 9 Dec 2014 23:57:54 +0000 (23:57 +0000)
commitde226055ca2ca76a380b5ae110182097ac5e98e2
tree3a9ed4dffaa7ea109cdba8bcc603e696293fbd8d
parent22600ff32878d72edf4eeb2c52139760fd443656
Remove the Module pointer from GCStrategy and GCMetadataPrinter

In the current implementation, GCStrategy is a part of the ownership structure for the gc metadata which describes a Module. It also contains a reference to the module in question. As a result, GCStrategy instances are essentially Module specific.

I plan to transition away from this design. Instead, a GCStrategy will be owned by the LLVMContext. It will be a lightweight policy object which contains no information about the Modules or Functions involved, but can be easily reached given a Function.

The first step in this transition is to remove the direct Module reference from GCStrategy. This also requires removing the single user of this reference, the GCMetadataPrinter hierarchy. In theory, this will allow the lifetime of the printers to be scoped to the LLVMContext as well, but in practice, I'm not actually changing that. (Yet?)

An alternate design would have been to move the direct Module reference into the GCMetadataPrinter and change the keying of the owning maps to explicitly key off both GCStrategy and Module. I'm open to doing it that way instead, but didn't see much value in preserving the per Module association for GCMetadataPrinters.

The next change in this sequence will be to start unwinding the intertwined ownership between GCStrategy, GCModuleInfo, and GCFunctionInfo.

Differential Revision: http://reviews.llvm.org/D6566

llvm-svn: 223859
llvm/include/llvm/CodeGen/GCMetadataPrinter.h
llvm/include/llvm/CodeGen/GCStrategy.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
llvm/lib/CodeGen/GCMetadata.cpp
llvm/lib/CodeGen/GCMetadataPrinter.cpp