[all-commits] [llvm/llvm-project] aaf675: [GlobalISel] Refactor Combiner API

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Mon Sep 4 23:19:22 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aaf6755631d4876b170a9cf28eb6175e42e13f24
      https://github.com/llvm/llvm-project/commit/aaf6755631d4876b170a9cf28eb6175e42e13f24
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2023-09-05 (Tue, 05 Sep 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/Combiner.h
    M llvm/include/llvm/CodeGen/GlobalISel/CombinerInfo.h
    M llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
    M llvm/include/llvm/Target/GlobalISel/Combine.td
    M llvm/lib/CodeGen/GlobalISel/Combiner.cpp
    M llvm/lib/Target/AArch64/AArch64Combine.td
    M llvm/lib/Target/AArch64/GISel/AArch64O0PreLegalizerCombiner.cpp
    M llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp
    M llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
    M llvm/lib/Target/AArch64/GISel/AArch64PreLegalizerCombiner.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUCombine.td
    M llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUPreLegalizerCombiner.cpp
    M llvm/lib/Target/AMDGPU/AMDGPURegBankCombiner.cpp
    M llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp
    M llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp
    M llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp

  Log Message:
  -----------
  [GlobalISel] Refactor Combiner API

Remove CodeGen leftovers from the old combiner backend and adapt the API to fit the new backend better.
It's now quite a bit closer to how InstructionSelector works.

- `CombinerInfo` is now a simple "options" struct.
- `Combiner` is now the base class of all TableGen'd combiner implementation.
    - Many fields have been moved from derived classes into that class.
    - It has been refactored to create & own the Observer and Builder.
- `tryCombineAll` TableGen'd method can now be renamed, which allows targets to implement the actual `tryCombineAll` call manually and do whatever they want to do before/after it.

Note: `CombinerHelper` needs to be mutable because none of its methods are const. This can be revisited later.

Depends on D158710

Reviewed By: aemerson, dsanders

Differential Revision: https://reviews.llvm.org/D158713


  Commit: 4e513f69a155e4010f707ec8f840eac4ccc695fc
      https://github.com/llvm/llvm-project/commit/4e513f69a155e4010f707ec8f840eac4ccc695fc
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2023-09-05 (Tue, 05 Sep 2023)

  Changed paths:
    M llvm/include/llvm/Target/GlobalISel/Combine.td
    M llvm/lib/Target/AArch64/AArch64Combine.td
    M llvm/lib/Target/AMDGPU/AMDGPUCombine.td
    M llvm/lib/Target/Mips/MipsCombine.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-imms.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-operand-types.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-patfrag-root.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-permutations.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-variadics.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/operand-types.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/patfrag-errors.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-errors.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-parsing.td
    M llvm/utils/TableGen/GlobalISel/CombinerUtils.h

  Log Message:
  -----------
  [GlobalISel] Cleanup Combine.td

Now that the old backend is gone, clean-up a few things that no longer make sense and tidy up the file a bit.

Depends on D158710

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D158714


  Commit: 844c0da77766901eba6420c096657c6078289c4e
      https://github.com/llvm/llvm-project/commit/844c0da77766901eba6420c096657c6078289c4e
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2023-09-05 (Tue, 05 Sep 2023)

  Changed paths:
    M llvm/docs/GlobalISel/MIRPatterns.rst
    M llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
    M llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
    M llvm/include/llvm/Target/GlobalISel/Combine.td
    M llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-trivial-arith.mir
    A llvm/test/TableGen/GlobalISelCombinerEmitter/builtins/builtin-pattern-errors.td
    A llvm/test/TableGen/GlobalISelCombinerEmitter/builtins/builtin-pattern-parrsing.td
    A llvm/test/TableGen/GlobalISelCombinerEmitter/builtins/match-table-eraseroot.td
    A llvm/test/TableGen/GlobalISelCombinerEmitter/builtins/match-table-replacerreg.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-errors.td
    M llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-parsing.td
    M llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
    M llvm/utils/TableGen/GlobalISelMatchTable.cpp
    M llvm/utils/TableGen/GlobalISelMatchTable.h

  Log Message:
  -----------
  [TableGen][GlobalISel] Add MIR Pattern Builtins

Adds a new feature to MIR patterns: builtin instructions.
They offer some additional capabilities that currently cannot be expressed without falling back to C++ code.
There are two builtins added with this patch, but more can be added later as new needs arise:
 - GIReplaceReg
 - GIEraseRoot

Depends on D158714, D158713

Reviewed By: arsenm, aemerson

Differential Revision: https://reviews.llvm.org/D158975


Compare: https://github.com/llvm/llvm-project/compare/538f13584dbd...844c0da77766


More information about the All-commits mailing list