[globalisel][docs] Rework the Legalizer page slightly

The legalizer page was in a fairly good state. I've mostly just inlined
some information as a note and removed a reference to potential future
work that I think is very unlikely to be done (it's very hard to tell if
a pattern or set of patterns fully covers a node due to C++ predicates).

Also added a note that 'selectable' doesn't mean that InstructionSelect
must do it.
This commit is contained in:
Daniel Sanders 2019-10-30 12:23:03 -07:00
parent b6a2caf574
commit b28aa13df0

View File

@ -8,7 +8,9 @@ This pass transforms the generic machine instructions such that they are legal.
A legal instruction is defined as:
* **selectable** --- the target will later be able to select it to a
target-specific (non-generic) instruction.
target-specific (non-generic) instruction. This doesn't necessarily mean that
:doc:`InstructionSelect` has to handle it though. It just means that
**something** must handle it.
* operating on **vregs that can be loaded and stored** -- if necessary, the
target can select a ``G_LOAD``/``G_STORE`` of each gvreg operand.
@ -81,6 +83,20 @@ legality contains:
* The size in bytes and atomic ordering for each MachineMemOperand
.. note::
An alternative worth investigating is to generalize the API to represent
actions using ``std::function`` that implements the action, instead of explicit
enum tokens (``Legal``, ``WidenScalar``, ...) that instruct it to call a
function. This would have some benefits, most notable being that Custom could
be removed.
.. rubric:: Footnotes
.. [#legalizer-legacy-footnote] An API is broadly similar to
SelectionDAG/TargetLowering is available but is not recommended as a more
powerful API is available.
Rule Processing and Declaring Rules
"""""""""""""""""""""""""""""""""""
@ -232,26 +248,6 @@ There are some composite rules for common situations built out of the above faci
* ``moreElementsToNextMultiple()`` is like ``moreElementsToNextPow2()`` but is based on
multiples of X rather than powers of 2.
Other Information
"""""""""""""""""
``TODO``:
An alternative worth investigating is to generalize the API to represent
actions using ``std::function`` that implements the action, instead of explicit
enum tokens (``Legal``, ``WidenScalar``, ...).
``TODO``:
Moreover, we could use TableGen to initially infer legality of operation from
existing patterns (as any pattern we can select is by definition legal).
Expanding that to describe legalization actions is a much larger but
potentially useful project.
.. rubric:: Footnotes
.. [#legalizer-legacy-footnote] An API is broadly similar to
SelectionDAG/TargetLowering is available but is not recommended as a more
powerful API is available.
.. _min-legalizerinfo:
Minimum Rule Set