Do not use variable sized arrays in C++, they are non-portable. Patch

contributed by Morten Ofstad


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17217 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-10-25 18:44:14 +00:00
parent 408f9995a1
commit 6fcd8d848d

View File

@ -33,6 +33,7 @@
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/Config/alloca.h"
using namespace llvm; using namespace llvm;
static RegisterAnalysis<LiveVariables> X("livevars", "Live Variable Analysis"); static RegisterAnalysis<LiveVariables> X("livevars", "Live Variable Analysis");
@ -155,11 +156,10 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
// physical register. This is a purely local property, because all physical // physical register. This is a purely local property, because all physical
// register references as presumed dead across basic blocks. // register references as presumed dead across basic blocks.
// //
MachineInstr *PhysRegInfoA[RegInfo->getNumRegs()]; PhysRegInfo = (MachineInstr**)alloca(sizeof(MachineInstr*) *
bool PhysRegUsedA[RegInfo->getNumRegs()]; RegInfo->getNumRegs());
std::fill(PhysRegInfoA, PhysRegInfoA+RegInfo->getNumRegs(), (MachineInstr*)0); PhysRegUsed = (bool*)alloca(sizeof(bool)*RegInfo->getNumRegs());
PhysRegInfo = PhysRegInfoA; std::fill(PhysRegInfo, PhysRegInfo+RegInfo->getNumRegs(), (MachineInstr*)0);
PhysRegUsed = PhysRegUsedA;
/// Get some space for a respectable number of registers... /// Get some space for a respectable number of registers...
VirtRegInfo.resize(64); VirtRegInfo.resize(64);