X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=examples%2FParallelJIT%2FParallelJIT.cpp;h=b2c53a9bb10e723440d3fea3812e8be373e3f504;hb=c16fc548515f2fd01bc2cbe4befd822a636cc154;hp=305cf1dde06f8fad42ea91da1b0ef3f55ff30dfc;hpb=637f949a7fc97aa42e7360e9ed9462316b772d88;p=oota-llvm.git diff --git a/examples/ParallelJIT/ParallelJIT.cpp b/examples/ParallelJIT/ParallelJIT.cpp index 305cf1dde06..b2c53a9bb10 100644 --- a/examples/ParallelJIT/ParallelJIT.cpp +++ b/examples/ParallelJIT/ParallelJIT.cpp @@ -17,17 +17,17 @@ // call into the JIT at the same time (or the best possible approximation of the // same time). This test had assertion errors until I got the locking right. -#include -#include "llvm/LLVMContext.h" -#include "llvm/Module.h" -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Instructions.h" -#include "llvm/ExecutionEngine/JIT.h" -#include "llvm/ExecutionEngine/Interpreter.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ExecutionEngine/GenericValue.h" +#include "llvm/ExecutionEngine/Interpreter.h" +#include "llvm/IR/Constants.h" +#include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/Instructions.h" +#include "llvm/IR/LLVMContext.h" +#include "llvm/IR/Module.h" #include "llvm/Support/TargetSelect.h" #include +#include using namespace llvm; static Function* createAdd1(Module *M) { @@ -139,6 +139,7 @@ public: ~WaitForThreads() { int result = pthread_cond_destroy( &condition ); + (void)result; assert( result == 0 ); result = pthread_mutex_destroy( &mutex ); @@ -149,6 +150,7 @@ public: void block() { int result = pthread_mutex_lock( &mutex ); + (void)result; assert( result == 0 ); n ++; //~ std::cout << "block() n " << n << " waitFor " << waitFor << std::endl; @@ -178,6 +180,7 @@ public: void releaseThreads( size_t num ) { int result = pthread_mutex_lock( &mutex ); + (void)result; assert( result == 0 ); if ( n >= num ) { @@ -240,13 +243,14 @@ int main() { LLVMContext Context; // Create some module to put our function into it. - Module *M = new Module("test", Context); + std::unique_ptr Owner = make_unique("test", Context); + Module *M = Owner.get(); Function* add1F = createAdd1( M ); Function* fibF = CreateFibFunction( M ); // Now we create the JIT. - ExecutionEngine* EE = EngineBuilder(M).create(); + ExecutionEngine* EE = EngineBuilder(std::move(Owner)).create(); //~ std::cout << "We just constructed this LLVM module:\n\n" << *M; //~ std::cout << "\n\nRunning foo: " << std::flush;