Add a pass for constructing gc.statepoint sequences w/explicit relocations
authorPhilip Reames <listmail@philipreames.com>
Fri, 20 Feb 2015 01:06:44 +0000 (01:06 +0000)
committerPhilip Reames <listmail@philipreames.com>
Fri, 20 Feb 2015 01:06:44 +0000 (01:06 +0000)
commit673db11fdb3291845e56cdd04024e40123e55dde
tree3e0189a5de239163cd37358aa6d3cad3b87e0b40
parent49ab3a626a3e64c91707e899e75c3724f7fbaf23
Add a pass for constructing gc.statepoint sequences w/explicit relocations

This patch consists of a single pass whose only purpose is to visit previous inserted gc.statepoints which do not have gc.relocates inserted yet, and insert them. This can be used either immediately after IR generation to perform 'early safepoint insertion' or late in the pass order to perform 'late insertion'.

This patch is setting the stage for work to continue in tree.  In particular, there are known naming and style violations in the current patch.  I'll try to get those resolved over the next week or so.  As I touch each area to make style changes, I need to make sure we have adequate testing in place.  As part of the cleanup, I will be cleaning up a collection of test cases we have out of tree and submitting them upstream. The tests included in this change are very basic and mostly to provide examples of usage.

The pass has several main subproblems it needs to address:
- First, it has identify any live pointers. In the current code, the use of address spaces to distinguish pointers to GC managed objects is hard coded, but this will become parametrizable in the near future.  Note that the current change doesn't actually contain a useful liveness analysis.  It was seperated into a followup change as the code wasn't ready to be shared.  Instead, the current implementation just considers any dominating def of appropriate pointer type to be live.
- Second, it has to identify base pointers for each live pointer. This is a fairly straight forward data flow algorithm.
- Third, the information in the previous steps is used to actually introduce rewrites. Rather than trying to do this by hand, we simply re-purpose the code behind Mem2Reg to do this for us.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229945 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/InitializePasses.h
include/llvm/Transforms/Scalar.h
lib/Transforms/Scalar/CMakeLists.txt
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp [new file with mode: 0644]
lib/Transforms/Scalar/Scalar.cpp
test/Transforms/RewriteStatepointsForGC/basics.ll [new file with mode: 0644]