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

1

2

3

4

5

6

7

8

9

10

11

12

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

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

23#include

24#include

25#include

26

27using namespace clang;

28using namespace llvm;

29using namespace omp;

30

33 default:

34 break;

35#define GEN_CLANG_CLAUSE_CLASS

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

37 case Enum: \

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

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

40 }

41 llvm_unreachable("unknown OMPClause");

42}

43

46#define GEN_CLANG_CLAUSE_CLASS

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

48 case Enum: \

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

50#define CLAUSE_NO_CLASS(Enum, Str) \

51 case Enum: \

52 break;

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

54 }

55 llvm_unreachable("unknown OMPClause");

56}

57

61}

62

64 switch (C->getClauseKind()) {

65 case OMPC_schedule:

67 case OMPC_dist_schedule:

69 case OMPC_firstprivate:

71 case OMPC_lastprivate:

73 case OMPC_reduction:

75 case OMPC_task_reduction:

77 case OMPC_in_reduction:

79 case OMPC_linear:

81 case OMPC_if:

83 case OMPC_num_threads:

85 case OMPC_num_teams:

87 case OMPC_thread_limit:

89 case OMPC_device:

91 case OMPC_grainsize:

93 case OMPC_num_tasks:

95 case OMPC_final:

97 case OMPC_priority:

99 case OMPC_novariants:

101 case OMPC_nocontext:

103 case OMPC_filter:

105 case OMPC_ompx_dyn_cgroup_mem:

107 case OMPC_default:

108 case OMPC_proc_bind:

109 case OMPC_safelen:

110 case OMPC_simdlen:

111 case OMPC_sizes:

112 case OMPC_allocator:

113 case OMPC_allocate:

114 case OMPC_collapse:

115 case OMPC_private:

116 case OMPC_shared:

117 case OMPC_aligned:

118 case OMPC_copyin:

119 case OMPC_copyprivate:

120 case OMPC_ordered:

121 case OMPC_nowait:

122 case OMPC_untied:

123 case OMPC_mergeable:

124 case OMPC_threadprivate:

125 case OMPC_flush:

126 case OMPC_depobj:

127 case OMPC_read:

128 case OMPC_write:

129 case OMPC_update:

130 case OMPC_capture:

131 case OMPC_compare:

132 case OMPC_fail:

133 case OMPC_seq_cst:

134 case OMPC_acq_rel:

135 case OMPC_acquire:

136 case OMPC_release:

137 case OMPC_relaxed:

138 case OMPC_depend:

139 case OMPC_threads:

140 case OMPC_simd:

141 case OMPC_map:

142 case OMPC_nogroup:

143 case OMPC_hint:

144 case OMPC_defaultmap:

145 case OMPC_unknown:

146 case OMPC_uniform:

147 case OMPC_to:

148 case OMPC_from:

149 case OMPC_use_device_ptr:

150 case OMPC_use_device_addr:

151 case OMPC_is_device_ptr:

152 case OMPC_has_device_addr:

153 case OMPC_unified_address:

154 case OMPC_unified_shared_memory:

155 case OMPC_reverse_offload:

156 case OMPC_dynamic_allocators:

157 case OMPC_atomic_default_mem_order:

158 case OMPC_at:

159 case OMPC_severity:

160 case OMPC_message:

161 case OMPC_device_type:

162 case OMPC_match:

163 case OMPC_nontemporal:

164 case OMPC_order:

165 case OMPC_destroy:

166 case OMPC_detach:

167 case OMPC_inclusive:

168 case OMPC_exclusive:

169 case OMPC_uses_allocators:

170 case OMPC_affinity:

171 case OMPC_when:

172 case OMPC_bind:

173 case OMPC_ompx_bare:

174 break;

175 default:

176 break;

177 }

178

179 return nullptr;

180}

181

185}

186

188 switch (C->getClauseKind()) {

189 case OMPC_lastprivate:

191 case OMPC_reduction:

193 case OMPC_task_reduction:

195 case OMPC_in_reduction:

197 case OMPC_linear:

199 case OMPC_schedule:

200 case OMPC_dist_schedule:

201 case OMPC_firstprivate:

202 case OMPC_default:

203 case OMPC_proc_bind:

204 case OMPC_if:

205 case OMPC_final:

206 case OMPC_num_threads:

207 case OMPC_safelen:

208 case OMPC_simdlen:

209 case OMPC_sizes:

210 case OMPC_allocator:

211 case OMPC_allocate:

212 case OMPC_collapse:

213 case OMPC_private:

214 case OMPC_shared:

215 case OMPC_aligned:

216 case OMPC_copyin:

217 case OMPC_copyprivate:

218 case OMPC_ordered:

219 case OMPC_nowait:

220 case OMPC_untied:

221 case OMPC_mergeable:

222 case OMPC_threadprivate:

223 case OMPC_flush:

224 case OMPC_depobj:

225 case OMPC_read:

226 case OMPC_write:

227 case OMPC_update:

228 case OMPC_capture:

229 case OMPC_compare:

230 case OMPC_fail:

231 case OMPC_seq_cst:

232 case OMPC_acq_rel:

233 case OMPC_acquire:

234 case OMPC_release:

235 case OMPC_relaxed:

236 case OMPC_depend:

237 case OMPC_device:

238 case OMPC_threads:

239 case OMPC_simd:

240 case OMPC_map:

241 case OMPC_num_teams:

242 case OMPC_thread_limit:

243 case OMPC_priority:

244 case OMPC_grainsize:

245 case OMPC_nogroup:

246 case OMPC_num_tasks:

247 case OMPC_hint:

248 case OMPC_defaultmap:

249 case OMPC_unknown:

250 case OMPC_uniform:

251 case OMPC_to:

252 case OMPC_from:

253 case OMPC_use_device_ptr:

254 case OMPC_use_device_addr:

255 case OMPC_is_device_ptr:

256 case OMPC_has_device_addr:

257 case OMPC_unified_address:

258 case OMPC_unified_shared_memory:

259 case OMPC_reverse_offload:

260 case OMPC_dynamic_allocators:

261 case OMPC_atomic_default_mem_order:

262 case OMPC_at:

263 case OMPC_severity:

264 case OMPC_message:

265 case OMPC_device_type:

266 case OMPC_match:

267 case OMPC_nontemporal:

268 case OMPC_order:

269 case OMPC_destroy:

270 case OMPC_novariants:

271 case OMPC_nocontext:

272 case OMPC_detach:

273 case OMPC_inclusive:

274 case OMPC_exclusive:

275 case OMPC_uses_allocators:

276 case OMPC_affinity:

277 case OMPC_when:

278 case OMPC_bind:

279 break;

280 default:

281 break;

282 }

283

284 return nullptr;

285}

286

287

288

290 if (!S)

291 return nullptr;

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

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

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

295 return OED->getInitAddress();

296 }

297 return nullptr;

298}

299

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

304}

305

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

310}

311

315 return child_range(&NumTasks, &NumTasks + 1);

316}

317

322}

323

327 return child_range(&Priority, &Priority + 1);

328}

329

334}

335

340}

341

343 unsigned NumLoops,

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

348 auto *Clause =

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

352 Clause->setLoopCounter(I, nullptr);

353 }

354 return Clause;

355}

356

358 unsigned NumLoops) {

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

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

363 Clause->setLoopCounter(I, nullptr);

364 }

365 return Clause;

366}

367

369 Expr *NumIterations) {

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

371 getTrailingObjects<Expr *>()[NumLoop] = NumIterations;

372}

373

375 return llvm::ArrayRef(getTrailingObjects<Expr *>(), NumberOfLoops);

376}

377

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

380 getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop] = Counter;

381}

382

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

385 return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop];

386}

387

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

390 return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop];

391}

392

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

397}

398

403 void *Mem =

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

406 auto *Clause =

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

408 Clause->setLParenLoc(LParenLoc);

409 Clause->setArgumentLoc(ArgumentLoc);

410 Clause->setDependencyKind(DK);

411 return Clause;

412}

413

415 bool IsExtended) {

416 if (!IsExtended)

418 void *Mem =

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

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

422 Clause->IsExtended = true;

423 return Clause;

424}

425

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

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

429 std::copy(VL.begin(), VL.end(), varlist_end());

430}

431

436

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

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

441 Clause->setPrivateCopies(PrivateVL);

442 return Clause;

443}

444

446 unsigned N) {

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

449}

450

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

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

454 std::copy(VL.begin(), VL.end(), varlist_end());

455}

456

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

460 std::copy(VL.begin(), VL.end(), getPrivateCopies().end());

461}

462

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

472 Clause->setPrivateCopies(PrivateVL);

473 Clause->setInits(InitVL);

475 return Clause;

476}

477

479 unsigned N) {

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

482}

483

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

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

487 std::copy(PrivateCopies.begin(), PrivateCopies.end(), varlist_end());

488}

489

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

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

492 "not the same as the "

493 "preallocated buffer");

494 std::copy(SrcExprs.begin(), SrcExprs.end(), getPrivateCopies().end());

495}

496

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

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

499 "expressions is not the same as "

500 "the preallocated buffer");

501 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());

502}

503

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

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

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

507 "buffer");

508 std::copy(AssignmentOps.begin(), AssignmentOps.end(),

509 getDestinationExprs().end());

510}

511

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

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

522 Clause->setSourceExprs(SrcExprs);

523 Clause->setDestinationExprs(DstExprs);

524 Clause->setAssignmentOps(AssignmentOps);

527 return Clause;

528}

529

531 unsigned N) {

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

534}

535

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

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

545 return Clause;

546}

547

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

551}

552

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

556 std::copy(PL.begin(), PL.end(), varlist_end());

557}

558

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

562 std::copy(IL.begin(), IL.end(), getPrivates().end());

563}

564

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

568 std::copy(UL.begin(), UL.end(), getInits().end());

569}

570

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

574 std::copy(FL.begin(), FL.end(), getUpdates().end());

575}

576

578 assert(

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

581 std::copy(UE.begin(), UE.end(), getFinals().end() + 2);

582}

583

590 Expr *PostUpdate) {

591

592

593 void *Mem =

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

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

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

599 Clause->setPrivates(PL);

600 Clause->setInits(IL);

601

602

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

604 nullptr);

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

606 nullptr);

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

608 nullptr);

609 Clause->setStep(Step);

610 Clause->setCalcStep(CalcStep);

613 return Clause;

614}

615

617 unsigned NumVars) {

618

619

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

622}

623

625

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

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

629}

630

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

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

639 Clause->setAlignment(A);

640 return Clause;

641}

642

644 unsigned NumVars) {

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

647}

648

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

654}

655

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

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

658 "not the same as the "

659 "preallocated buffer");

660 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());

661}

662

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

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

665 "expressions is not the same as "

666 "the preallocated buffer");

667 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());

668}

669

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

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

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

673 "buffer");

674 std::copy(AssignmentOps.begin(), AssignmentOps.end(),

675 getDestinationExprs().end());

676}

677

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

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

686 Clause->setSourceExprs(SrcExprs);

687 Clause->setDestinationExprs(DstExprs);

688 Clause->setAssignmentOps(AssignmentOps);

689 return Clause;

690}

691

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

695}

696

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

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

699 "not the same as the "

700 "preallocated buffer");

701 std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end());

702}

703

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

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

706 "expressions is not the same as "

707 "the preallocated buffer");

708 std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end());

709}

710

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

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

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

714 "buffer");

715 std::copy(AssignmentOps.begin(), AssignmentOps.end(),

716 getDestinationExprs().end());

717}

718

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

727 Clause->setSourceExprs(SrcExprs);

728 Clause->setDestinationExprs(DstExprs);

729 Clause->setAssignmentOps(AssignmentOps);

730 return Clause;

731}

732

734 unsigned N) {

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

737}

738

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

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

742 std::copy(Privates.begin(), Privates.end(), varlist_end());

743}

744

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

746 assert(

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

749 std::copy(LHSExprs.begin(), LHSExprs.end(), getPrivates().end());

750}

751

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

753 assert(

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

756 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());

757}

758

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

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

761 "expressions is not the same "

762 "as the preallocated buffer");

763 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());

764}

765

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

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

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

769 "expressions is not the same "

770 "as the preallocated buffer");

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

772}

773

774void OMPReductionClause::setInscanCopyArrayTemps(

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

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

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

779 "buffer");

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

781}

782

783void OMPReductionClause::setInscanCopyArrayElems(

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

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

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

788 "buffer");

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

790}

791

801 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(

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

803 auto *Clause = new (Mem)

804 OMPReductionClause(StartLoc, LParenLoc, ModifierLoc, EndLoc, ColonLoc,

805 Modifier, VL.size(), QualifierLoc, NameInfo);

807 Clause->setPrivates(Privates);

808 Clause->setLHSExprs(LHSExprs);

809 Clause->setRHSExprs(RHSExprs);

810 Clause->setReductionOps(ReductionOps);

811 Clause->setPreInitStmt(PreInit);

812 Clause->setPostUpdateExpr(PostUpdate);

813 if (Modifier == OMPC_REDUCTION_inscan) {

814 Clause->setInscanCopyOps(CopyOps);

815 Clause->setInscanCopyArrayTemps(CopyArrayTemps);

816 Clause->setInscanCopyArrayElems(CopyArrayElems);

817 } else {

818 assert(CopyOps.empty() &&

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

820 assert(CopyArrayTemps.empty() &&

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

822 assert(CopyArrayElems.empty() &&

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

824 }

825 return Clause;

826}

827

831 void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(

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

834 Clause->setModifier(Modifier);

835 return Clause;

836}

837

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

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

841 std::copy(Privates.begin(), Privates.end(), varlist_end());

842}

843

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

845 assert(

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

848 std::copy(LHSExprs.begin(), LHSExprs.end(), getPrivates().end());

849}

850

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

852 assert(

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

855 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());

856}

857

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

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

860 "expressions is not the same "

861 "as the preallocated buffer");

862 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());

863}

864

871 Expr *PostUpdate) {

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

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

876 Clause->setPrivates(Privates);

877 Clause->setLHSExprs(LHSExprs);

878 Clause->setRHSExprs(RHSExprs);

879 Clause->setReductionOps(ReductionOps);

882 return Clause;

883}

884

886 unsigned N) {

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

889}

890

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

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

894 std::copy(Privates.begin(), Privates.end(), varlist_end());

895}

896

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

898 assert(

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

901 std::copy(LHSExprs.begin(), LHSExprs.end(), getPrivates().end());

902}

903

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

905 assert(

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

908 std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end());

909}

910

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

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

913 "expressions is not the same "

914 "as the preallocated buffer");

915 std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end());

916}

917

918void OMPInReductionClause::setTaskgroupDescriptors(

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

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

922 "preallocated buffer");

923 std::copy(TaskgroupDescriptors.begin(), TaskgroupDescriptors.end(),

924 getReductionOps().end());

925}

926

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

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

938 Clause->setPrivates(Privates);

939 Clause->setLHSExprs(LHSExprs);

940 Clause->setRHSExprs(RHSExprs);

941 Clause->setReductionOps(ReductionOps);

942 Clause->setTaskgroupDescriptors(TaskgroupDescriptors);

945 return Clause;

946}

947

949 unsigned N) {

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

952}

953

964 return Clause;

965}

966

968 unsigned NumSizes) {

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

971}

972

982 Clause->setArgRefs(Args);

983 return Clause;

984}

985

987 unsigned NumLoops) {

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

990}

991

998 return Clause;

999}

1000

1003}

1004

1009 Expr *Factor) {

1012 Clause->setLParenLoc(LParenLoc);

1014 Clause->setFactor(Factor);

1015 return Clause;

1016}

1017

1020}

1021

1028

1029

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

1032 StartLoc, LParenLoc, Allocator, Alignment, ColonLoc, Modifier1,

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

1034

1036 return Clause;

1037}

1038

1040 unsigned N) {

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

1043}

1044

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

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

1054 return Clause;

1055}

1056

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

1060}

1061

1066 Expr *Depobj) {

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

1068 Clause->setDepobj(Depobj);

1069 return Clause;

1070}

1071

1074}

1075

1081 void *Mem = C.Allocate(

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

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

1086 Clause->setDependencyKind(Data.DepKind);

1087 Clause->setDependencyLoc(Data.DepLoc);

1088 Clause->setColonLoc(Data.ColonLoc);

1089 Clause->setOmpAllMemoryLoc(Data.OmpAllMemoryLoc);

1090 Clause->setModifier(DepModifier);

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

1094 return Clause;

1095}

1096

1098 unsigned NumLoops) {

1099 void *Mem =

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

1103}

1104

1108 NumLoop < NumLoops &&

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

1110 "loops.");

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

1112 *It = Cnt;

1113}

1114

1118 NumLoop < NumLoops &&

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

1120 "loops.");

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

1122 return *It;

1123}

1124

1128 NumLoop < NumLoops &&

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

1130 "loops.");

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

1132 return *It;

1133}

1134

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

1137}

1139

1142 unsigned TotalNum = 0u;

1143 for (auto &C : ComponentLists)

1144 TotalNum += C.size();

1145 return TotalNum;

1146}

1147

1151 for (const ValueDecl *D : Declarations) {

1153 UniqueDecls.insert(VD);

1154 }

1155 return UniqueDecls.size();

1156}

1157

1167 Sizes.NumVars = Vars.size();

1171

1172

1173

1174

1175

1176

1177

1178

1179

1180

1181

1182 void *Mem = C.Allocate(

1189 OMPMapClause(MapModifiers, MapModifiersLoc, UDMQualifierLoc, MapperId,

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

1191

1194 Clause->setIteratorModifier(IteratorModifier);

1195 Clause->setClauseInfo(Declarations, ComponentLists);

1196 Clause->setMapType(Type);

1197 Clause->setMapLoc(TypeLoc);

1198 return Clause;

1199}

1200

1204 void *Mem = C.Allocate(

1211 Clause->setIteratorModifier(nullptr);

1212 return Clause;

1213}

1214

1223 Sizes.NumVars = Vars.size();

1227

1228

1229

1230

1231

1232

1233

1234

1235

1236

1237

1238 void *Mem = C.Allocate(

1244

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

1246 UDMQualifierLoc, MapperId, Locs, Sizes);

1247

1249 Clause->setUDMapperRefs(UDMapperRefs);

1250 Clause->setClauseInfo(Declarations, ComponentLists);

1251 return Clause;

1252}

1253

1256 void *Mem = C.Allocate(

1263}

1264

1273 Sizes.NumVars = Vars.size();

1277

1278

1279

1280

1281

1282

1283

1284

1285

1286

1287

1288 void *Mem = C.Allocate(

1294

1295 auto *Clause =

1296 new (Mem) OMPFromClause(MotionModifiers, MotionModifiersLoc,

1297 UDMQualifierLoc, MapperId, Locs, Sizes);

1298

1300 Clause->setUDMapperRefs(UDMapperRefs);

1301 Clause->setClauseInfo(Declarations, ComponentLists);

1302 return Clause;

1303}

1304

1308 void *Mem = C.Allocate(

1315}

1316

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

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

1320 std::copy(VL.begin(), VL.end(), varlist_end());

1321}

1322

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

1326 std::copy(VL.begin(), VL.end(), getPrivateCopies().end());

1327}

1328

1335 Sizes.NumVars = Vars.size();

1339

1340

1341

1342

1343

1344

1345

1346

1347

1348

1349

1350 void *Mem = C.Allocate(

1356

1358

1360 Clause->setPrivateCopies(PrivateVars);

1361 Clause->setInits(Inits);

1362 Clause->setClauseInfo(Declarations, ComponentLists);

1363 return Clause;

1364}

1365

1369 void *Mem = C.Allocate(

1376}

1377

1384 Sizes.NumVars = Vars.size();

1388

1389

1390

1391

1392

1393

1394

1395

1396

1397

1398

1399 void *Mem = C.Allocate(

1405

1407

1409 Clause->setClauseInfo(Declarations, ComponentLists);

1410 return Clause;

1411}

1412

1416 void *Mem = C.Allocate(

1423}

1424

1431 Sizes.NumVars = Vars.size();

1435

1436

1437

1438

1439

1440

1441

1442

1443

1444

1445

1446 void *Mem = C.Allocate(

1452

1454

1456 Clause->setClauseInfo(Declarations, ComponentLists);

1457 return Clause;

1458}

1459

1463 void *Mem = C.Allocate(

1470}

1471

1478 Sizes.NumVars = Vars.size();

1482

1483

1484

1485

1486

1487

1488

1489

1490

1491

1492

1493 void *Mem = C.Allocate(

1499

1501

1503 Clause->setClauseInfo(Declarations, ComponentLists);

1504 return Clause;

1505}

1506

1510 void *Mem = C.Allocate(

1517}

1518

1524

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

1526 auto *Clause =

1529 return Clause;

1530}

1531

1533 unsigned N) {

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

1536}

1537

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

1540 "the same as the preallocated buffer");

1541 std::copy(VL.begin(), VL.end(), varlist_end());

1542}

1543

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

1550 auto *Clause =

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

1553 return Clause;

1554}

1555

1557 unsigned N) {

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

1560}

1561

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

1568 auto *Clause =

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

1571 return Clause;

1572}

1573

1575 unsigned N) {

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

1578}

1579

1580void OMPUsesAllocatorsClause::setAllocatorsData(

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

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

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

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

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

1588 D.Allocator;

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

1590 static_cast<int>(

1591 ExprOffsets::AllocatorTraits)] =

1592 D.AllocatorTraits;

1593 getTrailingObjects<

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

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

1596 D.LParenLoc;

1597 getTrailingObjects<

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

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

1600 D.RParenLoc;

1601 }

1602}

1603

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

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

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

1612 static_cast<int>(

1613 ExprOffsets::AllocatorTraits)];

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

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

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

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

1620 return Data;

1621}

1622

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

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

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

1630 auto *Clause = new (Mem)

1632 Clause->setAllocatorsData(Data);

1633 return Clause;

1634}

1635

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

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

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

1642}

1643

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

1650 auto *Clause = new (Mem)

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

1652 Clause->setModifier(Modifier);

1653 Clause->setVarRefs(Locators);

1654 return Clause;

1655}

1656

1658 unsigned N) {

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

1661}

1662

1669

1670 void *Mem =

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

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

1675 Clause->setInteropVar(InteropVar);

1676 llvm::copy(InteropInfo.PreferTypes, Clause->getTrailingObjects<Expr *>() + 1);

1677 return Clause;

1678}

1679

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

1683}

1684

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

1690}

1691

1694}

1695

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

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

1706 Clause->setDependenceType(DepType);

1707 Clause->setDependenceLoc(DepLoc);

1708 Clause->setColonLoc(ColonLoc);

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

1712 return Clause;

1713}

1714

1716 unsigned N,

1717 unsigned NumLoops) {

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

1721}

1722

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

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

1726 *It = Cnt;

1727}

1728

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

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

1732 return *It;

1733}

1734

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

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

1738 return *It;

1739}

1740

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

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

1749 AC->setDirectiveKinds(DKVec);

1750 return AC;

1751}

1752

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

1757}

1758

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

1766 return CC;

1767}

1768

1770 unsigned K) {

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

1774}

1775

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

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

1785 return Clause;

1786}

1787

1789 unsigned N) {

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

1792}

1793

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

1803 return Clause;

1804}

1805

1807 unsigned N) {

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

1810}

1811

1812

1813

1814

1815

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

1817 OS << "if(";

1818 if (Node->getNameModifier() != OMPD_unknown)

1819 OS << getOpenMPDirectiveName(Node->getNameModifier()) << ": ";

1820 Node->getCondition()->printPretty(OS, nullptr, Policy, 0);

1821 OS << ")";

1822}

1823

1825 OS << "final(";

1826 Node->getCondition()->printPretty(OS, nullptr, Policy, 0);

1827 OS << ")";

1828}

1829

1831 OS << "num_threads(";

1832 Node->getNumThreads()->printPretty(OS, nullptr, Policy, 0);

1833 OS << ")";

1834}

1835

1837 OS << "align(";

1838 Node->getAlignment()->printPretty(OS, nullptr, Policy, 0);

1839 OS << ")";

1840}

1841

1843 OS << "safelen(";

1844 Node->getSafelen()->printPretty(OS, nullptr, Policy, 0);

1845 OS << ")";

1846}

1847

1849 OS << "simdlen(";

1850 Node->getSimdlen()->printPretty(OS, nullptr, Policy, 0);

1851 OS << ")";

1852}

1853

1855 OS << "sizes(";

1856 bool First = true;

1857 for (auto *Size : Node->getSizesRefs()) {

1859 OS << ", ";

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

1862 }

1863 OS << ")";

1864}

1865

1867 OS << "permutation(";

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

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

1870 });

1871 OS << ")";

1872}

1873

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

1875

1877 OS << "partial";

1878

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

1880 OS << '(';

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

1882 OS << ')';

1883 }

1884}

1885

1887 OS << "allocator(";

1888 Node->getAllocator()->printPretty(OS, nullptr, Policy, 0);

1889 OS << ")";

1890}

1891

1893 OS << "collapse(";

1894 Node->getNumForLoops()->printPretty(OS, nullptr, Policy, 0);

1895 OS << ")";

1896}

1897

1899 OS << "detach(";

1900 Node->getEventHandler()->printPretty(OS, nullptr, Policy, 0);

1901 OS << ")";

1902}

1903

1905 OS << "default("

1907 unsigned(Node->getDefaultKind()))

1908 << ")";

1909}

1910

1912 OS << "proc_bind("

1914 unsigned(Node->getProcBindKind()))

1915 << ")";

1916}

1917

1919 OS << "unified_address";

1920}

1921

1922void OMPClausePrinter::VisitOMPUnifiedSharedMemoryClause(

1924 OS << "unified_shared_memory";

1925}

1926

1928 OS << "reverse_offload";

1929}

1930

1931void OMPClausePrinter::VisitOMPDynamicAllocatorsClause(

1933 OS << "dynamic_allocators";

1934}

1935

1936void OMPClausePrinter::VisitOMPAtomicDefaultMemOrderClause(

1938 OS << "atomic_default_mem_order("

1940 Node->getAtomicDefaultMemOrderKind())

1941 << ")";

1942}

1943

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

1946 << ")";

1947}

1948

1950 OS << "severity("

1952 << ")";

1953}

1954

1956 OS << "message(\""

1957 << cast(Node->getMessageString())->getString() << "\")";

1958}

1959

1961 OS << "schedule(";

1964 Node->getFirstScheduleModifier());

1966 OS << ", ";

1968 Node->getSecondScheduleModifier());

1969 }

1970 OS << ": ";

1971 }

1973 if (auto *E = Node->getChunkSize()) {

1974 OS << ", ";

1976 }

1977 OS << ")";

1978}

1979

1981 OS << "ordered";

1982 if (auto *Num = Node->getNumForLoops()) {

1983 OS << "(";

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

1985 OS << ")";

1986 }

1987}

1988

1989void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *) {

1990 OS << "nowait";

1991}

1992

1993void OMPClausePrinter::VisitOMPUntiedClause(OMPUntiedClause *) {

1994 OS << "untied";

1995}

1996

1997void OMPClausePrinter::VisitOMPNogroupClause(OMPNogroupClause *) {

1998 OS << "nogroup";

1999}

2000

2001void OMPClausePrinter::VisitOMPMergeableClause(OMPMergeableClause *) {

2002 OS << "mergeable";

2003}

2004

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

2006

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

2008

2010 OS << "update";

2011 if (Node->isExtended()) {

2012 OS << "(";

2014 Node->getDependencyKind());

2015 OS << ")";

2016 }

2017}

2018

2019void OMPClausePrinter::VisitOMPCaptureClause(OMPCaptureClause *) {

2020 OS << "capture";

2021}

2022

2023void OMPClausePrinter::VisitOMPCompareClause(OMPCompareClause *) {

2024 OS << "compare";

2025}

2026

2028 OS << "fail";

2030 OS << "(";

2032 Node->getClauseKind(), static_cast<int>(Node->getFailParameter()));

2033 OS << ")";

2034 }

2035}

2036

2038 OS << "absent(";

2039 bool First = true;

2040 for (auto &D : Node->getDirectiveKinds()) {

2042 OS << ", ";

2043 OS << getOpenMPDirectiveName(D);

2045 }

2046 OS << ")";

2047}

2048

2050 OS << "holds(";

2051 Node->getExpr()->printPretty(OS, nullptr, Policy, 0);

2052 OS << ")";

2053}

2054

2056 OS << "contains(";

2057 bool First = true;

2058 for (auto &D : Node->getDirectiveKinds()) {

2060 OS << ", ";

2061 OS << getOpenMPDirectiveName(D);

2063 }

2064 OS << ")";

2065}

2066

2067void OMPClausePrinter::VisitOMPNoOpenMPClause(OMPNoOpenMPClause *) {

2068 OS << "no_openmp";

2069}

2070

2071void OMPClausePrinter::VisitOMPNoOpenMPRoutinesClause(

2073 OS << "no_openmp_routines";

2074}

2075

2077 OS << "no_parallelism";

2078}

2079

2080void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) {

2081 OS << "seq_cst";

2082}

2083

2084void OMPClausePrinter::VisitOMPAcqRelClause(OMPAcqRelClause *) {

2085 OS << "acq_rel";

2086}

2087

2088void OMPClausePrinter::VisitOMPAcquireClause(OMPAcquireClause *) {

2089 OS << "acquire";

2090}

2091

2092void OMPClausePrinter::VisitOMPReleaseClause(OMPReleaseClause *) {

2093 OS << "release";

2094}

2095

2096void OMPClausePrinter::VisitOMPRelaxedClause(OMPRelaxedClause *) {

2097 OS << "relaxed";

2098}

2099

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

2101

2102void OMPClausePrinter::VisitOMPThreadsClause(OMPThreadsClause *) {

2103 OS << "threads";

2104}

2105

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

2107

2109 OS << "device(";

2113 << ": ";

2114 }

2115 Node->getDevice()->printPretty(OS, nullptr, Policy, 0);

2116 OS << ")";

2117}

2118

2120 if (Node->varlist_empty()) {

2121 OS << "num_teams";

2122 VisitOMPClauseList(Node, '(');

2123 OS << ")";

2124 }

2125}

2126

2128 if (Node->varlist_empty()) {

2129 OS << "thread_limit";

2130 VisitOMPClauseList(Node, '(');

2131 OS << ")";

2132 }

2133}

2134

2136 OS << "priority(";

2137 Node->getPriority()->printPretty(OS, nullptr, Policy, 0);

2138 OS << ")";

2139}

2140

2142 OS << "grainsize(";

2146 << ": ";

2147 }

2148 Node->getGrainsize()->printPretty(OS, nullptr, Policy, 0);

2149 OS << ")";

2150}

2151

2153 OS << "num_tasks(";

2157 << ": ";

2158 }

2159 Node->getNumTasks()->printPretty(OS, nullptr, Policy, 0);

2160 OS << ")";

2161}

2162

2164 OS << "hint(";

2165 Node->getHint()->printPretty(OS, nullptr, Policy, 0);

2166 OS << ")";

2167}

2168

2170 OS << "init(";

2171 bool First = true;

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

2174 OS << "prefer_type(";

2175 else

2176 OS << ",";

2179 }

2181 OS << "), ";

2182 if (Node->getIsTarget())

2183 OS << "target";

2184 if (Node->getIsTargetSync()) {

2185 if (Node->getIsTarget())

2186 OS << ", ";

2187 OS << "targetsync";

2188 }

2189 OS << " : ";

2190 Node->getInteropVar()->printPretty(OS, nullptr, Policy);

2191 OS << ")";

2192}

2193

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

2195 OS << "use(";

2196 Node->getInteropVar()->printPretty(OS, nullptr, Policy);

2197 OS << ")";

2198}

2199

2201 OS << "destroy";

2202 if (Expr *E = Node->getInteropVar()) {

2203 OS << "(";

2205 OS << ")";

2206 }

2207}

2208

2210 OS << "novariants";

2211 if (Expr *E = Node->getCondition()) {

2212 OS << "(";

2214 OS << ")";

2215 }

2216}

2217

2219 OS << "nocontext";

2220 if (Expr *E = Node->getCondition()) {

2221 OS << "(";

2223 OS << ")";

2224 }

2225}

2226

2227template

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

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

2230 E = Node->varlist_end();

2231 I != E; ++I) {

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

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

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

2235 if (isa(DRE->getDecl()))

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

2237 else

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

2239 } else

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

2241 }

2242}

2243

2245 if (Node->varlist_empty())

2246 return;

2247

2248 Expr *FirstModifier = nullptr;

2249 Expr *SecondModifier = nullptr;

2250 auto FirstAllocMod = Node->getFirstAllocateModifier();

2251 auto SecondAllocMod = Node->getSecondAllocateModifier();

2254 if (FirstAllocMod == OMPC_ALLOCATE_allocator ||

2256 FirstModifier = Node->getAllocator();

2257 SecondModifier = Node->getAlignment();

2258 } else {

2259 FirstModifier = Node->getAlignment();

2260 SecondModifier = Node->getAllocator();

2261 }

2262

2263 OS << "allocate";

2264

2265 if (FirstModifier) {

2266 OS << "(";

2267 if (!FirstUnknown) {

2269 OS << "(";

2270 }

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

2272 if (!FirstUnknown)

2273 OS << ")";

2274 if (SecondModifier) {

2275 OS << ", ";

2276 if (!SecondUnknown) {

2278 SecondAllocMod);

2279 OS << "(";

2280 }

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

2282 if (!SecondUnknown)

2283 OS << ")";

2284 }

2285 OS << ":";

2286 VisitOMPClauseList(Node, ' ');

2287 } else {

2288

2289 VisitOMPClauseList(Node, '(');

2290 }

2291 OS << ")";

2292}

2293

2295 if (Node->varlist_empty()) {

2296 OS << "private";

2297 VisitOMPClauseList(Node, '(');

2298 OS << ")";

2299 }

2300}

2301

2303 if (Node->varlist_empty()) {

2304 OS << "firstprivate";

2305 VisitOMPClauseList(Node, '(');

2306 OS << ")";

2307 }

2308}

2309

2311 if (Node->varlist_empty()) {

2312 OS << "lastprivate";

2315 OS << "("

2317 << ":";

2318 }

2320 OS << ")";

2321 }

2322}

2323

2325 if (Node->varlist_empty()) {

2326 OS << "shared";

2327 VisitOMPClauseList(Node, '(');

2328 OS << ")";

2329 }

2330}

2331

2333 if (Node->varlist_empty()) {

2334 OS << "reduction(";

2335 if (Node->getModifierLoc().isValid())

2337 << ", ";

2339 Node->getQualifierLoc().getNestedNameSpecifier();

2341 Node->getNameInfo().getName().getCXXOverloadedOperator();

2342 if (QualifierLoc == nullptr && OOK != OO_None) {

2343

2345 } else {

2346

2347 if (QualifierLoc != nullptr)

2348 QualifierLoc->print(OS, Policy);

2349 OS << Node->getNameInfo();

2350 }

2351 OS << ":";

2352 VisitOMPClauseList(Node, ' ');

2353 OS << ")";

2354 }

2355}

2356

2357void OMPClausePrinter::VisitOMPTaskReductionClause(

2359 if (Node->varlist_empty()) {

2360 OS << "task_reduction(";

2362 Node->getQualifierLoc().getNestedNameSpecifier();

2364 Node->getNameInfo().getName().getCXXOverloadedOperator();

2365 if (QualifierLoc == nullptr && OOK != OO_None) {

2366

2368 } else {

2369

2370 if (QualifierLoc != nullptr)

2371 QualifierLoc->print(OS, Policy);

2372 OS << Node->getNameInfo();

2373 }

2374 OS << ":";

2375 VisitOMPClauseList(Node, ' ');

2376 OS << ")";

2377 }

2378}

2379

2381 if (Node->varlist_empty()) {

2382 OS << "in_reduction(";

2384 Node->getQualifierLoc().getNestedNameSpecifier();

2386 Node->getNameInfo().getName().getCXXOverloadedOperator();

2387 if (QualifierLoc == nullptr && OOK != OO_None) {

2388

2390 } else {

2391

2392 if (QualifierLoc != nullptr)

2393 QualifierLoc->print(OS, Policy);

2394 OS << Node->getNameInfo();

2395 }

2396 OS << ":";

2397 VisitOMPClauseList(Node, ' ');

2398 OS << ")";

2399 }

2400}

2401

2403 if (Node->varlist_empty()) {

2404 OS << "linear";

2405 VisitOMPClauseList(Node, '(');

2406 if (Node->getModifierLoc().isValid() || Node->getStep() != nullptr) {

2407 OS << ": ";

2408 }

2409 if (Node->getModifierLoc().isValid()) {

2411 }

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

2413 if (Node->getModifierLoc().isValid()) {

2414 OS << ", ";

2415 }

2416 OS << "step(";

2417 Node->getStep()->printPretty(OS, nullptr, Policy, 0);

2418 OS << ")";

2419 }

2420 OS << ")";

2421 }

2422}

2423

2425 if (Node->varlist_empty()) {

2426 OS << "aligned";

2427 VisitOMPClauseList(Node, '(');

2428 if (Node->getAlignment() != nullptr) {

2429 OS << ": ";

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

2431 }

2432 OS << ")";

2433 }

2434}

2435

2437 if (Node->varlist_empty()) {

2438 OS << "copyin";

2439 VisitOMPClauseList(Node, '(');

2440 OS << ")";

2441 }

2442}

2443

2445 if (Node->varlist_empty()) {

2446 OS << "copyprivate";

2447 VisitOMPClauseList(Node, '(');

2448 OS << ")";

2449 }

2450}

2451

2453 if (Node->varlist_empty()) {

2454 VisitOMPClauseList(Node, '(');

2455 OS << ")";

2456 }

2457}

2458

2460 OS << "(";

2461 Node->getDepobj()->printPretty(OS, nullptr, Policy, 0);

2462 OS << ")";

2463}

2464

2466 OS << "depend(";

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

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

2469 OS << ", ";

2470 }

2473 bool IsOmpAllMemory = false;

2474 if (PrintKind == OMPC_DEPEND_outallmemory) {

2475 PrintKind = OMPC_DEPEND_out;

2476 IsOmpAllMemory = true;

2477 } else if (PrintKind == OMPC_DEPEND_inoutallmemory) {

2478 PrintKind = OMPC_DEPEND_inout;

2479 IsOmpAllMemory = true;

2480 }

2482 if (Node->varlist_empty() || IsOmpAllMemory)

2483 OS << " :";

2484 VisitOMPClauseList(Node, ' ');

2485 if (IsOmpAllMemory) {

2486 OS << (Node->varlist_empty() ? " " : ",");

2487 OS << "omp_all_memory";

2488 }

2489 OS << ")";

2490}

2491

2492template

2495 OS << '(';

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

2498 if (MapperNNS)

2499 MapperNNS->print(OS, Policy);

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

2501}

2502

2503template

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

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

2508}

2509

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

2511 if (Node->varlist_empty()) {

2512 OS << "map(";

2516 if (Node->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_iterator) {

2518 } else {

2520 Node->getMapTypeModifier(I));

2521 if (Node->getMapTypeModifier(I) == OMPC_MAP_MODIFIER_mapper)

2523 }

2524 OS << ',';

2525 }

2526 }

2528 OS << ':';

2529 }

2530 VisitOMPClauseList(Node, ' ');

2531 OS << ")";

2532 }

2533}

2534

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

2536 if (Node->varlist_empty())

2537 return;

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

2539 unsigned ModifierCount = 0;

2542 ++ModifierCount;

2543 }

2544 if (ModifierCount) {

2545 OS << '(';

2549 Node->getMotionModifier(I));

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

2552 if (I < ModifierCount - 1)

2553 OS << ", ";

2554 }

2555 }

2556 OS << ':';

2557 VisitOMPClauseList(Node, ' ');

2558 } else {

2559 VisitOMPClauseList(Node, '(');

2560 }

2561 OS << ")";

2562}

2563

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

2565 VisitOMPMotionClause(Node);

2566}

2567

2569 VisitOMPMotionClause(Node);

2570}

2571

2574 OMPC_dist_schedule, Node->getDistScheduleKind());

2575 if (auto *E = Node->getChunkSize()) {

2576 OS << ", ";

2578 }

2579 OS << ")";

2580}

2581

2583 OS << "defaultmap(";

2585 Node->getDefaultmapModifier());

2587 OS << ": ";

2589 Node->getDefaultmapKind());

2590 }

2591 OS << ")";

2592}

2593

2595 if (Node->varlist_empty()) {

2596 OS << "use_device_ptr";

2597 VisitOMPClauseList(Node, '(');

2598 OS << ")";

2599 }

2600}

2601

2602void OMPClausePrinter::VisitOMPUseDeviceAddrClause(

2604 if (Node->varlist_empty()) {

2605 OS << "use_device_addr";

2606 VisitOMPClauseList(Node, '(');

2607 OS << ")";

2608 }

2609}

2610

2612 if (Node->varlist_empty()) {

2613 OS << "is_device_ptr";

2614 VisitOMPClauseList(Node, '(');

2615 OS << ")";

2616 }

2617}

2618

2620 if (Node->varlist_empty()) {

2621 OS << "has_device_addr";

2622 VisitOMPClauseList(Node, '(');

2623 OS << ")";

2624 }

2625}

2626

2628 if (Node->varlist_empty()) {

2629 OS << "nontemporal";

2630 VisitOMPClauseList(Node, '(');

2631 OS << ")";

2632 }

2633}

2634

2636 OS << "order(";

2639 OS << ": ";

2640 }

2642}

2643

2645 if (Node->varlist_empty()) {

2646 OS << "inclusive";

2647 VisitOMPClauseList(Node, '(');

2648 OS << ")";

2649 }

2650}

2651

2653 if (Node->varlist_empty()) {

2654 OS << "exclusive";

2655 VisitOMPClauseList(Node, '(');

2656 OS << ")";

2657 }

2658}

2659

2660void OMPClausePrinter::VisitOMPUsesAllocatorsClause(

2662 if (Node->getNumberOfAllocators() == 0)

2663 return;

2664 OS << "uses_allocators(";

2665 for (unsigned I = 0, E = Node->getNumberOfAllocators(); I < E; ++I) {

2667 Data.Allocator->printPretty(OS, nullptr, Policy);

2668 if (Data.AllocatorTraits) {

2669 OS << "(";

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

2671 OS << ")";

2672 }

2673 if (I < E - 1)

2674 OS << ",";

2675 }

2676 OS << ")";

2677}

2678

2680 if (Node->varlist_empty())

2681 return;

2682 OS << "affinity";

2683 char StartSym = '(';

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

2685 OS << "(";

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

2687 OS << " :";

2688 StartSym = ' ';

2689 }

2690 VisitOMPClauseList(Node, StartSym);

2691 OS << ")";

2692}

2693

2695 OS << "filter(";

2696 Node->getThreadID()->printPretty(OS, nullptr, Policy, 0);

2697 OS << ")";

2698}

2699

2701 OS << "bind("

2703 << ")";

2704}

2705

2706void OMPClausePrinter::VisitOMPXDynCGroupMemClause(

2708 OS << "ompx_dyn_cgroup_mem(";

2709 Node->getSize()->printPretty(OS, nullptr, Policy, 0);

2710 OS << ")";

2711}

2712

2714 OS << "doacross(";

2716

2717 switch (DepType) {

2718 case OMPC_DOACROSS_source:

2719 OS << "source:";

2720 break;

2721 case OMPC_DOACROSS_sink:

2722 OS << "sink:";

2723 break;

2724 case OMPC_DOACROSS_source_omp_cur_iteration:

2725 OS << "source: omp_cur_iteration";

2726 break;

2727 case OMPC_DOACROSS_sink_omp_cur_iteration:

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

2729 break;

2730 default:

2731 llvm_unreachable("unknown docaross modifier");

2732 }

2733 VisitOMPClauseList(Node, ' ');

2734 OS << ")";

2735}

2736

2738 OS << "ompx_attribute(";

2739 bool IsFirst = true;

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

2741 if (!IsFirst)

2742 OS << ", ";

2744 IsFirst = false;

2745 }

2746 OS << ")";

2747}

2748

2750 OS << "ompx_bare";

2751}

2752

2754 VariantMatchInfo &VMI) const {

2757

2758

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

2760 assert(Selector.ScoreOrCondition &&

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

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

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

2764 TraitProperty::user_condition_unknown &&

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

2766

2767 if (std::optional CondVal =

2768 Selector.ScoreOrCondition->getIntegerConstantExpr(ASTCtx))

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

2770 : TraitProperty::user_condition_true,

2771 "");

2772 else

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

2774 continue;

2775 }

2776

2777 std::optionalllvm::APSInt Score;

2778 llvm::APInt *ScorePtr = nullptr;

2779 if (Selector.ScoreOrCondition) {

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

2781 ScorePtr = &*Score;

2782 else

2783 VMI.addTrait(TraitProperty::user_condition_false,

2784 "");

2785 }

2786

2789

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

2791 continue;

2792

2793

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

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

2796 getOpenMPContextTraitPropertyForSelector(

2798 "Ill-formed construct selector!");

2799 }

2800 }

2801}

2802

2805 bool FirstSet = true;

2807 if (!FirstSet)

2808 OS << ", ";

2809 FirstSet = false;

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

2811

2812 bool FirstSelector = true;

2814 if (!FirstSelector)

2815 OS << ", ";

2816 FirstSelector = false;

2817 OS << getOpenMPContextTraitSelectorName(Selector.Kind);

2818

2819 bool AllowsTraitScore = false;

2820 bool RequiresProperty = false;

2821 isValidTraitSelectorForTraitSet(

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

2823

2824 if (!RequiresProperty)

2825 continue;

2826

2827 OS << "(";

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

2829 if (Selector.ScoreOrCondition)

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

2831 else

2832 OS << "...";

2833 } else {

2834

2835 if (Selector.ScoreOrCondition) {

2836 OS << "score(";

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

2838 OS << "): ";

2839 }

2840

2841 bool FirstProperty = true;

2843 if (!FirstProperty)

2844 OS << ", ";

2845 FirstProperty = false;

2846 OS << getOpenMPContextTraitPropertyName(Property.Kind,

2848 }

2849 }

2850 OS << ")";

2851 }

2852 OS << "}";

2853 }

2854}

2855

2857 std::string MangledName;

2858 llvm::raw_string_ostream OS(MangledName);

2862

2863 bool AllowsTraitScore = false;

2864 bool RequiresProperty = false;

2865 isValidTraitSelectorForTraitSet(

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

2868

2869 if (!RequiresProperty ||

2870 Selector.Kind == TraitSelector::user_condition)

2871 continue;

2872

2874 OS << '$' << 'P'

2875 << getOpenMPContextTraitPropertyName(Property.Kind,

2877 }

2878 }

2879 return MangledName;

2880}

2881

2882OMPTraitInfo::OMPTraitInfo(StringRef MangledName) {

2883 unsigned long U;

2884 do {

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

2886 break;

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

2888 break;

2891 Set.Kind = TraitSet(U);

2892 do {

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

2894 break;

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

2896 break;

2899 Selector.Kind = TraitSelector(U);

2900 do {

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

2902 break;

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

2906 Property.RawString = PropRestPair.first;

2907 Property.Kind = getOpenMPContextTraitPropertyKind(

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

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

2910 } while (true);

2911 } while (true);

2912 } while (true);

2913}

2914

2919 TI.print(OS, Policy);

2920 return OS;

2921}

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

2925}

2926

2928 ASTContext &ASTCtx, std::function<void(StringRef)> &&DiagUnknownTrait,

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

2932 ASTCtx.getTargetInfo().getTriple()),

2933 FeatureValidityCheck([&](StringRef FeatureName) {

2935 }),

2936 DiagUnknownTrait(std::move(DiagUnknownTrait)) {

2938

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

2941}

2942

2944 auto It = FeatureMap.find(RawString);

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

2946 return It->second;

2947 if (!FeatureValidityCheck(RawString))

2948 DiagUnknownTrait(RawString);

2949 return false;

2950}

Defines the clang::ASTContext interface.

This file defines OpenMP nodes for declarative directives.

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.

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

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

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

Attr - This represents one attribute.

void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const

virtual Decl * getCanonicalDecl()

Retrieves the "canonical" declaration of the given declaration.

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.

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

void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) 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)

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

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.

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

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

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

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

Build 'align' clause with the given alignment.

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

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.

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

Creates an empty clause with the place for NumVars variables.

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.

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

Creates an empty clause with the place for N variables.

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

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

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

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

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').

static OMPBindClause * CreateEmpty(const ASTContext &C)

Build an empty 'bind' clause.

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

Class that represents a component of a mappable expression.

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

static unsigned getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists)

Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.

void setPostUpdateExpr(Expr *S)

Set pre-initialization statement for the clause.

static OMPClauseWithPostUpdate * get(OMPClause *C)

Class that handles pre-initialization statement for some clauses, like 'schedule',...

const Stmt * getPreInitStmt() const

Get pre-initialization statement for the clause.

static OMPClauseWithPreInit * get(OMPClause *C)

void setPreInitStmt(Stmt *S, OpenMPDirectiveKind ThisRegion=llvm::omp::OMPD_unknown)

Set pre-initialization statement for the clause.

This is a basic class for representing single OpenMP clause.

void setLocStart(SourceLocation Loc)

Sets the starting location of the clause.

child_range used_children()

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

llvm::iterator_range< child_iterator > child_range

void setLocEnd(SourceLocation Loc)

Sets the ending location of the clause.

OpenMPClauseKind getClauseKind() const

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

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

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)

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

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.

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

Creates an empty clause with N variables.

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.

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

Creates an empty clause with N variables.

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

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

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.

Expr * getModifier()

Return optional depend modifier.

Expr * getLoopData(unsigned NumLoop)

Get the loop data.

void setLoopData(unsigned NumLoop, Expr *Cnt)

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

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

Creates an empty clause with N variables.

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.

static OMPDepobjClause * CreateEmpty(const ASTContext &C)

Creates an empty clause.

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

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

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

void setDirectiveKinds(ArrayRef< OpenMPDirectiveKind > DK)

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

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

void setLoopData(unsigned NumLoop, Expr *Cnt)

Set the loop data.

Expr * getLoopData(unsigned NumLoop)

Get the loop data.

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.

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

Creates an empty clause with N expressions.

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.

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

Creates clause with a list of variables VL.

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

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

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

child_range used_children()

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.

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

Creates an empty clause with the place for N variables.

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.

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

Creates clause with a list of variables VL.

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

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

Creates an empty clause with the place for NumVars variables.

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

Creates clause with a list of variables Vars.

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.

static OMPFullClause * CreateEmpty(const ASTContext &C)

Build an empty 'full' AST node for deserialization.

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

child_range used_children()

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.

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

Creates an empty clause with the place for NumVars variables.

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

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

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

child_range used_children()

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.

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.

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.

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

Creates an empty clause with the place for N variables.

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

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

Creates a fully specified clause.

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

Creates an empty clause with N expressions.

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.

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

Creates an empty clause with the place for NumVars variables.

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.

void setPrivateCopies(ArrayRef< Expr * > PrivateCopies)

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

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.

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

child_range used_children()

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

Creates an empty clause with the place for NumVars variables.

void setUpdates(ArrayRef< Expr * > UL)

Sets the list of update expressions for linear variables.

void setFinals(ArrayRef< Expr * > FL)

Sets the list of final update expressions for linear variables.

void setUsedExprs(ArrayRef< Expr * > UE)

Sets the list of used expressions for the linear clause.

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.

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

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.

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

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

void setUDMapperRefs(ArrayRef< Expr * > DMDs)

Set the user-defined mappers that are in the trailing objects of the class.

void setClauseInfo(ArrayRef< ValueDecl * > Declarations, MappableExprComponentListsRef ComponentLists)

Fill the clause information from the list of declarations and associated component lists.

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

This represents 'message' clause in the '#pragma omp error' directive.

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

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.

child_range used_children()

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.

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

Creates clause with a list of variables VL.

void setPrivateRefs(ArrayRef< Expr * > VL)

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

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

child_range used_children()

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

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

child_range used_children()

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.

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

Creates an empty clause with N variables.

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

llvm::iterator_range< child_iterator > child_range

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

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

void setLoopCounter(unsigned NumLoop, Expr *Counter)

Set loop counter for the specified loop.

void setLoopNumIterations(unsigned NumLoop, Expr *NumIterations)

Set number of iterations for the specified loop.

ArrayRef< Expr * > getLoopNumIterations() const

Get number of iterations for all the loops.

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

Build 'ordered' clause.

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

Build an empty clause.

Expr * getLoopCounter(unsigned NumLoop)

Get loops counter for the specified loop.

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.

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

Build an AST node for a 'partial' clause.

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

void setLParenLoc(SourceLocation Loc)

Sets the location of '('.

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

Build an empty 'permutation' AST node for deserialization.

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

Build a 'permutation' clause AST node.

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

child_range used_children()

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.

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

Creates an empty clause with the place for N variables.

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

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

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

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

Creates an empty clause with the place for N variables.

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)

Creates clause with a list of variables VL.

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.

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

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

This represents 'severity' clause in the '#pragma omp error' directive.

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

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.

void setLParenLoc(SourceLocation Loc)

Sets the location of '('.

void setSizesRefs(ArrayRef< Expr * > VL)

Sets the tile size expressions.

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

Build an empty 'sizes' AST node for deserialization.

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

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.

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

Creates an empty clause with the place for N variables.

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.

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

Creates an empty clause with N variables.

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

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.

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

Creates clause with a list of variables Vars.

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.

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

Print a human readable representation into OS.

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

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

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.

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

Creates an empty clause with the place for N variables.

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

Creates clause for 'atomic' directive.

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

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.

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

Creates an empty clause with the place for NumVars variables.

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.

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

Creates an empty clause with the place for NumVars variables.

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

OMPUsesAllocatorsClause::Data getAllocatorData(unsigned I) const

Returns data for the specified allocator.

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

Creates an empty clause with the place for N allocators.

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

Creates clause with a list of allocators Data.

MutableArrayRef< Expr * > getVarRefs()

Fetches list of variables associated with this clause.

varlist_iterator varlist_end()

unsigned varlist_size() const

void setVarRefs(ArrayRef< Expr * > VL)

Sets the list of variables for this clause.

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.

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.

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

Encodes a location in the source.

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

virtual bool isValidFeatureName(StringRef Feature) const

Determine whether this TargetInfo supports the given feature.

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

The base class of the type hierarchy.

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.

OverloadedOperatorKind

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

@ OO_None

Not an overloaded operator.

llvm::omp::Directive OpenMPDirectiveKind

OpenMP directives.

@ OMPC_ORDER_MODIFIER_unknown

OpenMPReductionClauseModifier

OpenMP modifiers for 'reduction' clause.

@ OMPC_SCHEDULE_MODIFIER_unknown

const char * getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type)

OpenMPDoacrossClauseModifier

OpenMP dependence types for 'doacross' clause.

const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)

Insertion operator for diagnostics.

static constexpr unsigned NumberOfOMPMapClauseModifiers

Number of allowed map-type-modifiers.

@ Property

The type of a property.

OpenMPBindClauseKind

OpenMP bindings for the 'bind' clause.

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.

const FunctionProtoType * T

const char * getOperatorSpelling(OverloadedOperatorKind Operator)

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

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.

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

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.

bool matchesISATrait(StringRef RawString) const override

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

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