Move ownership of GCStrategy objects to LLVMContext
authorPhilip Reames <listmail@philipreames.com>
Fri, 16 Jan 2015 20:07:33 +0000 (20:07 +0000)
committerPhilip Reames <listmail@philipreames.com>
Fri, 16 Jan 2015 20:07:33 +0000 (20:07 +0000)
commit07fbc5c1c66670ea2b325c303f52f3e82d69eb93
tree6d9e8a2cf4d7ea9d6daf18c5a776156fab8056cf
parent9da6e03161e6d79b9400955fac484fbd874c0279
Move ownership of GCStrategy objects to LLVMContext

Note: This change ended up being slightly more controversial than expected.  Chandler has tentatively okayed this for the moment, but I may be revisiting this in the near future after we settle some high level questions.

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.)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226311 91177308-0d34-0410-b5e6-96231b3b80d8
23 files changed:
include/llvm/CodeGen/GCMetadata.h
include/llvm/CodeGen/GCMetadataPrinter.h
include/llvm/CodeGen/GCStrategy.h [deleted file]
include/llvm/IR/Function.h
include/llvm/IR/GCStrategy.h [new file with mode: 0644]
include/llvm/Support/Registry.h
lib/CodeGen/CMakeLists.txt
lib/CodeGen/ErlangGC.cpp
lib/CodeGen/GCMetadata.cpp
lib/CodeGen/GCRootLowering.cpp
lib/CodeGen/GCStrategy.cpp [deleted file]
lib/CodeGen/OcamlGC.cpp
lib/CodeGen/Passes.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/CodeGen/SelectionDAG/StatepointLowering.cpp
lib/CodeGen/ShadowStackGC.cpp
lib/CodeGen/StatepointExampleGC.cpp
lib/IR/CMakeLists.txt
lib/IR/Function.cpp
lib/IR/GCStrategy.cpp [new file with mode: 0644]
lib/IR/LLVMContextImpl.cpp
lib/IR/LLVMContextImpl.h