llvm-project/llvm/lib/CodeGen/GlobalISel
Daniel Sanders 262ed0ecd7 [globalisel] Introduce LegalityQuery to better encapsulate the legalizer decisions. NFC.
Summary:
`getAction(const InstrAspect &) const` breaks encapsulation by exposing
the smaller components that are used to decide how to legalize an
instruction.

This is a problem because we need to change the implementation of
LegalizerInfo so that it's able to describe particular type combinations
rather than just cartesian products of types.

For example, declaring the following
  setAction({..., 0, s32}, Legal)
  setAction({..., 0, s64}, Legal)
  setAction({..., 1, s32}, Legal)
  setAction({..., 1, s64}, Legal)
currently declares these type combinations as legal:
  {s32, s32}
  {s64, s32}
  {s32, s64}
  {s64, s64}
but we currently have no means to say that, for example, {s64, s32} is
not legal. Some operations such as G_INSERT/G_EXTRACT/G_MERGE_VALUES/
G_UNMERGE_VALUES has relationships between the types that are currently
described incorrectly.

Additionally, G_LOAD/G_STORE currently have no means to legalize non-atomics
differently to atomics. The necessary information is in the MMO but we have no
way to use this in the legalizer. Similarly, there is currently no way for the
register type and the memory type to differ so there is no way to cleanly
represent extending-load/truncating-store in a way that can't be broken by
optimizers (resulting in illegal MIR).

This patch introduces LegalityQuery which provides all the information
needed by the legalizer to make a decision on whether something is legal
and how to legalize it.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar, volkan, reames, bogner

Reviewed By: bogner

Subscribers: bogner, llvm-commits, kristof.beyls

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

llvm-svn: 323342
2018-01-24 17:17:46 +00:00
..
CMakeLists.txt [GlobalISel] Remove a stall comment in CMake. 2017-08-04 20:15:41 +00:00
CallLowering.cpp MachineFunction: Return reference from getFunction(); NFC 2017-12-15 22:22:58 +00:00
GlobalISel.cpp [GlobalISel] Make GlobalISel a non-optional library. 2017-08-03 21:52:25 +00:00
IRTranslator.cpp [GISel]: Don't create G_MUL with 1 during translation of GEP 2018-01-05 02:56:28 +00:00
InstructionSelect.cpp [GISel]: Remove redundant copies at the end of ISel 2018-01-24 01:35:26 +00:00
InstructionSelector.cpp [GISel] Make constrainSelectedInstRegOperands() available to the legalizer. NFC 2018-01-17 19:31:33 +00:00
LLVMBuild.txt Revert "Get GlobalISel to build on Linux after r286407" 2016-11-16 22:24:59 +00:00
Legalizer.cpp MachineFunction: Return reference from getFunction(); NFC 2017-12-15 22:22:58 +00:00
LegalizerHelper.cpp [globalisel] Introduce LegalityQuery to better encapsulate the legalizer decisions. NFC. 2018-01-24 17:17:46 +00:00
LegalizerInfo.cpp [globalisel] Introduce LegalityQuery to better encapsulate the legalizer decisions. NFC. 2018-01-24 17:17:46 +00:00
Localizer.cpp [CodeGen] Rename functions PrintReg* to printReg* 2017-11-28 12:42:37 +00:00
MachineIRBuilder.cpp MachineFunction: Return reference from getFunction(); NFC 2017-12-15 22:22:58 +00:00
RegBankSelect.cpp MachineFunction: Return reference from getFunction(); NFC 2017-12-15 22:22:58 +00:00
RegisterBank.cpp Fix a bunch more layering of CodeGen headers that are in Target 2017-11-17 01:07:10 +00:00
RegisterBankInfo.cpp Remove redundant includes from lib/CodeGen. 2017-12-13 21:30:47 +00:00
Utils.cpp [GISel] Make constrainSelectedInstRegOperands() available to the legalizer. NFC 2018-01-17 19:31:33 +00:00