1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Move MachineRegisterInfo::setRegClass out of line.

llvm-svn: 69126
This commit is contained in:
Dan Gohman 2009-04-15 01:19:35 +00:00
parent a885b48029
commit e1e53b379b
2 changed files with 21 additions and 16 deletions

View File

@ -152,22 +152,7 @@ public:
/// setRegClass - Set the register class of the specified virtual register.
///
void setRegClass(unsigned Reg, const TargetRegisterClass *RC) {
unsigned VR = Reg;
Reg -= TargetRegisterInfo::FirstVirtualRegister;
assert(Reg < VRegInfo.size() && "Invalid vreg!");
const TargetRegisterClass *OldRC = VRegInfo[Reg].first;
VRegInfo[Reg].first = RC;
// Remove from old register class's vregs list. This may be slow but
// fortunately this operation is rarely needed.
std::vector<unsigned> &VRegs = RegClass2VRegMap[OldRC->getID()];
std::vector<unsigned>::iterator I=std::find(VRegs.begin(), VRegs.end(), VR);
VRegs.erase(I);
// Add to new register class's vregs list.
RegClass2VRegMap[RC->getID()].push_back(VR);
}
void setRegClass(unsigned Reg, const TargetRegisterClass *RC);
/// createVirtualRegister - Create and return a new virtual register in the
/// function with the specified register class.

View File

@ -35,6 +35,26 @@ MachineRegisterInfo::~MachineRegisterInfo() {
delete [] PhysRegUseDefLists;
}
/// setRegClass - Set the register class of the specified virtual register.
///
void
MachineRegisterInfo::setRegClass(unsigned Reg, const TargetRegisterClass *RC) {
unsigned VR = Reg;
Reg -= TargetRegisterInfo::FirstVirtualRegister;
assert(Reg < VRegInfo.size() && "Invalid vreg!");
const TargetRegisterClass *OldRC = VRegInfo[Reg].first;
VRegInfo[Reg].first = RC;
// Remove from old register class's vregs list. This may be slow but
// fortunately this operation is rarely needed.
std::vector<unsigned> &VRegs = RegClass2VRegMap[OldRC->getID()];
std::vector<unsigned>::iterator I=std::find(VRegs.begin(), VRegs.end(), VR);
VRegs.erase(I);
// Add to new register class's vregs list.
RegClass2VRegMap[RC->getID()].push_back(VR);
}
/// createVirtualRegister - Create and return a new virtual register in the
/// function with the specified register class.
///