[PATCH] Remove the Module pointer from GCStrategy and GCMetadataPrinter

Philip Reames listmail at philipreames.com
Mon Dec 8 10:58:26 PST 2014


Hi whitequark,

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.

http://reviews.llvm.org/D6566

Files:
  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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6566.17043.patch
Type: text/x-patch
Size: 6687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141208/9afd3d6c/attachment.bin>


More information about the llvm-commits mailing list