X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=examples%2FParallelJIT%2FParallelJIT.cpp;h=3c485d4c964d1532972d4b57adaeab2686de65aa;hb=ac6ac4cb6c567726b5ea8c823906a4ab6c8c089a;hp=b05e518ec410c7925959988c6af9581bc8ba0bc2;hpb=3f4ed32b4398eaf4fe0080d8001ba01e6c2f43c8;p=oota-llvm.git diff --git a/examples/ParallelJIT/ParallelJIT.cpp b/examples/ParallelJIT/ParallelJIT.cpp index b05e518ec41..3c485d4c964 100644 --- a/examples/ParallelJIT/ParallelJIT.cpp +++ b/examples/ParallelJIT/ParallelJIT.cpp @@ -17,9 +17,9 @@ // 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 "llvm/ADT/STLExtras.h" #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/ExecutionEngine/Interpreter.h" -#include "llvm/ExecutionEngine/JIT.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Instructions.h" @@ -28,6 +28,7 @@ #include "llvm/Support/TargetSelect.h" #include #include + using namespace llvm; static Function* createAdd1(Module *M) { @@ -38,7 +39,7 @@ static Function* createAdd1(Module *M) { cast(M->getOrInsertFunction("add1", Type::getInt32Ty(M->getContext()), Type::getInt32Ty(M->getContext()), - (Type *)0)); + nullptr)); // Add a basic block to the function. As before, it automatically inserts // because of the last argument. @@ -49,7 +50,7 @@ static Function* createAdd1(Module *M) { // Get pointers to the integer argument of the add1 function... assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg - Argument *ArgX = Add1F->arg_begin(); // Get the arg + Argument *ArgX = &*Add1F->arg_begin(); // Get the arg ArgX->setName("AnArg"); // Give it a nice symbolic name for fun. // Create the add instruction, inserting it into the end of BB. @@ -69,7 +70,7 @@ static Function *CreateFibFunction(Module *M) { cast(M->getOrInsertFunction("fib", Type::getInt32Ty(M->getContext()), Type::getInt32Ty(M->getContext()), - (Type *)0)); + nullptr)); // Add a basic block to the function. BasicBlock *BB = BasicBlock::Create(M->getContext(), "EntryBlock", FibF); @@ -79,7 +80,7 @@ static Function *CreateFibFunction(Module *M) { Value *Two = ConstantInt::get(Type::getInt32Ty(M->getContext()), 2); // Get pointer to the integer argument of the add1 function... - Argument *ArgX = FibF->arg_begin(); // Get the arg. + Argument *ArgX = &*FibF->arg_begin(); // Get the arg. ArgX->setName("AnArg"); // Give it a nice symbolic name for fun. // Create the true_block. @@ -129,10 +130,10 @@ public: n = 0; waitFor = 0; - int result = pthread_cond_init( &condition, NULL ); + int result = pthread_cond_init( &condition, nullptr ); assert( result == 0 ); - result = pthread_mutex_init( &mutex, NULL ); + result = pthread_mutex_init( &mutex, nullptr ); assert( result == 0 ); } @@ -261,21 +262,21 @@ int main() { struct threadParams fib2 = { EE, fibF, 42 }; pthread_t add1Thread; - int result = pthread_create( &add1Thread, NULL, callFunc, &add1 ); + int result = pthread_create( &add1Thread, nullptr, callFunc, &add1 ); if ( result != 0 ) { std::cerr << "Could not create thread" << std::endl; return 1; } pthread_t fibThread1; - result = pthread_create( &fibThread1, NULL, callFunc, &fib1 ); + result = pthread_create( &fibThread1, nullptr, callFunc, &fib1 ); if ( result != 0 ) { std::cerr << "Could not create thread" << std::endl; return 1; } pthread_t fibThread2; - result = pthread_create( &fibThread2, NULL, callFunc, &fib2 ); + result = pthread_create( &fibThread2, nullptr, callFunc, &fib2 ); if ( result != 0 ) { std::cerr << "Could not create thread" << std::endl; return 1;