[polly] Avoid llvm::Type::getPointerTo() (NFC) (#112651)
`llvm::Type::getPointerTo()` is to be deprecated & removed soon.
This commit is contained in:
parent
9b713f5d23
commit
2ab2539ce9
@ -28,27 +28,23 @@ void ParallelLoopGeneratorKMP::createCallSpawnThreads(Value *SubFn,
|
|||||||
|
|
||||||
if (!KMPCMicroTy) {
|
if (!KMPCMicroTy) {
|
||||||
// void (*kmpc_micro)(kmp_int32 *global_tid, kmp_int32 *bound_tid, ...)
|
// void (*kmpc_micro)(kmp_int32 *global_tid, kmp_int32 *bound_tid, ...)
|
||||||
Type *MicroParams[] = {Builder.getInt32Ty()->getPointerTo(),
|
Type *MicroParams[] = {Builder.getPtrTy(0), Builder.getPtrTy(0)};
|
||||||
Builder.getInt32Ty()->getPointerTo()};
|
|
||||||
|
|
||||||
KMPCMicroTy = FunctionType::get(Builder.getVoidTy(), MicroParams, true);
|
KMPCMicroTy = FunctionType::get(Builder.getVoidTy(), MicroParams, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If F is not available, declare it.
|
// If F is not available, declare it.
|
||||||
if (!F) {
|
if (!F) {
|
||||||
StructType *IdentTy =
|
|
||||||
StructType::getTypeByName(M->getContext(), "struct.ident_t");
|
|
||||||
|
|
||||||
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
||||||
Type *Params[] = {IdentTy->getPointerTo(), Builder.getInt32Ty(),
|
Type *Params[] = {Builder.getPtrTy(0), Builder.getInt32Ty(),
|
||||||
KMPCMicroTy->getPointerTo()};
|
Builder.getPtrTy(0)};
|
||||||
|
|
||||||
FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), Params, true);
|
FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), Params, true);
|
||||||
F = Function::Create(Ty, Linkage, Name, M);
|
F = Function::Create(Ty, Linkage, Name, M);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *Task = Builder.CreatePointerBitCastOrAddrSpaceCast(
|
Value *Task =
|
||||||
SubFn, KMPCMicroTy->getPointerTo());
|
Builder.CreatePointerBitCastOrAddrSpaceCast(SubFn, Builder.getPtrTy(0));
|
||||||
|
|
||||||
Value *Args[] = {SourceLocationInfo,
|
Value *Args[] = {SourceLocationInfo,
|
||||||
Builder.getInt32(4) /* Number of arguments (w/o Task) */,
|
Builder.getInt32(4) /* Number of arguments (w/o Task) */,
|
||||||
@ -77,12 +73,9 @@ void ParallelLoopGeneratorKMP::deployParallelExecution(Function *SubFn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Function *ParallelLoopGeneratorKMP::prepareSubFnDefinition(Function *F) const {
|
Function *ParallelLoopGeneratorKMP::prepareSubFnDefinition(Function *F) const {
|
||||||
std::vector<Type *> Arguments = {Builder.getInt32Ty()->getPointerTo(),
|
std::vector<Type *> Arguments = {
|
||||||
Builder.getInt32Ty()->getPointerTo(),
|
Builder.getPtrTy(0), Builder.getPtrTy(0), LongType, LongType, LongType,
|
||||||
LongType,
|
Builder.getPtrTy()};
|
||||||
LongType,
|
|
||||||
LongType,
|
|
||||||
Builder.getPtrTy()};
|
|
||||||
|
|
||||||
FunctionType *FT = FunctionType::get(Builder.getVoidTy(), Arguments, false);
|
FunctionType *FT = FunctionType::get(Builder.getVoidTy(), Arguments, false);
|
||||||
Function *SubFn = Function::Create(FT, Function::InternalLinkage,
|
Function *SubFn = Function::Create(FT, Function::InternalLinkage,
|
||||||
@ -320,11 +313,8 @@ Value *ParallelLoopGeneratorKMP::createCallGlobalThreadNum() {
|
|||||||
|
|
||||||
// If F is not available, declare it.
|
// If F is not available, declare it.
|
||||||
if (!F) {
|
if (!F) {
|
||||||
StructType *IdentTy =
|
|
||||||
StructType::getTypeByName(M->getContext(), "struct.ident_t");
|
|
||||||
|
|
||||||
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
||||||
Type *Params[] = {IdentTy->getPointerTo()};
|
Type *Params[] = {Builder.getPtrTy(0)};
|
||||||
|
|
||||||
FunctionType *Ty = FunctionType::get(Builder.getInt32Ty(), Params, false);
|
FunctionType *Ty = FunctionType::get(Builder.getInt32Ty(), Params, false);
|
||||||
F = Function::Create(Ty, Linkage, Name, M);
|
F = Function::Create(Ty, Linkage, Name, M);
|
||||||
@ -342,11 +332,8 @@ void ParallelLoopGeneratorKMP::createCallPushNumThreads(Value *GlobalThreadID,
|
|||||||
|
|
||||||
// If F is not available, declare it.
|
// If F is not available, declare it.
|
||||||
if (!F) {
|
if (!F) {
|
||||||
StructType *IdentTy =
|
|
||||||
StructType::getTypeByName(M->getContext(), "struct.ident_t");
|
|
||||||
|
|
||||||
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
||||||
Type *Params[] = {IdentTy->getPointerTo(), Builder.getInt32Ty(),
|
Type *Params[] = {Builder.getPtrTy(0), Builder.getInt32Ty(),
|
||||||
Builder.getInt32Ty()};
|
Builder.getInt32Ty()};
|
||||||
|
|
||||||
FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), Params, false);
|
FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), Params, false);
|
||||||
@ -367,20 +354,18 @@ void ParallelLoopGeneratorKMP::createCallStaticInit(Value *GlobalThreadID,
|
|||||||
const std::string Name =
|
const std::string Name =
|
||||||
is64BitArch() ? "__kmpc_for_static_init_8" : "__kmpc_for_static_init_4";
|
is64BitArch() ? "__kmpc_for_static_init_8" : "__kmpc_for_static_init_4";
|
||||||
Function *F = M->getFunction(Name);
|
Function *F = M->getFunction(Name);
|
||||||
StructType *IdentTy =
|
|
||||||
StructType::getTypeByName(M->getContext(), "struct.ident_t");
|
|
||||||
|
|
||||||
// If F is not available, declare it.
|
// If F is not available, declare it.
|
||||||
if (!F) {
|
if (!F) {
|
||||||
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
||||||
|
|
||||||
Type *Params[] = {IdentTy->getPointerTo(),
|
Type *Params[] = {Builder.getPtrTy(0),
|
||||||
Builder.getInt32Ty(),
|
Builder.getInt32Ty(),
|
||||||
Builder.getInt32Ty(),
|
Builder.getInt32Ty(),
|
||||||
Builder.getInt32Ty()->getPointerTo(),
|
Builder.getPtrTy(0),
|
||||||
LongType->getPointerTo(),
|
Builder.getPtrTy(0),
|
||||||
LongType->getPointerTo(),
|
Builder.getPtrTy(0),
|
||||||
LongType->getPointerTo(),
|
Builder.getPtrTy(0),
|
||||||
LongType,
|
LongType,
|
||||||
LongType};
|
LongType};
|
||||||
|
|
||||||
@ -414,7 +399,7 @@ void ParallelLoopGeneratorKMP::createCallStaticFini(Value *GlobalThreadID) {
|
|||||||
// If F is not available, declare it.
|
// If F is not available, declare it.
|
||||||
if (!F) {
|
if (!F) {
|
||||||
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
||||||
Type *Params[] = {IdentTy->getPointerTo(), Builder.getInt32Ty()};
|
Type *Params[] = {Builder.getPtrTy(0), Builder.getInt32Ty()};
|
||||||
FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), Params, false);
|
FunctionType *Ty = FunctionType::get(Builder.getVoidTy(), Params, false);
|
||||||
F = Function::Create(Ty, Linkage, Name, M);
|
F = Function::Create(Ty, Linkage, Name, M);
|
||||||
}
|
}
|
||||||
@ -432,14 +417,12 @@ void ParallelLoopGeneratorKMP::createCallDispatchInit(Value *GlobalThreadID,
|
|||||||
const std::string Name =
|
const std::string Name =
|
||||||
is64BitArch() ? "__kmpc_dispatch_init_8" : "__kmpc_dispatch_init_4";
|
is64BitArch() ? "__kmpc_dispatch_init_8" : "__kmpc_dispatch_init_4";
|
||||||
Function *F = M->getFunction(Name);
|
Function *F = M->getFunction(Name);
|
||||||
StructType *IdentTy =
|
|
||||||
StructType::getTypeByName(M->getContext(), "struct.ident_t");
|
|
||||||
|
|
||||||
// If F is not available, declare it.
|
// If F is not available, declare it.
|
||||||
if (!F) {
|
if (!F) {
|
||||||
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
||||||
|
|
||||||
Type *Params[] = {IdentTy->getPointerTo(),
|
Type *Params[] = {Builder.getPtrTy(0),
|
||||||
Builder.getInt32Ty(),
|
Builder.getInt32Ty(),
|
||||||
Builder.getInt32Ty(),
|
Builder.getInt32Ty(),
|
||||||
LongType,
|
LongType,
|
||||||
@ -481,12 +464,9 @@ Value *ParallelLoopGeneratorKMP::createCallDispatchNext(Value *GlobalThreadID,
|
|||||||
if (!F) {
|
if (!F) {
|
||||||
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
|
||||||
|
|
||||||
Type *Params[] = {IdentTy->getPointerTo(),
|
Type *Params[] = {Builder.getPtrTy(0), Builder.getInt32Ty(),
|
||||||
Builder.getInt32Ty(),
|
Builder.getPtrTy(0), Builder.getPtrTy(0),
|
||||||
Builder.getInt32Ty()->getPointerTo(),
|
Builder.getPtrTy(0), Builder.getPtrTy(0)};
|
||||||
LongType->getPointerTo(),
|
|
||||||
LongType->getPointerTo(),
|
|
||||||
LongType->getPointerTo()};
|
|
||||||
|
|
||||||
FunctionType *Ty = FunctionType::get(Builder.getInt32Ty(), Params, false);
|
FunctionType *Ty = FunctionType::get(Builder.getInt32Ty(), Params, false);
|
||||||
F = Function::Create(Ty, Linkage, Name, M);
|
F = Function::Create(Ty, Linkage, Name, M);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user