OSDN Git Service

Teach TableGen to infer missing register classes.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 4 Oct 2011 15:28:49 +0000 (15:28 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 4 Oct 2011 15:28:49 +0000 (15:28 +0000)
commitbabf0569e2e4f204f9a304416cc4acc349d8f836
treea47b47efc8a5d4334c3f5bf0ace78ee018f7e141
parent01faf432d9d81212b492f326594d43a951fe64f0
Teach TableGen to infer missing register classes.

The set of register classes should be closed under sub-register
operations and intersections. That will allow the register allocator to
model combinations of constraints accurately.

This patch implements the easiest form of register class inference:  For
every register class, and for every sub-register SubIdx, the subset of
registers in RC that have a SubIdx sub-register should also be a register
class.

This does create some new register classes for the targets in the tree:

ARM gets a new QQQQPR_with_ssub_0.  This class was omitted from the .td
file on purpose because it only has two registers.  InstrEmitter and
RegisterCoalescer have safeguards against selecting too small register
classes, so it is harmless.

PowerPC gets a G8RC_with_sub_32 class because LR is not a sub_32
sub-register of LR8.  I think that might be an omission?

X86 puts RIP in the GR64 class, and since that register doesn't have
8-bit sub-registers, we get:

  GR64_with_sub_8bit
  GR64_TC_with_sub_8bit
  GR64_NOREX_with_sub_8bit
  GR64_TC_with_sub_8bit_hi

The various CodeGen classes have already been fixed so adding new
register classes should not affect compile time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141084 91177308-0d34-0410-b5e6-96231b3b80d8
utils/TableGen/CodeGenRegisters.cpp
utils/TableGen/CodeGenRegisters.h