[llvm] r351699 - GlobalISel: Add isPointer legality predicates
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 20 11:45:14 PST 2019
Author: arsenm
Date: Sun Jan 20 11:45:14 2019
New Revision: 351699
URL: http://llvm.org/viewvc/llvm-project?rev=351699&view=rev
Log:
GlobalISel: Add isPointer legality predicates
Modified:
llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h?rev=351699&r1=351698&r2=351699&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h Sun Jan 20 11:45:14 2019
@@ -204,6 +204,12 @@ LegalityPredicate typePairAndMemSizeInSe
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);
Modified: llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp?rev=351699&r1=351698&r2=351699&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp Sun Jan 20 11:45:14 2019
@@ -56,6 +56,20 @@ LegalityPredicate LegalityPredicates::is
};
}
+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) {
More information about the llvm-commits
mailing list