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)
commit3490d23337b1bb4257c7109a09dfa3baeb02f90d
tree6d5f4709594ff4729f0ff54f530adae21db7c9b4
parentea614a50253ab17cf140fe0ce46d5bb169f45989
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223859 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/GCMetadataPrinter.h
include/llvm/CodeGen/GCStrategy.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
lib/CodeGen/GCMetadata.cpp
lib/CodeGen/GCMetadataPrinter.cpp