[Statepoints] Support for "patchable" statepoints.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 12 May 2015 23:52:24 +0000 (23:52 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 12 May 2015 23:52:24 +0000 (23:52 +0000)
commitead2d1fbe08460fbdbf2fefa38ffa8e477d553d9
treead9487e89bd6f24b6a776a7fa4989444abda7edc
parent36cb3ce66a44d7e28810a299f1b32eb6d610b3cd
[Statepoints] Support for "patchable" statepoints.

Summary:
This change adds two new parameters to the statepoint intrinsic, `i64 id`
and `i32 num_patch_bytes`.  `id` gets propagated to the ID field
in the generated StackMap section.  If the `num_patch_bytes` is
non-zero then the statepoint is lowered to `num_patch_bytes` bytes of
nops instead of a call (the spill and reload code remains unchanged).
A non-zero `num_patch_bytes` is useful in situations where a language
runtime requires complete control over how a call is lowered.

This change brings statepoints one step closer to patchpoints.  With
some additional work (that is not part of this patch) it should be
possible to get rid of `TargetOpcode::STATEPOINT` altogether.

PlaceSafepoints generates `statepoint` wrappers with `id` set to
`0xABCDEF00` (the old default value for the ID reported in the stackmap)
and `num_patch_bytes` set to `0`.  This can be made more sophisticated
later.

Reviewers: reames, pgavlin, swaroop.sridhar, AndyAyers

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237214 91177308-0d34-0410-b5e6-96231b3b80d8
53 files changed:
docs/Statepoints.rst
include/llvm/CodeGen/StackMaps.h
include/llvm/IR/IRBuilder.h
include/llvm/IR/Intrinsics.td
include/llvm/IR/Statepoint.h
lib/CodeGen/SelectionDAG/StatepointLowering.cpp
lib/CodeGen/StackMaps.cpp
lib/IR/IRBuilder.cpp
lib/IR/Verifier.cpp
lib/Target/X86/X86MCInstLower.cpp
lib/Transforms/Scalar/PlaceSafepoints.cpp
test/Analysis/ValueTracking/memory-dereferenceable.ll
test/CodeGen/Generic/overloaded-intrinsic-name.ll
test/CodeGen/X86/statepoint-allocas.ll
test/CodeGen/X86/statepoint-call-lowering.ll
test/CodeGen/X86/statepoint-forward.ll
test/CodeGen/X86/statepoint-gctransition-call-lowering.ll
test/CodeGen/X86/statepoint-invoke.ll
test/CodeGen/X86/statepoint-stack-usage.ll
test/CodeGen/X86/statepoint-stackmap-format.ll
test/Transforms/CodeGenPrepare/statepoint-relocate.ll
test/Transforms/InstCombine/gc.relocate.ll
test/Transforms/InstCombine/statepoint.ll
test/Transforms/PlaceSafepoints/basic.ll
test/Transforms/PlaceSafepoints/call-in-loop.ll
test/Transforms/PlaceSafepoints/finite-loops.ll
test/Transforms/PlaceSafepoints/invokes.ll
test/Transforms/PlaceSafepoints/split-backedge.ll
test/Transforms/PlaceSafepoints/statepoint-frameescape.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-1.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-10.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-11.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-2.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-3.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-4.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-5.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-6.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-7.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-8.ll
test/Transforms/RewriteStatepointsForGC/base-pointers-9.ll
test/Transforms/RewriteStatepointsForGC/base-pointers.ll
test/Transforms/RewriteStatepointsForGC/basics.ll
test/Transforms/RewriteStatepointsForGC/constants.ll
test/Transforms/RewriteStatepointsForGC/gc_relocate_creation.ll
test/Transforms/RewriteStatepointsForGC/live-vector.ll
test/Transforms/RewriteStatepointsForGC/liveness-basics.ll
test/Transforms/RewriteStatepointsForGC/preprocess.ll
test/Transforms/RewriteStatepointsForGC/relocate_invoke_result.ll
test/Transforms/RewriteStatepointsForGC/relocation.ll
test/Verifier/invalid-patchable-statepoint.ll [new file with mode: 0644]
test/Verifier/invalid-statepoint.ll
test/Verifier/invalid-statepoint2.ll
test/Verifier/statepoint.ll