summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
diff options
context:
space:
mode:
authorDaniel Sanders <daniel_l_sanders@apple.com>2018-06-27 19:03:21 +0000
committerDaniel Sanders <daniel_l_sanders@apple.com>2018-06-27 19:03:21 +0000
commitbdeb880d14dfcc54b990cb32e0d0804bd24f70cf (patch)
treeac015a0069a76505232196742ae07c74bf4b299b /llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
parent6835c284a41e7604eb6ccb7bc0750327b0bd4705 (diff)
downloadbcm5719-llvm-bdeb880d14dfcc54b990cb32e0d0804bd24f70cf.tar.gz
bcm5719-llvm-bdeb880d14dfcc54b990cb32e0d0804bd24f70cf.zip
[globalisel][legalizer] Add AtomicOrdering to LegalityQuery and use it in AArch64
Now that we have the ability to legalize based on MMO's. Add support for legalizing based on AtomicOrdering and use it to correct the legalization of the atomic instructions. Also extend all() to be a variadic template as this ruleset now requires 3 and 4 argument versions. llvm-svn: 335767
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
index 56b57b53d64..344f573a67f 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
@@ -15,11 +15,9 @@
using namespace llvm;
-LegalityPredicate
-LegalityPredicates::all(LegalityPredicate P0, LegalityPredicate P1) {
- return [=](const LegalityQuery &Query) {
- return P0(Query) && P1(Query);
- };
+LegalityPredicate LegalityPredicates::typeIs(unsigned TypeIdx, LLT Type) {
+ return
+ [=](const LegalityQuery &Query) { return Query.Types[TypeIdx] == Type; };
}
LegalityPredicate
@@ -94,3 +92,10 @@ LegalityPredicate LegalityPredicates::numElementsNotPow2(unsigned TypeIdx) {
return QueryTy.isVector() && isPowerOf2_32(QueryTy.getNumElements());
};
}
+
+LegalityPredicate LegalityPredicates::atomicOrderingAtLeastOrStrongerThan(
+ unsigned MMOIdx, AtomicOrdering Ordering) {
+ return [=](const LegalityQuery &Query) {
+ return isAtLeastOrStrongerThan(Query.MMODescrs[MMOIdx].Ordering, Ordering);
+ };
+}
OpenPOWER on IntegriCloud