[PATCH] D41373: [GISel][RFC]: GlobalISel Combiner prototype

Aditya Nandakumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 17:34:59 PST 2017


aditya_nandakumar created this revision.
aditya_nandakumar added reviewers: qcolombet, aemerson, dsanders, volkan, t.p.northover, kristof.beyls, Gerolf, bogner, rovka, ab.
Herald added subscribers: javed.absar, mgorny.

Hello All

Here's a prototype for GISel Combiner pass/framework.
The various components are

1. GICombinerHelper - this contains transformations that are common to all targets. Targets can pick and choose which transformations (at function/opcode granularity) each pass uses via configuring a GICombinerInfo.
2. GICombiner - this contains some common code and it does the traversal, driving of combines, worklist management and iterating until convergence.
3. GICombinerInfo - the GICombinerInfo is an interface with a virtual method called combine. The combiner info will allow targets to pick and choose (or implement their own specific combines). CombineInfos can make use of available combines in GICombineHelper to configure the transformations for a particular pass. Currently this approach allows cherry picking transformations from helpers (at function/opcode granularity) and also allows early returning on specific transformations. Targets also get to prioritize whether target specific combines run before/after the opt-in generic combines. Ideally we would like this part to be configured by both C++ and Tablegen. The CombinerInfo also has a field which indicates how to deal with IllegalOps (ie - should we allow to create them/or legalize them?). This has not been addressed in this patch as I'm not sure what the right approach here is.
4. A CombinerPass would configure a CombinerInfo, create the GICombiner with the Info, and call GICombiner::combineMachineInstrs(MachineFunction&).

The above organization is very similar to the GISelLegalizer.

This patch includes a CombinerPass called PreLegalizeCombiner which is meant to run before legalization. Currently the only implemented transformation in the helper is simple copy propagation.

This patch also includes an initial version of InstCombine like PatternMatcher for easy matching of combines along with unit tests.

Looking forward to your feedback.


Repository:
  rL LLVM

https://reviews.llvm.org/D41373

Files:
  include/llvm/CodeGen/GlobalISel/GICombiner.h
  include/llvm/CodeGen/GlobalISel/GICombinerHelper.h
  include/llvm/CodeGen/GlobalISel/GICombinerInfo.h
  include/llvm/CodeGen/GlobalISel/GMIPatternMatch.h
  include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
  include/llvm/CodeGen/GlobalISel/PreLegalizeCombiner.h
  include/llvm/InitializePasses.h
  lib/CodeGen/GlobalISel/CMakeLists.txt
  lib/CodeGen/GlobalISel/GICombiner.cpp
  lib/CodeGen/GlobalISel/GICombinerHelper.cpp
  lib/CodeGen/GlobalISel/GlobalISel.cpp
  lib/CodeGen/GlobalISel/PreLegalizeCombiner.cpp
  lib/Target/AArch64/AArch64TargetMachine.cpp
  test/CodeGen/AArch64/GlobalISel/combine-copy.mir
  unittests/CodeGen/GlobalISel/CMakeLists.txt
  unittests/CodeGen/GlobalISel/PatternMatchTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41373.127435.patch
Type: text/x-patch
Size: 39179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171219/6b00aaff/attachment.bin>


More information about the llvm-commits mailing list