summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2019-01-20 19:45:14 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2019-01-20 19:45:14 +0000
commita5195829f636162090d8dd6ff1c530933d9dcc53 (patch)
tree3c51b8e73082e079961b3a69c277ee0ef6f869ef
parent46ffe68d773c1cb91c872cae5adf51b9ea15f180 (diff)
downloadbcm5719-llvm-a5195829f636162090d8dd6ff1c530933d9dcc53.tar.gz
bcm5719-llvm-a5195829f636162090d8dd6ff1c530933d9dcc53.zip
GlobalISel: Add isPointer legality predicates
llvm-svn: 351699
-rw-r--r--llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h6
-rw-r--r--llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp14
2 files changed, 20 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
index e60d64510a0..c738fd1352c 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
@@ -204,6 +204,12 @@ LegalityPredicate typePairAndMemSizeInSet(
std::initializer_list<TypePairAndMemSize> TypesAndMemSizeInit);
/// True iff the specified type index is a scalar.
LegalityPredicate isScalar(unsigned TypeIdx);
+/// True iff the specified type index is a pointer (with any address space).
+LegalityPredicate isPointer(unsigned TypeIdx);
+/// True iff the specified type index is a pointer with the specified address
+/// space.
+LegalityPredicate isPointer(unsigned TypeIdx, unsigned AddrSpace);
+
/// True iff the specified type index is a scalar that's narrower than the given
/// size.
LegalityPredicate narrowerThan(unsigned TypeIdx, unsigned Size);
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
index 6148bbe2074..5e3f38d3ca5 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
@@ -56,6 +56,20 @@ LegalityPredicate LegalityPredicates::isScalar(unsigned TypeIdx) {
};
}
+LegalityPredicate LegalityPredicates::isPointer(unsigned TypeIdx) {
+ return [=](const LegalityQuery &Query) {
+ return Query.Types[TypeIdx].isPointer();
+ };
+}
+
+LegalityPredicate LegalityPredicates::isPointer(unsigned TypeIdx,
+ unsigned AddrSpace) {
+ return [=](const LegalityQuery &Query) {
+ LLT Ty = Query.Types[TypeIdx];
+ return Ty.isPointer() && Ty.getAddressSpace() == AddrSpace;
+ };
+}
+
LegalityPredicate LegalityPredicates::narrowerThan(unsigned TypeIdx,
unsigned Size) {
return [=](const LegalityQuery &Query) {
OpenPOWER on IntegriCloud