diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2014-06-18 07:08:49 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-06-18 07:08:49 +0000 |
| commit | 23b69426343f4cbfd12cabea483379e18ffd5e3e (patch) | |
| tree | 46f621aea11eac996d82d1a946dfc72231943967 /clang/lib/CodeGen | |
| parent | acf5bc16e3ff17440c243207438b9f6ed0f32e70 (diff) | |
| download | bcm5719-llvm-23b69426343f4cbfd12cabea483379e18ffd5e3e.tar.gz bcm5719-llvm-23b69426343f4cbfd12cabea483379e18ffd5e3e.zip | |
[OPENMP] Reformatting and code improvement.
llvm-svn: 211147
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 21 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.h | 8 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 13 |
3 files changed, 20 insertions, 22 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 8ff4c3c3050..12a3a7790ee 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -19,7 +19,7 @@ #include "llvm/IR/GlobalValue.h" #include "llvm/IR/Value.h" #include "llvm/Support/raw_ostream.h" -#include <assert.h> +#include <cassert> using namespace clang; using namespace CodeGen; @@ -31,8 +31,8 @@ CGOpenMPRuntime::CGOpenMPRuntime(CodeGenModule &CGM) CGM.Int32Ty /* reserved_2 */, CGM.Int32Ty /* reserved_3 */, CGM.Int8PtrTy /* psource */, NULL); // Build void (*kmpc_micro)(kmp_int32 *global_tid, kmp_int32 *bound_tid,...) - llvm::Type *MicroParams[] = { llvm::PointerType::getUnqual(CGM.Int32Ty), - llvm::PointerType::getUnqual(CGM.Int32Ty) }; + llvm::Type *MicroParams[] = {llvm::PointerType::getUnqual(CGM.Int32Ty), + llvm::PointerType::getUnqual(CGM.Int32Ty)}; Kmpc_MicroTy = llvm::FunctionType::get(CGM.VoidTy, MicroParams, true); } @@ -57,10 +57,9 @@ CGOpenMPRuntime::GetOrCreateDefaultOpenMPLocation(OpenMPLocationFlags Flags) { DefaultOpenMPLocation->setLinkage(llvm::GlobalValue::PrivateLinkage); llvm::Constant *Zero = llvm::ConstantInt::get(CGM.Int32Ty, 0, true); - llvm::Constant *Values[] = { - Zero, llvm::ConstantInt::get(CGM.Int32Ty, Flags), Zero, - Zero, DefaultOpenMPPSource - }; + llvm::Constant *Values[] = {Zero, + llvm::ConstantInt::get(CGM.Int32Ty, Flags), + Zero, Zero, DefaultOpenMPPSource}; llvm::Constant *Init = llvm::ConstantStruct::get(IdentTy, Values); DefaultOpenMPLocation->setInitializer(Init); return DefaultOpenMPLocation; @@ -132,7 +131,7 @@ llvm::Value *CGOpenMPRuntime::GetOpenMPGlobalThreadNum(CodeGenFunction &CGF, // Generate "int32 .kmpc_global_thread_num.addr;" CGBuilderTy::InsertPointGuard IPG(CGF.Builder); CGF.Builder.SetInsertPoint(CGF.AllocaInsertPt); - llvm::Value *Args[] = { EmitOpenMPUpdateLocation(CGF, Loc) }; + llvm::Value *Args[] = {EmitOpenMPUpdateLocation(CGF, Loc)}; GTid = CGF.EmitRuntimeCall( CreateRuntimeFunction(OMPRTL__kmpc_global_thread_num), Args); OpenMPGtidMap[CGF.CurFn] = GTid; @@ -163,8 +162,8 @@ CGOpenMPRuntime::CreateRuntimeFunction(OpenMPRTLFunction Function) { case OMPRTL__kmpc_fork_call: { // Build void __kmpc_fork_call(ident_t *loc, kmp_int32 argc, kmpc_micro // microtask, ...); - llvm::Type *TypeParams[] = { getIdentTyPointerTy(), CGM.Int32Ty, - getKmpc_MicroPointerTy() }; + llvm::Type *TypeParams[] = {getIdentTyPointerTy(), CGM.Int32Ty, + getKmpc_MicroPointerTy()}; llvm::FunctionType *FnTy = llvm::FunctionType::get(CGM.VoidTy, TypeParams, true); RTLFn = CGM.CreateRuntimeFunction(FnTy, "__kmpc_fork_call"); @@ -172,7 +171,7 @@ CGOpenMPRuntime::CreateRuntimeFunction(OpenMPRTLFunction Function) { } case OMPRTL__kmpc_global_thread_num: { // Build kmp_int32 __kmpc_global_thread_num(ident_t *loc); - llvm::Type *TypeParams[] = { getIdentTyPointerTy() }; + llvm::Type *TypeParams[] = {getIdentTyPointerTy()}; llvm::FunctionType *FnTy = llvm::FunctionType::get(CGM.Int32Ty, TypeParams, false); RTLFn = CGM.CreateRuntimeFunction(FnTy, "__kmpc_global_thread_num"); diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h index 368c2d897aa..862e8a148c5 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.h +++ b/clang/lib/CodeGen/CGOpenMPRuntime.h @@ -31,7 +31,7 @@ class FunctionType; class StructType; class Type; class Value; -} +} // namespace llvm namespace clang { @@ -136,7 +136,7 @@ private: OpenMPGtidMapTy OpenMPGtidMap; public: - CGOpenMPRuntime(CodeGenModule &CGM); + explicit CGOpenMPRuntime(CodeGenModule &CGM); ~CGOpenMPRuntime() {} /// \brief Cleans up references to the objects in finished function. @@ -171,7 +171,7 @@ public: /// \return Specified function. llvm::Constant *CreateRuntimeFunction(OpenMPRTLFunction Function); }; -} -} +} // namespace CodeGen +} // namespace clang #endif diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 9f915fa2d37..097d9a895c3 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -38,13 +38,12 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) { // Build call __kmpc_fork_call(loc, 1, microtask, captured_struct/*context*/) llvm::Value *Args[] = { - CGM.getOpenMPRuntime().EmitOpenMPUpdateLocation(*this, S.getLocStart()), - Builder.getInt32(1), // Number of arguments after 'microtask' argument - // (there is only one additional argument - 'context') - Builder.CreateBitCast(OutlinedFn, - CGM.getOpenMPRuntime().getKmpc_MicroPointerTy()), - EmitCastToVoidPtr(CapturedStruct) - }; + CGM.getOpenMPRuntime().EmitOpenMPUpdateLocation(*this, S.getLocStart()), + Builder.getInt32(1), // Number of arguments after 'microtask' argument + // (there is only one additional argument - 'context') + Builder.CreateBitCast(OutlinedFn, + CGM.getOpenMPRuntime().getKmpc_MicroPointerTy()), + EmitCastToVoidPtr(CapturedStruct)}; llvm::Constant *RTLFn = CGM.getOpenMPRuntime().CreateRuntimeFunction( CGOpenMPRuntime::OMPRTL__kmpc_fork_call); EmitRuntimeCall(RTLFn, Args); |

