1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

GlobalISel: Add isPointer legality predicates

llvm-svn: 351699
This commit is contained in:
Matt Arsenault 2019-01-20 19:45:14 +00:00
parent 481e85cce0
commit 63509e5a64
2 changed files with 20 additions and 0 deletions

View File

@ -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);

View File

@ -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) {