summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2015-12-23 01:42:15 +0000
committerPhilip Reames <listmail@philipreames.com>2015-12-23 01:42:15 +0000
commitee8f0553273549b3ce6b6656a50beab3446300df (patch)
treed2f23bdbb207b6e6e81e61d8d4b406dcf7c7dbe9 /llvm/lib/CodeGen
parent7300afa36a60766834d9431a16896768d1d18305 (diff)
downloadbcm5719-llvm-ee8f0553273549b3ce6b6656a50beab3446300df.tar.gz
bcm5719-llvm-ee8f0553273549b3ce6b6656a50beab3446300df.zip
[GC] Make GCStrategy::isGCManagedPointer a type predicate not a value predicate [NFC]
Reasons: 1) The existing form was a form of false generality. None of the implemented GCStrategies use anything other than a type. Its becoming more and more clear we're going to need some type of strong GC pointer in the type system and we shouldn't pretend otherwise at this point. 2) The API was awkward when applied to vectors-of-pointers. The old one could have been made to work, but calling isGCManagedPointer(Ty->getScalarType()) is much cleaner than the Value alternatives. 3) The rewriting implementation effectively assumes the type based predicate as well. We should be consistent. llvm-svn: 256312
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/CoreCLRGC.cpp4
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp6
-rw-r--r--llvm/lib/CodeGen/StatepointExampleGC.cpp4
3 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/CoreCLRGC.cpp b/llvm/lib/CodeGen/CoreCLRGC.cpp
index 28c97ba71bd..ff7c0d5dc0a 100644
--- a/llvm/lib/CodeGen/CoreCLRGC.cpp
+++ b/llvm/lib/CodeGen/CoreCLRGC.cpp
@@ -38,9 +38,9 @@ public:
UsesMetadata = false;
CustomRoots = false;
}
- Optional<bool> isGCManagedPointer(const Value *V) const override {
+ Optional<bool> isGCManagedPointer(const Type *Ty) const override {
// Method is only valid on pointer typed values.
- PointerType *PT = cast<PointerType>(V->getType());
+ const PointerType *PT = cast<PointerType>(Ty);
// We pick addrspace(1) as our GC managed heap.
return (1 == PT->getAddressSpace());
}
diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index a74d15371ca..87373154c87 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -509,21 +509,21 @@ static void lowerStatepointMetaArgs(SmallVectorImpl<SDValue> &Ops,
// to the GCStrategy from there (yet).
GCStrategy &S = Builder.GFI->getStrategy();
for (const Value *V : Bases) {
- auto Opt = S.isGCManagedPointer(V);
+ auto Opt = S.isGCManagedPointer(V->getType());
if (Opt.hasValue()) {
assert(Opt.getValue() &&
"non gc managed base pointer found in statepoint");
}
}
for (const Value *V : Ptrs) {
- auto Opt = S.isGCManagedPointer(V);
+ auto Opt = S.isGCManagedPointer(V->getType());
if (Opt.hasValue()) {
assert(Opt.getValue() &&
"non gc managed derived pointer found in statepoint");
}
}
for (const Value *V : Relocations) {
- auto Opt = S.isGCManagedPointer(V);
+ auto Opt = S.isGCManagedPointer(V->getType());
if (Opt.hasValue()) {
assert(Opt.getValue() && "non gc managed pointer relocated");
}
diff --git a/llvm/lib/CodeGen/StatepointExampleGC.cpp b/llvm/lib/CodeGen/StatepointExampleGC.cpp
index 95dfd75018c..3f60e18fafa 100644
--- a/llvm/lib/CodeGen/StatepointExampleGC.cpp
+++ b/llvm/lib/CodeGen/StatepointExampleGC.cpp
@@ -34,9 +34,9 @@ public:
UsesMetadata = false;
CustomRoots = false;
}
- Optional<bool> isGCManagedPointer(const Value *V) const override {
+ Optional<bool> isGCManagedPointer(const Type *Ty) const override {
// Method is only valid on pointer typed values.
- PointerType *PT = cast<PointerType>(V->getType());
+ const PointerType *PT = cast<PointerType>(Ty);
// For the sake of this example GC, we arbitrarily pick addrspace(1) as our
// GC managed heap. We know that a pointer into this heap needs to be
// updated and that no other pointer does. Note that addrspace(1) is used
OpenPOWER on IntegriCloud