diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-02-17 19:07:56 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-02-17 19:07:56 +0000 |
commit | d9f0ff56a1878347fe5a0f162ef8c2ef2b63aeb5 (patch) | |
tree | 75dda73c9862f8c73eb74083958cc2e11be718f3 /include/llvm/CodeGen | |
parent | dbe266be35cfee0fbda5523ac578fef81e8fdfcc (diff) | |
download | external_llvm-d9f0ff56a1878347fe5a0f162ef8c2ef2b63aeb5.zip external_llvm-d9f0ff56a1878347fe5a0f162ef8c2ef2b63aeb5.tar.gz external_llvm-d9f0ff56a1878347fe5a0f162ef8c2ef2b63aeb5.tar.bz2 |
Transfer regmasks to MRI.
MRI keeps track of which physregs have been used. Make sure it gets
updated with all the regmask-clobbered registers.
Delete the closePhysRegsUsed() function which isn't necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r-- | include/llvm/CodeGen/MachineRegisterInfo.h | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h index b121dc5..ea108f4 100644 --- a/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/include/llvm/CodeGen/MachineRegisterInfo.h @@ -56,8 +56,13 @@ class MachineRegisterInfo { /// register allocation (though most don't modify this). This is used /// so that the code generator knows which callee save registers to save and /// for other target specific uses. + /// This vector only has bits set for registers explicitly used, not their + /// aliases. BitVector UsedPhysRegs; + /// UsedPhysRegMask - Additional used physregs, but including aliases. + BitVector UsedPhysRegMask; + /// ReservedRegs - This is a bit vector of reserved registers. The target /// may change its mind about which registers should be reserved. This /// vector is the frozen set of reserved registers when register allocation @@ -296,32 +301,41 @@ public: /// isPhysRegUsed - Return true if the specified register is used in this /// function. This only works after register allocation. - bool isPhysRegUsed(unsigned Reg) const { return UsedPhysRegs[Reg]; } + bool isPhysRegUsed(unsigned Reg) const { + return UsedPhysRegs.test(Reg) || UsedPhysRegMask.test(Reg); + } /// isPhysRegOrOverlapUsed - Return true if Reg or any overlapping register /// is used in this function. bool isPhysRegOrOverlapUsed(unsigned Reg) const { + if (UsedPhysRegMask.test(Reg)) + return true; for (const unsigned *AI = TRI->getOverlaps(Reg); *AI; ++AI) - if (isPhysRegUsed(*AI)) + if (UsedPhysRegs.test(*AI)) return true; return false; } /// setPhysRegUsed - Mark the specified register used in this function. /// This should only be called during and after register allocation. - void setPhysRegUsed(unsigned Reg) { UsedPhysRegs[Reg] = true; } + void setPhysRegUsed(unsigned Reg) { UsedPhysRegs.set(Reg); } /// addPhysRegsUsed - Mark the specified registers used in this function. /// This should only be called during and after register allocation. void addPhysRegsUsed(const BitVector &Regs) { UsedPhysRegs |= Regs; } + /// addPhysRegsUsedFromRegMask - Mark any registers not in RegMask as used. + /// This corresponds to the bit mask attached to register mask operands. + void addPhysRegsUsedFromRegMask(const uint32_t *RegMask) { + UsedPhysRegMask.setBitsNotInMask(RegMask); + } + /// setPhysRegUnused - Mark the specified register unused in this function. /// This should only be called during and after register allocation. - void setPhysRegUnused(unsigned Reg) { UsedPhysRegs[Reg] = false; } - - /// closePhysRegsUsed - Expand UsedPhysRegs to its transitive closure over - /// subregisters. That means that if R is used, so are all subregisters. - void closePhysRegsUsed(const TargetRegisterInfo&); + void setPhysRegUnused(unsigned Reg) { + UsedPhysRegs.reset(Reg); + UsedPhysRegMask.reset(Reg); + } //===--------------------------------------------------------------------===// |