clang: lib/AST/OpenMPClause.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

22#include "llvm/ADT/SmallPtrSet.h"

23#include "llvm/Support/ErrorHandling.h"

24#include

25#include

26#include

27

28using namespace clang;

29using namespace llvm;

30using namespace omp;

31

34 default:

35 break;

36#define GEN_CLANG_CLAUSE_CLASS

37#define CLAUSE_CLASS(Enum, Str, Class) \

38 case Enum: \

39 return static_cast<Class *>(this)->children();

40#include "llvm/Frontend/OpenMP/OMP.inc"

41 }

42 llvm_unreachable("unknown OMPClause");

43}

44

47#define GEN_CLANG_CLAUSE_CLASS

48#define CLAUSE_CLASS(Enum, Str, Class) \

49 case Enum: \

50 return static_cast<Class *>(this)->used_children();

51#define CLAUSE_NO_CLASS(Enum, Str) \

52 case Enum: \

53 break;

54#include "llvm/Frontend/OpenMP/OMP.inc"

55 }

56 llvm_unreachable("unknown OMPClause");

57}

58

63

65 switch (C->getClauseKind()) {

66 case OMPC_schedule:

68 case OMPC_dist_schedule:

70 case OMPC_firstprivate:

72 case OMPC_lastprivate:

74 case OMPC_reduction:

76 case OMPC_task_reduction:

78 case OMPC_in_reduction:

80 case OMPC_linear:

82 case OMPC_if:

84 case OMPC_num_threads:

86 case OMPC_num_teams:

88 case OMPC_thread_limit:

90 case OMPC_device:

92 case OMPC_grainsize:

94 case OMPC_num_tasks:

96 case OMPC_final:

98 case OMPC_priority:

100 case OMPC_novariants:

102 case OMPC_nocontext:

104 case OMPC_filter:

106 case OMPC_ompx_dyn_cgroup_mem:

108 case OMPC_dyn_groupprivate:

110 case OMPC_message:

112 case OMPC_default:

113 case OMPC_proc_bind:

114 case OMPC_safelen:

115 case OMPC_simdlen:

116 case OMPC_sizes:

117 case OMPC_allocator:

118 case OMPC_allocate:

119 case OMPC_collapse:

120 case OMPC_private:

121 case OMPC_shared:

122 case OMPC_aligned:

123 case OMPC_copyin:

124 case OMPC_copyprivate:

125 case OMPC_ordered:

126 case OMPC_nowait:

127 case OMPC_untied:

128 case OMPC_mergeable:

129 case OMPC_threadset:

130 case OMPC_threadprivate:

131 case OMPC_groupprivate:

132 case OMPC_flush:

133 case OMPC_depobj:

134 case OMPC_read:

135 case OMPC_write:

136 case OMPC_update:

137 case OMPC_capture:

138 case OMPC_compare:

139 case OMPC_fail:

140 case OMPC_seq_cst:

141 case OMPC_acq_rel:

142 case OMPC_acquire:

143 case OMPC_release:

144 case OMPC_relaxed:

145 case OMPC_depend:

146 case OMPC_threads:

147 case OMPC_simd:

148 case OMPC_map:

149 case OMPC_nogroup:

150 case OMPC_hint:

151 case OMPC_defaultmap:

152 case OMPC_unknown:

153 case OMPC_uniform:

154 case OMPC_to:

155 case OMPC_from:

156 case OMPC_use_device_ptr:

157 case OMPC_use_device_addr:

158 case OMPC_is_device_ptr:

159 case OMPC_has_device_addr:

160 case OMPC_unified_address:

161 case OMPC_unified_shared_memory:

162 case OMPC_reverse_offload:

163 case OMPC_dynamic_allocators:

164 case OMPC_atomic_default_mem_order:

165 case OMPC_self_maps:

166 case OMPC_at:

167 case OMPC_severity:

168 case OMPC_device_type:

169 case OMPC_match:

170 case OMPC_nontemporal:

171 case OMPC_order:

172 case OMPC_destroy:

173 case OMPC_detach:

174 case OMPC_inclusive:

175 case OMPC_exclusive:

176 case OMPC_uses_allocators:

177 case OMPC_affinity:

178 case OMPC_when:

179 case OMPC_bind:

180 case OMPC_ompx_bare:

181 break;

182 default:

183 break;

184 }

185

186 return nullptr;

187}

188

193

195 switch (C->getClauseKind()) {

196 case OMPC_lastprivate:

198 case OMPC_reduction:

200 case OMPC_task_reduction:

202 case OMPC_in_reduction:

204 case OMPC_linear:

206 case OMPC_schedule:

207 case OMPC_dist_schedule:

208 case OMPC_firstprivate:

209 case OMPC_default:

210 case OMPC_proc_bind:

211 case OMPC_if:

212 case OMPC_final:

213 case OMPC_num_threads:

214 case OMPC_safelen:

215 case OMPC_simdlen:

216 case OMPC_sizes:

217 case OMPC_allocator:

218 case OMPC_allocate:

219 case OMPC_collapse:

220 case OMPC_private:

221 case OMPC_shared:

222 case OMPC_aligned:

223 case OMPC_copyin:

224 case OMPC_copyprivate:

225 case OMPC_ordered:

226 case OMPC_nowait:

227 case OMPC_untied:

228 case OMPC_mergeable:

229 case OMPC_threadprivate:

230 case OMPC_groupprivate:

231 case OMPC_flush:

232 case OMPC_depobj:

233 case OMPC_read:

234 case OMPC_write:

235 case OMPC_update:

236 case OMPC_capture:

237 case OMPC_compare:

238 case OMPC_fail:

239 case OMPC_seq_cst:

240 case OMPC_acq_rel:

241 case OMPC_acquire:

242 case OMPC_release:

243 case OMPC_relaxed:

244 case OMPC_depend:

245 case OMPC_device:

246 case OMPC_threads:

247 case OMPC_simd:

248 case OMPC_map:

249 case OMPC_num_teams:

250 case OMPC_thread_limit:

251 case OMPC_priority:

252 case OMPC_grainsize:

253 case OMPC_nogroup:

254 case OMPC_num_tasks:

255 case OMPC_hint:

256 case OMPC_defaultmap:

257 case OMPC_unknown:

258 case OMPC_uniform:

259 case OMPC_to:

260 case OMPC_from:

261 case OMPC_use_device_ptr:

262 case OMPC_use_device_addr:

263 case OMPC_is_device_ptr:

264 case OMPC_has_device_addr:

265 case OMPC_unified_address:

266 case OMPC_unified_shared_memory:

267 case OMPC_reverse_offload:

268 case OMPC_dynamic_allocators:

269 case OMPC_atomic_default_mem_order:

270 case OMPC_self_maps:

271 case OMPC_at:

272 case OMPC_severity:

273 case OMPC_message:

274 case OMPC_device_type:

275 case OMPC_match:

276 case OMPC_nontemporal:

277 case OMPC_order:

278 case OMPC_destroy:

279 case OMPC_novariants:

280 case OMPC_nocontext:

281 case OMPC_detach:

282 case OMPC_inclusive:

283 case OMPC_exclusive:

284 case OMPC_uses_allocators:

285 case OMPC_affinity:

286 case OMPC_when:

287 case OMPC_bind:

288 break;

289 default:

290 break;

291 }

292

293 return nullptr;

294}

295

296

297

299 if (!S)

300 return nullptr;

301 if (auto *DS = dyn_cast(S)) {

302 assert(DS->isSingleDecl() && "Only single expression must be captured.");

303 if (auto *OED = dyn_cast(DS->getSingleDecl()))

304 return OED->getInitAddress();

305 }

306 return nullptr;

307}

308

312 return child_range(&Condition, &Condition + 1);

313}

314

316 if (Condition)

317 return child_range(&Condition, &Condition + 1);

319}

320

324 return child_range(&Grainsize, &Grainsize + 1);

325}

326

332

338

344

350

356

358 unsigned NumLoops,

362 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));

363 auto *Clause =

364 new (Mem) OMPOrderedClause(Num, NumLoops, StartLoc, LParenLoc, EndLoc);

365 for (unsigned I = 0; I < NumLoops; ++I) {

366 Clause->setLoopNumIterations(I, nullptr);

367 Clause->setLoopCounter(I, nullptr);

368 }

369 return Clause;

370}

371

373 unsigned NumLoops) {

374 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops));

375 auto *Clause = new (Mem) OMPOrderedClause(NumLoops);

376 for (unsigned I = 0; I < NumLoops; ++I) {

377 Clause->setLoopNumIterations(I, nullptr);

378 Clause->setLoopCounter(I, nullptr);

379 }

380 return Clause;

381}

382

384 Expr *NumIterations) {

385 assert(NumLoop < NumberOfLoops && "out of loops number.");

386 getTrailingObjects()[NumLoop] = NumIterations;

387}

388

390 return getTrailingObjects(NumberOfLoops);

391}

392

394 assert(NumLoop < NumberOfLoops && "out of loops number.");

395 getTrailingObjects()[NumberOfLoops + NumLoop] = Counter;

396}

397

399 assert(NumLoop < NumberOfLoops && "out of loops number.");

400 return getTrailingObjects()[NumberOfLoops + NumLoop];

401}

402

404 assert(NumLoop < NumberOfLoops && "out of loops number.");

405 return getTrailingObjects()[NumberOfLoops + NumLoop];

406}

407

411 return new (C) OMPUpdateClause(StartLoc, EndLoc, false);

412}

413

418 void *Mem =

419 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),

420 alignof(OMPUpdateClause));

421 auto *Clause =

422 new (Mem) OMPUpdateClause(StartLoc, EndLoc, true);

423 Clause->setLParenLoc(LParenLoc);

424 Clause->setArgumentLoc(ArgumentLoc);

425 Clause->setDependencyKind(DK);

426 return Clause;

427}

428

430 bool IsExtended) {

431 if (!IsExtended)

432 return new (C) OMPUpdateClause(false);

433 void *Mem =

434 C.Allocate(totalSizeToAlloc<SourceLocation, OpenMPDependClauseKind>(2, 1),

435 alignof(OMPUpdateClause));

436 auto *Clause = new (Mem) OMPUpdateClause(true);

437 Clause->IsExtended = true;

438 return Clause;

439}

440

441void OMPPrivateClause::setPrivateCopies(ArrayRef<Expr *> VL) {

443 "Number of private copies is not the same as the preallocated buffer");

445}

446

451

452 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));

453 OMPPrivateClause *Clause =

454 new (Mem) OMPPrivateClause(StartLoc, LParenLoc, EndLoc, VL.size());

455 Clause->setVarRefs(VL);

456 Clause->setPrivateCopies(PrivateVL);

457 return Clause;

458}

459

461 unsigned N) {

462 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * N));

463 return new (Mem) OMPPrivateClause(N);

464}

465

466void OMPFirstprivateClause::setPrivateCopies(ArrayRef<Expr *> VL) {

468 "Number of private copies is not the same as the preallocated buffer");

470}

471

474 "Number of inits is not the same as the preallocated buffer");

475 llvm::copy(VL, getPrivateCopies().end());

476}

477

483 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(3 * VL.size()));

484 OMPFirstprivateClause *Clause =

485 new (Mem) OMPFirstprivateClause(StartLoc, LParenLoc, EndLoc, VL.size());

486 Clause->setVarRefs(VL);

487 Clause->setPrivateCopies(PrivateVL);

488 Clause->setInits(InitVL);

489 Clause->setPreInitStmt(PreInit);

490 return Clause;

491}

492

494 unsigned N) {

495 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(3 * N));

496 return new (Mem) OMPFirstprivateClause(N);

497}

498

500 assert(PrivateCopies.size() == varlist_size() &&

501 "Number of private copies is not the same as the preallocated buffer");

502 llvm::copy(PrivateCopies, varlist_end());

503}

504

505void OMPLastprivateClause::setSourceExprs(ArrayRef<Expr *> SrcExprs) {

506 assert(SrcExprs.size() == varlist_size() && "Number of source expressions is "

507 "not the same as the "

508 "preallocated buffer");

509 llvm::copy(SrcExprs, getPrivateCopies().end());

510}

511

512void OMPLastprivateClause::setDestinationExprs(ArrayRef<Expr *> DstExprs) {

513 assert(DstExprs.size() == varlist_size() && "Number of destination "

514 "expressions is not the same as "

515 "the preallocated buffer");

516 llvm::copy(DstExprs, getSourceExprs().end());

517}

518

519void OMPLastprivateClause::setAssignmentOps(ArrayRef<Expr *> AssignmentOps) {

520 assert(AssignmentOps.size() == varlist_size() &&

521 "Number of assignment expressions is not the same as the preallocated "

522 "buffer");

523 llvm::copy(AssignmentOps, getDestinationExprs().end());

524}

525

532 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));

533 OMPLastprivateClause *Clause = new (Mem) OMPLastprivateClause(

534 StartLoc, LParenLoc, EndLoc, LPKind, LPKindLoc, ColonLoc, VL.size());

535 Clause->setVarRefs(VL);

536 Clause->setSourceExprs(SrcExprs);

537 Clause->setDestinationExprs(DstExprs);

538 Clause->setAssignmentOps(AssignmentOps);

539 Clause->setPreInitStmt(PreInit);

540 Clause->setPostUpdateExpr(PostUpdate);

541 return Clause;

542}

543

545 unsigned N) {

546 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * N));

547 return new (Mem) OMPLastprivateClause(N);

548}

549

555 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));

556 OMPSharedClause *Clause =

557 new (Mem) OMPSharedClause(StartLoc, LParenLoc, EndLoc, VL.size());

558 Clause->setVarRefs(VL);

559 return Clause;

560}

561

563 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));

564 return new (Mem) OMPSharedClause(N);

565}

566

569 "Number of privates is not the same as the preallocated buffer");

571}

572

575 "Number of inits is not the same as the preallocated buffer");

576 llvm::copy(IL, getPrivates().end());

577}

578

581 "Number of updates is not the same as the preallocated buffer");

582 llvm::copy(UL, getInits().end());

583}

584

587 "Number of final updates is not the same as the preallocated buffer");

588 llvm::copy(FL, getUpdates().end());

589}

590

592 assert(

594 "Number of used expressions is not the same as the preallocated buffer");

595 llvm::copy(UE, getFinals().end() + 2);

596}

597

604 Expr *PostUpdate) {

605

606

607 void *Mem =

608 C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2 + VL.size() + 1));

609 OMPLinearClause *Clause =

610 new (Mem) OMPLinearClause(StartLoc, LParenLoc, Modifier, ModifierLoc,

611 ColonLoc, StepModifierLoc, EndLoc, VL.size());

612 Clause->setVarRefs(VL);

613 Clause->setPrivates(PL);

614 Clause->setInits(IL);

615

616

617 std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(),

618 nullptr);

619 std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(),

620 nullptr);

621 std::fill(Clause->getUsedExprs().begin(), Clause->getUsedExprs().end(),

622 nullptr);

623 Clause->setStep(Step);

624 Clause->setCalcStep(CalcStep);

625 Clause->setPreInitStmt(PreInit);

626 Clause->setPostUpdateExpr(PostUpdate);

627 return Clause;

628}

629

631 unsigned NumVars) {

632

633

634 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2 + NumVars +1));

635 return new (Mem) OMPLinearClause(NumVars);

636}

637

639

641 reinterpret_cast<Stmt **>(getUsedExprs().begin()),

642 reinterpret_cast<Stmt **>(llvm::find(getUsedExprs(), nullptr)));

643}

644

649 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));

650 OMPAlignedClause *Clause = new (Mem)

651 OMPAlignedClause(StartLoc, LParenLoc, ColonLoc, EndLoc, VL.size());

652 Clause->setVarRefs(VL);

653 Clause->setAlignment(A);

654 return Clause;

655}

656

658 unsigned NumVars) {

659 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(NumVars + 1));

660 return new (Mem) OMPAlignedClause(NumVars);

661}

662

667 return new (C) OMPAlignClause(A, StartLoc, LParenLoc, EndLoc);

668}

669

670void OMPCopyinClause::setSourceExprs(ArrayRef<Expr *> SrcExprs) {

671 assert(SrcExprs.size() == varlist_size() && "Number of source expressions is "

672 "not the same as the "

673 "preallocated buffer");

675}

676

677void OMPCopyinClause::setDestinationExprs(ArrayRef<Expr *> DstExprs) {

678 assert(DstExprs.size() == varlist_size() && "Number of destination "

679 "expressions is not the same as "

680 "the preallocated buffer");

681 llvm::copy(DstExprs, getSourceExprs().end());

682}

683

684void OMPCopyinClause::setAssignmentOps(ArrayRef<Expr *> AssignmentOps) {

685 assert(AssignmentOps.size() == varlist_size() &&

686 "Number of assignment expressions is not the same as the preallocated "

687 "buffer");

688 llvm::copy(AssignmentOps, getDestinationExprs().end());

689}

690

695 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));

696 OMPCopyinClause *Clause =

697 new (Mem) OMPCopyinClause(StartLoc, LParenLoc, EndLoc, VL.size());

698 Clause->setVarRefs(VL);

699 Clause->setSourceExprs(SrcExprs);

700 Clause->setDestinationExprs(DstExprs);

701 Clause->setAssignmentOps(AssignmentOps);

702 return Clause;

703}

704

706 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(4 * N));

707 return new (Mem) OMPCopyinClause(N);

708}

709

710void OMPCopyprivateClause::setSourceExprs(ArrayRef<Expr *> SrcExprs) {

711 assert(SrcExprs.size() == varlist_size() && "Number of source expressions is "

712 "not the same as the "

713 "preallocated buffer");

715}

716

717void OMPCopyprivateClause::setDestinationExprs(ArrayRef<Expr *> DstExprs) {

718 assert(DstExprs.size() == varlist_size() && "Number of destination "

719 "expressions is not the same as "

720 "the preallocated buffer");

721 llvm::copy(DstExprs, getSourceExprs().end());

722}

723

724void OMPCopyprivateClause::setAssignmentOps(ArrayRef<Expr *> AssignmentOps) {

725 assert(AssignmentOps.size() == varlist_size() &&

726 "Number of assignment expressions is not the same as the preallocated "

727 "buffer");

728 llvm::copy(AssignmentOps, getDestinationExprs().end());

729}

730

735 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size()));

736 OMPCopyprivateClause *Clause =

737 new (Mem) OMPCopyprivateClause(StartLoc, LParenLoc, EndLoc, VL.size());

738 Clause->setVarRefs(VL);

739 Clause->setSourceExprs(SrcExprs);

740 Clause->setDestinationExprs(DstExprs);

741 Clause->setAssignmentOps(AssignmentOps);

742 return Clause;

743}

744

746 unsigned N) {

747 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(4 * N));

748 return new (Mem) OMPCopyprivateClause(N);

749}

750

751void OMPReductionClause::setPrivates(ArrayRef<Expr *> Privates) {

753 "Number of private copies is not the same as the preallocated buffer");

755}

756

757void OMPReductionClause::setLHSExprs(ArrayRef<Expr *> LHSExprs) {

758 assert(

760 "Number of LHS expressions is not the same as the preallocated buffer");

761 llvm::copy(LHSExprs, getPrivates().end());

762}

763

764void OMPReductionClause::setRHSExprs(ArrayRef<Expr *> RHSExprs) {

765 assert(

767 "Number of RHS expressions is not the same as the preallocated buffer");

768 llvm::copy(RHSExprs, getLHSExprs().end());

769}

770

771void OMPReductionClause::setReductionOps(ArrayRef<Expr *> ReductionOps) {

772 assert(ReductionOps.size() == varlist_size() && "Number of reduction "

773 "expressions is not the same "

774 "as the preallocated buffer");

775 llvm::copy(ReductionOps, getRHSExprs().end());

776}

777

778void OMPReductionClause::setInscanCopyOps(ArrayRef<Expr *> Ops) {

779 assert(Modifier == OMPC_REDUCTION_inscan && "Expected inscan reduction.");

780 assert(Ops.size() == varlist_size() && "Number of copy "

781 "expressions is not the same "

782 "as the preallocated buffer");

783 llvm::copy(Ops, getReductionOps().end());

784}

785

786void OMPReductionClause::setInscanCopyArrayTemps(

788 assert(Modifier == OMPC_REDUCTION_inscan && "Expected inscan reduction.");

789 assert(CopyArrayTemps.size() == varlist_size() &&

790 "Number of copy temp expressions is not the same as the preallocated "

791 "buffer");

792 llvm::copy(CopyArrayTemps, getInscanCopyOps().end());

793}

794

795void OMPReductionClause::setInscanCopyArrayElems(

797 assert(Modifier == OMPC_REDUCTION_inscan && "Expected inscan reduction.");

798 assert(CopyArrayElems.size() == varlist_size() &&

799 "Number of copy temp expressions is not the same as the preallocated "

800 "buffer");

801 llvm::copy(CopyArrayElems, getInscanCopyArrayTemps().end());

802}

803

815 void *Mem = C.Allocate(totalSizeToAlloc<Expr *, bool>(

816 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * VL.size(), VL.size()));

817 auto *Clause = new (Mem) OMPReductionClause(

818 StartLoc, LParenLoc, ModifierLoc, EndLoc, ColonLoc, Modifier,

819 OrignalSharingModifier, VL.size(), QualifierLoc, NameInfo);

820 Clause->setVarRefs(VL);

821 Clause->setPrivates(Privates);

822 Clause->setLHSExprs(LHSExprs);

823 Clause->setRHSExprs(RHSExprs);

824 Clause->setReductionOps(ReductionOps);

825 Clause->setPreInitStmt(PreInit);

826 Clause->setPostUpdateExpr(PostUpdate);

827 Clause->setPrivateVariableReductionFlags(IsPrivateVarReduction);

828 if (Modifier == OMPC_REDUCTION_inscan) {

829 Clause->setInscanCopyOps(CopyOps);

830 Clause->setInscanCopyArrayTemps(CopyArrayTemps);

831 Clause->setInscanCopyArrayElems(CopyArrayElems);

832 } else {

833 assert(CopyOps.empty() &&

834 "copy operations are expected in inscan reductions only.");

835 assert(CopyArrayTemps.empty() &&

836 "copy array temps are expected in inscan reductions only.");

837 assert(CopyArrayElems.empty() &&

838 "copy array temps are expected in inscan reductions only.");

839 }

840 return Clause;

841}

842

846 void *Mem = C.Allocate(totalSizeToAlloc<Expr *, bool>(

847 (Modifier == OMPC_REDUCTION_inscan ? 8 : 5) * N, N));

848 auto *Clause = new (Mem) OMPReductionClause(N);

849 Clause->setModifier(Modifier);

850 return Clause;

851}

852

853void OMPTaskReductionClause::setPrivates(ArrayRef<Expr *> Privates) {

855 "Number of private copies is not the same as the preallocated buffer");

857}

858

859void OMPTaskReductionClause::setLHSExprs(ArrayRef<Expr *> LHSExprs) {

860 assert(

862 "Number of LHS expressions is not the same as the preallocated buffer");

863 llvm::copy(LHSExprs, getPrivates().end());

864}

865

866void OMPTaskReductionClause::setRHSExprs(ArrayRef<Expr *> RHSExprs) {

867 assert(

869 "Number of RHS expressions is not the same as the preallocated buffer");

870 llvm::copy(RHSExprs, getLHSExprs().end());

871}

872

873void OMPTaskReductionClause::setReductionOps(ArrayRef<Expr *> ReductionOps) {

874 assert(ReductionOps.size() == varlist_size() && "Number of task reduction "

875 "expressions is not the same "

876 "as the preallocated buffer");

877 llvm::copy(ReductionOps, getRHSExprs().end());

878}

879

886 Expr *PostUpdate) {

887 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));

888 OMPTaskReductionClause *Clause = new (Mem) OMPTaskReductionClause(

889 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);

890 Clause->setVarRefs(VL);

891 Clause->setPrivates(Privates);

892 Clause->setLHSExprs(LHSExprs);

893 Clause->setRHSExprs(RHSExprs);

894 Clause->setReductionOps(ReductionOps);

895 Clause->setPreInitStmt(PreInit);

896 Clause->setPostUpdateExpr(PostUpdate);

897 return Clause;

898}

899

901 unsigned N) {

902 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * N));

903 return new (Mem) OMPTaskReductionClause(N);

904}

905

906void OMPInReductionClause::setPrivates(ArrayRef<Expr *> Privates) {

908 "Number of private copies is not the same as the preallocated buffer");

910}

911

912void OMPInReductionClause::setLHSExprs(ArrayRef<Expr *> LHSExprs) {

913 assert(

915 "Number of LHS expressions is not the same as the preallocated buffer");

916 llvm::copy(LHSExprs, getPrivates().end());

917}

918

919void OMPInReductionClause::setRHSExprs(ArrayRef<Expr *> RHSExprs) {

920 assert(

922 "Number of RHS expressions is not the same as the preallocated buffer");

923 llvm::copy(RHSExprs, getLHSExprs().end());

924}

925

926void OMPInReductionClause::setReductionOps(ArrayRef<Expr *> ReductionOps) {

927 assert(ReductionOps.size() == varlist_size() && "Number of in reduction "

928 "expressions is not the same "

929 "as the preallocated buffer");

930 llvm::copy(ReductionOps, getRHSExprs().end());

931}

932

933void OMPInReductionClause::setTaskgroupDescriptors(

935 assert(TaskgroupDescriptors.size() == varlist_size() &&

936 "Number of in reduction descriptors is not the same as the "

937 "preallocated buffer");

938 llvm::copy(TaskgroupDescriptors, getReductionOps().end());

939}

940

948 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(6 * VL.size()));

949 OMPInReductionClause *Clause = new (Mem) OMPInReductionClause(

950 StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo);

951 Clause->setVarRefs(VL);

952 Clause->setPrivates(Privates);

953 Clause->setLHSExprs(LHSExprs);

954 Clause->setRHSExprs(RHSExprs);

955 Clause->setReductionOps(ReductionOps);

956 Clause->setTaskgroupDescriptors(TaskgroupDescriptors);

957 Clause->setPreInitStmt(PreInit);

958 Clause->setPostUpdateExpr(PostUpdate);

959 return Clause;

960}

961

963 unsigned N) {

964 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(6 * N));

965 return new (Mem) OMPInReductionClause(N);

966}

967

973 OMPSizesClause *Clause = CreateEmpty(C, Sizes.size());

974 Clause->setLocStart(StartLoc);

975 Clause->setLParenLoc(LParenLoc);

976 Clause->setLocEnd(EndLoc);

977 Clause->setSizesRefs(Sizes);

978 return Clause;

979}

980

982 unsigned NumSizes) {

983 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(NumSizes));

984 return new (Mem) OMPSizesClause(NumSizes);

985}

986

992 OMPPermutationClause *Clause = CreateEmpty(C, Args.size());

993 Clause->setLocStart(StartLoc);

994 Clause->setLParenLoc(LParenLoc);

995 Clause->setLocEnd(EndLoc);

996 Clause->setArgRefs(Args);

997 return Clause;

998}

999

1001 unsigned NumLoops) {

1002 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(NumLoops));

1003 return new (Mem) OMPPermutationClause(NumLoops);

1004}

1005

1010 Clause->setLocStart(StartLoc);

1011 Clause->setLocEnd(EndLoc);

1012 return Clause;

1013}

1014

1016 return new (C) OMPFullClause();

1017}

1018

1023 Expr *Factor) {

1025 Clause->setLocStart(StartLoc);

1026 Clause->setLParenLoc(LParenLoc);

1027 Clause->setLocEnd(EndLoc);

1028 Clause->setFactor(Factor);

1029 return Clause;

1030}

1031

1033 return new (C) OMPPartialClause();

1034}

1035

1041 OMPLoopRangeClause *Clause = CreateEmpty(C);

1042 Clause->setLocStart(StartLoc);

1043 Clause->setLParenLoc(LParenLoc);

1044 Clause->setFirstLoc(FirstLoc);

1045 Clause->setCountLoc(CountLoc);

1046 Clause->setLocEnd(EndLoc);

1047 Clause->setFirst(First);

1048 Clause->setCount(Count);

1049 return Clause;

1050}

1051

1053 return new (C) OMPLoopRangeClause();

1054}

1055

1062

1063

1064 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));

1065 auto *Clause = new (Mem) OMPAllocateClause(

1066 StartLoc, LParenLoc, Allocator, Alignment, ColonLoc, Modifier1,

1067 Modifier1Loc, Modifier2, Modifier2Loc, EndLoc, VL.size());

1068

1069 Clause->setVarRefs(VL);

1070 return Clause;

1071}

1072

1074 unsigned N) {

1075 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));

1076 return new (Mem) OMPAllocateClause(N);

1077}

1078

1084 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1));

1085 OMPFlushClause *Clause =

1086 new (Mem) OMPFlushClause(StartLoc, LParenLoc, EndLoc, VL.size());

1087 Clause->setVarRefs(VL);

1088 return Clause;

1089}

1090

1092 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));

1093 return new (Mem) OMPFlushClause(N);

1094}

1095

1100 Expr *Depobj) {

1101 auto *Clause = new (C) OMPDepobjClause(StartLoc, LParenLoc, RParenLoc);

1102 Clause->setDepobj(Depobj);

1103 return Clause;

1104}

1105

1107 return new (C) OMPDepobjClause();

1108}

1109

1115 void *Mem = C.Allocate(

1116 totalSizeToAlloc<Expr *>(VL.size() + 1 + NumLoops),

1117 alignof(OMPDependClause));

1118 OMPDependClause *Clause = new (Mem)

1119 OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops);

1120 Clause->setDependencyKind(Data.DepKind);

1121 Clause->setDependencyLoc(Data.DepLoc);

1122 Clause->setColonLoc(Data.ColonLoc);

1123 Clause->setOmpAllMemoryLoc(Data.OmpAllMemoryLoc);

1124 Clause->setModifier(DepModifier);

1125 Clause->setVarRefs(VL);

1126 for (unsigned I = 0 ; I < NumLoops; ++I)

1127 Clause->setLoopData(I, nullptr);

1128 return Clause;

1129}

1130

1132 unsigned NumLoops) {

1133 void *Mem =

1134 C.Allocate(totalSizeToAlloc<Expr *>(N + 1 + NumLoops),

1135 alignof(OMPDependClause));

1136 return new (Mem) OMPDependClause(N, NumLoops);

1137}

1138

1142 NumLoop < NumLoops &&

1143 "Expected sink or source depend + loop index must be less number of "

1144 "loops.");

1145 auto *It = std::next(getVarRefs().end(), NumLoop + 1);

1146 *It = Cnt;

1147}

1148

1152 NumLoop < NumLoops &&

1153 "Expected sink or source depend + loop index must be less number of "

1154 "loops.");

1155 auto *It = std::next(getVarRefs().end(), NumLoop + 1);

1156 return *It;

1157}

1158

1162 NumLoop < NumLoops &&

1163 "Expected sink or source depend + loop index must be less number of "

1164 "loops.");

1165 const auto *It = std::next(getVarRefs().end(), NumLoop + 1);

1166 return *It;

1167}

1168

1169void OMPDependClause::setModifier(Expr *DepModifier) {

1171}

1173

1176 unsigned TotalNum = 0u;

1177 for (auto &C : ComponentLists)

1178 TotalNum += C.size();

1179 return TotalNum;

1180}

1181

1185 for (const ValueDecl *D : Declarations) {

1187 UniqueDecls.insert(VD);

1188 }

1189 return UniqueDecls.size();

1190}

1191

1195 "Cannot get element-type from array-shaping expr.");

1196

1197

1198

1201

1202

1203

1205

1207

1209 if (const auto *ATy = BaseType->getAsArrayTypeUnsafe())

1210 ElemTy = ATy->getElementType();

1211 else

1213

1215 return ElemTy;

1216}

1217

1218std::pair<const Expr *, std::optional<size_t>>

1221

1222

1223

1224 if (Components.size() < 2)

1225 return {nullptr, std::nullopt};

1226

1227

1228

1229

1230 if (Components.back().isNonContiguous() && CurDirKind == OMPD_target_update)

1231 return {nullptr, std::nullopt};

1232

1233

1234

1235

1236

1237 for (auto [I, Component] : llvm::enumerate(Components)) {

1238

1239 if (I == 0)

1240 continue;

1241

1242 const Expr *CurExpr = Component.getAssociatedExpression();

1243 if (!CurExpr)

1244 break;

1245

1246

1247

1249 continue;

1250

1251

1254 continue;

1255

1256

1257 return {CurExpr, Components.size() - I};

1258 }

1259

1260 return {nullptr, std::nullopt};

1261}

1262

1272 Sizes.NumVars = Vars.size();

1276

1277

1278

1279

1280

1281

1282

1283

1284

1285

1286

1287 void *Mem = C.Allocate(

1293 OMPMapClause *Clause = new (Mem)

1294 OMPMapClause(MapModifiers, MapModifiersLoc, UDMQualifierLoc, MapperId,

1295 Type, TypeIsImplicit, TypeLoc, Locs, Sizes);

1296

1297 Clause->setVarRefs(Vars);

1298 Clause->setUDMapperRefs(UDMapperRefs);

1299 Clause->setIteratorModifier(IteratorModifier);

1300 Clause->setClauseInfo(Declarations, ComponentLists);

1301 Clause->setMapType(Type);

1302 Clause->setMapLoc(TypeLoc);

1303 return Clause;

1304}

1305

1309 void *Mem = C.Allocate(

1315 OMPMapClause *Clause = new (Mem) OMPMapClause(Sizes);

1316 Clause->setIteratorModifier(nullptr);

1317 return Clause;

1318}

1319

1328 Sizes.NumVars = Vars.size();

1332

1333

1334

1335

1336

1337

1338

1339

1340

1341

1342

1343 void *Mem = C.Allocate(

1349

1350 auto *Clause = new (Mem) OMPToClause(MotionModifiers, MotionModifiersLoc,

1351 UDMQualifierLoc, MapperId, Locs, Sizes);

1352

1353 Clause->setVarRefs(Vars);

1354 Clause->setUDMapperRefs(UDMapperRefs);

1355 Clause->setClauseInfo(Declarations, ComponentLists);

1356 Clause->setIteratorModifier(IteratorModifier);

1357 return Clause;

1358}

1359

1362 void *Mem = C.Allocate(

1368 OMPToClause *Clause = new (Mem) OMPToClause(Sizes);

1369 Clause->setIteratorModifier(nullptr);

1370 return Clause;

1371}

1372

1381 Sizes.NumVars = Vars.size();

1385

1386

1387

1388

1389

1390

1391

1392

1393

1394

1395

1396 void *Mem = C.Allocate(

1402

1403 auto *Clause =

1404 new (Mem) OMPFromClause(MotionModifiers, MotionModifiersLoc,

1405 UDMQualifierLoc, MapperId, Locs, Sizes);

1406

1407 Clause->setVarRefs(Vars);

1408 Clause->setUDMapperRefs(UDMapperRefs);

1409 Clause->setClauseInfo(Declarations, ComponentLists);

1410 Clause->setIteratorModifier(IteratorModifier);

1411 return Clause;

1412}

1413

1417 void *Mem = C.Allocate(

1423 OMPFromClause *Clause = new (Mem) OMPFromClause(Sizes);

1424 Clause->setIteratorModifier(nullptr);

1425 return Clause;

1426}

1427

1428void OMPUseDevicePtrClause::setPrivateCopies(ArrayRef<Expr *> VL) {

1430 "Number of private copies is not the same as the preallocated buffer");

1432}

1433

1436 "Number of inits is not the same as the preallocated buffer");

1437 llvm::copy(VL, getPrivateCopies().end());

1438}

1439

1446 Sizes.NumVars = Vars.size();

1450

1451

1452

1453

1454

1455

1456

1457

1458

1459

1460

1461 void *Mem = C.Allocate(

1467

1468 OMPUseDevicePtrClause *Clause = new (Mem) OMPUseDevicePtrClause(Locs, Sizes);

1469

1470 Clause->setVarRefs(Vars);

1471 Clause->setPrivateCopies(PrivateVars);

1472 Clause->setInits(Inits);

1473 Clause->setClauseInfo(Declarations, ComponentLists);

1474 return Clause;

1475}

1476

1480 void *Mem = C.Allocate(

1486 return new (Mem) OMPUseDevicePtrClause(Sizes);

1487}

1488

1495 Sizes.NumVars = Vars.size();

1499

1500

1501

1502

1503

1504

1505

1506

1507

1508

1509

1510 void *Mem = C.Allocate(

1516

1517 auto *Clause = new (Mem) OMPUseDeviceAddrClause(Locs, Sizes);

1518

1519 Clause->setVarRefs(Vars);

1520 Clause->setClauseInfo(Declarations, ComponentLists);

1521 return Clause;

1522}

1523

1527 void *Mem = C.Allocate(

1533 return new (Mem) OMPUseDeviceAddrClause(Sizes);

1534}

1535

1542 Sizes.NumVars = Vars.size();

1546

1547

1548

1549

1550

1551

1552

1553

1554

1555

1556

1557 void *Mem = C.Allocate(

1563

1564 OMPIsDevicePtrClause *Clause = new (Mem) OMPIsDevicePtrClause(Locs, Sizes);

1565

1566 Clause->setVarRefs(Vars);

1567 Clause->setClauseInfo(Declarations, ComponentLists);

1568 return Clause;

1569}

1570

1574 void *Mem = C.Allocate(

1580 return new (Mem) OMPIsDevicePtrClause(Sizes);

1581}

1582

1589 Sizes.NumVars = Vars.size();

1593

1594

1595

1596

1597

1598

1599

1600

1601

1602

1603

1604 void *Mem = C.Allocate(

1610

1611 auto *Clause = new (Mem) OMPHasDeviceAddrClause(Locs, Sizes);

1612

1613 Clause->setVarRefs(Vars);

1614 Clause->setClauseInfo(Declarations, ComponentLists);

1615 return Clause;

1616}

1617

1621 void *Mem = C.Allocate(

1627 return new (Mem) OMPHasDeviceAddrClause(Sizes);

1628}

1629

1635

1636 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size()));

1637 auto *Clause =

1638 new (Mem) OMPNontemporalClause(StartLoc, LParenLoc, EndLoc, VL.size());

1639 Clause->setVarRefs(VL);

1640 return Clause;

1641}

1642

1644 unsigned N) {

1645 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * N));

1646 return new (Mem) OMPNontemporalClause(N);

1647}

1648

1650 assert(VL.size() == varlist_size() && "Number of private references is not "

1651 "the same as the preallocated buffer");

1653}

1654

1660 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));

1661 auto *Clause =

1662 new (Mem) OMPInclusiveClause(StartLoc, LParenLoc, EndLoc, VL.size());

1663 Clause->setVarRefs(VL);

1664 return Clause;

1665}

1666

1668 unsigned N) {

1669 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));

1670 return new (Mem) OMPInclusiveClause(N);

1671}

1672

1678 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));

1679 auto *Clause =

1680 new (Mem) OMPExclusiveClause(StartLoc, LParenLoc, EndLoc, VL.size());

1681 Clause->setVarRefs(VL);

1682 return Clause;

1683}

1684

1686 unsigned N) {

1687 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));

1688 return new (Mem) OMPExclusiveClause(N);

1689}

1690

1691void OMPUsesAllocatorsClause::setAllocatorsData(

1693 assert(Data.size() == NumOfAllocators &&

1694 "Size of allocators data is not the same as the preallocated buffer.");

1695 for (unsigned I = 0, E = Data.size(); I < E; ++I) {

1697 getTrailingObjects<Expr *>()[I * static_cast<int>(ExprOffsets::Total) +

1698 static_cast<int>(ExprOffsets::Allocator)] =

1700 getTrailingObjects<Expr *>()[I * static_cast<int>(ExprOffsets::Total) +

1701 static_cast<int>(

1702 ExprOffsets::AllocatorTraits)] =

1704 getTrailingObjects<

1705 SourceLocation>()[I * static_cast<int>(ParenLocsOffsets::Total) +

1706 static_cast<int>(ParenLocsOffsets::LParen)] =

1708 getTrailingObjects<

1709 SourceLocation>()[I * static_cast<int>(ParenLocsOffsets::Total) +

1710 static_cast<int>(ParenLocsOffsets::RParen)] =

1711 D.RParenLoc;

1712 }

1713}

1714

1719 getTrailingObjects<Expr *>()[I * static_cast<int>(ExprOffsets::Total) +

1720 static_cast<int>(ExprOffsets::Allocator)];

1722 getTrailingObjects<Expr *>()[I * static_cast<int>(ExprOffsets::Total) +

1723 static_cast<int>(

1724 ExprOffsets::AllocatorTraits)];

1726 SourceLocation>()[I * static_cast<int>(ParenLocsOffsets::Total) +

1727 static_cast<int>(ParenLocsOffsets::LParen)];

1729 SourceLocation>()[I * static_cast<int>(ParenLocsOffsets::Total) +

1730 static_cast<int>(ParenLocsOffsets::RParen)];

1731 return Data;

1732}

1733

1738 void *Mem = C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(

1739 static_cast<int>(ExprOffsets::Total) * Data.size(),

1740 static_cast<int>(ParenLocsOffsets::Total) * Data.size()));

1741 auto *Clause = new (Mem)

1742 OMPUsesAllocatorsClause(StartLoc, LParenLoc, EndLoc, Data.size());

1743 Clause->setAllocatorsData(Data);

1744 return Clause;

1745}

1746

1749 void *Mem = C.Allocate(totalSizeToAlloc<Expr *, SourceLocation>(

1750 static_cast<int>(ExprOffsets::Total) * N,

1751 static_cast<int>(ParenLocsOffsets::Total) * N));

1752 return new (Mem) OMPUsesAllocatorsClause(N);

1753}

1754

1760 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(Locators.size() + 1));

1761 auto *Clause = new (Mem)

1762 OMPAffinityClause(StartLoc, LParenLoc, ColonLoc, EndLoc, Locators.size());

1763 Clause->setModifier(Modifier);

1764 Clause->setVarRefs(Locators);

1765 return Clause;

1766}

1767

1769 unsigned N) {

1770 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N + 1));

1771 return new (Mem) OMPAffinityClause(N);

1772}

1773

1780

1781 void *Mem =

1782 C.Allocate(totalSizeToAlloc<Expr *>(InteropInfo.PreferTypes.size() + 1));

1783 auto *Clause = new (Mem) OMPInitClause(

1785 VarLoc, EndLoc, InteropInfo.PreferTypes.size() + 1);

1786 Clause->setInteropVar(InteropVar);

1787 llvm::copy(InteropInfo.PreferTypes, Clause->getTrailingObjects() + 1);

1788 return Clause;

1789}

1790

1792 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));

1793 return new (Mem) OMPInitClause(N);

1794}

1795

1800 return new (C) OMPBindClause(K, KLoc, StartLoc, LParenLoc, EndLoc);

1801}

1802

1804 return new (C) OMPBindClause();

1805}

1806

1813 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + NumLoops),

1814 alignof(OMPDoacrossClause));

1815 OMPDoacrossClause *Clause = new (Mem)

1816 OMPDoacrossClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops);

1817 Clause->setDependenceType(DepType);

1818 Clause->setDependenceLoc(DepLoc);

1819 Clause->setColonLoc(ColonLoc);

1820 Clause->setVarRefs(VL);

1821 for (unsigned I = 0; I < NumLoops; ++I)

1822 Clause->setLoopData(I, nullptr);

1823 return Clause;

1824}

1825

1827 unsigned N,

1828 unsigned NumLoops) {

1829 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N + NumLoops),

1830 alignof(OMPDoacrossClause));

1831 return new (Mem) OMPDoacrossClause(N, NumLoops);

1832}

1833

1835 assert(NumLoop < NumLoops && "Loop index must be less number of loops.");

1836 auto *It = std::next(getVarRefs().end(), NumLoop);

1837 *It = Cnt;

1838}

1839

1841 assert(NumLoop < NumLoops && "Loop index must be less number of loops.");

1842 auto *It = std::next(getVarRefs().end(), NumLoop);

1843 return *It;

1844}

1845

1847 assert(NumLoop < NumLoops && "Loop index must be less number of loops.");

1848 const auto *It = std::next(getVarRefs().end(), NumLoop);

1849 return *It;

1850}

1851

1857 void *Mem = C.Allocate(totalSizeToAlloc(DKVec.size()),

1858 alignof(OMPAbsentClause));

1859 auto *AC = new (Mem) OMPAbsentClause(Loc, LLoc, RLoc, DKVec.size());

1860 AC->setDirectiveKinds(DKVec);

1861 return AC;

1862}

1863

1865 void *Mem = C.Allocate(totalSizeToAlloc(K),

1866 alignof(OMPAbsentClause));

1867 return new (Mem) OMPAbsentClause(K);

1868}

1869

1873 void *Mem = C.Allocate(totalSizeToAlloc(DKVec.size()),

1874 alignof(OMPContainsClause));

1875 auto *CC = new (Mem) OMPContainsClause(Loc, LLoc, RLoc, DKVec.size());

1876 CC->setDirectiveKinds(DKVec);

1877 return CC;

1878}

1879

1881 unsigned K) {

1882 void *Mem = C.Allocate(totalSizeToAlloc(K),

1883 alignof(OMPContainsClause));

1884 return new (Mem) OMPContainsClause(K);

1885}

1886

1891 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));

1892 OMPNumTeamsClause *Clause =

1893 new (Mem) OMPNumTeamsClause(C, StartLoc, LParenLoc, EndLoc, VL.size());

1894 Clause->setVarRefs(VL);

1895 Clause->setPreInitStmt(PreInit, CaptureRegion);

1896 return Clause;

1897}

1898

1900 unsigned N) {

1901 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));

1902 return new (Mem) OMPNumTeamsClause(N);

1903}

1904

1909 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));

1910 OMPThreadLimitClause *Clause =

1911 new (Mem) OMPThreadLimitClause(C, StartLoc, LParenLoc, EndLoc, VL.size());

1912 Clause->setVarRefs(VL);

1913 Clause->setPreInitStmt(PreInit, CaptureRegion);

1914 return Clause;

1915}

1916

1918 unsigned N) {

1919 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));

1920 return new (Mem) OMPThreadLimitClause(N);

1921}

1922

1923

1924

1925

1926

1927void OMPClausePrinter::VisitOMPIfClause(OMPIfClause *Node) {

1928 OS << "if(";

1930 OS << getOpenMPDirectiveName(Node->getNameModifier(), Version) << ": ";

1932 OS << ")";

1933}

1934

1935void OMPClausePrinter::VisitOMPFinalClause(OMPFinalClause *Node) {

1936 OS << "final(";

1938 OS << ")";

1939}

1940

1941void OMPClausePrinter::VisitOMPNumThreadsClause(OMPNumThreadsClause *Node) {

1942 OS << "num_threads(";

1946 << ": ";

1947 }

1949 OS << ")";

1950}

1951

1952void OMPClausePrinter::VisitOMPAlignClause(OMPAlignClause *Node) {

1953 OS << "align(";

1955 OS << ")";

1956}

1957

1958void OMPClausePrinter::VisitOMPSafelenClause(OMPSafelenClause *Node) {

1959 OS << "safelen(";

1961 OS << ")";

1962}

1963

1964void OMPClausePrinter::VisitOMPSimdlenClause(OMPSimdlenClause *Node) {

1965 OS << "simdlen(";

1967 OS << ")";

1968}

1969

1970void OMPClausePrinter::VisitOMPSizesClause(OMPSizesClause *Node) {

1971 OS << "sizes(";

1972 bool First = true;

1975 OS << ", ";

1976 Size->printPretty(OS, nullptr, Policy, 0);

1978 }

1979 OS << ")";

1980}

1981

1982void OMPClausePrinter::VisitOMPPermutationClause(OMPPermutationClause *Node) {

1983 OS << "permutation(";

1984 llvm::interleaveComma(Node->getArgsRefs(), OS, [&](const Expr *E) {

1985 E->printPretty(OS, nullptr, Policy, 0);

1986 });

1987 OS << ")";

1988}

1989

1990void OMPClausePrinter::VisitOMPFullClause(OMPFullClause *Node) { OS << "full"; }

1991

1992void OMPClausePrinter::VisitOMPPartialClause(OMPPartialClause *Node) {

1993 OS << "partial";

1994

1995 if (Expr *Factor = Node->getFactor()) {

1996 OS << '(';

1997 Factor->printPretty(OS, nullptr, Policy, 0);

1998 OS << ')';

1999 }

2000}

2001

2002void OMPClausePrinter::VisitOMPLoopRangeClause(OMPLoopRangeClause *Node) {

2003 OS << "looprange";

2004

2006 Expr *Count = Node->getCount();

2007

2008 if (First && Count) {

2009 OS << "(";

2010 First->printPretty(OS, nullptr, Policy, 0);

2011 OS << ",";

2012 Count->printPretty(OS, nullptr, Policy, 0);

2013 OS << ")";

2014 }

2015}

2016

2017void OMPClausePrinter::VisitOMPAllocatorClause(OMPAllocatorClause *Node) {

2018 OS << "allocator(";

2020 OS << ")";

2021}

2022

2023void OMPClausePrinter::VisitOMPCollapseClause(OMPCollapseClause *Node) {

2024 OS << "collapse(";

2026 OS << ")";

2027}

2028

2029void OMPClausePrinter::VisitOMPDetachClause(OMPDetachClause *Node) {

2030 OS << "detach(";

2032 OS << ")";

2033}

2034

2035void OMPClausePrinter::VisitOMPDefaultClause(OMPDefaultClause *Node) {

2036 OS << "default("

2039 if (Version >= 60 && Node->getDefaultVC() != OMPC_DEFAULT_VC_all) {

2040 OS << ":"

2042 }

2043

2044 OS << ")";

2045}

2046

2047void OMPClausePrinter::VisitOMPThreadsetClause(OMPThreadsetClause *Node) {

2048 OS << "threadset("

2051 << ")";

2052}

2053

2054void OMPClausePrinter::VisitOMPProcBindClause(OMPProcBindClause *Node) {

2055 OS << "proc_bind("

2058 << ")";

2059}

2060

2062 OS << "unified_address";

2063}

2064

2065void OMPClausePrinter::VisitOMPUnifiedSharedMemoryClause(

2067 OS << "unified_shared_memory";

2068}

2069

2071 OS << "reverse_offload";

2072}

2073

2074void OMPClausePrinter::VisitOMPDynamicAllocatorsClause(

2076 OS << "dynamic_allocators";

2077}

2078

2079void OMPClausePrinter::VisitOMPAtomicDefaultMemOrderClause(

2081 OS << "atomic_default_mem_order("

2084 << ")";

2085}

2086

2087void OMPClausePrinter::VisitOMPSelfMapsClause(OMPSelfMapsClause *) {

2088 OS << "self_maps";

2089}

2090

2091void OMPClausePrinter::VisitOMPAtClause(OMPAtClause *Node) {

2093 << ")";

2094}

2095

2096void OMPClausePrinter::VisitOMPSeverityClause(OMPSeverityClause *Node) {

2097 OS << "severity("

2099 << ")";

2100}

2101

2102void OMPClausePrinter::VisitOMPMessageClause(OMPMessageClause *Node) {

2103 OS << "message(";

2105 E->printPretty(OS, nullptr, Policy);

2106 OS << ")";

2107}

2108

2109void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {

2110 OS << "schedule(";

2115 OS << ", ";

2118 }

2119 OS << ": ";

2120 }

2123 OS << ", ";

2124 E->printPretty(OS, nullptr, Policy);

2125 }

2126 OS << ")";

2127}

2128

2129void OMPClausePrinter::VisitOMPOrderedClause(OMPOrderedClause *Node) {

2130 OS << "ordered";

2132 OS << "(";

2133 Num->printPretty(OS, nullptr, Policy, 0);

2134 OS << ")";

2135 }

2136}

2137

2138void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *Node) {

2139 OS << "nowait";

2141 OS << "(";

2143 OS << ")";

2144 }

2145}

2146

2147void OMPClausePrinter::VisitOMPUntiedClause(OMPUntiedClause *) {

2148 OS << "untied";

2149}

2150

2151void OMPClausePrinter::VisitOMPNogroupClause(OMPNogroupClause *) {

2152 OS << "nogroup";

2153}

2154

2155void OMPClausePrinter::VisitOMPMergeableClause(OMPMergeableClause *) {

2156 OS << "mergeable";

2157}

2158

2159void OMPClausePrinter::VisitOMPReadClause(OMPReadClause *) { OS << "read"; }

2160

2161void OMPClausePrinter::VisitOMPWriteClause(OMPWriteClause *) { OS << "write"; }

2162

2163void OMPClausePrinter::VisitOMPUpdateClause(OMPUpdateClause *Node) {

2164 OS << "update";

2166 OS << "(";

2169 OS << ")";

2170 }

2171}

2172

2173void OMPClausePrinter::VisitOMPCaptureClause(OMPCaptureClause *) {

2174 OS << "capture";

2175}

2176

2177void OMPClausePrinter::VisitOMPCompareClause(OMPCompareClause *) {

2178 OS << "compare";

2179}

2180

2181void OMPClausePrinter::VisitOMPFailClause(OMPFailClause *Node) {

2182 OS << "fail";

2183 if (Node) {

2184 OS << "(";

2187 OS << ")";

2188 }

2189}

2190

2191void OMPClausePrinter::VisitOMPAbsentClause(OMPAbsentClause *Node) {

2192 OS << "absent(";

2193 bool First = true;

2196 OS << ", ";

2197 OS << getOpenMPDirectiveName(D, Version);

2199 }

2200 OS << ")";

2201}

2202

2203void OMPClausePrinter::VisitOMPHoldsClause(OMPHoldsClause *Node) {

2204 OS << "holds(";

2206 OS << ")";

2207}

2208

2209void OMPClausePrinter::VisitOMPContainsClause(OMPContainsClause *Node) {

2210 OS << "contains(";

2211 bool First = true;

2214 OS << ", ";

2215 OS << getOpenMPDirectiveName(D, Version);

2217 }

2218 OS << ")";

2219}

2220

2221void OMPClausePrinter::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {

2222 OS << "no_openmp";

2223}

2224

2225void OMPClausePrinter::VisitOMPNoOpenMPRoutinesClause(

2227 OS << "no_openmp_routines";

2228}

2229

2230void OMPClausePrinter::VisitOMPNoOpenMPConstructsClause(

2232 OS << "no_openmp_constructs";

2233}

2234

2236 OS << "no_parallelism";

2237}

2238

2239void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) {

2240 OS << "seq_cst";

2241}

2242

2243void OMPClausePrinter::VisitOMPAcqRelClause(OMPAcqRelClause *) {

2244 OS << "acq_rel";

2245}

2246

2247void OMPClausePrinter::VisitOMPAcquireClause(OMPAcquireClause *) {

2248 OS << "acquire";

2249}

2250

2251void OMPClausePrinter::VisitOMPReleaseClause(OMPReleaseClause *) {

2252 OS << "release";

2253}

2254

2255void OMPClausePrinter::VisitOMPRelaxedClause(OMPRelaxedClause *) {

2256 OS << "relaxed";

2257}

2258

2259void OMPClausePrinter::VisitOMPWeakClause(OMPWeakClause *) { OS << "weak"; }

2260

2261void OMPClausePrinter::VisitOMPThreadsClause(OMPThreadsClause *) {

2262 OS << "threads";

2263}

2264

2265void OMPClausePrinter::VisitOMPSIMDClause(OMPSIMDClause *) { OS << "simd"; }

2266

2267void OMPClausePrinter::VisitOMPDeviceClause(OMPDeviceClause *Node) {

2268 OS << "device(";

2272 << ": ";

2273 }

2275 OS << ")";

2276}

2277

2278void OMPClausePrinter::VisitOMPNumTeamsClause(OMPNumTeamsClause *Node) {

2280 OS << "num_teams";

2281 VisitOMPClauseList(Node, '(');

2282 OS << ")";

2283 }

2284}

2285

2286void OMPClausePrinter::VisitOMPThreadLimitClause(OMPThreadLimitClause *Node) {

2288 OS << "thread_limit";

2289 VisitOMPClauseList(Node, '(');

2290 OS << ")";

2291 }

2292}

2293

2294void OMPClausePrinter::VisitOMPPriorityClause(OMPPriorityClause *Node) {

2295 OS << "priority(";

2297 OS << ")";

2298}

2299

2300void OMPClausePrinter::VisitOMPGrainsizeClause(OMPGrainsizeClause *Node) {

2301 OS << "grainsize(";

2305 << ": ";

2306 }

2308 OS << ")";

2309}

2310

2311void OMPClausePrinter::VisitOMPNumTasksClause(OMPNumTasksClause *Node) {

2312 OS << "num_tasks(";

2316 << ": ";

2317 }

2319 OS << ")";

2320}

2321

2322void OMPClausePrinter::VisitOMPHintClause(OMPHintClause *Node) {

2323 OS << "hint(";

2325 OS << ")";

2326}

2327

2328void OMPClausePrinter::VisitOMPInitClause(OMPInitClause *Node) {

2329 OS << "init(";

2330 bool First = true;

2331 for (const Expr *E : Node->prefs()) {

2333 OS << "prefer_type(";

2334 else

2335 OS << ",";

2336 E->printPretty(OS, nullptr, Policy);

2338 }

2340 OS << "), ";

2342 OS << "target";

2345 OS << ", ";

2346 OS << "targetsync";

2347 }

2348 OS << " : ";

2350 OS << ")";

2351}

2352

2353void OMPClausePrinter::VisitOMPUseClause(OMPUseClause *Node) {

2354 OS << "use(";

2356 OS << ")";

2357}

2358

2359void OMPClausePrinter::VisitOMPDestroyClause(OMPDestroyClause *Node) {

2360 OS << "destroy";

2362 OS << "(";

2363 E->printPretty(OS, nullptr, Policy);

2364 OS << ")";

2365 }

2366}

2367

2368void OMPClausePrinter::VisitOMPNovariantsClause(OMPNovariantsClause *Node) {

2369 OS << "novariants";

2371 OS << "(";

2372 E->printPretty(OS, nullptr, Policy, 0);

2373 OS << ")";

2374 }

2375}

2376

2377void OMPClausePrinter::VisitOMPNocontextClause(OMPNocontextClause *Node) {

2378 OS << "nocontext";

2380 OS << "(";

2381 E->printPretty(OS, nullptr, Policy, 0);

2382 OS << ")";

2383 }

2384}

2385

2386template

2387void OMPClausePrinter::VisitOMPClauseList(T *Node, char StartSym) {

2388 for (typename T::varlist_iterator I = Node->varlist_begin(),

2389 E = Node->varlist_end();

2390 I != E; ++I) {

2391 assert(*I && "Expected non-null Stmt");

2392 OS << (I == Node->varlist_begin() ? StartSym : ',');

2393 if (auto *DRE = dyn_cast(*I)) {

2395 DRE->printPretty(OS, nullptr, Policy, 0);

2396 else

2397 DRE->getDecl()->printQualifiedName(OS);

2398 } else

2399 (*I)->printPretty(OS, nullptr, Policy, 0);

2400 }

2401}

2402

2403void OMPClausePrinter::VisitOMPAllocateClause(OMPAllocateClause *Node) {

2405 return;

2406

2407 Expr *FirstModifier = nullptr;

2408 Expr *SecondModifier = nullptr;

2413 if (FirstAllocMod == OMPC_ALLOCATE_allocator ||

2417 } else {

2420 }

2421

2422 OS << "allocate";

2423

2424 if (FirstModifier) {

2425 OS << "(";

2426 if (!FirstUnknown) {

2428 OS << "(";

2429 }

2430 FirstModifier->printPretty(OS, nullptr, Policy, 0);

2431 if (!FirstUnknown)

2432 OS << ")";

2433 if (SecondModifier) {

2434 OS << ", ";

2435 if (!SecondUnknown) {

2437 SecondAllocMod);

2438 OS << "(";

2439 }

2440 SecondModifier->printPretty(OS, nullptr, Policy, 0);

2441 if (!SecondUnknown)

2442 OS << ")";

2443 }

2444 OS << ":";

2445 VisitOMPClauseList(Node, ' ');

2446 } else {

2447

2448 VisitOMPClauseList(Node, '(');

2449 }

2450 OS << ")";

2451}

2452

2453void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) {

2455 OS << "private";

2456 VisitOMPClauseList(Node, '(');

2457 OS << ")";

2458 }

2459}

2460

2463 OS << "firstprivate";

2464 VisitOMPClauseList(Node, '(');

2465 OS << ")";

2466 }

2467}

2468

2469void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) {

2471 OS << "lastprivate";

2474 OS << "("

2476 << ":";

2477 }

2479 OS << ")";

2480 }

2481}

2482

2483void OMPClausePrinter::VisitOMPSharedClause(OMPSharedClause *Node) {

2485 OS << "shared";

2486 VisitOMPClauseList(Node, '(');

2487 OS << ")";

2488 }

2489}

2490

2491void OMPClausePrinter::VisitOMPReductionClause(OMPReductionClause *Node) {

2493 OS << "reduction(";

2496 << ", ";

2501 if (!Qualifier && OOK != OO_None) {

2502

2504 } else {

2505

2508 }

2509 OS << ":";

2510 VisitOMPClauseList(Node, ' ');

2511 OS << ")";

2512 }

2513}

2514

2515void OMPClausePrinter::VisitOMPTaskReductionClause(

2518 OS << "task_reduction(";

2523 if (!Qualifier && OOK != OO_None) {

2524

2526 } else {

2527

2530 }

2531 OS << ":";

2532 VisitOMPClauseList(Node, ' ');

2533 OS << ")";

2534 }

2535}

2536

2537void OMPClausePrinter::VisitOMPInReductionClause(OMPInReductionClause *Node) {

2539 OS << "in_reduction(";

2544 if (!Qualifier && OOK != OO_None) {

2545

2547 } else {

2548

2551 }

2552 OS << ":";

2553 VisitOMPClauseList(Node, ' ');

2554 OS << ")";

2555 }

2556}

2557

2558void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) {

2560 OS << "linear";

2561 VisitOMPClauseList(Node, '(');

2563 OS << ": ";

2564 }

2567 }

2568 if (Node->getStep() != nullptr) {

2570 OS << ", ";

2571 }

2572 OS << "step(";

2574 OS << ")";

2575 }

2576 OS << ")";

2577 }

2578}

2579

2580void OMPClausePrinter::VisitOMPAlignedClause(OMPAlignedClause *Node) {

2582 OS << "aligned";

2583 VisitOMPClauseList(Node, '(');

2585 OS << ": ";

2587 }

2588 OS << ")";

2589 }

2590}

2591

2592void OMPClausePrinter::VisitOMPCopyinClause(OMPCopyinClause *Node) {

2594 OS << "copyin";

2595 VisitOMPClauseList(Node, '(');

2596 OS << ")";

2597 }

2598}

2599

2600void OMPClausePrinter::VisitOMPCopyprivateClause(OMPCopyprivateClause *Node) {

2602 OS << "copyprivate";

2603 VisitOMPClauseList(Node, '(');

2604 OS << ")";

2605 }

2606}

2607

2608void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) {

2610 VisitOMPClauseList(Node, '(');

2611 OS << ")";

2612 }

2613}

2614

2615void OMPClausePrinter::VisitOMPDepobjClause(OMPDepobjClause *Node) {

2616 OS << "(";

2618 OS << ")";

2619}

2620

2621void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) {

2622 OS << "depend(";

2623 if (Expr *DepModifier = Node->getModifier()) {

2624 DepModifier->printPretty(OS, nullptr, Policy);

2625 OS << ", ";

2626 }

2629 bool IsOmpAllMemory = false;

2630 if (PrintKind == OMPC_DEPEND_outallmemory) {

2631 PrintKind = OMPC_DEPEND_out;

2632 IsOmpAllMemory = true;

2633 } else if (PrintKind == OMPC_DEPEND_inoutallmemory) {

2634 PrintKind = OMPC_DEPEND_inout;

2635 IsOmpAllMemory = true;

2636 }

2639 OS << " :";

2640 VisitOMPClauseList(Node, ' ');

2641 if (IsOmpAllMemory) {

2643 OS << "omp_all_memory";

2644 }

2645 OS << ")";

2646}

2647

2648template

2651 OS << '(';

2653 Node->getMapperQualifierLoc().getNestedNameSpecifier();

2654 MapperNNS.print(OS, Policy);

2655 OS << Node->getMapperIdInfo() << ')';

2656}

2657

2658template

2661 if (Expr *IteratorModifier = Node->getIteratorModifier())

2662 IteratorModifier->printPretty(OS, nullptr, Policy);

2663}

2664

2665void OMPClausePrinter::VisitOMPMapClause(OMPMapClause *Node) {

2667 OS << "map(";

2673 } else {

2678 }

2679 OS << ',';

2680 }

2681 }

2683 OS << ':';

2684 }

2685 VisitOMPClauseList(Node, ' ');

2686 OS << ")";

2687 }

2688}

2689

2690template void OMPClausePrinter::VisitOMPMotionClause(T *Node) {

2691 if (Node->varlist_empty())

2692 return;

2693 OS << getOpenMPClauseName(Node->getClauseKind());

2694 unsigned ModifierCount = 0;

2697 ++ModifierCount;

2698 }

2699 if (ModifierCount) {

2700 OS << '(';

2703 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_iterator) {

2705 } else {

2707 Node->getMotionModifier(I));

2708 if (Node->getMotionModifier(I) == OMPC_MOTION_MODIFIER_mapper)

2710 if (I < ModifierCount - 1)

2711 OS << ", ";

2712 }

2713 }

2714 }

2715 OS << ':';

2716 VisitOMPClauseList(Node, ' ');

2717 } else {

2718 VisitOMPClauseList(Node, '(');

2719 }

2720 OS << ")";

2721}

2722

2723void OMPClausePrinter::VisitOMPToClause(OMPToClause *Node) {

2724 VisitOMPMotionClause(Node);

2725}

2726

2727void OMPClausePrinter::VisitOMPFromClause(OMPFromClause *Node) {

2728 VisitOMPMotionClause(Node);

2729}

2730

2735 OS << ", ";

2736 E->printPretty(OS, nullptr, Policy);

2737 }

2738 OS << ")";

2739}

2740

2741void OMPClausePrinter::VisitOMPDefaultmapClause(OMPDefaultmapClause *Node) {

2742 OS << "defaultmap(";

2746 OS << ": ";

2749 }

2750 OS << ")";

2751}

2752

2755 OS << "use_device_ptr";

2756 VisitOMPClauseList(Node, '(');

2757 OS << ")";

2758 }

2759}

2760

2761void OMPClausePrinter::VisitOMPUseDeviceAddrClause(

2764 OS << "use_device_addr";

2765 VisitOMPClauseList(Node, '(');

2766 OS << ")";

2767 }

2768}

2769

2770void OMPClausePrinter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *Node) {

2772 OS << "is_device_ptr";

2773 VisitOMPClauseList(Node, '(');

2774 OS << ")";

2775 }

2776}

2777

2780 OS << "has_device_addr";

2781 VisitOMPClauseList(Node, '(');

2782 OS << ")";

2783 }

2784}

2785

2786void OMPClausePrinter::VisitOMPNontemporalClause(OMPNontemporalClause *Node) {

2788 OS << "nontemporal";

2789 VisitOMPClauseList(Node, '(');

2790 OS << ")";

2791 }

2792}

2793

2794void OMPClausePrinter::VisitOMPOrderClause(OMPOrderClause *Node) {

2795 OS << "order(";

2798 OS << ": ";

2799 }

2801}

2802

2803void OMPClausePrinter::VisitOMPInclusiveClause(OMPInclusiveClause *Node) {

2805 OS << "inclusive";

2806 VisitOMPClauseList(Node, '(');

2807 OS << ")";

2808 }

2809}

2810

2811void OMPClausePrinter::VisitOMPExclusiveClause(OMPExclusiveClause *Node) {

2813 OS << "exclusive";

2814 VisitOMPClauseList(Node, '(');

2815 OS << ")";

2816 }

2817}

2818

2819void OMPClausePrinter::VisitOMPUsesAllocatorsClause(

2822 return;

2823 OS << "uses_allocators(";

2827 if (Data.AllocatorTraits) {

2828 OS << "(";

2829 Data.AllocatorTraits->printPretty(OS, nullptr, Policy);

2830 OS << ")";

2831 }

2832 if (I < E - 1)

2833 OS << ",";

2834 }

2835 OS << ")";

2836}

2837

2838void OMPClausePrinter::VisitOMPAffinityClause(OMPAffinityClause *Node) {

2840 return;

2841 OS << "affinity";

2842 char StartSym = '(';

2843 if (Expr *Modifier = Node->getModifier()) {

2844 OS << "(";

2845 Modifier->printPretty(OS, nullptr, Policy);

2846 OS << " :";

2847 StartSym = ' ';

2848 }

2849 VisitOMPClauseList(Node, StartSym);

2850 OS << ")";

2851}

2852

2853void OMPClausePrinter::VisitOMPFilterClause(OMPFilterClause *Node) {

2854 OS << "filter(";

2856 OS << ")";

2857}

2858

2859void OMPClausePrinter::VisitOMPBindClause(OMPBindClause *Node) {

2860 OS << "bind("

2862 << ")";

2863}

2864

2865void OMPClausePrinter::VisitOMPXDynCGroupMemClause(

2867 OS << "ompx_dyn_cgroup_mem(";

2869 OS << ")";

2870}

2871

2872void OMPClausePrinter::VisitOMPDynGroupprivateClause(

2874 OS << "dyn_groupprivate(";

2880 OS << ", ";

2883 }

2884 OS << ": ";

2885 }

2887 OS << ')';

2888}

2889

2890void OMPClausePrinter::VisitOMPDoacrossClause(OMPDoacrossClause *Node) {

2891 OS << "doacross(";

2893

2894 switch (DepType) {

2895 case OMPC_DOACROSS_source:

2896 OS << "source:";

2897 break;

2898 case OMPC_DOACROSS_sink:

2899 OS << "sink:";

2900 break;

2901 case OMPC_DOACROSS_source_omp_cur_iteration:

2902 OS << "source: omp_cur_iteration";

2903 break;

2904 case OMPC_DOACROSS_sink_omp_cur_iteration:

2905 OS << "sink: omp_cur_iteration - 1";

2906 break;

2907 default:

2908 llvm_unreachable("unknown docaross modifier");

2909 }

2910 VisitOMPClauseList(Node, ' ');

2911 OS << ")";

2912}

2913

2914void OMPClausePrinter::VisitOMPXAttributeClause(OMPXAttributeClause *Node) {

2915 OS << "ompx_attribute(";

2917 for (auto &Attr : Node->getAttrs()) {

2919 OS << ", ";

2920 Attr->printPretty(OS, Policy);

2922 }

2923 OS << ")";

2924}

2925

2926void OMPClausePrinter::VisitOMPXBareClause(OMPXBareClause *Node) {

2927 OS << "ompx_bare";

2928}

2929

2931 VariantMatchInfo &VMI) const {

2934

2935

2936 if (Selector.Kind == TraitSelector::user_condition) {

2937 assert(Selector.ScoreOrCondition &&

2938 "Ill-formed user condition, expected condition expression!");

2939 assert(Selector.Properties.size() == 1 &&

2940 Selector.Properties.front().Kind ==

2941 TraitProperty::user_condition_unknown &&

2942 "Ill-formed user condition, expected unknown trait property!");

2943

2944 if (std::optional CondVal =

2945 Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx))

2946 VMI.addTrait(CondVal->isZero() ? TraitProperty::user_condition_false

2947 : TraitProperty::user_condition_true,

2948 "");

2949 else

2950 VMI.addTrait(TraitProperty::user_condition_false, "");

2951 continue;

2952 }

2953

2954 std::optionalllvm::APSInt Score;

2955 llvm::APInt *ScorePtr = nullptr;

2956 if (Selector.ScoreOrCondition) {

2957 if ((Score = Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx)))

2958 ScorePtr = &*Score;

2959 else

2960 VMI.addTrait(TraitProperty::user_condition_false,

2961 "");

2962 }

2963

2966

2967 if (Set.Kind != TraitSet::construct)

2968 continue;

2969

2970

2971 assert(Selector.Properties.size() == 1 &&

2972 Selector.Properties.front().Kind ==

2973 getOpenMPContextTraitPropertyForSelector(

2975 "Ill-formed construct selector!");

2976 }

2977 }

2978}

2979

2982 bool FirstSet = true;

2984 if (!FirstSet)

2985 OS << ", ";

2986 FirstSet = false;

2987 OS << getOpenMPContextTraitSetName(Set.Kind) << "={";

2988

2989 bool FirstSelector = true;

2991 if (!FirstSelector)

2992 OS << ", ";

2993 FirstSelector = false;

2994 OS << getOpenMPContextTraitSelectorName(Selector.Kind);

2995

2996 bool AllowsTraitScore = false;

2997 bool RequiresProperty = false;

2998 isValidTraitSelectorForTraitSet(

2999 Selector.Kind, Set.Kind, AllowsTraitScore, RequiresProperty);

3000

3001 if (!RequiresProperty)

3002 continue;

3003

3004 OS << "(";

3005 if (Selector.Kind == TraitSelector::user_condition) {

3006 if (Selector.ScoreOrCondition)

3007 Selector.ScoreOrCondition->printPretty(OS, nullptr, Policy);

3008 else

3009 OS << "...";

3010 } else {

3011

3012 if (Selector.ScoreOrCondition) {

3013 OS << "score(";

3014 Selector.ScoreOrCondition->printPretty(OS, nullptr, Policy);

3015 OS << "): ";

3016 }

3017

3018 bool FirstProperty = true;

3020 if (!FirstProperty)

3021 OS << ", ";

3022 FirstProperty = false;

3023 OS << getOpenMPContextTraitPropertyName(Property.Kind,

3025 }

3026 }

3027 OS << ")";

3028 }

3029 OS << "}";

3030 }

3031}

3032

3034 std::string MangledName;

3035 llvm::raw_string_ostream OS(MangledName);

3039

3040 bool AllowsTraitScore = false;

3041 bool RequiresProperty = false;

3042 isValidTraitSelectorForTraitSet(

3043 Selector.Kind, Set.Kind, AllowsTraitScore, RequiresProperty);

3045

3046 if (!RequiresProperty ||

3047 Selector.Kind == TraitSelector::user_condition)

3048 continue;

3049

3051 OS << '$' << 'P'

3052 << getOpenMPContextTraitPropertyName(Property.Kind,

3054 }

3055 }

3056 return MangledName;

3057}

3058

3059OMPTraitInfo::OMPTraitInfo(StringRef MangledName) {

3060 unsigned long U;

3061 do {

3062 if (!MangledName.consume_front("$S"))

3063 break;

3064 if (MangledName.consumeInteger(10, U))

3065 break;

3068 Set.Kind = TraitSet(U);

3069 do {

3070 if (!MangledName.consume_front("$s"))

3071 break;

3072 if (MangledName.consumeInteger(10, U))

3073 break;

3076 Selector.Kind = TraitSelector(U);

3077 do {

3078 if (!MangledName.consume_front("$P"))

3079 break;

3082 std::pair<StringRef, StringRef> PropRestPair = MangledName.split('$');

3083 Property.RawString = PropRestPair.first;

3084 Property.Kind = getOpenMPContextTraitPropertyKind(

3085 Set.Kind, Selector.Kind, PropRestPair.first);

3086 MangledName = MangledName.drop_front(PropRestPair.first.size());

3087 } while (true);

3088 } while (true);

3089 } while (true);

3090}

3091

3096 TI.print(OS, Policy);

3097 return OS;

3098}

3101 return TI ? OS << *TI : OS;

3102}

3103

3108 : OMPContext(ASTCtx.getLangOpts().OpenMPIsTargetDevice,

3109 ASTCtx.getTargetInfo().getTriple(),

3110 ASTCtx.getLangOpts().OMPTargetTriples.empty()

3111 ? llvm::Triple()

3112 : ASTCtx.getLangOpts().OMPTargetTriples[0],

3114 FeatureValidityCheck([&](StringRef FeatureName) {

3115 return ASTCtx.getTargetInfo().isValidFeatureName(FeatureName);

3116 }),

3117 DiagUnknownTrait(std::move(DiagUnknownTrait)) {

3119

3120 for (llvm::omp::TraitProperty Property : ConstructTraits)

3122}

3123

3125 auto It = FeatureMap.find(RawString);

3126 if (It != FeatureMap.end())

3127 return It->second;

3128 if (!FeatureValidityCheck(RawString))

3129 DiagUnknownTrait(RawString);

3130 return false;

3131}

Defines the clang::ASTContext interface.

This file defines OpenMP nodes for declarative directives.

unsigned IsFirst

Indicates that this is the first token of the file.

Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.

static Stmt ** getAddrOfExprAsWritten(Stmt *S)

Gets the address of the original, non-captured, expression used in the clause as the preinitializer.

Definition OpenMPClause.cpp:298

static void PrintIterator(raw_ostream &OS, T *Node, const PrintingPolicy &Policy)

Definition OpenMPClause.cpp:2659

static void PrintMapper(raw_ostream &OS, T *Node, const PrintingPolicy &Policy)

Definition OpenMPClause.cpp:2649

This file defines OpenMP AST classes for clauses.

Defines some OpenMP-specific enums and functions.

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

const TargetInfo & getTargetInfo() const

void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const

static QualType getBaseOriginalType(const Expr *Base)

Return original type of the base expression for array section.

OverloadedOperatorKind getCXXOverloadedOperator() const

If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...

This represents one expression.

Represents a function declaration or definition.

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

A C++ nested-name-specifier augmented with source location information.

NestedNameSpecifier getNestedNameSpecifier() const

Retrieve the nested-name-specifier to which this instance refers.

Represents a C++ nested name specifier, such as "\::std::vector::".

void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false, bool PrintFinalScopeResOp=true) const

Print this nested name specifier to the given output stream.

This represents the 'absent' clause in the 'pragma omp assume' directive.

static OMPAbsentClause * CreateEmpty(const ASTContext &C, unsigned NumKinds)

Definition OpenMPClause.cpp:1864

static OMPAbsentClause * Create(const ASTContext &C, ArrayRef< OpenMPDirectiveKind > DKVec, SourceLocation Loc, SourceLocation LLoc, SourceLocation RLoc)

Definition OpenMPClause.cpp:1852

This represents 'acq_rel' clause in the 'pragma omp atomic|flush' directives.

This represents 'acquire' clause in the 'pragma omp atomic|flush' directives.

This represents clause 'affinity' in the 'pragma omp task'-based directives.

static OMPAffinityClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)

Creates clause with a modifier a list of locator items.

Definition OpenMPClause.cpp:1756

Expr * getModifier()

Gets affinity modifier.

static OMPAffinityClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N locator items.

Definition OpenMPClause.cpp:1768

This represents the 'align' clause in the 'pragma omp allocate' directive.

Expr * getAlignment() const

Returns alignment.

static OMPAlignClause * Create(const ASTContext &C, Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)

Build 'align' clause with the given alignment.

Definition OpenMPClause.cpp:663

This represents clause 'aligned' in the 'pragma omp ...' directives.

Expr * getAlignment()

Returns alignment.

static OMPAlignedClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, Expr *A)

Creates clause with a list of variables VL and alignment A.

Definition OpenMPClause.cpp:646

static OMPAlignedClause * CreateEmpty(const ASTContext &C, unsigned NumVars)

Creates an empty clause with the place for NumVars variables.

Definition OpenMPClause.cpp:657

This represents clause 'allocate' in the 'pragma omp ...' directives.

static OMPAllocateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, Expr *Allocator, Expr *Alignment, SourceLocation ColonLoc, OpenMPAllocateClauseModifier Modifier1, SourceLocation Modifier1Loc, OpenMPAllocateClauseModifier Modifier2, SourceLocation Modifier2Loc, SourceLocation EndLoc, ArrayRef< Expr * > VL)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:1056

OpenMPAllocateClauseModifier getSecondAllocateModifier() const

Get the second modifier of the clause.

Expr * getAlignment() const

Returns the alignment expression or nullptr, if no alignment specified.

OpenMPAllocateClauseModifier getFirstAllocateModifier() const

Get the first modifier of the clause.

Expr * getAllocator() const

Returns the allocator expression or nullptr, if no allocator is specified.

static OMPAllocateClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:1073

This represents 'allocator' clause in the 'pragma omp ...' directive.

Expr * getAllocator() const

Returns allocator.

This represents 'at' clause in the 'pragma omp error' directive.

OpenMPAtClauseKind getAtKind() const

Returns kind of the clause.

This represents 'atomic_default_mem_order' clause in the 'pragma omp requires' directive.

OpenMPAtomicDefaultMemOrderClauseKind getAtomicDefaultMemOrderKind() const

Returns kind of the clause.

This represents 'bind' clause in the 'pragma omp ...' directives.

OpenMPBindClauseKind getBindKind() const

Returns kind of the clause.

static OMPBindClause * Create(const ASTContext &C, OpenMPBindClauseKind K, SourceLocation KLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)

Build 'bind' clause with kind K ('teams', 'parallel', or 'thread').

Definition OpenMPClause.cpp:1797

static OMPBindClause * CreateEmpty(const ASTContext &C)

Build an empty 'bind' clause.

Definition OpenMPClause.cpp:1803

This represents 'capture' clause in the 'pragma omp atomic' directive.

Class that represents a component of a mappable expression.

ArrayRef< MappableExprComponentList > MappableExprComponentListsRef

static unsigned getUniqueDeclarationsTotalNumber(ArrayRef< const ValueDecl * > Declarations)

Definition OpenMPClause.cpp:1182

static unsigned getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists)

Definition OpenMPClause.cpp:1174

ArrayRef< MappableComponent > MappableExprComponentListRef

static std::pair< const Expr *, std::optional< size_t > > findAttachPtrExpr(MappableExprComponentListRef Components, OpenMPDirectiveKind CurDirKind)

Find the attach pointer expression from a list of mappable expression components.

Definition OpenMPClause.cpp:1219

static QualType getComponentExprElementType(const Expr *Exp)

Get the type of an element of a ComponentList Expr Exp.

Definition OpenMPClause.cpp:1193

static OMPClauseWithPostUpdate * get(OMPClause *C)

Definition OpenMPClause.cpp:189

OMPClauseWithPostUpdate(const OMPClause *This)

const Stmt * getPreInitStmt() const

Get pre-initialization statement for the clause.

OMPClauseWithPreInit(const OMPClause *This)

static OMPClauseWithPreInit * get(OMPClause *C)

Definition OpenMPClause.cpp:59

This is a basic class for representing single OpenMP clause.

child_range used_children()

Get the iterator range for the expressions used in the clauses.

Definition OpenMPClause.cpp:45

llvm::iterator_range< child_iterator > child_range

child_range children()

Definition OpenMPClause.cpp:32

OpenMPClauseKind getClauseKind() const

Returns kind of OpenMP clause (private, shared, reduction, etc.).

This represents 'collapse' clause in the 'pragma omp ...' directive.

Expr * getNumForLoops() const

Return the number of associated for-loops.

This represents 'compare' clause in the 'pragma omp atomic' directive.

This represents the 'contains' clause in the 'pragma omp assume' directive.

static OMPContainsClause * CreateEmpty(const ASTContext &C, unsigned NumKinds)

Definition OpenMPClause.cpp:1880

static OMPContainsClause * Create(const ASTContext &C, ArrayRef< OpenMPDirectiveKind > DKVec, SourceLocation Loc, SourceLocation LLoc, SourceLocation RLoc)

Definition OpenMPClause.cpp:1870

This represents clause 'copyin' in the 'pragma omp ...' directives.

static OMPCopyinClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:691

static OMPCopyinClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with N variables.

Definition OpenMPClause.cpp:705

This represents clause 'copyprivate' in the 'pragma omp ...' directives.

static OMPCopyprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:731

static OMPCopyprivateClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with N variables.

Definition OpenMPClause.cpp:745

This represents 'default' clause in the 'pragma omp ...' directive.

llvm::omp::DefaultKind getDefaultKind() const

Returns kind of the clause.

OpenMPDefaultClauseVariableCategory getDefaultVC() const

This represents 'defaultmap' clause in the 'pragma omp ...' directive.

OpenMPDefaultmapClauseModifier getDefaultmapModifier() const

Get the modifier of the clause.

OpenMPDefaultmapClauseKind getDefaultmapKind() const

Get kind of the clause.

This represents implicit clause 'depend' for the 'pragma omp task' directive.

static OMPDependClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, DependDataTy Data, Expr *DepModifier, ArrayRef< Expr * > VL, unsigned NumLoops)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:1111

Expr * getModifier()

Return optional depend modifier.

Definition OpenMPClause.cpp:1172

Expr * getLoopData(unsigned NumLoop)

Get the loop data.

Definition OpenMPClause.cpp:1149

void setLoopData(unsigned NumLoop, Expr *Cnt)

Set the loop data for the depend clauses with 'sink|source' kind of dependency.

Definition OpenMPClause.cpp:1139

static OMPDependClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)

Creates an empty clause with N variables.

Definition OpenMPClause.cpp:1131

OpenMPDependClauseKind getDependencyKind() const

Get dependency type.

This represents implicit clause 'depobj' for the 'pragma omp depobj' directive.

static OMPDepobjClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Depobj)

Creates clause.

Definition OpenMPClause.cpp:1096

static OMPDepobjClause * CreateEmpty(const ASTContext &C)

Creates an empty clause.

Definition OpenMPClause.cpp:1106

Expr * getDepobj()

Returns depobj expression associated with the clause.

This represents 'destroy' clause in the 'pragma omp depobj' directive or the 'pragma omp interop' dir...

Expr * getInteropVar() const

Returns the interop variable.

This represents 'detach' clause in the 'pragma omp task' directive.

Expr * getEventHandler() const

Returns event-handler expression.

This represents 'device' clause in the 'pragma omp ...' directive.

OpenMPDeviceClauseModifier getModifier() const

Gets modifier.

Expr * getDevice()

Return device number.

MutableArrayRef< OpenMPDirectiveKind > getDirectiveKinds()

This represents 'dist_schedule' clause in the 'pragma omp ...' directive.

OpenMPDistScheduleClauseKind getDistScheduleKind() const

Get kind of the clause.

Expr * getChunkSize()

Get chunk size.

This represents the 'doacross' clause for the 'pragma omp ordered' directive.

void setLoopData(unsigned NumLoop, Expr *Cnt)

Set the loop data.

Definition OpenMPClause.cpp:1834

Expr * getLoopData(unsigned NumLoop)

Get the loop data.

Definition OpenMPClause.cpp:1840

static OMPDoacrossClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VL, unsigned NumLoops)

Creates clause with a list of expressions VL.

Definition OpenMPClause.cpp:1808

static OMPDoacrossClause * CreateEmpty(const ASTContext &C, unsigned N, unsigned NumLoops)

Creates an empty clause with N expressions.

Definition OpenMPClause.cpp:1826

OpenMPDoacrossClauseModifier getDependenceType() const

Get dependence type.

This represents 'dyn_groupprivate' clause in 'pragma omp target ...' and 'pragma omp teams ....

Expr * getSize()

Get size.

OpenMPDynGroupprivateClauseFallbackModifier getDynGroupprivateFallbackModifier() const

Get the second modifier of the clause.

OpenMPDynGroupprivateClauseModifier getDynGroupprivateModifier() const

Get the first modifier of the clause.

This represents 'dynamic_allocators' clause in the 'pragma omp requires' directive.

This represents clause 'exclusive' in the 'pragma omp scan' directive.

static OMPExclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:1685

static OMPExclusiveClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:1673

This represents 'fail' clause in the 'pragma omp atomic' directive.

OpenMPClauseKind getFailParameter() const

Gets the parameter (type memory-order-clause) in Fail clause.

This represents 'filter' clause in the 'pragma omp ...' directive.

Expr * getThreadID() const

Return thread identifier.

This represents 'final' clause in the 'pragma omp ...' directive.

child_range used_children()

Definition OpenMPClause.cpp:333

Expr * getCondition() const

Returns condition.

This represents clause 'firstprivate' in the 'pragma omp ...' directives.

static OMPFirstprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PrivateVL, ArrayRef< Expr * > InitVL, Stmt *PreInit)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:479

static OMPFirstprivateClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:493

This represents implicit clause 'flush' for the 'pragma omp flush' directive.

static OMPFlushClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with N variables.

Definition OpenMPClause.cpp:1091

static OMPFlushClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:1079

This represents clause 'from' in the 'pragma omp ...' directives.

static OMPFromClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, Expr *IteratorExpr, ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId)

Creates clause with a list of variables Vars.

Definition OpenMPClause.cpp:1373

static OMPFromClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)

Creates an empty clause with the place for NumVars variables.

Definition OpenMPClause.cpp:1415

Representation of the 'full' clause of the 'pragma omp unroll' directive.

static OMPFullClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc)

Build an AST node for a 'full' clause.

Definition OpenMPClause.cpp:1006

static OMPFullClause * CreateEmpty(const ASTContext &C)

Build an empty 'full' AST node for deserialization.

Definition OpenMPClause.cpp:1015

This represents 'grainsize' clause in the 'pragma omp ...' directive.

Expr * getGrainsize() const

Return safe iteration space distance.

child_range used_children()

Definition OpenMPClause.cpp:321

OpenMPGrainsizeClauseModifier getModifier() const

Gets modifier.

This represents clause 'has_device_ptr' in the 'pragma omp ...' directives.

static OMPHasDeviceAddrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)

Creates clause with a list of variables Vars.

Definition OpenMPClause.cpp:1584

static OMPHasDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)

Creates an empty clause with the place for NumVars variables.

Definition OpenMPClause.cpp:1619

This represents 'hint' clause in the 'pragma omp ...' directive.

Expr * getHint() const

Returns number of threads.

This represents the 'holds' clause in the 'pragma omp assume' directive.

This represents 'if' clause in the 'pragma omp ...' directive.

child_range used_children()

Definition OpenMPClause.cpp:309

Expr * getCondition() const

Returns condition.

OpenMPDirectiveKind getNameModifier() const

Return directive name modifier associated with the clause.

This represents clause 'in_reduction' in the 'pragma omp task' directives.

static OMPInReductionClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:962

NestedNameSpecifierLoc getQualifierLoc() const

Gets the nested name specifier.

const DeclarationNameInfo & getNameInfo() const

Gets the name info for specified reduction identifier.

static OMPInReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr * > Privates, ArrayRef< Expr * > LHSExprs, ArrayRef< Expr * > RHSExprs, ArrayRef< Expr * > ReductionOps, ArrayRef< Expr * > TaskgroupDescriptors, Stmt *PreInit, Expr *PostUpdate)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:941

This represents clause 'inclusive' in the 'pragma omp scan' directive.

static OMPInclusiveClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:1655

static OMPInclusiveClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:1667

This represents the 'init' clause in 'pragma omp ...' directives.

bool getIsTarget() const

Returns true is interop-type 'target' is used.

bool getIsTargetSync() const

Returns true is interop-type 'targetsync' is used.

static OMPInitClause * Create(const ASTContext &C, Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)

Creates a fully specified clause.

Definition OpenMPClause.cpp:1774

static OMPInitClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with N expressions.

Definition OpenMPClause.cpp:1791

Expr * getInteropVar()

Returns the interop variable.

This represents clause 'is_device_ptr' in the 'pragma omp ...' directives.

static OMPIsDevicePtrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)

Creates clause with a list of variables Vars.

Definition OpenMPClause.cpp:1537

static OMPIsDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)

Creates an empty clause with the place for NumVars variables.

Definition OpenMPClause.cpp:1572

This represents clause 'lastprivate' in the 'pragma omp ...' directives.

static OMPLastprivateClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:544

void setPrivateCopies(ArrayRef< Expr * > PrivateCopies)

Set list of helper expressions, required for generation of private copies of original lastprivate var...

Definition OpenMPClause.cpp:499

static OMPLastprivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > SrcExprs, ArrayRef< Expr * > DstExprs, ArrayRef< Expr * > AssignmentOps, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:526

OpenMPLastprivateModifier getKind() const

Lastprivate kind.

This represents clause 'linear' in the 'pragma omp ...' directives.

child_range used_children()

Definition OpenMPClause.cpp:638

SourceLocation getModifierLoc() const

Return modifier location.

static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)

Creates an empty clause with the place for NumVars variables.

Definition OpenMPClause.cpp:630

Expr * getStep()

Returns linear step.

void setUpdates(ArrayRef< Expr * > UL)

Sets the list of update expressions for linear variables.

Definition OpenMPClause.cpp:579

void setFinals(ArrayRef< Expr * > FL)

Sets the list of final update expressions for linear variables.

Definition OpenMPClause.cpp:585

void setUsedExprs(ArrayRef< Expr * > UE)

Sets the list of used expressions for the linear clause.

Definition OpenMPClause.cpp:591

static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation StepModifierLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)

Creates clause with a list of variables VL and a linear step Step.

Definition OpenMPClause.cpp:598

OpenMPLinearClauseKind getModifier() const

Return modifier.

This class represents the 'looprange' clause in the 'pragma omp fuse' directive.

Expr * getFirst() const

Get looprange 'first' expression.

static OMPLoopRangeClause * CreateEmpty(const ASTContext &C)

Build an empty 'looprange' clause node.

Definition OpenMPClause.cpp:1052

static OMPLoopRangeClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation FirstLoc, SourceLocation CountLoc, SourceLocation EndLoc, Expr *First, Expr *Count)

Build a 'looprange' clause AST node.

Definition OpenMPClause.cpp:1037

Expr * getCount() const

Get looprange 'count' expression.

This represents clause 'map' in the 'pragma omp ...' directives.

OpenMPMapClauseKind getMapType() const LLVM_READONLY

Fetches mapping kind for the clause.

static OMPMapClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapModifiers, ArrayRef< SourceLocation > MapModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId, OpenMPMapClauseKind Type, bool TypeIsImplicit, SourceLocation TypeLoc)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:1263

static OMPMapClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)

Creates an empty clause with the place for NumVars original expressions, NumUniqueDeclarations declar...

Definition OpenMPClause.cpp:1307

OpenMPMapModifierKind getMapTypeModifier(unsigned Cnt) const LLVM_READONLY

Fetches the map-type-modifier at 'Cnt' index of array of modifiers.

This represents 'mergeable' clause in the 'pragma omp ...' directive.

This represents the 'message' clause in the 'pragma omp error' and the 'pragma omp parallel' directiv...

Expr * getMessageString() const

Returns message string of the clause.

This represents the 'no_openmp' clause in the 'pragma omp assume' directive.

This represents the 'no_openmp_constructs' clause in the.

This represents the 'no_openmp_routines' clause in the 'pragma omp assume' directive.

This represents the 'no_parallelism' clause in the 'pragma omp assume' directive.

This represents 'nocontext' clause in the 'pragma omp ...' directive.

Expr * getCondition() const

Returns condition.

child_range used_children()

Definition OpenMPClause.cpp:351

This represents 'nogroup' clause in the 'pragma omp ...' directive.

This represents clause 'nontemporal' in the 'pragma omp ...' directives.

static OMPNontemporalClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:1643

static OMPNontemporalClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:1630

void setPrivateRefs(ArrayRef< Expr * > VL)

Sets the list of references to private copies created in private clauses.

Definition OpenMPClause.cpp:1649

This represents 'novariants' clause in the 'pragma omp ...' directive.

child_range used_children()

Definition OpenMPClause.cpp:345

Expr * getCondition() const

Returns condition.

This represents 'nowait' clause in the 'pragma omp ...' directive.

Expr * getCondition() const

Returns condition.

child_range used_children()

Definition OpenMPClause.cpp:315

This represents 'num_tasks' clause in the 'pragma omp ...' directive.

Expr * getNumTasks() const

Return safe iteration space distance.

child_range used_children()

Definition OpenMPClause.cpp:327

OpenMPNumTasksClauseModifier getModifier() const

Gets modifier.

This represents 'num_teams' clause in the 'pragma omp ...' directive.

static OMPNumTeamsClause * Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, Stmt *PreInit)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:1887

static OMPNumTeamsClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with N variables.

Definition OpenMPClause.cpp:1899

This represents 'num_threads' clause in the 'pragma omp ...' directive.

OpenMPNumThreadsClauseModifier getModifier() const

Gets modifier.

Expr * getNumThreads() const

Returns number of threads.

llvm::iterator_range< child_iterator > child_range

This represents 'order' clause in the 'pragma omp ...' directive.

OpenMPOrderClauseKind getKind() const

Returns kind of the clause.

OpenMPOrderClauseModifier getModifier() const

Returns Modifier of the clause.

This represents 'ordered' clause in the 'pragma omp ...' directive.

void setLoopCounter(unsigned NumLoop, Expr *Counter)

Set loop counter for the specified loop.

Definition OpenMPClause.cpp:393

Expr * getNumForLoops() const

Return the number of associated for-loops.

void setLoopNumIterations(unsigned NumLoop, Expr *NumIterations)

Set number of iterations for the specified loop.

Definition OpenMPClause.cpp:383

ArrayRef< Expr * > getLoopNumIterations() const

Get number of iterations for all the loops.

Definition OpenMPClause.cpp:389

static OMPOrderedClause * Create(const ASTContext &C, Expr *Num, unsigned NumLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)

Build 'ordered' clause.

Definition OpenMPClause.cpp:357

static OMPOrderedClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)

Build an empty clause.

Definition OpenMPClause.cpp:372

Expr * getLoopCounter(unsigned NumLoop)

Get loops counter for the specified loop.

Definition OpenMPClause.cpp:398

Representation of the 'partial' clause of the 'pragma omp unroll' directive.

static OMPPartialClause * CreateEmpty(const ASTContext &C)

Build an empty 'partial' AST node for deserialization.

Definition OpenMPClause.cpp:1032

static OMPPartialClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, Expr *Factor)

Build an AST node for a 'partial' clause.

Definition OpenMPClause.cpp:1019

Expr * getFactor() const

Returns the argument of the clause or nullptr if not set.

This class represents the 'permutation' clause in the 'pragma omp interchange' directive.

MutableArrayRef< Expr * > getArgsRefs()

Returns the permutation index expressions.

static OMPPermutationClause * CreateEmpty(const ASTContext &C, unsigned NumLoops)

Build an empty 'permutation' AST node for deserialization.

Definition OpenMPClause.cpp:1000

static OMPPermutationClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > Args)

Build a 'permutation' clause AST node.

Definition OpenMPClause.cpp:987

This represents 'priority' clause in the 'pragma omp ...' directive.

child_range used_children()

Definition OpenMPClause.cpp:339

Expr * getPriority()

Return Priority number.

This represents clause 'private' in the 'pragma omp ...' directives.

static OMPPrivateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PrivateVL)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:448

static OMPPrivateClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:460

This represents 'proc_bind' clause in the 'pragma omp ...' directive.

llvm::omp::ProcBindKind getProcBindKind() const

Returns kind of the clause.

This represents 'read' clause in the 'pragma omp atomic' directive.

This represents clause 'reduction' in the 'pragma omp ...' directives.

const DeclarationNameInfo & getNameInfo() const

Gets the name info for specified reduction identifier.

static OMPReductionClause * CreateEmpty(const ASTContext &C, unsigned N, OpenMPReductionClauseModifier Modifier)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:844

static OMPReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, OpenMPReductionClauseModifier Modifier, ArrayRef< Expr * > VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr * > Privates, ArrayRef< Expr * > LHSExprs, ArrayRef< Expr * > RHSExprs, ArrayRef< Expr * > ReductionOps, ArrayRef< Expr * > CopyOps, ArrayRef< Expr * > CopyArrayTemps, ArrayRef< Expr * > CopyArrayElems, Stmt *PreInit, Expr *PostUpdate, ArrayRef< bool > IsPrivateVarReduction, OpenMPOriginalSharingModifier OriginalSharingModifier)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:804

NestedNameSpecifierLoc getQualifierLoc() const

Gets the nested name specifier.

OpenMPReductionClauseModifier getModifier() const

Returns modifier.

SourceLocation getModifierLoc() const

Returns modifier location.

This represents 'relaxed' clause in the 'pragma omp atomic' directives.

This represents 'release' clause in the 'pragma omp atomic|flush' directives.

This represents 'reverse_offload' clause in the 'pragma omp requires' directive.

This represents 'simd' clause in the 'pragma omp ...' directive.

This represents 'safelen' clause in the 'pragma omp ...' directive.

Expr * getSafelen() const

Return safe iteration space distance.

This represents 'schedule' clause in the 'pragma omp ...' directive.

OpenMPScheduleClauseKind getScheduleKind() const

Get kind of the clause.

OpenMPScheduleClauseModifier getSecondScheduleModifier() const

Get the second modifier of the clause.

OpenMPScheduleClauseModifier getFirstScheduleModifier() const

Get the first modifier of the clause.

Expr * getChunkSize()

Get chunk size.

This represents 'self_maps' clause in the 'pragma omp requires' directive.

This represents 'seq_cst' clause in the 'pragma omp atomic|flush' directives.

This represents the 'severity' clause in the 'pragma omp error' and the 'pragma omp parallel' directi...

OpenMPSeverityClauseKind getSeverityKind() const

Returns kind of the clause.

This represents 'simdlen' clause in the 'pragma omp ...' directive.

Expr * getSimdlen() const

Return safe iteration space distance.

This represents the 'sizes' clause in the 'pragma omp tile' directive.

static OMPSizesClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > Sizes)

Build a 'sizes' AST node.

Definition OpenMPClause.cpp:968

MutableArrayRef< Expr * > getSizesRefs()

Returns the tile size expressions.

static OMPSizesClause * CreateEmpty(const ASTContext &C, unsigned NumSizes)

Build an empty 'sizes' AST node for deserialization.

Definition OpenMPClause.cpp:981

This represents clause 'task_reduction' in the 'pragma omp taskgroup' directives.

NestedNameSpecifierLoc getQualifierLoc() const

Gets the nested name specifier.

const DeclarationNameInfo & getNameInfo() const

Gets the name info for specified reduction identifier.

static OMPTaskReductionClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, ArrayRef< Expr * > Privates, ArrayRef< Expr * > LHSExprs, ArrayRef< Expr * > RHSExprs, ArrayRef< Expr * > ReductionOps, Stmt *PreInit, Expr *PostUpdate)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:880

static OMPTaskReductionClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:900

This represents 'thread_limit' clause in the 'pragma omp ...' directive.

static OMPThreadLimitClause * Create(const ASTContext &C, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, Stmt *PreInit)

Creates clause with a list of variables VL.

Definition OpenMPClause.cpp:1905

static OMPThreadLimitClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with N variables.

Definition OpenMPClause.cpp:1917

This represents 'threads' clause in the 'pragma omp ...' directive.

This represents 'threadset' clause in the 'pragma omp task ...' directive.

OpenMPThreadsetKind getThreadsetKind() const

Returns kind of the clause.

This represents clause 'to' in the 'pragma omp ...' directives.

static OMPToClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)

Creates an empty clause with the place for NumVars variables.

Definition OpenMPClause.cpp:1360

static OMPToClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists, ArrayRef< Expr * > UDMapperRefs, Expr *IteratorModifier, ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId)

Creates clause with a list of variables Vars.

Definition OpenMPClause.cpp:1320

Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...

std::string getMangledName() const

Return a string representation identifying this context selector.

Definition OpenMPClause.cpp:3033

void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const

Print a human readable representation into OS.

Definition OpenMPClause.cpp:2980

void getAsVariantMatchInfo(ASTContext &ASTCtx, llvm::omp::VariantMatchInfo &VMI) const

Create a variant match info object from this trait info object.

Definition OpenMPClause.cpp:2930

llvm::SmallVector< OMPTraitSet, 2 > Sets

The outermost level of selector sets.

This represents 'unified_address' clause in the 'pragma omp requires' directive.

This represents 'untied' clause in the 'pragma omp ...' directive.

This represents 'update' clause in the 'pragma omp atomic' directive.

OpenMPDependClauseKind getDependencyKind() const

Gets the dependence kind in clause for 'depobj' directive.

static OMPUpdateClause * CreateEmpty(const ASTContext &C, bool IsExtended)

Creates an empty clause with the place for N variables.

Definition OpenMPClause.cpp:429

static OMPUpdateClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc)

Creates clause for 'atomic' directive.

Definition OpenMPClause.cpp:408

bool isExtended() const

Checks if the clause is the extended clauses for 'depobj' directive.

This represents the 'use' clause in 'pragma omp ...' directives.

Expr * getInteropVar() const

Returns the interop variable.

This represents clause 'use_device_addr' in the 'pragma omp ...' directives.

static OMPUseDeviceAddrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)

Creates clause with a list of variables Vars.

Definition OpenMPClause.cpp:1490

static OMPUseDeviceAddrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)

Creates an empty clause with the place for NumVars variables.

Definition OpenMPClause.cpp:1525

This represents clause 'use_device_ptr' in the 'pragma omp ...' directives.

static OMPUseDevicePtrClause * Create(const ASTContext &C, const OMPVarListLocTy &Locs, ArrayRef< Expr * > Vars, ArrayRef< Expr * > PrivateVars, ArrayRef< Expr * > Inits, ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)

Creates clause with a list of variables Vars.

Definition OpenMPClause.cpp:1440

static OMPUseDevicePtrClause * CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes)

Creates an empty clause with the place for NumVars variables.

Definition OpenMPClause.cpp:1478

This represents clause 'uses_allocators' in the 'pragma omp target'-based directives.

OMPUsesAllocatorsClause::Data getAllocatorData(unsigned I) const

Returns data for the specified allocator.

Definition OpenMPClause.cpp:1716

static OMPUsesAllocatorsClause * CreateEmpty(const ASTContext &C, unsigned N)

Creates an empty clause with the place for N allocators.

Definition OpenMPClause.cpp:1748

unsigned getNumberOfAllocators() const

Returns number of allocators associated with the clause.

static OMPUsesAllocatorsClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< OMPUsesAllocatorsClause::Data > Data)

Creates clause with a list of allocators Data.

Definition OpenMPClause.cpp:1735

MutableArrayRef< Expr * > getVarRefs()

varlist_iterator varlist_end()

bool varlist_empty() const

unsigned varlist_size() const

This represents 'weak' clause in the 'pragma omp atomic' directives.

This represents 'write' clause in the 'pragma omp atomic' directive.

This represents 'ompx_attribute' clause in a directive that might generate an outlined function.

ArrayRef< const Attr * > getAttrs() const

Returned the attributes parsed from this clause.

This represents 'ompx_bare' clause in the 'pragma omp target teams ...' directive.

This represents 'ompx_dyn_cgroup_mem' clause in the 'pragma omp target ...' directive.

Expr * getSize()

Return the size expression.

A (possibly-)qualified type.

QualType getNonReferenceType() const

If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...

QualType getCanonicalType() const

Smart pointer class that efficiently represents Objective-C method names.

Encodes a location in the source.

bool isValid() const

Return true if this is a valid SourceLocation object.

Stmt - This represents one statement.

void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const

Base wrapper for a particular "section" of type source info.

The base class of the type hierarchy.

bool isPointerType() const

QualType getPointeeType() const

If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.

Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...

Defines the clang::TargetInfo interface.

The JSON file list parser is used to communicate input to InstallAPI.

OpenMPOriginalSharingModifier

OpenMP 6.0 original sharing modifiers.

OverloadedOperatorKind

Enumeration specifying the different kinds of C++ overloaded operators.

@ OO_None

Not an overloaded operator.

bool isa(CodeGen::Address addr)

@ OMPC_ORDER_MODIFIER_unknown

OpenMPReductionClauseModifier

OpenMP modifiers for 'reduction' clause.

@ DeviceNum

'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.

@ OMPC_SCHEDULE_MODIFIER_unknown

const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)

OpenMPDoacrossClauseModifier

OpenMP dependence types for 'doacross' clause.

static constexpr unsigned NumberOfOMPMapClauseModifiers

Number of allowed map-type-modifiers.

@ OMPC_DYN_GROUPPRIVATE_FALLBACK_unknown

@ Property

The type of a property.

OpenMPBindClauseKind

OpenMP bindings for the 'bind' clause.

const FunctionProtoType * T

OpenMPLastprivateModifier

OpenMP 'lastprivate' clause modifier.

@ OMPC_LASTPRIVATE_unknown

OpenMPDependClauseKind

OpenMP attributes for 'depend' clause.

OpenMPGrainsizeClauseModifier

OpenMPNumTasksClauseModifier

static constexpr unsigned NumberOfOMPMotionModifiers

Number of allowed motion-modifiers.

@ OMPC_MOTION_MODIFIER_unknown

@ OMPC_DEFAULTMAP_unknown

OpenMPAllocateClauseModifier

OpenMP modifiers for 'allocate' clause.

OpenMPLinearClauseKind

OpenMP attributes for 'linear' clause.

llvm::omp::Directive OpenMPDirectiveKind

OpenMP directives.

@ OMPC_DYN_GROUPPRIVATE_unknown

OpenMPNumThreadsClauseModifier

@ OMPC_NUMTHREADS_unknown

const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)

Insertion operator for diagnostics.

const char * getOperatorSpelling(OverloadedOperatorKind Operator)

Retrieve the spelling of the given overloaded operator, without the preceding "operator" keyword.

U cast(CodeGen::Address addr)

const char * getOpenMPDefaultVariableCategoryName(unsigned VC)

OpenMPDeviceClauseModifier

OpenMP modifiers for 'device' clause.

@ OMPC_MAP_MODIFIER_unknown

OpenMPMapClauseKind

OpenMP mapping kind for 'map' clause.

Diagnostic wrappers for TextAPI types for error reporting.

int const char * function

DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...

DeclarationName getName() const

getName - Returns the embedded declaration name.

llvm::SmallVector< Expr *, 4 > PreferTypes

This structure contains all sizes needed for by an OMPMappableExprListClause.

unsigned NumComponentLists

Number of component lists.

unsigned NumVars

Number of expressions listed.

unsigned NumUniqueDeclarations

Number of unique base declarations.

unsigned NumComponents

Total number of expression components.

Data for list of allocators.

SourceLocation LParenLoc

Locations of '(' and ')' symbols.

Expr * AllocatorTraits

Allocator traits.

Expr * Allocator

Allocator.

This structure contains most locations needed for by an OMPVarListClause.

Describes how types, statements, expressions, and declarations should be printed.

TargetOMPContext(ASTContext &ASTCtx, std::function< void(StringRef)> &&DiagUnknownTrait, const FunctionDecl *CurrentFunctionDecl, ArrayRef< llvm::omp::TraitProperty > ConstructTraits, int DeviceNum)

Definition OpenMPClause.cpp:3104

bool matchesISATrait(StringRef RawString) const override

See llvm::omp::OMPContext::matchesISATrait.

Definition OpenMPClause.cpp:3124