diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-07-15 05:56:32 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-07-15 05:56:32 +0000 |
commit | f7f72bc1eaf01bfc6f09094d200e6aea35921f65 (patch) | |
tree | 64f28d00808d6f0cbc7260de38518b3b96d29054 | |
parent | bbcdebbc8d16c84f2f76eb1192db22472e94661c (diff) | |
download | external_llvm-f7f72bc1eaf01bfc6f09094d200e6aea35921f65.zip external_llvm-f7f72bc1eaf01bfc6f09094d200e6aea35921f65.tar.gz external_llvm-f7f72bc1eaf01bfc6f09094d200e6aea35921f65.tar.bz2 |
Use std::vector instead of a hard-coded array. The length of that array could
get *very* large, but we only need it to be the size of thenumber of pregs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108411 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CriticalAntiDepBreaker.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/CriticalAntiDepBreaker.h | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/CodeGen/CriticalAntiDepBreaker.cpp b/lib/CodeGen/CriticalAntiDepBreaker.cpp index e3746a9..9d48665 100644 --- a/lib/CodeGen/CriticalAntiDepBreaker.cpp +++ b/lib/CodeGen/CriticalAntiDepBreaker.cpp @@ -34,6 +34,9 @@ CriticalAntiDepBreaker(MachineFunction& MFi) : TRI(MF.getTarget().getRegisterInfo()), AllocatableSet(TRI->getAllocatableSet(MF)) { + Classes.reserve(TRI->getNumRegs()); + KillIndices.reserve(TRI->getNumRegs()); + DefIndices.reserve(TRI->getNumRegs()); } CriticalAntiDepBreaker::~CriticalAntiDepBreaker() { @@ -41,8 +44,7 @@ CriticalAntiDepBreaker::~CriticalAntiDepBreaker() { void CriticalAntiDepBreaker::StartBlock(MachineBasicBlock *BB) { // Clear out the register class data. - std::fill(Classes, array_endof(Classes), - static_cast<const TargetRegisterClass *>(0)); + Classes.clear(); // Initialize the indices to indicate that no registers are live. const unsigned BBSize = BB->size(); diff --git a/lib/CodeGen/CriticalAntiDepBreaker.h b/lib/CodeGen/CriticalAntiDepBreaker.h index 5406300..62ef72a 100644 --- a/lib/CodeGen/CriticalAntiDepBreaker.h +++ b/lib/CodeGen/CriticalAntiDepBreaker.h @@ -25,6 +25,7 @@ #include "llvm/ADT/BitVector.h" #include "llvm/ADT/SmallSet.h" #include <map> +#include <vector> namespace llvm { class TargetInstrInfo; @@ -46,19 +47,18 @@ class TargetRegisterInfo; /// corresponding value is null. If the register is live but used in /// multiple register classes, the corresponding value is -1 casted to a /// pointer. - const TargetRegisterClass * - Classes[TargetRegisterInfo::FirstVirtualRegister]; + std::vector<const TargetRegisterClass *> Classes; /// RegRegs - Map registers to all their references within a live range. std::multimap<unsigned, MachineOperand *> RegRefs; /// KillIndices - The index of the most recent kill (proceding bottom-up), /// or ~0u if the register is not live. - unsigned KillIndices[TargetRegisterInfo::FirstVirtualRegister]; + std::vector<unsigned> KillIndices; /// DefIndices - The index of the most recent complete def (proceding bottom /// up), or ~0u if the register is live. - unsigned DefIndices[TargetRegisterInfo::FirstVirtualRegister]; + std::vector<unsigned> DefIndices; /// KeepRegs - A set of registers which are live and cannot be changed to /// break anti-dependencies. |