[llvm-commits] CVS: llvm/lib/CodeGen/LiveVariables.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Oct 25 11:44:28 PDT 2004
Changes in directory llvm/lib/CodeGen:
LiveVariables.cpp updated: 1.44 -> 1.45
---
Log message:
Do not use variable sized arrays in C++, they are non-portable. Patch
contributed by Morten Ofstad
---
Diffs of the changes: (+5 -5)
Index: llvm/lib/CodeGen/LiveVariables.cpp
diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.44 llvm/lib/CodeGen/LiveVariables.cpp:1.45
--- llvm/lib/CodeGen/LiveVariables.cpp:1.44 Wed Sep 1 17:55:35 2004
+++ llvm/lib/CodeGen/LiveVariables.cpp Mon Oct 25 13:44:14 2004
@@ -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 @@
// 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);
More information about the llvm-commits
mailing list