[PATCH] D62423: [globalisel][legalizer] Attempt to write down the minimal legalization rules

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 09:07:31 PDT 2019


qcolombet added a comment.

Hi Daniel,

Thanks for writing this down. I think the description is accurate (modulo the bit cast stuff) of what we do today.
That said, the vision (that we don't implement currently) for the legalizer was actually much simpler:

- The target needs to provide a way to legalize exts from producer/consumer sets.
- The target needs to support loading and storing from producer/consumer sets.

>From there, supporting truncates, merge/unmerge, build vector and so on is a matter of issuing the right loads and stores. That's not very efficient thus we encourage targets to do what you wrote down, but the idea was that it is more an optimization than anything else.

Cheers,
-Quentin



================
Comment at: llvm/docs/GlobalISel.rst:455
+only operation to account for. We don't require that it's legal because it
+can be lowered to COPY (or to nothing using replaceAllUses()).
+
----------------
Just a remark.
Bitcasts can actually be tricky to lower  (from langref: `The conversion is done as if the value had been stored to memory and read back as type ty2`) because it can shuffle bits around.
Therefore we should add that if the bistcast for the dst and src type is not a no-op, then the target should know how to expand it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62423/new/

https://reviews.llvm.org/D62423





More information about the llvm-commits mailing list