diff options
| author | Dan Gohman <gohman@apple.com> | 2008-12-08 04:54:11 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2008-12-08 04:54:11 +0000 |
| commit | 91dfc0880997013f80f385ad1add5e1bb4955a2b (patch) | |
| tree | 5dfa8fae0e3f86f324cb5dcb4bcae0ca8c9ac618 /llvm/lib/CodeGen/MachineRegisterInfo.cpp | |
| parent | 9de2ac8e8b08b9f914acf331a64142818017bd1f (diff) | |
| download | bcm5719-llvm-91dfc0880997013f80f385ad1add5e1bb4955a2b.tar.gz bcm5719-llvm-91dfc0880997013f80f385ad1add5e1bb4955a2b.zip | |
Move createVirtualRegister out-of-line.
llvm-svn: 60684
Diffstat (limited to 'llvm/lib/CodeGen/MachineRegisterInfo.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachineRegisterInfo.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp index 5e20689e0f6..e5148e74be8 100644 --- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp +++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp @@ -35,6 +35,24 @@ MachineRegisterInfo::~MachineRegisterInfo() { delete [] PhysRegUseDefLists; } +/// createVirtualRegister - Create and return a new virtual register in the +/// function with the specified register class. +/// +unsigned +MachineRegisterInfo::createVirtualRegister(const TargetRegisterClass *RegClass){ + assert(RegClass && "Cannot create register without RegClass!"); + // Add a reg, but keep track of whether the vector reallocated or not. + void *ArrayBase = VRegInfo.empty() ? 0 : &VRegInfo[0]; + VRegInfo.push_back(std::make_pair(RegClass, (MachineOperand*)0)); + + if (!((&VRegInfo[0] == ArrayBase || VRegInfo.size() == 1))) + // The vector reallocated, handle this now. + HandleVRegListReallocation(); + unsigned VR = getLastVirtReg(); + RegClass2VRegMap[RegClass->getID()].push_back(VR); + return VR; +} + /// HandleVRegListReallocation - We just added a virtual register to the /// VRegInfo info list and it reallocated. Update the use/def lists info /// pointers. |

