From 210448c2338b264d47de552e5a5b52f382b5daf3 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 15 Apr 2009 01:19:35 +0000 Subject: [PATCH] Move MachineRegisterInfo::setRegClass out of line. llvm-svn: 69126 --- .../llvm/CodeGen/MachineRegisterInfo.h | 17 +--------------- llvm/lib/CodeGen/MachineRegisterInfo.cpp | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/llvm/include/llvm/CodeGen/MachineRegisterInfo.h b/llvm/include/llvm/CodeGen/MachineRegisterInfo.h index b313fce182f8..02f9b7c686e2 100644 --- a/llvm/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/llvm/include/llvm/CodeGen/MachineRegisterInfo.h @@ -152,23 +152,8 @@ 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; + void setRegClass(unsigned Reg, const TargetRegisterClass *RC); - // Remove from old register class's vregs list. This may be slow but - // fortunately this operation is rarely needed. - std::vector &VRegs = RegClass2VRegMap[OldRC->getID()]; - std::vector::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. /// diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp index e5148e74be82..4f5ab1f5860e 100644 --- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp +++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp @@ -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 &VRegs = RegClass2VRegMap[OldRC->getID()]; + std::vector::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. ///