@@ -28,27 +28,23 @@ void ParallelLoopGeneratorKMP::createCallSpawnThreads(Value *SubFn,
2828
2929 if (!KMPCMicroTy) {
3030 // void (*kmpc_micro)(kmp_int32 *global_tid, kmp_int32 *bound_tid, ...)
31- Type *MicroParams[] = {Builder.getInt32Ty ()->getPointerTo (),
32- Builder.getInt32Ty ()->getPointerTo ()};
31+ Type *MicroParams[] = {Builder.getPtrTy (0 ), Builder.getPtrTy (0 )};
3332
3433 KMPCMicroTy = FunctionType::get (Builder.getVoidTy (), MicroParams, true );
3534 }
3635
3736 // If F is not available, declare it.
3837 if (!F) {
39- StructType *IdentTy =
40- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
41-
4238 GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
43- Type *Params[] = {IdentTy-> getPointerTo ( ), Builder.getInt32Ty (),
44- KMPCMicroTy-> getPointerTo ( )};
39+ Type *Params[] = {Builder. getPtrTy ( 0 ), Builder.getInt32Ty (),
40+ Builder. getPtrTy ( 0 )};
4541
4642 FunctionType *Ty = FunctionType::get (Builder.getVoidTy (), Params, true );
4743 F = Function::Create (Ty, Linkage, Name, M);
4844 }
4945
50- Value *Task = Builder. CreatePointerBitCastOrAddrSpaceCast (
51- SubFn, KMPCMicroTy-> getPointerTo ( ));
46+ Value *Task =
47+ Builder. CreatePointerBitCastOrAddrSpaceCast ( SubFn, Builder. getPtrTy ( 0 ));
5248
5349 Value *Args[] = {SourceLocationInfo,
5450 Builder.getInt32 (4 ) /* Number of arguments (w/o Task) */ ,
@@ -77,12 +73,9 @@ void ParallelLoopGeneratorKMP::deployParallelExecution(Function *SubFn,
7773}
7874
7975Function *ParallelLoopGeneratorKMP::prepareSubFnDefinition (Function *F) const {
80- std::vector<Type *> Arguments = {Builder.getInt32Ty ()->getPointerTo (),
81- Builder.getInt32Ty ()->getPointerTo (),
82- LongType,
83- LongType,
84- LongType,
85- Builder.getPtrTy ()};
76+ std::vector<Type *> Arguments = {
77+ Builder.getPtrTy (0 ), Builder.getPtrTy (0 ), LongType, LongType, LongType,
78+ Builder.getPtrTy ()};
8679
8780 FunctionType *FT = FunctionType::get (Builder.getVoidTy (), Arguments, false );
8881 Function *SubFn = Function::Create (FT, Function::InternalLinkage,
@@ -320,11 +313,8 @@ Value *ParallelLoopGeneratorKMP::createCallGlobalThreadNum() {
320313
321314 // If F is not available, declare it.
322315 if (!F) {
323- StructType *IdentTy =
324- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
325-
326316 GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
327- Type *Params[] = {IdentTy-> getPointerTo ( )};
317+ Type *Params[] = {Builder. getPtrTy ( 0 )};
328318
329319 FunctionType *Ty = FunctionType::get (Builder.getInt32Ty (), Params, false );
330320 F = Function::Create (Ty, Linkage, Name, M);
@@ -342,11 +332,8 @@ void ParallelLoopGeneratorKMP::createCallPushNumThreads(Value *GlobalThreadID,
342332
343333 // If F is not available, declare it.
344334 if (!F) {
345- StructType *IdentTy =
346- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
347-
348335 GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
349- Type *Params[] = {IdentTy-> getPointerTo ( ), Builder.getInt32Ty (),
336+ Type *Params[] = {Builder. getPtrTy ( 0 ), Builder.getInt32Ty (),
350337 Builder.getInt32Ty ()};
351338
352339 FunctionType *Ty = FunctionType::get (Builder.getVoidTy (), Params, false );
@@ -367,20 +354,18 @@ void ParallelLoopGeneratorKMP::createCallStaticInit(Value *GlobalThreadID,
367354 const std::string Name =
368355 is64BitArch () ? " __kmpc_for_static_init_8" : " __kmpc_for_static_init_4" ;
369356 Function *F = M->getFunction (Name);
370- StructType *IdentTy =
371- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
372357
373358 // If F is not available, declare it.
374359 if (!F) {
375360 GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
376361
377- Type *Params[] = {IdentTy-> getPointerTo ( ),
362+ Type *Params[] = {Builder. getPtrTy ( 0 ),
378363 Builder.getInt32Ty (),
379364 Builder.getInt32Ty (),
380- Builder.getInt32Ty ()-> getPointerTo ( ),
381- LongType-> getPointerTo ( ),
382- LongType-> getPointerTo ( ),
383- LongType-> getPointerTo ( ),
365+ Builder.getPtrTy ( 0 ),
366+ Builder. getPtrTy ( 0 ),
367+ Builder. getPtrTy ( 0 ),
368+ Builder. getPtrTy ( 0 ),
384369 LongType,
385370 LongType};
386371
@@ -414,7 +399,7 @@ void ParallelLoopGeneratorKMP::createCallStaticFini(Value *GlobalThreadID) {
414399 // If F is not available, declare it.
415400 if (!F) {
416401 GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
417- Type *Params[] = {IdentTy-> getPointerTo ( ), Builder.getInt32Ty ()};
402+ Type *Params[] = {Builder. getPtrTy ( 0 ), Builder.getInt32Ty ()};
418403 FunctionType *Ty = FunctionType::get (Builder.getVoidTy (), Params, false );
419404 F = Function::Create (Ty, Linkage, Name, M);
420405 }
@@ -432,14 +417,12 @@ void ParallelLoopGeneratorKMP::createCallDispatchInit(Value *GlobalThreadID,
432417 const std::string Name =
433418 is64BitArch () ? " __kmpc_dispatch_init_8" : " __kmpc_dispatch_init_4" ;
434419 Function *F = M->getFunction (Name);
435- StructType *IdentTy =
436- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
437420
438421 // If F is not available, declare it.
439422 if (!F) {
440423 GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
441424
442- Type *Params[] = {IdentTy-> getPointerTo ( ),
425+ Type *Params[] = {Builder. getPtrTy ( 0 ),
443426 Builder.getInt32Ty (),
444427 Builder.getInt32Ty (),
445428 LongType,
@@ -481,12 +464,9 @@ Value *ParallelLoopGeneratorKMP::createCallDispatchNext(Value *GlobalThreadID,
481464 if (!F) {
482465 GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
483466
484- Type *Params[] = {IdentTy->getPointerTo (),
485- Builder.getInt32Ty (),
486- Builder.getInt32Ty ()->getPointerTo (),
487- LongType->getPointerTo (),
488- LongType->getPointerTo (),
489- LongType->getPointerTo ()};
467+ Type *Params[] = {Builder.getPtrTy (0 ), Builder.getInt32Ty (),
468+ Builder.getPtrTy (0 ), Builder.getPtrTy (0 ),
469+ Builder.getPtrTy (0 ), Builder.getPtrTy (0 )};
490470
491471 FunctionType *Ty = FunctionType::get (Builder.getInt32Ty (), Params, false );
492472 F = Function::Create (Ty, Linkage, Name, M);
0 commit comments