diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-22 20:31:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-22 20:31:01 +0000 |
commit | 8bcb0991864975618c09697b1aca10683346d9f0 (patch) | |
tree | 0afab28faa50e5f27698f8dd6c1921fff8d25e39 /contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | b14637d118e110006a149a79b649c5695e7f419a (diff) | |
parent | 1d5ae1026e831016fc29fd927877c86af904481f (diff) |
Notes
Diffstat (limited to 'contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 1c6c0406d048..ee7a7cb60bc9 100644 --- a/contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/contrib/llvm-project/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -32,12 +32,12 @@ #include "llvm/Support/DynamicLibrary.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Host.h" -#include "llvm/Support/MutexGuard.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetMachine.h" #include <cmath> #include <cstring> +#include <mutex> using namespace llvm; #define DEBUG_TYPE "jit" @@ -191,7 +191,7 @@ uint64_t ExecutionEngineState::RemoveMapping(StringRef Name) { std::string ExecutionEngine::getMangledName(const GlobalValue *GV) { assert(GV->hasName() && "Global must have name."); - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); SmallString<128> FullName; const DataLayout &DL = @@ -204,12 +204,12 @@ std::string ExecutionEngine::getMangledName(const GlobalValue *GV) { } void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); addGlobalMapping(getMangledName(GV), (uint64_t) Addr); } void ExecutionEngine::addGlobalMapping(StringRef Name, uint64_t Addr) { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); assert(!Name.empty() && "Empty GlobalMapping symbol name!"); @@ -228,14 +228,14 @@ void ExecutionEngine::addGlobalMapping(StringRef Name, uint64_t Addr) { } void ExecutionEngine::clearAllGlobalMappings() { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); EEState.getGlobalAddressMap().clear(); EEState.getGlobalAddressReverseMap().clear(); } void ExecutionEngine::clearGlobalMappingsFromModule(Module *M) { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); for (GlobalObject &GO : M->global_objects()) EEState.RemoveMapping(getMangledName(&GO)); @@ -243,12 +243,12 @@ void ExecutionEngine::clearGlobalMappingsFromModule(Module *M) { uint64_t ExecutionEngine::updateGlobalMapping(const GlobalValue *GV, void *Addr) { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); return updateGlobalMapping(getMangledName(GV), (uint64_t) Addr); } uint64_t ExecutionEngine::updateGlobalMapping(StringRef Name, uint64_t Addr) { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); ExecutionEngineState::GlobalAddressMapTy &Map = EEState.getGlobalAddressMap(); @@ -275,7 +275,7 @@ uint64_t ExecutionEngine::updateGlobalMapping(StringRef Name, uint64_t Addr) { } uint64_t ExecutionEngine::getAddressToGlobalIfAvailable(StringRef S) { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); uint64_t Address = 0; ExecutionEngineState::GlobalAddressMapTy::iterator I = EEState.getGlobalAddressMap().find(S); @@ -286,19 +286,19 @@ uint64_t ExecutionEngine::getAddressToGlobalIfAvailable(StringRef S) { void *ExecutionEngine::getPointerToGlobalIfAvailable(StringRef S) { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); if (void* Address = (void *) getAddressToGlobalIfAvailable(S)) return Address; return nullptr; } void *ExecutionEngine::getPointerToGlobalIfAvailable(const GlobalValue *GV) { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); return getPointerToGlobalIfAvailable(getMangledName(GV)); } const GlobalValue *ExecutionEngine::getGlobalValueAtAddress(void *Addr) { - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); // If we haven't computed the reverse mapping yet, do so first. if (EEState.getGlobalAddressReverseMap().empty()) { @@ -340,14 +340,14 @@ void *ArgvArray::reset(LLVMContext &C, ExecutionEngine *EE, Values.clear(); // Free the old contents. Values.reserve(InputArgv.size()); unsigned PtrSize = EE->getDataLayout().getPointerSize(); - Array = make_unique<char[]>((InputArgv.size()+1)*PtrSize); + Array = std::make_unique<char[]>((InputArgv.size()+1)*PtrSize); LLVM_DEBUG(dbgs() << "JIT: ARGV = " << (void *)Array.get() << "\n"); Type *SBytePtr = Type::getInt8PtrTy(C); for (unsigned i = 0; i != InputArgv.size(); ++i) { unsigned Size = InputArgv[i].size()+1; - auto Dest = make_unique<char[]>(Size); + auto Dest = std::make_unique<char[]>(Size); LLVM_DEBUG(dbgs() << "JIT: ARGV[" << i << "] = " << (void *)Dest.get() << "\n"); @@ -575,7 +575,7 @@ void *ExecutionEngine::getPointerToGlobal(const GlobalValue *GV) { if (Function *F = const_cast<Function*>(dyn_cast<Function>(GV))) return getPointerToFunction(F); - MutexGuard locked(lock); + std::lock_guard<sys::Mutex> locked(lock); if (void* P = getPointerToGlobalIfAvailable(GV)) return P; @@ -626,7 +626,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { break; case Type::VectorTyID: // if the whole vector is 'undef' just reserve memory for the value. - auto* VTy = dyn_cast<VectorType>(C->getType()); + auto* VTy = cast<VectorType>(C->getType()); Type *ElemTy = VTy->getElementType(); unsigned int elemNum = VTy->getNumElements(); Result.AggregateVal.resize(elemNum); @@ -925,7 +925,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { elemNum = CDV->getNumElements(); ElemTy = CDV->getElementType(); } else if (CV || CAZ) { - VectorType* VTy = dyn_cast<VectorType>(C->getType()); + auto* VTy = cast<VectorType>(C->getType()); elemNum = VTy->getNumElements(); ElemTy = VTy->getElementType(); } else { |