[PATCH] D54980: [NFC][GISel]: Provide an standard interface to observe changes across GISel passes

Aditya Nandakumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 27 15:22:38 PST 2018


aditya_nandakumar created this revision.
aditya_nandakumar added reviewers: ab, bogner, dsanders, volkan, aemerson, jpaquette, qcolombet, rtereshin.
Herald added subscribers: atanasyan, jrtc27, javed.absar, sdardis.
Herald added a reviewer: paquette.

Currently to track changes to the MachineFunction (to keep work lists updated etc) in the legalizer and combiner, we use different mechanisms that are overlapping and inconsistent.
For eg, in the legalizer, we use MachineIRBuilder::recordInsertions to track new instructions - but the legalizer also mutates instructions which also call recordInsertion. This name is inconsistent with what it does, and also the MachineIRBuilder seems like the wrong abstraction to keep track of removals/mutations.
In the combiner, we use CombinerObserver which also track these changes to instructions using it's own API.
This patch unifies them in a consistent API called GISelChangeObserver that will be passed into most APIs. Now MachineIRBuilder::recordInsertion is removed, and instead the user can install an Observer to MachineIRBuilder or even notify the observer of changes. Additionally, with the MachineFunction::Delegate interface available, we can install the Observer to the MachineFunction to automatically track insertions and deletions.
This should be NFC.


Repository:
  rL LLVM

https://reviews.llvm.org/D54980

Files:
  include/llvm/CodeGen/GlobalISel/Combiner.h
  include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  include/llvm/CodeGen/GlobalISel/CombinerInfo.h
  include/llvm/CodeGen/GlobalISel/GISelChangeObserver.h
  include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
  include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
  include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
  lib/CodeGen/GlobalISel/Combiner.cpp
  lib/CodeGen/GlobalISel/CombinerHelper.cpp
  lib/CodeGen/GlobalISel/Legalizer.cpp
  lib/CodeGen/GlobalISel/LegalizerHelper.cpp
  lib/CodeGen/GlobalISel/LegalizerInfo.cpp
  lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
  lib/Target/AArch64/AArch64LegalizerInfo.cpp
  lib/Target/AArch64/AArch64LegalizerInfo.h
  lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp
  lib/Target/ARM/ARMLegalizerInfo.cpp
  lib/Target/ARM/ARMLegalizerInfo.h
  lib/Target/Mips/MipsLegalizerInfo.cpp
  lib/Target/Mips/MipsLegalizerInfo.h
  unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp
  unittests/CodeGen/GlobalISel/LegalizerHelperTest.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54980.175592.patch
Type: text/x-patch
Size: 37394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181127/aee5cc49/attachment.bin>


More information about the llvm-commits mailing list