From 390d78b3d05a69182ba79d666ff2ffa82f5dbb57 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 23 Aug 2009 22:49:13 +0000 Subject: [PATCH] remove use of alloca.h llvm-svn: 79870 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 9fbee9cb7954..19d7ce375ec7 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -19,9 +19,9 @@ #include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/Config/alloca.h" #include "llvm/ExecutionEngine/GenericValue.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MutexGuard.h" @@ -859,9 +859,11 @@ void ExecutionEngine::LoadValueFromMemory(GenericValue &Result, // Host and target are different endian - reverse copy the stored // bytes into a buffer, and load from that. uint8_t *Src = (uint8_t*)Ptr; - uint8_t *Buf = (uint8_t*)alloca(LoadBytes); - std::reverse_copy(Src, Src + LoadBytes, Buf); - Ptr = (GenericValue*)Buf; + + SmallVector Buf; + Buf.resize(LoadBytes+1); + std::reverse_copy(Src, Src + LoadBytes, Buf.data()); + Ptr = (GenericValue*)Buf.data(); } switch (Ty->getTypeID()) {