Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Commit d9b1b65

Browse files
committed
Unify error handling
1 parent 512a796 commit d9b1b65

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

ffi/CGIntrinsicsOpenMP.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ Function *CGIntrinsicsOpenMP::createOutlinedFunction(
393393
<< *OutlinedFn << "=== End of Dump OutlinedFn\n");
394394

395395
if (verifyFunction(*OutlinedFn, &errs()))
396-
report_fatal_error("Verification of OutlinedFn failed!");
396+
FATAL_ERROR("Verification of OutlinedFn failed!");
397397

398398
CapturedVars.append(CapturedShared);
399399
CapturedVars.append(CapturedFirstprivate);
@@ -576,7 +576,7 @@ void CGIntrinsicsOpenMP::emitOMPParallelHostRuntime(
576576
<< *Fn << "=== End of Dump OuterFn\n");
577577

578578
if (verifyFunction(*Fn, &errs()))
579-
report_fatal_error("Verification of OuterFn failed!");
579+
FATAL_ERROR("Verification of OuterFn failed!");
580580
}
581581

582582
#if 0
@@ -827,7 +827,7 @@ void CGIntrinsicsOpenMP::emitOMPParallelDeviceRuntime(
827827
OMPBuilder.Builder.CreateRetVoid();
828828

829829
if (verifyFunction(*OutlinedWrapperFn, &errs()))
830-
report_fatal_error("Verification of OutlinedWrapperFn failed!");
830+
FATAL_ERROR("Verification of OutlinedWrapperFn failed!");
831831

832832
DEBUG_ENABLE(dbgs() << "=== Dump OutlinedWrapper\n"
833833
<< *OutlinedWrapperFn
@@ -985,7 +985,7 @@ void CGIntrinsicsOpenMP::emitOMPParallelDeviceRuntime(
985985
<< *Fn << "=== End of Dump OuterFn\n");
986986

987987
if (verifyFunction(*Fn, &errs()))
988-
report_fatal_error("Verification of OuterFn failed!");
988+
FATAL_ERROR("Verification of OuterFn failed!");
989989
}
990990

991991
FunctionCallee CGIntrinsicsOpenMP::getKmpcForStaticInit(Type *Ty) {
@@ -1013,7 +1013,7 @@ FunctionCallee CGIntrinsicsOpenMP::getKmpcDistributeStaticInit(Type *Ty) {
10131013
return OMPBuilder.getOrCreateRuntimeFunction(
10141014
M, OMPRTL___kmpc_distribute_static_init_8u);
10151015

1016-
report_fatal_error("unknown OpenMP loop iterator bitwidth");
1016+
FATAL_ERROR("unknown OpenMP loop iterator bitwidth");
10171017
}
10181018

10191019
void CGIntrinsicsOpenMP::emitOMPFor(DSAValueMapTy &DSAValueMap,
@@ -1125,7 +1125,7 @@ void CGIntrinsicsOpenMP::emitOMPFor(DSAValueMapTy &DSAValueMap,
11251125
OMPBuilder.Builder, OMPBuilder.Builder.saveIP(), Orig,
11261126
ReductionInfos);
11271127
} else
1128-
report_fatal_error("Unsupported privatization");
1128+
FATAL_ERROR("Unsupported privatization");
11291129

11301130
assert(ReplacementValue && "Expected non-null ReplacementValue");
11311131

@@ -1264,7 +1264,7 @@ void CGIntrinsicsOpenMP::emitOMPFor(DSAValueMapTy &DSAValueMap,
12641264
}
12651265

12661266
if (verifyFunction(*PreHeader->getParent(), &errs()))
1267-
report_fatal_error("Verification of omp for lowering failed!");
1267+
FATAL_ERROR("Verification of omp for lowering failed!");
12681268
}
12691269

12701270
void CGIntrinsicsOpenMP::emitOMPTask(DSAValueMapTy &DSAValueMap, Function *Fn,
@@ -1306,7 +1306,7 @@ void CGIntrinsicsOpenMP::emitOMPTask(DSAValueMapTy &DSAValueMap, Function *Fn,
13061306
// Store a copy of the value, thus get the pointer element type.
13071307
PrivatesTy.push_back(OriginalValue->getType()->getPointerElementType());
13081308
} else
1309-
report_fatal_error("Unknown DSA type");
1309+
FATAL_ERROR("Unknown DSA type");
13101310
}
13111311

13121312
StructType *KmpSharedsTTy = nullptr;
@@ -1526,7 +1526,7 @@ void CGIntrinsicsOpenMP::emitOMPTask(DSAValueMapTy &DSAValueMap, Function *Fn,
15261526
ReplacementValue = FirstprivateGEP;
15271527
++PrivatesGEPIdx;
15281528
} else
1529-
report_fatal_error("Unknown DSA type");
1529+
FATAL_ERROR("Unknown DSA type");
15301530

15311531
assert(ReplacementValue && "Expected non-null ReplacementValue");
15321532
SmallVector<User *, 8> Users(OriginalValue->users());
@@ -1669,7 +1669,7 @@ void CGIntrinsicsOpenMP::emitOMPOffloadingMappings(
16691669
// do nothing
16701670
break;
16711671
default:
1672-
report_fatal_error("Unknown mapping type");
1672+
FATAL_ERROR("Unknown mapping type");
16731673
}
16741674

16751675
return MapType;
@@ -1769,7 +1769,7 @@ void CGIntrinsicsOpenMP::emitOMPOffloadingMappings(
17691769
break;
17701770
}
17711771
default:
1772-
report_fatal_error("Unknown mapping type");
1772+
FATAL_ERROR("Unknown mapping type");
17731773
}
17741774
}
17751775

@@ -1885,7 +1885,7 @@ void CGIntrinsicsOpenMP::emitOMPCritical(Function *Fn, BasicBlock *BBEntry,
18851885
BodyGenCallbackTy BodyGenCB,
18861886
FinalizeCallbackTy FiniCB) {
18871887
if (isOpenMPDeviceRuntime())
1888-
report_fatal_error("Critical regions are not (yet) implemented on device");
1888+
FATAL_ERROR("Critical regions are not (yet) implemented on device");
18891889

18901890
const DebugLoc DL = BBEntry->getTerminator()->getDebugLoc();
18911891
BBEntry->getTerminator()->eraseFromParent();
@@ -2390,7 +2390,7 @@ void CGIntrinsicsOpenMP::emitOMPTeamsDeviceRuntime(
23902390
<< *Fn << "=== End of Dump OuterFn\n");
23912391

23922392
if (verifyFunction(*Fn, &errs()))
2393-
report_fatal_error("Verification of OuterFn failed!");
2393+
FATAL_ERROR("Verification of OuterFn failed!");
23942394
}
23952395

23962396
void CGIntrinsicsOpenMP::emitOMPTeams(DSAValueMapTy &DSAValueMap,
@@ -2490,7 +2490,7 @@ void CGIntrinsicsOpenMP::emitOMPTeamsHostRuntime(
24902490
<< *Fn << "=== End of Dump OuterFn\n");
24912491

24922492
if (verifyFunction(*Fn, &errs()))
2493-
report_fatal_error("Verification of OuterFn failed!");
2493+
FATAL_ERROR("Verification of OuterFn failed!");
24942494
}
24952495

24962496
void CGIntrinsicsOpenMP::emitOMPTargetEnterData(
@@ -2698,7 +2698,7 @@ void CGIntrinsicsOpenMP::emitOMPDistribute(DSAValueMapTy &DSAValueMap,
26982698
} else
26992699
OMPBuilder.Builder.CreateStore(V, ReplacementValue);
27002700
} else
2701-
report_fatal_error("Unsupported privatization");
2701+
FATAL_ERROR("Unsupported privatization");
27022702

27032703
assert(ReplacementValue && "Expected non-null ReplacementValue");
27042704

@@ -3067,7 +3067,7 @@ void CGIntrinsicsOpenMP::emitOMPDistributeParallelFor(
30673067
DSAValueMap.erase(PUpperBound);
30683068

30693069
if (verifyFunction(*Fn, &errs()))
3070-
report_fatal_error(
3070+
FATAL_ERROR(
30713071
"Verification of DistributeParallelFor lowering failed!");
30723072

30733073
DEBUG_ENABLE(dbgs() << "=== Dump DistributeParallelFor\n"
@@ -3178,7 +3178,7 @@ Value *CGReduction::emitOperation<DSA_REDUCTION_ADD>(IRBuilderBase &IRB,
31783178
else if (VTy->isFloatTy() || VTy->isDoubleTy())
31793179
return IRB.CreateFAdd(LHS, RHS, "red.add");
31803180
else
3181-
report_fatal_error("Unsupported type for reduction operation");
3181+
FATAL_ERROR("Unsupported type for reduction operation");
31823182
}
31833183

31843184
// OpenMP 5.1, 2.21.5, sub is the same as add.
@@ -3197,7 +3197,7 @@ Value *CGReduction::emitOperation<DSA_REDUCTION_MUL>(IRBuilderBase &IRB,
31973197
else if (VTy->isFloatTy() || VTy->isDoubleTy())
31983198
return IRB.CreateFMul(LHS, RHS, "red.mul");
31993199
else
3200-
report_fatal_error("Unsupported type for reduction operation");
3200+
FATAL_ERROR("Unsupported type for reduction operation");
32013201
}
32023202

32033203
template <>

ffi/IntrinsicsOpenMP.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ struct IntrinsicsOpenMP : public ModulePass {
384384
else
385385
OMPLoopInfo.Sched = OMPScheduleType::StaticChunked;
386386
} else
387-
report_fatal_error("Unsupported scheduling type");
387+
FATAL_ERROR("Unsupported scheduling type");
388388
} else if (Tag.startswith("QUAL.OMP.IF")) {
389389
assert(O.input_size() == 1 &&
390390
"Expected single if condition value");
@@ -426,7 +426,7 @@ struct IntrinsicsOpenMP : public ModulePass {
426426
TeamsInfo.NumTeams = TagInputs[0];
427427
break;
428428
default:
429-
report_fatal_error("Unsupported qualifier in directive");
429+
FATAL_ERROR("Unsupported qualifier in directive");
430430
}
431431
} else if (Tag.startswith("QUAL.OMP.THREAD_LIMIT")) {
432432
assert(O.input_size() == 1 &&
@@ -446,7 +446,7 @@ struct IntrinsicsOpenMP : public ModulePass {
446446
TeamsInfo.ThreadLimit = TagInputs[0];
447447
break;
448448
default:
449-
report_fatal_error("Unsupported qualifier in directive");
449+
FATAL_ERROR("Unsupported qualifier in directive");
450450
}
451451
} else if (Tag.startswith("QUAL.OMP.NOWAIT")) {
452452
switch (Dir) {
@@ -457,7 +457,7 @@ struct IntrinsicsOpenMP : public ModulePass {
457457
TargetInfo.NoWait = true;
458458
break;
459459
default:
460-
report_fatal_error("Unsupported nowait qualifier in directive");
460+
FATAL_ERROR("Unsupported nowait qualifier in directive");
461461
}
462462
} else /* DSA Qualifiers */ {
463463
auto It = StringToDSA.find(Tag);
@@ -500,7 +500,7 @@ struct IntrinsicsOpenMP : public ModulePass {
500500
} else if (Tag == "OMP.DEVICE")
501501
IsDeviceTargetRegion = true;
502502
else
503-
report_fatal_error("Unknown tag " + Tag);
503+
FATAL_ERROR(("Unknown tag " + Tag).str().c_str());
504504
}
505505

506506
assert(Dir != OMPD_unknown && "Expected valid OMP directive");
@@ -586,27 +586,27 @@ struct IntrinsicsOpenMP : public ModulePass {
586586
StructMappingInfoMap, IsDeviceTargetRegion);
587587
} else if (Dir == OMPD_target_data) {
588588
if (IsDeviceTargetRegion)
589-
report_fatal_error("Target enter data should never appear inside a "
589+
FATAL_ERROR("Target enter data should never appear inside a "
590590
"device target region");
591591
CGIOMP.emitOMPTargetData(Fn, BBEntry, BBExit, DSAValueMap,
592592
StructMappingInfoMap);
593593
} else if (Dir == OMPD_target_enter_data) {
594594
if (IsDeviceTargetRegion)
595-
report_fatal_error("Target enter data should never appear inside a "
595+
FATAL_ERROR("Target enter data should never appear inside a "
596596
"device target region");
597597

598598
CGIOMP.emitOMPTargetEnterData(Fn, BBEntry, DSAValueMap,
599599
StructMappingInfoMap);
600600
} else if (Dir == OMPD_target_exit_data) {
601601
if (IsDeviceTargetRegion)
602-
report_fatal_error("Target exit data should never appear inside a "
602+
FATAL_ERROR("Target exit data should never appear inside a "
603603
"device target region");
604604

605605
CGIOMP.emitOMPTargetExitData(Fn, BBEntry, DSAValueMap,
606606
StructMappingInfoMap);
607607
} else if (Dir == OMPD_target_update) {
608608
if (IsDeviceTargetRegion)
609-
report_fatal_error("Target exit data should never appear inside a "
609+
FATAL_ERROR("Target exit data should never appear inside a "
610610
"device target region");
611611

612612
CGIOMP.emitOMPTargetUpdate(Fn, BBEntry, DSAValueMap,
@@ -630,11 +630,11 @@ struct IntrinsicsOpenMP : public ModulePass {
630630
OMPLoopInfo, ParRegionInfo, TargetInfo, StructMappingInfoMap,
631631
IsDeviceTargetRegion);
632632
} else {
633-
report_fatal_error("Unknown directive");
633+
FATAL_ERROR("Unknown directive");
634634
}
635635

636636
if (verifyFunction(*Fn, &errs()))
637-
report_fatal_error(
637+
FATAL_ERROR(
638638
"Verification of IntrinsicsOpenMP lowering failed!");
639639
}
640640
}

0 commit comments

Comments
 (0)