[llvm-commits] [polly] r150334 - /polly/trunk/lib/CodeGeneration.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Sun Feb 12 04:09:32 PST 2012
Author: grosser
Date: Sun Feb 12 06:09:32 2012
New Revision: 150334
URL: http://llvm.org/viewvc/llvm-project?rev=150334&view=rev
Log:
CodeGen: Further improve style
Modified:
polly/trunk/lib/CodeGeneration.cpp
Modified: polly/trunk/lib/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=150334&r1=150333&r2=150334&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Sun Feb 12 06:09:32 2012
@@ -1555,52 +1555,46 @@
// OpenMP mode.
void addOpenMPDeclarations(Module *M)
{
- LLVMContext &Context = M->getContext();
- IRBuilder<> Builder(Context);
- IntegerType *IntPtrTy = TD->getIntPtrType(Context);
+ IRBuilder<> Builder(M->getContext());
+ IntegerType *LongTy = TD->getIntPtrType(M->getContext());
+
+ llvm::GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
if (!M->getFunction("GOMP_parallel_end")) {
- FunctionType *FT = FunctionType::get(Type::getVoidTy(Context), false);
- Function::Create(FT, Function::ExternalLinkage, "GOMP_parallel_end", M);
+ FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), false);
+ Function::Create(Ty, Linkage, "GOMP_parallel_end", M);
}
if (!M->getFunction("GOMP_parallel_loop_runtime_start")) {
- // Type of first argument.
- std::vector<Type*> Args(1, Builder.getInt8PtrTy());
- FunctionType *FnArgTy = FunctionType::get(Builder.getVoidTy(), Args,
- false);
- PointerType *FnPtrTy = PointerType::getUnqual(FnArgTy);
-
- Args.clear();
- Args.push_back(FnPtrTy);
- Args.push_back(Builder.getInt8PtrTy());
- Args.push_back(Builder.getInt32Ty());
- Args.push_back(IntPtrTy);
- Args.push_back(IntPtrTy);
- Args.push_back(IntPtrTy);
-
- FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), Args, false);
- Function::Create(Ty, Function::ExternalLinkage,
- "GOMP_parallel_loop_runtime_start", M);
+ Type *Params[] = {
+ PointerType::getUnqual(FunctionType::get(Builder.getVoidTy(),
+ Builder.getInt8PtrTy(),
+ false)),
+ Builder.getInt8PtrTy(),
+ Builder.getInt32Ty(),
+ LongTy,
+ LongTy,
+ LongTy,
+ };
+
+ FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), Params, false);
+ Function::Create(Ty, Linkage, "GOMP_parallel_loop_runtime_start", M);
}
if (!M->getFunction("GOMP_loop_runtime_next")) {
- PointerType *IntLongPtrTy = PointerType::getUnqual(IntPtrTy);
+ PointerType *LongPtrTy = PointerType::getUnqual(LongTy);
+ Type *Params[] = {
+ LongPtrTy,
+ LongPtrTy,
+ };
- std::vector<Type*> Args;
- Args.push_back(IntLongPtrTy);
- Args.push_back(IntLongPtrTy);
-
- FunctionType *Ty = FunctionType::get(Builder.getInt8Ty(), Args, false);
- Function::Create(Ty, Function::ExternalLinkage,
- "GOMP_loop_runtime_next", M);
+ FunctionType *Ty = FunctionType::get(Builder.getInt8Ty(), Params, false);
+ Function::Create(Ty, Linkage, "GOMP_loop_runtime_next", M);
}
if (!M->getFunction("GOMP_loop_end_nowait")) {
- FunctionType *FT = FunctionType::get(Builder.getVoidTy(),
- std::vector<Type*>(), false);
- Function::Create(FT, Function::ExternalLinkage,
- "GOMP_loop_end_nowait", M);
+ FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), false);
+ Function::Create(Ty, Linkage, "GOMP_loop_end_nowait", M);
}
}
@@ -1702,8 +1696,7 @@
Module *M = region->getEntry()->getParent()->getParent();
- if (OpenMP)
- addOpenMPDeclarations(M);
+ if (OpenMP) addOpenMPDeclarations(M);
// In the CFG the optimized code of the SCoP is generated next to the
// original code. Both the new and the original version of the code remain
More information about the llvm-commits
mailing list