[PATCH] Move ownership of GCStrategy objects to LLVMContext

Philip Reames listmail at philipreames.com
Tue Dec 30 09:06:55 PST 2014


Hi chandlerc, nicholas, sanjoy,

(I would appreciate a close review on this one.  I'm changing ownership in a non-trivial way and am introducing what might be considered a layering violation - IR owrning and returning pointers to a CodeGen class.)

Rather than have the GCStrategy object owned by the GCModuleInfo - which is an immutable analysis pass used mainly by gc.root - have it be owned by the LLVMContext.  This simplifies the ownership logic (i.e. can you have two instances of the same strategy at once?), but more importantly, allows us to access the GCStrategy in the middle end optimizer.  To this end, I add an accessor through Function which becomes the canonical way to get at a GCStrategy instance.  

In the near future, this will allows me to move some of the checks from http://reviews.llvm.org/D6808 into the Verifier itself, and to introduce optimization legality predicates for some of the recent additions to InstCombine.  (These will follow as separate changes.)

http://reviews.llvm.org/D6811

Files:
  include/llvm/CodeGen/GCMetadata.h
  include/llvm/CodeGen/GCStrategy.h
  include/llvm/IR/Function.h
  lib/CodeGen/GCMetadata.cpp
  lib/IR/Function.cpp
  lib/IR/LLVMContextImpl.cpp
  lib/IR/LLVMContextImpl.h

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6811.17721.patch
Type: text/x-patch
Size: 7885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141230/54000c67/attachment.bin>


More information about the llvm-commits mailing list