[llvm] 2d098be - [globalisel][docs] Rework the Legalizer page slightly

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 13:42:32 PDT 2019


Author: Daniel Sanders
Date: 2019-10-30T13:42:19-07:00
New Revision: 2d098bea0361461f49f50c86d957dbbd69dc1e3b

URL: https://github.com/llvm/llvm-project/commit/2d098bea0361461f49f50c86d957dbbd69dc1e3b
DIFF: https://github.com/llvm/llvm-project/commit/2d098bea0361461f49f50c86d957dbbd69dc1e3b.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/docs/GlobalISel/Legalizer.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/GlobalISel/Legalizer.rst b/llvm/docs/GlobalISel/Legalizer.rst
index d0cb7324c5e5..3417b6841929 100644
--- a/llvm/docs/GlobalISel/Legalizer.rst
+++ b/llvm/docs/GlobalISel/Legalizer.rst
@@ -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


        


More information about the llvm-commits mailing list