@@ -28,27 +28,23 @@ void ParallelLoopGeneratorKMP::createCallSpawnThreads(Value *SubFn,
28
28
29
29
if (!KMPCMicroTy) {
30
30
// 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 )};
33
32
34
33
KMPCMicroTy = FunctionType::get (Builder.getVoidTy (), MicroParams, true );
35
34
}
36
35
37
36
// If F is not available, declare it.
38
37
if (!F) {
39
- StructType *IdentTy =
40
- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
41
-
42
38
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 )};
45
41
46
42
FunctionType *Ty = FunctionType::get (Builder.getVoidTy (), Params, true );
47
43
F = Function::Create (Ty, Linkage, Name, M);
48
44
}
49
45
50
- Value *Task = Builder. CreatePointerBitCastOrAddrSpaceCast (
51
- SubFn, KMPCMicroTy-> getPointerTo ( ));
46
+ Value *Task =
47
+ Builder. CreatePointerBitCastOrAddrSpaceCast ( SubFn, Builder. getPtrTy ( 0 ));
52
48
53
49
Value *Args[] = {SourceLocationInfo,
54
50
Builder.getInt32 (4 ) /* Number of arguments (w/o Task) */ ,
@@ -77,12 +73,9 @@ void ParallelLoopGeneratorKMP::deployParallelExecution(Function *SubFn,
77
73
}
78
74
79
75
Function *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 ()};
86
79
87
80
FunctionType *FT = FunctionType::get (Builder.getVoidTy (), Arguments, false );
88
81
Function *SubFn = Function::Create (FT, Function::InternalLinkage,
@@ -320,11 +313,8 @@ Value *ParallelLoopGeneratorKMP::createCallGlobalThreadNum() {
320
313
321
314
// If F is not available, declare it.
322
315
if (!F) {
323
- StructType *IdentTy =
324
- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
325
-
326
316
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
327
- Type *Params[] = {IdentTy-> getPointerTo ( )};
317
+ Type *Params[] = {Builder. getPtrTy ( 0 )};
328
318
329
319
FunctionType *Ty = FunctionType::get (Builder.getInt32Ty (), Params, false );
330
320
F = Function::Create (Ty, Linkage, Name, M);
@@ -342,11 +332,8 @@ void ParallelLoopGeneratorKMP::createCallPushNumThreads(Value *GlobalThreadID,
342
332
343
333
// If F is not available, declare it.
344
334
if (!F) {
345
- StructType *IdentTy =
346
- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
347
-
348
335
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
349
- Type *Params[] = {IdentTy-> getPointerTo ( ), Builder.getInt32Ty (),
336
+ Type *Params[] = {Builder. getPtrTy ( 0 ), Builder.getInt32Ty (),
350
337
Builder.getInt32Ty ()};
351
338
352
339
FunctionType *Ty = FunctionType::get (Builder.getVoidTy (), Params, false );
@@ -367,20 +354,18 @@ void ParallelLoopGeneratorKMP::createCallStaticInit(Value *GlobalThreadID,
367
354
const std::string Name =
368
355
is64BitArch () ? " __kmpc_for_static_init_8" : " __kmpc_for_static_init_4" ;
369
356
Function *F = M->getFunction (Name);
370
- StructType *IdentTy =
371
- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
372
357
373
358
// If F is not available, declare it.
374
359
if (!F) {
375
360
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
376
361
377
- Type *Params[] = {IdentTy-> getPointerTo ( ),
362
+ Type *Params[] = {Builder. getPtrTy ( 0 ),
378
363
Builder.getInt32Ty (),
379
364
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 ),
384
369
LongType,
385
370
LongType};
386
371
@@ -414,7 +399,7 @@ void ParallelLoopGeneratorKMP::createCallStaticFini(Value *GlobalThreadID) {
414
399
// If F is not available, declare it.
415
400
if (!F) {
416
401
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
417
- Type *Params[] = {IdentTy-> getPointerTo ( ), Builder.getInt32Ty ()};
402
+ Type *Params[] = {Builder. getPtrTy ( 0 ), Builder.getInt32Ty ()};
418
403
FunctionType *Ty = FunctionType::get (Builder.getVoidTy (), Params, false );
419
404
F = Function::Create (Ty, Linkage, Name, M);
420
405
}
@@ -432,14 +417,12 @@ void ParallelLoopGeneratorKMP::createCallDispatchInit(Value *GlobalThreadID,
432
417
const std::string Name =
433
418
is64BitArch () ? " __kmpc_dispatch_init_8" : " __kmpc_dispatch_init_4" ;
434
419
Function *F = M->getFunction (Name);
435
- StructType *IdentTy =
436
- StructType::getTypeByName (M->getContext (), " struct.ident_t" );
437
420
438
421
// If F is not available, declare it.
439
422
if (!F) {
440
423
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
441
424
442
- Type *Params[] = {IdentTy-> getPointerTo ( ),
425
+ Type *Params[] = {Builder. getPtrTy ( 0 ),
443
426
Builder.getInt32Ty (),
444
427
Builder.getInt32Ty (),
445
428
LongType,
@@ -481,12 +464,9 @@ Value *ParallelLoopGeneratorKMP::createCallDispatchNext(Value *GlobalThreadID,
481
464
if (!F) {
482
465
GlobalValue::LinkageTypes Linkage = Function::ExternalLinkage;
483
466
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 )};
490
470
491
471
FunctionType *Ty = FunctionType::get (Builder.getInt32Ty (), Params, false );
492
472
F = Function::Create (Ty, Linkage, Name, M);
0 commit comments