@@ -1869,11 +1869,11 @@ void CGOpenMPRuntime::emitIfClause(CodeGenFunction &CGF, const Expr *Cond,
18691869 CGF.EmitBlock(ContBlock, /*IsFinished=*/true);
18701870}
18711871
1872- void CGOpenMPRuntime::emitParallelCall(
1873- CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn,
1874- ArrayRef<llvm::Value *> CapturedVars, const Expr *IfCond ,
1875- llvm::Value *NumThreads, OpenMPNumThreadsClauseModifier NumThreadsModifier ,
1876- OpenMPSeverityClauseKind Severity, const Expr *Message ) {
1872+ void CGOpenMPRuntime::emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc,
1873+ llvm::Function *OutlinedFn,
1874+ ArrayRef<llvm::Value *> CapturedVars,
1875+ const Expr *IfCond ,
1876+ llvm::Value *NumThreads ) {
18771877 if (!CGF.HaveInsertPoint())
18781878 return;
18791879 llvm::Value *RTLoc = emitUpdateLocation(CGF, Loc);
@@ -2396,8 +2396,9 @@ void CGOpenMPRuntime::emitBarrierCall(CodeGenFunction &CGF, SourceLocation Loc,
23962396
23972397void CGOpenMPRuntime::emitErrorCall(CodeGenFunction &CGF, SourceLocation Loc,
23982398 Expr *ME, bool IsFatal) {
2399- llvm::Value *MVL = ME ? CGF.EmitScalarExpr(ME)
2400- : llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
2399+ llvm::Value *MVL =
2400+ ME ? CGF.EmitStringLiteralLValue(cast<StringLiteral>(ME)).getPointer(CGF)
2401+ : llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
24012402 // Build call void __kmpc_error(ident_t *loc, int severity, const char
24022403 // *message)
24032404 llvm::Value *Args[] = {
@@ -2745,54 +2746,18 @@ llvm::Value *CGOpenMPRuntime::emitForNext(CodeGenFunction &CGF,
27452746 CGF.getContext().BoolTy, Loc);
27462747}
27472748
2748- llvm::Value *CGOpenMPRuntime::emitMessageClause(CodeGenFunction &CGF,
2749- const Expr *Message) {
2750- if (!Message)
2751- return llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
2752- return CGF.EmitScalarExpr(Message);
2753- }
2754-
2755- llvm::Value *
2756- CGOpenMPRuntime::emitMessageClause(CodeGenFunction &CGF,
2757- const OMPMessageClause *MessageClause) {
2758- return emitMessageClause(
2759- CGF, MessageClause ? MessageClause->getMessageString() : nullptr);
2760- }
2761-
2762- llvm::Value *
2763- CGOpenMPRuntime::emitSeverityClause(OpenMPSeverityClauseKind Severity) {
2764- // OpenMP 6.0, 10.4: "If no severity clause is specified then the effect is
2765- // as if sev-level is fatal."
2766- return llvm::ConstantInt::get(CGM.Int32Ty,
2767- Severity == OMPC_SEVERITY_warning ? 1 : 2);
2768- }
2769-
2770- llvm::Value *
2771- CGOpenMPRuntime::emitSeverityClause(const OMPSeverityClause *SeverityClause) {
2772- return emitSeverityClause(SeverityClause ? SeverityClause->getSeverityKind()
2773- : OMPC_SEVERITY_unknown);
2774- }
2775-
2776- void CGOpenMPRuntime::emitNumThreadsClause(
2777- CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
2778- OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
2779- const Expr *Message) {
2749+ void CGOpenMPRuntime::emitNumThreadsClause(CodeGenFunction &CGF,
2750+ llvm::Value *NumThreads,
2751+ SourceLocation Loc) {
27802752 if (!CGF.HaveInsertPoint())
27812753 return;
2782- llvm::SmallVector<llvm::Value *, 4> Args(
2783- {emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc),
2784- CGF.Builder.CreateIntCast(NumThreads, CGF.Int32Ty, /*isSigned*/ true)});
27852754 // Build call __kmpc_push_num_threads(&loc, global_tid, num_threads)
2786- // or __kmpc_push_num_threads_strict(&loc, global_tid, num_threads, severity,
2787- // messsage) if strict modifier is used.
2788- RuntimeFunction FnID = OMPRTL___kmpc_push_num_threads;
2789- if (Modifier == OMPC_NUMTHREADS_strict) {
2790- FnID = OMPRTL___kmpc_push_num_threads_strict;
2791- Args.push_back(emitSeverityClause(Severity));
2792- Args.push_back(emitMessageClause(CGF, Message));
2793- }
2794- CGF.EmitRuntimeCall(
2795- OMPBuilder.getOrCreateRuntimeFunction(CGM.getModule(), FnID), Args);
2755+ llvm::Value *Args[] = {
2756+ emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc),
2757+ CGF.Builder.CreateIntCast(NumThreads, CGF.Int32Ty, /*isSigned*/ true)};
2758+ CGF.EmitRuntimeCall(OMPBuilder.getOrCreateRuntimeFunction(
2759+ CGM.getModule(), OMPRTL___kmpc_push_num_threads),
2760+ Args);
27962761}
27972762
27982763void CGOpenMPRuntime::emitProcBindClause(CodeGenFunction &CGF,
@@ -12587,11 +12552,12 @@ llvm::Function *CGOpenMPSIMDRuntime::emitTaskOutlinedFunction(
1258712552 llvm_unreachable("Not supported in SIMD-only mode");
1258812553}
1258912554
12590- void CGOpenMPSIMDRuntime::emitParallelCall(
12591- CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn,
12592- ArrayRef<llvm::Value *> CapturedVars, const Expr *IfCond,
12593- llvm::Value *NumThreads, OpenMPNumThreadsClauseModifier NumThreadsModifier,
12594- OpenMPSeverityClauseKind Severity, const Expr *Message) {
12555+ void CGOpenMPSIMDRuntime::emitParallelCall(CodeGenFunction &CGF,
12556+ SourceLocation Loc,
12557+ llvm::Function *OutlinedFn,
12558+ ArrayRef<llvm::Value *> CapturedVars,
12559+ const Expr *IfCond,
12560+ llvm::Value *NumThreads) {
1259512561 llvm_unreachable("Not supported in SIMD-only mode");
1259612562}
1259712563
@@ -12695,10 +12661,9 @@ llvm::Value *CGOpenMPSIMDRuntime::emitForNext(CodeGenFunction &CGF,
1269512661 llvm_unreachable("Not supported in SIMD-only mode");
1269612662}
1269712663
12698- void CGOpenMPSIMDRuntime::emitNumThreadsClause(
12699- CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
12700- OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
12701- const Expr *Message) {
12664+ void CGOpenMPSIMDRuntime::emitNumThreadsClause(CodeGenFunction &CGF,
12665+ llvm::Value *NumThreads,
12666+ SourceLocation Loc) {
1270212667 llvm_unreachable("Not supported in SIMD-only mode");
1270312668}
1270412669
0 commit comments