summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-25 18:44:14 +0000
committerChris Lattner <sabre@nondot.org>2004-10-25 18:44:14 +0000
commit6fcd8d848dc722537c32b91daea59f50b78a4eba (patch)
treedf620699b6e855f91377cd30d92dce7f8d083b1f /lib
parent408f9995a1d04ca34a68bb470b0a7584b6d10121 (diff)
downloadexternal_llvm-6fcd8d848dc722537c32b91daea59f50b78a4eba.zip
external_llvm-6fcd8d848dc722537c32b91daea59f50b78a4eba.tar.gz
external_llvm-6fcd8d848dc722537c32b91daea59f50b78a4eba.tar.bz2
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
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/LiveVariables.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp
index 825b56d..d4d71dc 100644
--- a/lib/CodeGen/LiveVariables.cpp
+++ b/lib/CodeGen/LiveVariables.cpp
@@ -33,6 +33,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/Config/alloca.h"
using namespace llvm;
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
// register references as presumed dead across basic blocks.
//
- MachineInstr *PhysRegInfoA[RegInfo->getNumRegs()];
- bool PhysRegUsedA[RegInfo->getNumRegs()];
- std::fill(PhysRegInfoA, PhysRegInfoA+RegInfo->getNumRegs(), (MachineInstr*)0);
- PhysRegInfo = PhysRegInfoA;
- PhysRegUsed = PhysRegUsedA;
+ PhysRegInfo = (MachineInstr**)alloca(sizeof(MachineInstr*) *
+ RegInfo->getNumRegs());
+ PhysRegUsed = (bool*)alloca(sizeof(bool)*RegInfo->getNumRegs());
+ std::fill(PhysRegInfo, PhysRegInfo+RegInfo->getNumRegs(), (MachineInstr*)0);
/// Get some space for a respectable number of registers...
VirtRegInfo.resize(64);