[llvm-commits] [llvm] r108411 - in /llvm/trunk/lib/CodeGen: CriticalAntiDepBreaker.cpp CriticalAntiDepBreaker.h
Bill Wendling
isanbard at gmail.com
Wed Jul 14 22:56:32 PDT 2010
Author: void
Date: Thu Jul 15 00:56:32 2010
New Revision: 108411
URL: http://llvm.org/viewvc/llvm-project?rev=108411&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp
llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.h
Modified: llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp?rev=108411&r1=108410&r2=108411&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp (original)
+++ llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.cpp Thu Jul 15 00:56:32 2010
@@ -34,6 +34,9 @@
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 @@
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();
Modified: llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.h?rev=108411&r1=108410&r2=108411&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.h (original)
+++ llvm/trunk/lib/CodeGen/CriticalAntiDepBreaker.h Thu Jul 15 00:56:32 2010
@@ -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 @@
/// 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.
More information about the llvm-commits
mailing list