mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-30 02:25:19 +00:00
Add a version of FindUnusedReg that restrict search to a specific set of registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34784 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -156,6 +156,21 @@ static void CreateRegClassMask(const TargetRegisterClass *RC, BitVector &Mask) {
|
||||
Mask.set(*I);
|
||||
}
|
||||
|
||||
unsigned RegScavenger::FindUnusedReg(const TargetRegisterClass *RegClass,
|
||||
const BitVector &Candidates) const {
|
||||
// Mask off the registers which are not in the TargetRegisterClass.
|
||||
BitVector RegStatesCopy(NumPhysRegs, false);
|
||||
CreateRegClassMask(RegClass, RegStatesCopy);
|
||||
RegStatesCopy &= RegStates;
|
||||
|
||||
// Restrict the search to candidates.
|
||||
RegStatesCopy &= Candidates;
|
||||
|
||||
// Returns the first unused (bit is set) register, or 0 is none is found.
|
||||
int Reg = RegStatesCopy.find_first();
|
||||
return (Reg == -1) ? 0 : Reg;
|
||||
}
|
||||
|
||||
unsigned RegScavenger::FindUnusedReg(const TargetRegisterClass *RegClass,
|
||||
bool ExCalleeSaved) const {
|
||||
// Mask off the registers which are not in the TargetRegisterClass.
|
||||
|
Reference in New Issue
Block a user