GlobalISel: Relax verification of physical register copy types
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sat, 17 Apr 2021 14:54:56 +0000 (10:54 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 28 Apr 2021 12:45:41 +0000 (08:45 -0400)
commitcea97fc0fcd86d52f9efa215116356b72faeb17d
tree09934f30607865789660c29d1e9a11f42019a403
parent6998f8ae2d14e096aff33968f226587b5c1a193a
GlobalISel: Relax verification of physical register copy types

This was picking a concrete size for a physical register, and
enforcing exact match on the virtual register's type size. Some
targets add multiple types to a register class, and some are smaller
than the full bit width. For example x86 adds f32 to 128-bit xmm
registers, and AMDGPU adds i16/f16 to 32-bit registers.

It might be better to represent these cases as a copy of the full
register and an extraction of the subpart, but a lot of code assumes
you can directly copy. This will help fix the current usage of the DAG
calling convention infrastructure which is incompatible with how
GlobalISel is now using it.

The API is somewhat cumbersome here, but I just mirrored the existing
functions, except now with LLTs (and allow returning null on failure,
unlike the MVT version). I think the concept of selecting register
classes based on type is flawed to begin with, but I'm trying to keep
this compatible with the existing handling.
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
llvm/lib/CodeGen/MachineVerifier.cpp
llvm/lib/CodeGen/TargetRegisterInfo.cpp
llvm/test/MachineVerifier/test_copy_physregs_x86.mir [new file with mode: 0644]