diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2018-04-09 21:10:09 +0000 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2018-04-09 21:10:09 +0000 |
commit | 5281b02e8492e1bce75860404a7c0aeedc3fe17a (patch) | |
tree | 5131c4ba77ca9df755b7990ecdb54fb9f6d8c34d /llvm/lib/CodeGen | |
parent | 97b6b1b926588c0b8c91744bdb6d073f44b93f1b (diff) | |
download | bcm5719-llvm-5281b02e8492e1bce75860404a7c0aeedc3fe17a.tar.gz bcm5719-llvm-5281b02e8492e1bce75860404a7c0aeedc3fe17a.zip |
[globalisel][legalizerinfo] Add support for the Lower action in getActionDefinitionsBuilder() and use it in AArch64.
Lower is slightly odd. It often doesn't change the type but the lowerings
do use the new type to decide what code to create. Treat it like a mutation
but provide convenience functions that re-use the existing type.
Re-uses the existing tests:
test/CodeGen/AArch64/GlobalISel/legalize-rem.mir
test/CodeGen/AArch64/GlobalISel//legalize-mul.mir
test/CodeGen/AArch64/GlobalISel//legalize-cmpxchg-with-success.mir
llvm-svn: 329623
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp index 65a0c9e62be..a29b32ecdc0 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp @@ -20,6 +20,13 @@ LegalizeMutation LegalizeMutations::changeTo(unsigned TypeIdx, LLT Ty) { [=](const LegalityQuery &Query) { return std::make_pair(TypeIdx, Ty); }; } +LegalizeMutation LegalizeMutations::changeTo(unsigned TypeIdx, + unsigned FromTypeIdx) { + return [=](const LegalityQuery &Query) { + return std::make_pair(TypeIdx, Query.Types[FromTypeIdx]); + }; +} + LegalizeMutation LegalizeMutations::widenScalarToNextPow2(unsigned TypeIdx, unsigned Min) { return [=](const LegalityQuery &Query) { diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp index 709bf353975..32fec80ec4a 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerInfo.cpp @@ -64,6 +64,7 @@ LegalizeActionStep LegalizeRuleSet::apply(const LegalityQuery &Query) const { DEBUG(dbgs() << ".. .. " << (unsigned)Rule.getAction() << ", " << Mutation.first << ", " << Mutation.second << "\n"); assert((Query.Types[Mutation.first] != Mutation.second || + Rule.getAction() == Lower || Rule.getAction() == MoreElements || Rule.getAction() == FewerElements) && "Simple loop detected"); |