TableGen/GlobalISel: Fix pattern matching of immarg literals
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 8 Jan 2020 20:40:37 +0000 (15:40 -0500)
committerMatt Arsenault <arsenm2@gmail.com>
Thu, 9 Jan 2020 22:37:52 +0000 (17:37 -0500)
commit10edb1d0d4a15812a71f8953bba96a4f1fc9d0af
treeec483e8bcc257e76021e2233dd0b12e9a21b00b6
parentb4a647449fa01bd4e29bce5afef51770cddec664
TableGen/GlobalISel: Fix pattern matching of immarg literals

For arguments that are not expected to be materialized with
G_CONSTANT, this was emitting predicates which could never match. It
was first adding a meaningless LLT check, which would always fail due
to the operand not being a register.

Infer the cases where a literal should check for an immediate operand,
instead of a register This avoids needing to invent a special way of
representing timm literal values.

Also handle immediate arguments in GIM_CheckLiteralInt. The comments
stated it handled isImm() and isCImm(), but that wasn't really true.

This unblocks work on the selection of all of the complicated AMDGPU
intrinsics in future commits.
llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
llvm/test/TableGen/Common/GlobalISelEmitterCommon.td
llvm/test/TableGen/GlobalISelEmitter-immarg-literal-pattern.td [new file with mode: 0644]
llvm/utils/TableGen/CodeGenInstruction.cpp
llvm/utils/TableGen/CodeGenInstruction.h
llvm/utils/TableGen/CodeGenIntrinsics.h
llvm/utils/TableGen/CodeGenTarget.cpp
llvm/utils/TableGen/GlobalISelEmitter.cpp