Introduce TargetRegisterInfo::getOverlaps(Reg), returning a list of all
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 14 Dec 2010 23:03:42 +0000 (23:03 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 14 Dec 2010 23:03:42 +0000 (23:03 +0000)
commitb83ff84193d44bb9aa75e1264ffaff55f468a303
tree0c0553935851d6f625d74839a56f8fc52c3e5c4f
parentd40963c4065432ec7e47879d3ca665a54ee903b6
Introduce TargetRegisterInfo::getOverlaps(Reg), returning a list of all
registers that alias Reg, including itself. This is almost the same as the
existing getAliasSet() method, except for the inclusion of Reg.

The name matches the reflexive TRI::regsOverlap(x, y) relation.

It is very common to do stuff to a register and all its aliases:

  stuff(Reg)
  for (const unsigned *Alias = TRI->getAliasSet(Reg); *Alias; ++Alias)
    stuff(*Alias);

That can now be written as the simpler:

  for (const unsigned *Alias = TRI->getOverlaps(Reg); *Alias; ++Alias)
    stuff(*Alias);

This change requires a bit more constant space for the alias lists because Reg
is included and because the empty alias list cannot be shared any longer.

If the getAliasSet method is eventually removed, this space can be reclaimed by
sharing overlap lists. For instance, %rax and %eax have identical overlap sets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121800 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetRegisterInfo.h
utils/TableGen/RegisterInfoEmitter.cpp