[PATCH] D90304: [GlobalISel] Introduce optimal variant of regbankselect

Gabriel Hjort Ã…kerlund via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 06:25:32 PDT 2020


ehjogab created this revision.
ehjogab added reviewers: dsanders, arsenm, qcolombet, ab, bjope, rovka.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
ehjogab requested review of this revision.
Herald added a subscriber: wdng.

This patch introduces a new option '--regbankselect-optimal' to the
register bank selector. The algorithm is based on dynamic programming
and works as follows:

1. For each instruction, working top-down, compute cost of applying each InstructionMapping. If the result needs to be converted into some other register bank not supported by any of the InstructionMappings, compute the cost of introducing a copy.
2. For each instruction, working bottom-up, select the InstructionMapping that places the result in the register bank needed for each usage.
3. For each instruction, working top-down, choose the selected InstructionMapping with lowest cost. For all other selected InstructionMappings, introduce copy instructions.

Compared to the greedy version, which looks at and make decision for one
instruction at a time, this version operates at a global scope.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90304

Files:
  llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h
  llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
  llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
  llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90304.301265.patch
Type: text/x-patch
Size: 31097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201028/442cac90/attachment.bin>


More information about the llvm-commits mailing list