diff options
author | Jush Lu <jush.msn@gmail.com> | 2011-03-09 19:39:16 +0800 |
---|---|---|
committer | Jush Lu <jush.msn@gmail.com> | 2011-03-09 19:39:16 +0800 |
commit | b5530586d68bd25831a6796b5d3199cb0769a35c (patch) | |
tree | fac4a03b53b6a64b0c00f433e4d8b3c9f2bc67cd /lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | b4e17c5bf4361bbdeced39aa071150d7fa9c3c10 (diff) | |
parent | d01f50f42ce60207ed6d27fb1778e456d83be06c (diff) | |
download | external_llvm-b5530586d68bd25831a6796b5d3199cb0769a35c.zip external_llvm-b5530586d68bd25831a6796b5d3199cb0769a35c.tar.gz external_llvm-b5530586d68bd25831a6796b5d3199cb0769a35c.tar.bz2 |
Merge upstream r127116
Diffstat (limited to 'lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index fc5cb92..25a61c0 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -26,8 +26,8 @@ #include "llvm/Support/MutexGuard.h" #include "llvm/Support/ValueHandle.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/System/DynamicLibrary.h" -#include "llvm/System/Host.h" +#include "llvm/Support/DynamicLibrary.h" +#include "llvm/Support/Host.h" #include "llvm/Target/TargetData.h" #include <cmath> #include <cstring> @@ -46,6 +46,16 @@ ExecutionEngine *(*ExecutionEngine::JITCtor)( StringRef MArch, StringRef MCPU, const SmallVectorImpl<std::string>& MAttrs) = 0; +ExecutionEngine *(*ExecutionEngine::MCJITCtor)( + Module *M, + std::string *ErrorStr, + JITMemoryManager *JMM, + CodeGenOpt::Level OptLevel, + bool GVsWithCode, + CodeModel::Model CMM, + StringRef MArch, + StringRef MCPU, + const SmallVectorImpl<std::string>& MAttrs) = 0; ExecutionEngine *(*ExecutionEngine::InterpCtor)(Module *M, std::string *ErrorStr) = 0; @@ -69,9 +79,10 @@ ExecutionEngine::~ExecutionEngine() { void ExecutionEngine::DeregisterAllTables() { if (ExceptionTableDeregister) { - for (std::vector<void*>::iterator it = AllExceptionTables.begin(), - ie = AllExceptionTables.end(); it != ie; ++it) - ExceptionTableDeregister(*it); + DenseMap<const Function*, void*>::iterator it = AllExceptionTables.begin(); + DenseMap<const Function*, void*>::iterator ite = AllExceptionTables.end(); + for (; it != ite; ++it) + ExceptionTableDeregister(it->second); AllExceptionTables.clear(); } } @@ -430,7 +441,13 @@ ExecutionEngine *EngineBuilder::create() { // Unless the interpreter was explicitly selected or the JIT is not linked, // try making a JIT. if (WhichEngine & EngineKind::JIT) { - if (ExecutionEngine::JITCtor) { + if (UseMCJIT && ExecutionEngine::MCJITCtor) { + ExecutionEngine *EE = + ExecutionEngine::MCJITCtor(M, ErrorStr, JMM, OptLevel, + AllocateGVsWithCode, CMModel, + MArch, MCPU, MAttrs); + if (EE) return EE; + } else if (ExecutionEngine::JITCtor) { ExecutionEngine *EE = ExecutionEngine::JITCtor(M, ErrorStr, JMM, OptLevel, AllocateGVsWithCode, CMModel, @@ -548,8 +565,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { else if (CE->getType()->isDoubleTy()) GV.DoubleVal = GV.IntVal.roundToDouble(); else if (CE->getType()->isX86_FP80Ty()) { - const uint64_t zero[] = {0, 0}; - APFloat apf = APFloat(APInt(80, 2, zero)); + APFloat apf = APFloat::getZero(APFloat::x87DoubleExtended); (void)apf.convertFromAPInt(GV.IntVal, false, APFloat::rmNearestTiesToEven); @@ -564,8 +580,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { else if (CE->getType()->isDoubleTy()) GV.DoubleVal = GV.IntVal.signedRoundToDouble(); else if (CE->getType()->isX86_FP80Ty()) { - const uint64_t zero[] = { 0, 0}; - APFloat apf = APFloat(APInt(80, 2, zero)); + APFloat apf = APFloat::getZero(APFloat::x87DoubleExtended); (void)apf.convertFromAPInt(GV.IntVal, true, APFloat::rmNearestTiesToEven); @@ -621,11 +636,11 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { break; case Type::FloatTyID: assert(DestTy->isIntegerTy(32) && "Invalid bitcast"); - GV.IntVal.floatToBits(GV.FloatVal); + GV.IntVal = APInt::floatToBits(GV.FloatVal); break; case Type::DoubleTyID: assert(DestTy->isIntegerTy(64) && "Invalid bitcast"); - GV.IntVal.doubleToBits(GV.DoubleVal); + GV.IntVal = APInt::doubleToBits(GV.DoubleVal); break; case Type::PointerTyID: assert(DestTy->isPointerTy() && "Invalid bitcast"); |