[PATCH] D42251: [globalisel][legalizer] Adapt LegalizerInfo to support inter-type dependencies and other things.

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 15:07:03 PST 2018


bogner added a comment.

In https://reviews.llvm.org/D42251#987055, @dsanders wrote:

> It's now possible to declare multiple-opcodes together:
>
>   getActionDefinitions({G_ADD, G_SUB, G_MUL, G_AND, G_OR, G_XOR, G_SHL})
>       .legalFor({s32, s64, v2s32, v4s32, v2s64})
>       .clampScalar(0, s32, s64)
>       .widenScalarToNextPow2(0)
>       .clampNumElements(0, v2s32, v4s32)
>       .clampNumElements(0, v2s64, v2s64)
>       .moreElementsToNextPow2(0);


I think it'd make for a slightly safer API to separate this out so it's done in two steps. Maybe something like:

  auto ArithOps = createAliasedActionDefinitions({G_ADD, G_SUB, ...});
  ArithOps.legalFor({s32, s64, ...}).clampScalar(...)...

This way you can avoid the complexity that happens if someone tries to pass different but overlapping sets of opcodes in subsequent calls to getActionDefinitions.


https://reviews.llvm.org/D42251





More information about the llvm-commits mailing list