24#include "llvm/ADT/FoldingSet.h"
30 llvm::FoldingSetNodeID &ID;
32 bool ProfileLambdaExpr;
35 StmtProfiler(llvm::FoldingSetNodeID &ID,
bool Canonical,
36 bool ProfileLambdaExpr)
37 : ID(ID), Canonical(Canonical), ProfileLambdaExpr(ProfileLambdaExpr) {}
39 virtual ~StmtProfiler() {}
41 void VisitStmt(
const Stmt *S);
44 void VisitInteger(uint64_t
Value) { ID.AddInteger(
Value); }
46 void VisitStmtNoChildren(
const Stmt *S) {
52#define STMT(Node, Base) void Visit##Node(const Node *S);
53#include "clang/AST/StmtNodes.inc"
57 virtual void VisitDecl(
const Decl *D) = 0;
64 virtual void VisitName(
DeclarationName Name,
bool TreatAsDecl =
false) = 0;
86 class StmtProfilerWithPointers :
public StmtProfiler {
87 const ASTContext &Context;
90 StmtProfilerWithPointers(llvm::FoldingSetNodeID &ID,
91 const ASTContext &Context,
bool Canonical,
92 bool ProfileLambdaExpr)
93 : StmtProfiler(
ID, Canonical, ProfileLambdaExpr), Context(Context) {}
100 void VisitDecl(
const Decl *D)
override {
103 if (Canonical && D) {
104 if (
const NonTypeTemplateParmDecl *NTTP =
105 dyn_cast<NonTypeTemplateParmDecl>(D)) {
106 ID.AddInteger(NTTP->getDepth());
107 ID.AddInteger(NTTP->getIndex());
108 ID.AddBoolean(NTTP->isParameterPack());
117 VisitType(Context.getUnconstrainedType(NTTP->getType()));
121 if (
const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
132 VisitType(Parm->getType());
133 ID.AddInteger(Parm->getFunctionScopeDepth());
134 ID.AddInteger(Parm->getFunctionScopeIndex());
138 if (
const TemplateTypeParmDecl *TTP =
139 dyn_cast<TemplateTypeParmDecl>(D)) {
140 ID.AddInteger(TTP->getDepth());
141 ID.AddInteger(TTP->getIndex());
142 ID.AddBoolean(TTP->isParameterPack());
146 if (
const TemplateTemplateParmDecl *TTP =
147 dyn_cast<TemplateTemplateParmDecl>(D)) {
148 ID.AddInteger(TTP->getDepth());
149 ID.AddInteger(TTP->getIndex());
150 ID.AddBoolean(TTP->isParameterPack());
158 void VisitType(QualType
T)
override {
159 if (Canonical && !
T.isNull())
160 T = Context.getCanonicalType(
T);
162 ID.AddPointer(
T.getAsOpaquePtr());
165 void VisitName(DeclarationName Name,
bool )
override {
169 void VisitIdentifierInfo(
const IdentifierInfo *II)
override {
173 void VisitNestedNameSpecifier(NestedNameSpecifier NNS)
override {
181 Name = Context.getCanonicalTemplateName(Name);
187 class StmtProfilerWithoutPointers :
public StmtProfiler {
190 StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
196 if (SC == Stmt::UnresolvedLookupExprClass) {
199 ID.AddInteger(Stmt::DeclRefExprClass);
205 void VisitType(QualType
T)
override {
209 void VisitName(DeclarationName Name,
bool TreatAsDecl)
override {
215 Hash.AddDeclarationName(Name, TreatAsDecl);
217 void VisitIdentifierInfo(
const IdentifierInfo *II)
override {
220 Hash.AddIdentifierInfo(II);
223 void VisitDecl(
const Decl *D)
override {
230 Hash.AddTemplateName(Name);
232 void VisitNestedNameSpecifier(NestedNameSpecifier NNS)
override {
233 ID.AddBoolean(
bool(NNS));
235 Hash.AddNestedNameSpecifier(NNS);
240void StmtProfiler::VisitStmt(
const Stmt *S) {
241 assert(S &&
"Requires non-null Stmt pointer");
243 VisitStmtNoChildren(S);
245 for (
const Stmt *SubStmt : S->
children()) {
253void StmtProfiler::VisitDeclStmt(
const DeclStmt *S) {
255 for (
const auto *D : S->
decls())
259void StmtProfiler::VisitNullStmt(
const NullStmt *S) {
263void StmtProfiler::VisitCompoundStmt(
const CompoundStmt *S) {
267void StmtProfiler::VisitCaseStmt(
const CaseStmt *S) {
271void StmtProfiler::VisitDefaultStmt(
const DefaultStmt *S) {
275void StmtProfiler::VisitLabelStmt(
const LabelStmt *S) {
280void StmtProfiler::VisitAttributedStmt(
const AttributedStmt *S) {
285void StmtProfiler::VisitIfStmt(
const IfStmt *S) {
290void StmtProfiler::VisitSwitchStmt(
const SwitchStmt *S) {
295void StmtProfiler::VisitWhileStmt(
const WhileStmt *S) {
300void StmtProfiler::VisitDoStmt(
const DoStmt *S) {
304void StmtProfiler::VisitForStmt(
const ForStmt *S) {
308void StmtProfiler::VisitGotoStmt(
const GotoStmt *S) {
313void StmtProfiler::VisitIndirectGotoStmt(
const IndirectGotoStmt *S) {
317void StmtProfiler::VisitContinueStmt(
const ContinueStmt *S) {
321void StmtProfiler::VisitBreakStmt(
const BreakStmt *S) {
325void StmtProfiler::VisitReturnStmt(
const ReturnStmt *S) {
329void StmtProfiler::VisitDeferStmt(
const DeferStmt *S) { VisitStmt(S); }
331void StmtProfiler::VisitGCCAsmStmt(
const GCCAsmStmt *S) {
342 for (
unsigned I = 0, N = S->
getNumInputs(); I != N; ++I) {
350 for (
auto *L : S->
labels())
351 VisitDecl(L->getLabel());
354void StmtProfiler::VisitMSAsmStmt(
const MSAsmStmt *S) {
359void StmtProfiler::VisitCXXCatchStmt(
const CXXCatchStmt *S) {
364void StmtProfiler::VisitCXXTryStmt(
const CXXTryStmt *S) {
368void StmtProfiler::VisitCXXForRangeStmt(
const CXXForRangeStmt *S) {
372void StmtProfiler::VisitCXXExpansionStmtPattern(
373 const CXXExpansionStmtPattern *S) {
377void StmtProfiler::VisitCXXExpansionStmtInstantiation(
378 const CXXExpansionStmtInstantiation *S) {
383void StmtProfiler::VisitMSDependentExistsStmt(
const MSDependentExistsStmt *S) {
390void StmtProfiler::VisitSEHTryStmt(
const SEHTryStmt *S) {
394void StmtProfiler::VisitSEHFinallyStmt(
const SEHFinallyStmt *S) {
398void StmtProfiler::VisitSEHExceptStmt(
const SEHExceptStmt *S) {
402void StmtProfiler::VisitSEHLeaveStmt(
const SEHLeaveStmt *S) {
406void StmtProfiler::VisitCapturedStmt(
const CapturedStmt *S) {
410void StmtProfiler::VisitSYCLKernelCallStmt(
const SYCLKernelCallStmt *S) {
414void StmtProfiler::VisitObjCForCollectionStmt(
const ObjCForCollectionStmt *S) {
418void StmtProfiler::VisitObjCAtCatchStmt(
const ObjCAtCatchStmt *S) {
425void StmtProfiler::VisitObjCAtFinallyStmt(
const ObjCAtFinallyStmt *S) {
429void StmtProfiler::VisitObjCAtTryStmt(
const ObjCAtTryStmt *S) {
434StmtProfiler::VisitObjCAtSynchronizedStmt(
const ObjCAtSynchronizedStmt *S) {
438void StmtProfiler::VisitObjCAtThrowStmt(
const ObjCAtThrowStmt *S) {
443StmtProfiler::VisitObjCAutoreleasePoolStmt(
const ObjCAutoreleasePoolStmt *S) {
448class OMPClauseProfiler :
public ConstOMPClauseVisitor<OMPClauseProfiler> {
449 StmtProfiler *Profiler;
451 template <
typename T>
452 void VisitOMPClauseList(
T *Node);
455 OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
456#define GEN_CLANG_CLAUSE_CLASS
457#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C);
458#include "llvm/Frontend/OpenMP/OMP.inc"
463void OMPClauseProfiler::VisitOMPClauseWithPreInit(
464 const OMPClauseWithPreInit *
C) {
465 if (
auto *S =
C->getPreInitStmt())
466 Profiler->VisitStmt(S);
469void OMPClauseProfiler::VisitOMPClauseWithPostUpdate(
470 const OMPClauseWithPostUpdate *
C) {
471 VisitOMPClauseWithPreInit(
C);
472 if (
auto *E =
C->getPostUpdateExpr())
473 Profiler->VisitStmt(E);
476void OMPClauseProfiler::VisitOMPIfClause(
const OMPIfClause *
C) {
477 VisitOMPClauseWithPreInit(
C);
478 if (
C->getCondition())
479 Profiler->VisitStmt(
C->getCondition());
482void OMPClauseProfiler::VisitOMPFinalClause(
const OMPFinalClause *
C) {
483 VisitOMPClauseWithPreInit(
C);
484 if (
C->getCondition())
485 Profiler->VisitStmt(
C->getCondition());
488void OMPClauseProfiler::VisitOMPNumThreadsClause(
const OMPNumThreadsClause *
C) {
489 Profiler->VisitInteger(
C->getPrescriptivenessModifier());
490 Profiler->VisitInteger(
C->getDimsModifier());
491 if (
const Expr *Modifier =
C->getDimsModifierExpr())
492 Profiler->VisitStmt(Modifier);
493 VisitOMPClauseList(
C);
494 VisitOMPClauseWithPreInit(
C);
497void OMPClauseProfiler::VisitOMPAlignClause(
const OMPAlignClause *
C) {
498 if (
C->getAlignment())
499 Profiler->VisitStmt(
C->getAlignment());
502void OMPClauseProfiler::VisitOMPSafelenClause(
const OMPSafelenClause *
C) {
504 Profiler->VisitStmt(
C->getSafelen());
507void OMPClauseProfiler::VisitOMPSimdlenClause(
const OMPSimdlenClause *
C) {
509 Profiler->VisitStmt(
C->getSimdlen());
512void OMPClauseProfiler::VisitOMPSizesClause(
const OMPSizesClause *
C) {
513 for (
auto *E :
C->getSizesRefs())
515 Profiler->VisitExpr(E);
518void OMPClauseProfiler::VisitOMPCountsClause(
const OMPCountsClause *
C) {
519 for (
auto *E :
C->getCountsRefs())
521 Profiler->VisitExpr(E);
524void OMPClauseProfiler::VisitOMPPermutationClause(
525 const OMPPermutationClause *
C) {
526 for (Expr *E :
C->getArgsRefs())
528 Profiler->VisitExpr(E);
531void OMPClauseProfiler::VisitOMPFullClause(
const OMPFullClause *
C) {}
533void OMPClauseProfiler::VisitOMPPartialClause(
const OMPPartialClause *
C) {
534 if (
const Expr *Factor =
C->getFactor())
535 Profiler->VisitExpr(Factor);
538void OMPClauseProfiler::VisitOMPLoopRangeClause(
const OMPLoopRangeClause *
C) {
539 if (
const Expr *
First =
C->getFirst())
540 Profiler->VisitExpr(
First);
541 if (
const Expr *Count =
C->getCount())
542 Profiler->VisitExpr(Count);
545void OMPClauseProfiler::VisitOMPAllocatorClause(
const OMPAllocatorClause *
C) {
546 if (
C->getAllocator())
547 Profiler->VisitStmt(
C->getAllocator());
550void OMPClauseProfiler::VisitOMPCollapseClause(
const OMPCollapseClause *
C) {
551 if (
C->getNumForLoops())
552 Profiler->VisitStmt(
C->getNumForLoops());
555void OMPClauseProfiler::VisitOMPDetachClause(
const OMPDetachClause *
C) {
556 if (Expr *Evt =
C->getEventHandler())
557 Profiler->VisitStmt(Evt);
560void OMPClauseProfiler::VisitOMPNovariantsClause(
const OMPNovariantsClause *
C) {
561 VisitOMPClauseWithPreInit(
C);
562 if (
C->getCondition())
563 Profiler->VisitStmt(
C->getCondition());
566void OMPClauseProfiler::VisitOMPNocontextClause(
const OMPNocontextClause *
C) {
567 VisitOMPClauseWithPreInit(
C);
568 if (
C->getCondition())
569 Profiler->VisitStmt(
C->getCondition());
572void OMPClauseProfiler::VisitOMPDefaultClause(
const OMPDefaultClause *
C) { }
574void OMPClauseProfiler::VisitOMPThreadsetClause(
const OMPThreadsetClause *
C) {}
576void OMPClauseProfiler::VisitOMPTransparentClause(
577 const OMPTransparentClause *
C) {
578 if (
C->getImpexType())
579 Profiler->VisitStmt(
C->getImpexType());
582void OMPClauseProfiler::VisitOMPProcBindClause(
const OMPProcBindClause *
C) { }
584void OMPClauseProfiler::VisitOMPUnifiedAddressClause(
585 const OMPUnifiedAddressClause *
C) {}
587void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause(
588 const OMPUnifiedSharedMemoryClause *
C) {}
590void OMPClauseProfiler::VisitOMPReverseOffloadClause(
591 const OMPReverseOffloadClause *
C) {}
593void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
594 const OMPDynamicAllocatorsClause *
C) {}
596void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause(
597 const OMPAtomicDefaultMemOrderClause *
C) {}
599void OMPClauseProfiler::VisitOMPSelfMapsClause(
const OMPSelfMapsClause *
C) {}
601void OMPClauseProfiler::VisitOMPAtClause(
const OMPAtClause *
C) {}
603void OMPClauseProfiler::VisitOMPSeverityClause(
const OMPSeverityClause *
C) {}
605void OMPClauseProfiler::VisitOMPMessageClause(
const OMPMessageClause *
C) {
606 if (
C->getMessageString())
607 Profiler->VisitStmt(
C->getMessageString());
610void OMPClauseProfiler::VisitOMPScheduleClause(
const OMPScheduleClause *
C) {
611 VisitOMPClauseWithPreInit(
C);
612 if (
auto *S =
C->getChunkSize())
613 Profiler->VisitStmt(S);
616void OMPClauseProfiler::VisitOMPOrderedClause(
const OMPOrderedClause *
C) {
617 if (
auto *
Num =
C->getNumForLoops())
618 Profiler->VisitStmt(
Num);
621void OMPClauseProfiler::VisitOMPNowaitClause(
const OMPNowaitClause *
C) {
622 if (
C->getCondition())
623 Profiler->VisitStmt(
C->getCondition());
626void OMPClauseProfiler::VisitOMPUntiedClause(
const OMPUntiedClause *) {}
628void OMPClauseProfiler::VisitOMPMergeableClause(
const OMPMergeableClause *) {}
630void OMPClauseProfiler::VisitOMPReadClause(
const OMPReadClause *) {}
632void OMPClauseProfiler::VisitOMPWriteClause(
const OMPWriteClause *) {}
634void OMPClauseProfiler::VisitOMPUpdateClause(
const OMPUpdateClause *) {}
636void OMPClauseProfiler::VisitOMPUpdateDependObjectsClause(
637 const OMPUpdateDependObjectsClause *) {}
639void OMPClauseProfiler::VisitOMPCaptureClause(
const OMPCaptureClause *) {}
641void OMPClauseProfiler::VisitOMPCompareClause(
const OMPCompareClause *) {}
643void OMPClauseProfiler::VisitOMPFailClause(
const OMPFailClause *) {}
645void OMPClauseProfiler::VisitOMPAbsentClause(
const OMPAbsentClause *) {}
647void OMPClauseProfiler::VisitOMPHoldsClause(
const OMPHoldsClause *) {}
649void OMPClauseProfiler::VisitOMPContainsClause(
const OMPContainsClause *) {}
651void OMPClauseProfiler::VisitOMPNoOpenMPClause(
const OMPNoOpenMPClause *) {}
653void OMPClauseProfiler::VisitOMPNoOpenMPRoutinesClause(
654 const OMPNoOpenMPRoutinesClause *) {}
656void OMPClauseProfiler::VisitOMPNoOpenMPConstructsClause(
657 const OMPNoOpenMPConstructsClause *) {}
659void OMPClauseProfiler::VisitOMPNoParallelismClause(
660 const OMPNoParallelismClause *) {}
662void OMPClauseProfiler::VisitOMPSeqCstClause(
const OMPSeqCstClause *) {}
664void OMPClauseProfiler::VisitOMPAcqRelClause(
const OMPAcqRelClause *) {}
666void OMPClauseProfiler::VisitOMPAcquireClause(
const OMPAcquireClause *) {}
668void OMPClauseProfiler::VisitOMPReleaseClause(
const OMPReleaseClause *) {}
670void OMPClauseProfiler::VisitOMPRelaxedClause(
const OMPRelaxedClause *) {}
672void OMPClauseProfiler::VisitOMPWeakClause(
const OMPWeakClause *) {}
674void OMPClauseProfiler::VisitOMPThreadsClause(
const OMPThreadsClause *) {}
676void OMPClauseProfiler::VisitOMPSIMDClause(
const OMPSIMDClause *) {}
678void OMPClauseProfiler::VisitOMPNogroupClause(
const OMPNogroupClause *) {}
680void OMPClauseProfiler::VisitOMPInitClause(
const OMPInitClause *
C) {
682 Profiler->VisitStmt(
C->getInteropVar());
683 Profiler->VisitInteger(
C->hasPreferAttrs() ? 1 : 0);
684 Profiler->VisitInteger(
C->varlist_size() - 1);
685 for (OMPInitClause::PrefView P :
C->prefs()) {
686 Profiler->VisitInteger(P.Fr ? 1 : 0);
688 Profiler->VisitStmt(P.Fr);
689 Profiler->VisitInteger(P.Attrs.size());
690 for (
const Expr *A : P.Attrs)
691 Profiler->VisitStmt(A);
695void OMPClauseProfiler::VisitOMPUseClause(
const OMPUseClause *
C) {
696 if (
C->getInteropVar())
697 Profiler->VisitStmt(
C->getInteropVar());
700void OMPClauseProfiler::VisitOMPDestroyClause(
const OMPDestroyClause *
C) {
701 if (
C->getInteropVar())
702 Profiler->VisitStmt(
C->getInteropVar());
705void OMPClauseProfiler::VisitOMPFilterClause(
const OMPFilterClause *
C) {
706 VisitOMPClauseWithPreInit(
C);
707 if (
C->getThreadID())
708 Profiler->VisitStmt(
C->getThreadID());
712void OMPClauseProfiler::VisitOMPClauseList(
T *Node) {
713 for (
auto *E : Node->varlist()) {
715 Profiler->VisitStmt(E);
719void OMPClauseProfiler::VisitOMPPrivateClause(
const OMPPrivateClause *
C) {
720 VisitOMPClauseList(
C);
721 for (
auto *E :
C->private_copies()) {
723 Profiler->VisitStmt(E);
727OMPClauseProfiler::VisitOMPFirstprivateClause(
const OMPFirstprivateClause *
C) {
728 VisitOMPClauseList(
C);
729 VisitOMPClauseWithPreInit(
C);
730 for (
auto *E :
C->private_copies()) {
732 Profiler->VisitStmt(E);
734 for (
auto *E :
C->inits()) {
736 Profiler->VisitStmt(E);
740OMPClauseProfiler::VisitOMPLastprivateClause(
const OMPLastprivateClause *
C) {
741 VisitOMPClauseList(
C);
742 VisitOMPClauseWithPostUpdate(
C);
743 for (
auto *E :
C->source_exprs()) {
745 Profiler->VisitStmt(E);
747 for (
auto *E :
C->destination_exprs()) {
749 Profiler->VisitStmt(E);
751 for (
auto *E :
C->assignment_ops()) {
753 Profiler->VisitStmt(E);
756void OMPClauseProfiler::VisitOMPSharedClause(
const OMPSharedClause *
C) {
757 VisitOMPClauseList(
C);
759void OMPClauseProfiler::VisitOMPReductionClause(
760 const OMPReductionClause *
C) {
761 Profiler->VisitNestedNameSpecifier(
762 C->getQualifierLoc().getNestedNameSpecifier());
763 Profiler->VisitName(
C->getNameInfo().getName());
764 VisitOMPClauseList(
C);
765 VisitOMPClauseWithPostUpdate(
C);
766 for (
auto *E :
C->privates()) {
768 Profiler->VisitStmt(E);
770 for (
auto *E :
C->lhs_exprs()) {
772 Profiler->VisitStmt(E);
774 for (
auto *E :
C->rhs_exprs()) {
776 Profiler->VisitStmt(E);
778 for (
auto *E :
C->reduction_ops()) {
780 Profiler->VisitStmt(E);
782 if (
C->getModifier() == clang::OMPC_REDUCTION_inscan) {
783 for (
auto *E :
C->copy_ops()) {
785 Profiler->VisitStmt(E);
787 for (
auto *E :
C->copy_array_temps()) {
789 Profiler->VisitStmt(E);
791 for (
auto *E :
C->copy_array_elems()) {
793 Profiler->VisitStmt(E);
797void OMPClauseProfiler::VisitOMPTaskReductionClause(
798 const OMPTaskReductionClause *
C) {
799 Profiler->VisitNestedNameSpecifier(
800 C->getQualifierLoc().getNestedNameSpecifier());
801 Profiler->VisitName(
C->getNameInfo().getName());
802 VisitOMPClauseList(
C);
803 VisitOMPClauseWithPostUpdate(
C);
804 for (
auto *E :
C->privates()) {
806 Profiler->VisitStmt(E);
808 for (
auto *E :
C->lhs_exprs()) {
810 Profiler->VisitStmt(E);
812 for (
auto *E :
C->rhs_exprs()) {
814 Profiler->VisitStmt(E);
816 for (
auto *E :
C->reduction_ops()) {
818 Profiler->VisitStmt(E);
821void OMPClauseProfiler::VisitOMPInReductionClause(
822 const OMPInReductionClause *
C) {
823 Profiler->VisitNestedNameSpecifier(
824 C->getQualifierLoc().getNestedNameSpecifier());
825 Profiler->VisitName(
C->getNameInfo().getName());
826 VisitOMPClauseList(
C);
827 VisitOMPClauseWithPostUpdate(
C);
828 for (
auto *E :
C->privates()) {
830 Profiler->VisitStmt(E);
832 for (
auto *E :
C->lhs_exprs()) {
834 Profiler->VisitStmt(E);
836 for (
auto *E :
C->rhs_exprs()) {
838 Profiler->VisitStmt(E);
840 for (
auto *E :
C->reduction_ops()) {
842 Profiler->VisitStmt(E);
844 for (
auto *E :
C->taskgroup_descriptors()) {
846 Profiler->VisitStmt(E);
849void OMPClauseProfiler::VisitOMPLinearClause(
const OMPLinearClause *
C) {
850 VisitOMPClauseList(
C);
851 VisitOMPClauseWithPostUpdate(
C);
852 for (
auto *E :
C->privates()) {
854 Profiler->VisitStmt(E);
856 for (
auto *E :
C->inits()) {
858 Profiler->VisitStmt(E);
860 for (
auto *E :
C->updates()) {
862 Profiler->VisitStmt(E);
864 for (
auto *E :
C->finals()) {
866 Profiler->VisitStmt(E);
869 Profiler->VisitStmt(
C->getStep());
870 if (
C->getCalcStep())
871 Profiler->VisitStmt(
C->getCalcStep());
873void OMPClauseProfiler::VisitOMPAlignedClause(
const OMPAlignedClause *
C) {
874 VisitOMPClauseList(
C);
875 if (
C->getAlignment())
876 Profiler->VisitStmt(
C->getAlignment());
878void OMPClauseProfiler::VisitOMPCopyinClause(
const OMPCopyinClause *
C) {
879 VisitOMPClauseList(
C);
880 for (
auto *E :
C->source_exprs()) {
882 Profiler->VisitStmt(E);
884 for (
auto *E :
C->destination_exprs()) {
886 Profiler->VisitStmt(E);
888 for (
auto *E :
C->assignment_ops()) {
890 Profiler->VisitStmt(E);
894OMPClauseProfiler::VisitOMPCopyprivateClause(
const OMPCopyprivateClause *
C) {
895 VisitOMPClauseList(
C);
896 for (
auto *E :
C->source_exprs()) {
898 Profiler->VisitStmt(E);
900 for (
auto *E :
C->destination_exprs()) {
902 Profiler->VisitStmt(E);
904 for (
auto *E :
C->assignment_ops()) {
906 Profiler->VisitStmt(E);
909void OMPClauseProfiler::VisitOMPFlushClause(
const OMPFlushClause *
C) {
910 VisitOMPClauseList(
C);
912void OMPClauseProfiler::VisitOMPDepobjClause(
const OMPDepobjClause *
C) {
913 if (
const Expr *Depobj =
C->getDepobj())
914 Profiler->VisitStmt(Depobj);
916void OMPClauseProfiler::VisitOMPDependClause(
const OMPDependClause *
C) {
917 VisitOMPClauseList(
C);
919void OMPClauseProfiler::VisitOMPDeviceClause(
const OMPDeviceClause *
C) {
921 Profiler->VisitStmt(
C->getDevice());
923void OMPClauseProfiler::VisitOMPMapClause(
const OMPMapClause *
C) {
924 VisitOMPClauseList(
C);
926void OMPClauseProfiler::VisitOMPAllocateClause(
const OMPAllocateClause *
C) {
927 if (Expr *Allocator =
C->getAllocator())
928 Profiler->VisitStmt(Allocator);
929 VisitOMPClauseList(
C);
931void OMPClauseProfiler::VisitOMPNumTeamsClause(
const OMPNumTeamsClause *
C) {
932 Profiler->VisitInteger(
C->getModifier());
933 if (
const Expr *Modifier =
C->getModifierExpr())
934 Profiler->VisitStmt(Modifier);
935 VisitOMPClauseList(
C);
936 VisitOMPClauseWithPreInit(
C);
938void OMPClauseProfiler::VisitOMPThreadLimitClause(
939 const OMPThreadLimitClause *
C) {
940 Profiler->VisitInteger(
C->getModifier());
941 if (
const Expr *Modifier =
C->getModifierExpr())
942 Profiler->VisitStmt(Modifier);
943 VisitOMPClauseList(
C);
944 VisitOMPClauseWithPreInit(
C);
946void OMPClauseProfiler::VisitOMPPriorityClause(
const OMPPriorityClause *
C) {
947 VisitOMPClauseWithPreInit(
C);
948 if (
C->getPriority())
949 Profiler->VisitStmt(
C->getPriority());
951void OMPClauseProfiler::VisitOMPGrainsizeClause(
const OMPGrainsizeClause *
C) {
952 VisitOMPClauseWithPreInit(
C);
953 if (
C->getGrainsize())
954 Profiler->VisitStmt(
C->getGrainsize());
956void OMPClauseProfiler::VisitOMPNumTasksClause(
const OMPNumTasksClause *
C) {
957 VisitOMPClauseWithPreInit(
C);
958 if (
C->getNumTasks())
959 Profiler->VisitStmt(
C->getNumTasks());
961void OMPClauseProfiler::VisitOMPHintClause(
const OMPHintClause *
C) {
963 Profiler->VisitStmt(
C->getHint());
965void OMPClauseProfiler::VisitOMPToClause(
const OMPToClause *
C) {
966 VisitOMPClauseList(
C);
968void OMPClauseProfiler::VisitOMPFromClause(
const OMPFromClause *
C) {
969 VisitOMPClauseList(
C);
971void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
972 const OMPUseDevicePtrClause *
C) {
973 VisitOMPClauseList(
C);
975void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
976 const OMPUseDeviceAddrClause *
C) {
977 VisitOMPClauseList(
C);
979void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
980 const OMPIsDevicePtrClause *
C) {
981 VisitOMPClauseList(
C);
983void OMPClauseProfiler::VisitOMPHasDeviceAddrClause(
984 const OMPHasDeviceAddrClause *
C) {
985 VisitOMPClauseList(
C);
987void OMPClauseProfiler::VisitOMPNontemporalClause(
988 const OMPNontemporalClause *
C) {
989 VisitOMPClauseList(
C);
990 for (
auto *E :
C->private_refs())
991 Profiler->VisitStmt(E);
993void OMPClauseProfiler::VisitOMPInclusiveClause(
const OMPInclusiveClause *
C) {
994 VisitOMPClauseList(
C);
996void OMPClauseProfiler::VisitOMPExclusiveClause(
const OMPExclusiveClause *
C) {
997 VisitOMPClauseList(
C);
999void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
1000 const OMPUsesAllocatorsClause *
C) {
1001 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
1002 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
1008void OMPClauseProfiler::VisitOMPAffinityClause(
const OMPAffinityClause *
C) {
1009 if (
const Expr *Modifier =
C->getModifier())
1010 Profiler->VisitStmt(Modifier);
1011 for (
const Expr *E :
C->varlist())
1012 Profiler->VisitStmt(E);
1014void OMPClauseProfiler::VisitOMPOrderClause(
const OMPOrderClause *
C) {}
1015void OMPClauseProfiler::VisitOMPBindClause(
const OMPBindClause *
C) {}
1016void OMPClauseProfiler::VisitOMPXDynCGroupMemClause(
1017 const OMPXDynCGroupMemClause *
C) {
1018 VisitOMPClauseWithPreInit(
C);
1019 if (Expr *Size =
C->getSize())
1020 Profiler->VisitStmt(Size);
1022void OMPClauseProfiler::VisitOMPDynGroupprivateClause(
1023 const OMPDynGroupprivateClause *
C) {
1024 VisitOMPClauseWithPreInit(
C);
1025 if (
auto *Size =
C->getSize())
1026 Profiler->VisitStmt(Size);
1028void OMPClauseProfiler::VisitOMPDoacrossClause(
const OMPDoacrossClause *
C) {
1029 VisitOMPClauseList(
C);
1031void OMPClauseProfiler::VisitOMPXAttributeClause(
const OMPXAttributeClause *
C) {
1033void OMPClauseProfiler::VisitOMPXBareClause(
const OMPXBareClause *
C) {}
1037StmtProfiler::VisitOMPExecutableDirective(
const OMPExecutableDirective *S) {
1039 OMPClauseProfiler P(
this);
1040 ArrayRef<OMPClause *> Clauses = S->clauses();
1041 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
1047void StmtProfiler::VisitOMPCanonicalLoop(
const OMPCanonicalLoop *L) {
1051void StmtProfiler::VisitOMPLoopBasedDirective(
const OMPLoopBasedDirective *S) {
1052 VisitOMPExecutableDirective(S);
1055void StmtProfiler::VisitOMPLoopDirective(
const OMPLoopDirective *S) {
1056 VisitOMPLoopBasedDirective(S);
1059void StmtProfiler::VisitOMPMetaDirective(
const OMPMetaDirective *S) {
1060 VisitOMPExecutableDirective(S);
1063void StmtProfiler::VisitOMPParallelDirective(
const OMPParallelDirective *S) {
1064 VisitOMPExecutableDirective(S);
1067void StmtProfiler::VisitOMPSimdDirective(
const OMPSimdDirective *S) {
1068 VisitOMPLoopDirective(S);
1071void StmtProfiler::VisitOMPCanonicalLoopNestTransformationDirective(
1072 const OMPCanonicalLoopNestTransformationDirective *S) {
1073 VisitOMPLoopBasedDirective(S);
1076void StmtProfiler::VisitOMPTileDirective(
const OMPTileDirective *S) {
1077 VisitOMPCanonicalLoopNestTransformationDirective(S);
1080void StmtProfiler::VisitOMPStripeDirective(
const OMPStripeDirective *S) {
1081 VisitOMPCanonicalLoopNestTransformationDirective(S);
1084void StmtProfiler::VisitOMPUnrollDirective(
const OMPUnrollDirective *S) {
1085 VisitOMPCanonicalLoopNestTransformationDirective(S);
1088void StmtProfiler::VisitOMPReverseDirective(
const OMPReverseDirective *S) {
1089 VisitOMPCanonicalLoopNestTransformationDirective(S);
1092void StmtProfiler::VisitOMPInterchangeDirective(
1093 const OMPInterchangeDirective *S) {
1094 VisitOMPCanonicalLoopNestTransformationDirective(S);
1097void StmtProfiler::VisitOMPSplitDirective(
const OMPSplitDirective *S) {
1098 VisitOMPCanonicalLoopNestTransformationDirective(S);
1101void StmtProfiler::VisitOMPCanonicalLoopSequenceTransformationDirective(
1102 const OMPCanonicalLoopSequenceTransformationDirective *S) {
1103 VisitOMPExecutableDirective(S);
1106void StmtProfiler::VisitOMPFuseDirective(
const OMPFuseDirective *S) {
1107 VisitOMPCanonicalLoopSequenceTransformationDirective(S);
1110void StmtProfiler::VisitOMPForDirective(
const OMPForDirective *S) {
1111 VisitOMPLoopDirective(S);
1114void StmtProfiler::VisitOMPForSimdDirective(
const OMPForSimdDirective *S) {
1115 VisitOMPLoopDirective(S);
1118void StmtProfiler::VisitOMPSectionsDirective(
const OMPSectionsDirective *S) {
1119 VisitOMPExecutableDirective(S);
1122void StmtProfiler::VisitOMPSectionDirective(
const OMPSectionDirective *S) {
1123 VisitOMPExecutableDirective(S);
1126void StmtProfiler::VisitOMPScopeDirective(
const OMPScopeDirective *S) {
1127 VisitOMPExecutableDirective(S);
1130void StmtProfiler::VisitOMPSingleDirective(
const OMPSingleDirective *S) {
1131 VisitOMPExecutableDirective(S);
1134void StmtProfiler::VisitOMPMasterDirective(
const OMPMasterDirective *S) {
1135 VisitOMPExecutableDirective(S);
1138void StmtProfiler::VisitOMPCriticalDirective(
const OMPCriticalDirective *S) {
1139 VisitOMPExecutableDirective(S);
1144StmtProfiler::VisitOMPParallelForDirective(
const OMPParallelForDirective *S) {
1145 VisitOMPLoopDirective(S);
1148void StmtProfiler::VisitOMPParallelForSimdDirective(
1149 const OMPParallelForSimdDirective *S) {
1150 VisitOMPLoopDirective(S);
1153void StmtProfiler::VisitOMPParallelMasterDirective(
1154 const OMPParallelMasterDirective *S) {
1155 VisitOMPExecutableDirective(S);
1158void StmtProfiler::VisitOMPParallelMaskedDirective(
1159 const OMPParallelMaskedDirective *S) {
1160 VisitOMPExecutableDirective(S);
1163void StmtProfiler::VisitOMPParallelSectionsDirective(
1164 const OMPParallelSectionsDirective *S) {
1165 VisitOMPExecutableDirective(S);
1168void StmtProfiler::VisitOMPTaskDirective(
const OMPTaskDirective *S) {
1169 VisitOMPExecutableDirective(S);
1172void StmtProfiler::VisitOMPTaskyieldDirective(
const OMPTaskyieldDirective *S) {
1173 VisitOMPExecutableDirective(S);
1176void StmtProfiler::VisitOMPBarrierDirective(
const OMPBarrierDirective *S) {
1177 VisitOMPExecutableDirective(S);
1180void StmtProfiler::VisitOMPTaskwaitDirective(
const OMPTaskwaitDirective *S) {
1181 VisitOMPExecutableDirective(S);
1184void StmtProfiler::VisitOMPAssumeDirective(
const OMPAssumeDirective *S) {
1185 VisitOMPExecutableDirective(S);
1188void StmtProfiler::VisitOMPErrorDirective(
const OMPErrorDirective *S) {
1189 VisitOMPExecutableDirective(S);
1191void StmtProfiler::VisitOMPTaskgroupDirective(
const OMPTaskgroupDirective *S) {
1192 VisitOMPExecutableDirective(S);
1197void StmtProfiler::VisitOMPFlushDirective(
const OMPFlushDirective *S) {
1198 VisitOMPExecutableDirective(S);
1201void StmtProfiler::VisitOMPDepobjDirective(
const OMPDepobjDirective *S) {
1202 VisitOMPExecutableDirective(S);
1205void StmtProfiler::VisitOMPScanDirective(
const OMPScanDirective *S) {
1206 VisitOMPExecutableDirective(S);
1209void StmtProfiler::VisitOMPOrderedStandaloneDirective(
1210 const OMPOrderedStandaloneDirective *S) {
1211 VisitOMPExecutableDirective(S);
1214void StmtProfiler::VisitOMPOrderedBlockAssocDirective(
1215 const OMPOrderedBlockAssocDirective *S) {
1216 VisitOMPExecutableDirective(S);
1219void StmtProfiler::VisitOMPAtomicDirective(
const OMPAtomicDirective *S) {
1220 VisitOMPExecutableDirective(S);
1223void StmtProfiler::VisitOMPTargetDirective(
const OMPTargetDirective *S) {
1224 VisitOMPExecutableDirective(S);
1227void StmtProfiler::VisitOMPTargetDataDirective(
const OMPTargetDataDirective *S) {
1228 VisitOMPExecutableDirective(S);
1231void StmtProfiler::VisitOMPTargetEnterDataDirective(
1232 const OMPTargetEnterDataDirective *S) {
1233 VisitOMPExecutableDirective(S);
1236void StmtProfiler::VisitOMPTargetExitDataDirective(
1237 const OMPTargetExitDataDirective *S) {
1238 VisitOMPExecutableDirective(S);
1241void StmtProfiler::VisitOMPTargetParallelDirective(
1242 const OMPTargetParallelDirective *S) {
1243 VisitOMPExecutableDirective(S);
1246void StmtProfiler::VisitOMPTargetParallelForDirective(
1247 const OMPTargetParallelForDirective *S) {
1248 VisitOMPExecutableDirective(S);
1251void StmtProfiler::VisitOMPTeamsDirective(
const OMPTeamsDirective *S) {
1252 VisitOMPExecutableDirective(S);
1255void StmtProfiler::VisitOMPCancellationPointDirective(
1256 const OMPCancellationPointDirective *S) {
1257 VisitOMPExecutableDirective(S);
1260void StmtProfiler::VisitOMPCancelDirective(
const OMPCancelDirective *S) {
1261 VisitOMPExecutableDirective(S);
1264void StmtProfiler::VisitOMPTaskLoopDirective(
const OMPTaskLoopDirective *S) {
1265 VisitOMPLoopDirective(S);
1268void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1269 const OMPTaskLoopSimdDirective *S) {
1270 VisitOMPLoopDirective(S);
1273void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1274 const OMPMasterTaskLoopDirective *S) {
1275 VisitOMPLoopDirective(S);
1278void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1279 const OMPMaskedTaskLoopDirective *S) {
1280 VisitOMPLoopDirective(S);
1283void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1284 const OMPMasterTaskLoopSimdDirective *S) {
1285 VisitOMPLoopDirective(S);
1288void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1289 const OMPMaskedTaskLoopSimdDirective *S) {
1290 VisitOMPLoopDirective(S);
1293void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1294 const OMPParallelMasterTaskLoopDirective *S) {
1295 VisitOMPLoopDirective(S);
1298void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1299 const OMPParallelMaskedTaskLoopDirective *S) {
1300 VisitOMPLoopDirective(S);
1303void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1304 const OMPParallelMasterTaskLoopSimdDirective *S) {
1305 VisitOMPLoopDirective(S);
1308void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1309 const OMPParallelMaskedTaskLoopSimdDirective *S) {
1310 VisitOMPLoopDirective(S);
1313void StmtProfiler::VisitOMPDistributeDirective(
1314 const OMPDistributeDirective *S) {
1315 VisitOMPLoopDirective(S);
1318void OMPClauseProfiler::VisitOMPDistScheduleClause(
1319 const OMPDistScheduleClause *
C) {
1320 VisitOMPClauseWithPreInit(
C);
1321 if (
auto *S =
C->getChunkSize())
1322 Profiler->VisitStmt(S);
1325void OMPClauseProfiler::VisitOMPDefaultmapClause(
const OMPDefaultmapClause *) {}
1327void StmtProfiler::VisitOMPTargetUpdateDirective(
1328 const OMPTargetUpdateDirective *S) {
1329 VisitOMPExecutableDirective(S);
1332void StmtProfiler::VisitOMPDistributeParallelForDirective(
1333 const OMPDistributeParallelForDirective *S) {
1334 VisitOMPLoopDirective(S);
1337void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1338 const OMPDistributeParallelForSimdDirective *S) {
1339 VisitOMPLoopDirective(S);
1342void StmtProfiler::VisitOMPDistributeSimdDirective(
1343 const OMPDistributeSimdDirective *S) {
1344 VisitOMPLoopDirective(S);
1347void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1348 const OMPTargetParallelForSimdDirective *S) {
1349 VisitOMPLoopDirective(S);
1352void StmtProfiler::VisitOMPTargetSimdDirective(
1353 const OMPTargetSimdDirective *S) {
1354 VisitOMPLoopDirective(S);
1357void StmtProfiler::VisitOMPTeamsDistributeDirective(
1358 const OMPTeamsDistributeDirective *S) {
1359 VisitOMPLoopDirective(S);
1362void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1363 const OMPTeamsDistributeSimdDirective *S) {
1364 VisitOMPLoopDirective(S);
1367void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1368 const OMPTeamsDistributeParallelForSimdDirective *S) {
1369 VisitOMPLoopDirective(S);
1372void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1373 const OMPTeamsDistributeParallelForDirective *S) {
1374 VisitOMPLoopDirective(S);
1377void StmtProfiler::VisitOMPTargetTeamsDirective(
1378 const OMPTargetTeamsDirective *S) {
1379 VisitOMPExecutableDirective(S);
1382void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1383 const OMPTargetTeamsDistributeDirective *S) {
1384 VisitOMPLoopDirective(S);
1387void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1388 const OMPTargetTeamsDistributeParallelForDirective *S) {
1389 VisitOMPLoopDirective(S);
1392void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1393 const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
1394 VisitOMPLoopDirective(S);
1397void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1398 const OMPTargetTeamsDistributeSimdDirective *S) {
1399 VisitOMPLoopDirective(S);
1402void StmtProfiler::VisitOMPInteropDirective(
const OMPInteropDirective *S) {
1403 VisitOMPExecutableDirective(S);
1406void StmtProfiler::VisitOMPDispatchDirective(
const OMPDispatchDirective *S) {
1407 VisitOMPExecutableDirective(S);
1410void StmtProfiler::VisitOMPMaskedDirective(
const OMPMaskedDirective *S) {
1411 VisitOMPExecutableDirective(S);
1414void StmtProfiler::VisitOMPGenericLoopDirective(
1415 const OMPGenericLoopDirective *S) {
1416 VisitOMPLoopDirective(S);
1419void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1420 const OMPTeamsGenericLoopDirective *S) {
1421 VisitOMPLoopDirective(S);
1424void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1425 const OMPTargetTeamsGenericLoopDirective *S) {
1426 VisitOMPLoopDirective(S);
1429void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1430 const OMPParallelGenericLoopDirective *S) {
1431 VisitOMPLoopDirective(S);
1434void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1435 const OMPTargetParallelGenericLoopDirective *S) {
1436 VisitOMPLoopDirective(S);
1439void StmtProfiler::VisitExpr(
const Expr *S) {
1443void StmtProfiler::VisitConstantExpr(
const ConstantExpr *S) {
1448void StmtProfiler::VisitDeclRefExpr(
const DeclRefExpr *S) {
1460void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1461 const SYCLUniqueStableNameExpr *S) {
1466void StmtProfiler::VisitUnresolvedSYCLKernelCallStmt(
1467 const UnresolvedSYCLKernelCallStmt *S) {
1471void StmtProfiler::VisitPredefinedExpr(
const PredefinedExpr *S) {
1476void StmtProfiler::VisitOpenACCAsteriskSizeExpr(
1477 const OpenACCAsteriskSizeExpr *S) {
1481void StmtProfiler::VisitIntegerLiteral(
const IntegerLiteral *S) {
1487 T =
T.getCanonicalType();
1489 if (
auto BitIntT =
T->
getAs<BitIntType>())
1490 BitIntT->Profile(ID);
1492 ID.AddInteger(
T->
castAs<BuiltinType>()->getKind());
1495void StmtProfiler::VisitFixedPointLiteral(
const FixedPointLiteral *S) {
1501void StmtProfiler::VisitCharacterLiteral(
const CharacterLiteral *S) {
1503 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1507void StmtProfiler::VisitFloatingLiteral(
const FloatingLiteral *S) {
1514void StmtProfiler::VisitImaginaryLiteral(
const ImaginaryLiteral *S) {
1518void StmtProfiler::VisitStringLiteral(
const StringLiteral *S) {
1521 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1524void StmtProfiler::VisitParenExpr(
const ParenExpr *S) {
1528void StmtProfiler::VisitParenListExpr(
const ParenListExpr *S) {
1532void StmtProfiler::VisitUnaryOperator(
const UnaryOperator *S) {
1537void StmtProfiler::VisitOffsetOfExpr(
const OffsetOfExpr *S) {
1540 for (
unsigned i = 0; i < n; ++i) {
1566StmtProfiler::VisitUnaryExprOrTypeTraitExpr(
const UnaryExprOrTypeTraitExpr *S) {
1573void StmtProfiler::VisitArraySubscriptExpr(
const ArraySubscriptExpr *S) {
1577void StmtProfiler::VisitMatrixSingleSubscriptExpr(
1578 const MatrixSingleSubscriptExpr *S) {
1582void StmtProfiler::VisitMatrixSubscriptExpr(
const MatrixSubscriptExpr *S) {
1586void StmtProfiler::VisitArraySectionExpr(
const ArraySectionExpr *S) {
1590void StmtProfiler::VisitOMPArrayShapingExpr(
const OMPArrayShapingExpr *S) {
1594void StmtProfiler::VisitOMPIteratorExpr(
const OMPIteratorExpr *S) {
1600void StmtProfiler::VisitCallExpr(
const CallExpr *S) {
1604void StmtProfiler::VisitMemberExpr(
const MemberExpr *S) {
1612void StmtProfiler::VisitCompoundLiteralExpr(
const CompoundLiteralExpr *S) {
1617void StmtProfiler::VisitCastExpr(
const CastExpr *S) {
1621void StmtProfiler::VisitImplicitCastExpr(
const ImplicitCastExpr *S) {
1626void StmtProfiler::VisitExplicitCastExpr(
const ExplicitCastExpr *S) {
1631void StmtProfiler::VisitCStyleCastExpr(
const CStyleCastExpr *S) {
1632 VisitExplicitCastExpr(S);
1635void StmtProfiler::VisitBinaryOperator(
const BinaryOperator *S) {
1641StmtProfiler::VisitCompoundAssignOperator(
const CompoundAssignOperator *S) {
1642 VisitBinaryOperator(S);
1645void StmtProfiler::VisitConditionalOperator(
const ConditionalOperator *S) {
1649void StmtProfiler::VisitBinaryConditionalOperator(
1650 const BinaryConditionalOperator *S) {
1654void StmtProfiler::VisitAddrLabelExpr(
const AddrLabelExpr *S) {
1659void StmtProfiler::VisitStmtExpr(
const StmtExpr *S) {
1663void StmtProfiler::VisitShuffleVectorExpr(
const ShuffleVectorExpr *S) {
1667void StmtProfiler::VisitConvertVectorExpr(
const ConvertVectorExpr *S) {
1671void StmtProfiler::VisitChooseExpr(
const ChooseExpr *S) {
1675void StmtProfiler::VisitGNUNullExpr(
const GNUNullExpr *S) {
1679void StmtProfiler::VisitVAArgExpr(
const VAArgExpr *S) {
1683void StmtProfiler::VisitInitListExpr(
const InitListExpr *S) {
1692void StmtProfiler::VisitDesignatedInitExpr(
const DesignatedInitExpr *S) {
1695 for (
const DesignatedInitExpr::Designator &D : S->
designators()) {
1696 if (D.isFieldDesignator()) {
1698 VisitName(D.getFieldName());
1702 if (D.isArrayDesignator()) {
1705 assert(D.isArrayRangeDesignator());
1708 ID.AddInteger(D.getArrayIndex());
1714void StmtProfiler::VisitDesignatedInitUpdateExpr(
1715 const DesignatedInitUpdateExpr *S) {
1716 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
1720void StmtProfiler::VisitArrayInitLoopExpr(
const ArrayInitLoopExpr *S) {
1724void StmtProfiler::VisitArrayInitIndexExpr(
const ArrayInitIndexExpr *S) {
1728void StmtProfiler::VisitNoInitExpr(
const NoInitExpr *S) {
1729 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
1732void StmtProfiler::VisitImplicitValueInitExpr(
const ImplicitValueInitExpr *S) {
1736void StmtProfiler::VisitExtVectorElementExpr(
const ExtVectorElementExpr *S) {
1741void StmtProfiler::VisitMatrixElementExpr(
const MatrixElementExpr *S) {
1746void StmtProfiler::VisitBlockExpr(
const BlockExpr *S) {
1751void StmtProfiler::VisitGenericSelectionExpr(
const GenericSelectionExpr *S) {
1755 QualType
T = Assoc.getType();
1757 ID.AddPointer(
nullptr);
1760 VisitExpr(Assoc.getAssociationExpr());
1764void StmtProfiler::VisitPseudoObjectExpr(
const PseudoObjectExpr *S) {
1769 if (
const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1770 Visit(OVE->getSourceExpr());
1773void StmtProfiler::VisitAtomicExpr(
const AtomicExpr *S) {
1778void StmtProfiler::VisitConceptSpecializationExpr(
1779 const ConceptSpecializationExpr *S) {
1783 VisitTemplateArgument(Arg);
1786void StmtProfiler::VisitRequiresExpr(
const RequiresExpr *S) {
1790 VisitDecl(LocalParam);
1793 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1795 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1796 if (!TypeReq->isSubstitutionFailure())
1797 VisitType(TypeReq->getType()->getType());
1798 }
else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1800 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1801 if (!ExprReq->isExprSubstitutionFailure())
1802 Visit(ExprReq->getExpr());
1807 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1808 const concepts::ExprRequirement::ReturnTypeRequirement &RetReq =
1809 ExprReq->getReturnTypeRequirement();
1822 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1823 if (!NestedReq->hasInvalidConstraint())
1824 Visit(NestedReq->getConstraintExpr());
1832 unsigned &NumArgs) {
1838 case OO_Array_Delete:
1840 case OO_Conditional:
1842 llvm_unreachable(
"Invalid operator call kind");
1847 return Stmt::UnaryOperatorClass;
1851 return Stmt::BinaryOperatorClass;
1856 return Stmt::UnaryOperatorClass;
1860 return Stmt::BinaryOperatorClass;
1865 return Stmt::UnaryOperatorClass;
1869 return Stmt::BinaryOperatorClass;
1873 return Stmt::BinaryOperatorClass;
1877 return Stmt::BinaryOperatorClass;
1881 return Stmt::BinaryOperatorClass;
1885 UnaryOp = UO_AddrOf;
1886 return Stmt::UnaryOperatorClass;
1890 return Stmt::BinaryOperatorClass;
1894 return Stmt::BinaryOperatorClass;
1898 return Stmt::UnaryOperatorClass;
1902 return Stmt::UnaryOperatorClass;
1905 BinaryOp = BO_Assign;
1906 return Stmt::BinaryOperatorClass;
1910 return Stmt::BinaryOperatorClass;
1914 return Stmt::BinaryOperatorClass;
1917 BinaryOp = BO_AddAssign;
1918 return Stmt::CompoundAssignOperatorClass;
1921 BinaryOp = BO_SubAssign;
1922 return Stmt::CompoundAssignOperatorClass;
1925 BinaryOp = BO_MulAssign;
1926 return Stmt::CompoundAssignOperatorClass;
1929 BinaryOp = BO_DivAssign;
1930 return Stmt::CompoundAssignOperatorClass;
1932 case OO_PercentEqual:
1933 BinaryOp = BO_RemAssign;
1934 return Stmt::CompoundAssignOperatorClass;
1937 BinaryOp = BO_XorAssign;
1938 return Stmt::CompoundAssignOperatorClass;
1941 BinaryOp = BO_AndAssign;
1942 return Stmt::CompoundAssignOperatorClass;
1945 BinaryOp = BO_OrAssign;
1946 return Stmt::CompoundAssignOperatorClass;
1950 return Stmt::BinaryOperatorClass;
1952 case OO_GreaterGreater:
1954 return Stmt::BinaryOperatorClass;
1956 case OO_LessLessEqual:
1957 BinaryOp = BO_ShlAssign;
1958 return Stmt::CompoundAssignOperatorClass;
1960 case OO_GreaterGreaterEqual:
1961 BinaryOp = BO_ShrAssign;
1962 return Stmt::CompoundAssignOperatorClass;
1966 return Stmt::BinaryOperatorClass;
1968 case OO_ExclaimEqual:
1970 return Stmt::BinaryOperatorClass;
1974 return Stmt::BinaryOperatorClass;
1976 case OO_GreaterEqual:
1978 return Stmt::BinaryOperatorClass;
1982 return Stmt::BinaryOperatorClass;
1986 return Stmt::BinaryOperatorClass;
1990 return Stmt::BinaryOperatorClass;
1993 UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc;
1995 return Stmt::UnaryOperatorClass;
1998 UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec;
2000 return Stmt::UnaryOperatorClass;
2003 BinaryOp = BO_Comma;
2004 return Stmt::BinaryOperatorClass;
2007 BinaryOp = BO_PtrMemI;
2008 return Stmt::BinaryOperatorClass;
2011 return Stmt::ArraySubscriptExprClass;
2014 return Stmt::CallExprClass;
2017 UnaryOp = UO_Coawait;
2018 return Stmt::UnaryOperatorClass;
2021 llvm_unreachable(
"Invalid overloaded operator expression");
2024#if defined(_MSC_VER) && !defined(__clang__)
2029#pragma optimize("", off)
2033void StmtProfiler::VisitCXXOperatorCallExpr(
const CXXOperatorCallExpr *S) {
2041 return Visit(S->
getArg(0));
2049 for (
unsigned I = 0; I != NumArgs; ++I)
2051 if (SC == Stmt::UnaryOperatorClass)
2052 ID.AddInteger(UnaryOp);
2053 else if (SC == Stmt::BinaryOperatorClass ||
2054 SC == Stmt::CompoundAssignOperatorClass)
2055 ID.AddInteger(BinaryOp);
2057 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
2066void StmtProfiler::VisitCXXRewrittenBinaryOperator(
2067 const CXXRewrittenBinaryOperator *S) {
2071 "resolved rewritten operator should never be type-dependent");
2076#if defined(_MSC_VER) && !defined(__clang__)
2078#pragma optimize("", on)
2082void StmtProfiler::VisitCXXMemberCallExpr(
const CXXMemberCallExpr *S) {
2086void StmtProfiler::VisitCUDAKernelCallExpr(
const CUDAKernelCallExpr *S) {
2090void StmtProfiler::VisitAsTypeExpr(
const AsTypeExpr *S) {
2094void StmtProfiler::VisitCXXNamedCastExpr(
const CXXNamedCastExpr *S) {
2095 VisitExplicitCastExpr(S);
2098void StmtProfiler::VisitCXXStaticCastExpr(
const CXXStaticCastExpr *S) {
2099 VisitCXXNamedCastExpr(S);
2102void StmtProfiler::VisitCXXDynamicCastExpr(
const CXXDynamicCastExpr *S) {
2103 VisitCXXNamedCastExpr(S);
2107StmtProfiler::VisitCXXReinterpretCastExpr(
const CXXReinterpretCastExpr *S) {
2108 VisitCXXNamedCastExpr(S);
2111void StmtProfiler::VisitCXXConstCastExpr(
const CXXConstCastExpr *S) {
2112 VisitCXXNamedCastExpr(S);
2115void StmtProfiler::VisitBuiltinBitCastExpr(
const BuiltinBitCastExpr *S) {
2120void StmtProfiler::VisitCXXAddrspaceCastExpr(
const CXXAddrspaceCastExpr *S) {
2121 VisitCXXNamedCastExpr(S);
2124void StmtProfiler::VisitUserDefinedLiteral(
const UserDefinedLiteral *S) {
2128void StmtProfiler::VisitCXXBoolLiteralExpr(
const CXXBoolLiteralExpr *S) {
2133void StmtProfiler::VisitCXXNullPtrLiteralExpr(
const CXXNullPtrLiteralExpr *S) {
2137void StmtProfiler::VisitCXXStdInitializerListExpr(
2138 const CXXStdInitializerListExpr *S) {
2142void StmtProfiler::VisitCXXTypeidExpr(
const CXXTypeidExpr *S) {
2148void StmtProfiler::VisitCXXUuidofExpr(
const CXXUuidofExpr *S) {
2154void StmtProfiler::VisitMSPropertyRefExpr(
const MSPropertyRefExpr *S) {
2159void StmtProfiler::VisitMSPropertySubscriptExpr(
2160 const MSPropertySubscriptExpr *S) {
2164void StmtProfiler::VisitCXXThisExpr(
const CXXThisExpr *S) {
2170void StmtProfiler::VisitCXXThrowExpr(
const CXXThrowExpr *S) {
2174void StmtProfiler::VisitCXXDefaultArgExpr(
const CXXDefaultArgExpr *S) {
2179void StmtProfiler::VisitCXXDefaultInitExpr(
const CXXDefaultInitExpr *S) {
2184void StmtProfiler::VisitCXXBindTemporaryExpr(
const CXXBindTemporaryExpr *S) {
2190void StmtProfiler::VisitCXXConstructExpr(
const CXXConstructExpr *S) {
2196void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2197 const CXXInheritedCtorInitExpr *S) {
2202void StmtProfiler::VisitCXXFunctionalCastExpr(
const CXXFunctionalCastExpr *S) {
2203 VisitExplicitCastExpr(S);
2207StmtProfiler::VisitCXXTemporaryObjectExpr(
const CXXTemporaryObjectExpr *S) {
2208 VisitCXXConstructExpr(S);
2212StmtProfiler::VisitLambdaExpr(
const LambdaExpr *S) {
2213 if (!ProfileLambdaExpr) {
2217 VisitStmtNoChildren(S);
2228 ID.AddInteger(
Capture.getCaptureKind());
2229 if (
Capture.capturesVariable())
2230 VisitDecl(
Capture.getCapturedVar());
2239 for (
auto *SubDecl : Lambda->
decls()) {
2240 FunctionDecl *
Call =
nullptr;
2241 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(SubDecl))
2242 Call = FTD->getTemplatedDecl();
2243 else if (
auto *FD = dyn_cast<FunctionDecl>(SubDecl))
2250 if (!
Call ||
Call->getOverloadedOperator() != OO_Call)
2258void StmtProfiler::VisitCXXReflectExpr(
const CXXReflectExpr *E) {
2260 assert(
false &&
"not implemented yet");
2264StmtProfiler::VisitCXXScalarValueInitExpr(
const CXXScalarValueInitExpr *S) {
2268void StmtProfiler::VisitCXXDeleteExpr(
const CXXDeleteExpr *S) {
2275void StmtProfiler::VisitCXXNewExpr(
const CXXNewExpr *S) {
2288StmtProfiler::VisitCXXPseudoDestructorExpr(
const CXXPseudoDestructorExpr *S) {
2302void StmtProfiler::VisitOverloadExpr(
const OverloadExpr *S) {
2304 bool DescribingDependentVarTemplate =
2306 if (DescribingDependentVarTemplate) {
2310 VisitName(S->
getName(),
true);
2318StmtProfiler::VisitUnresolvedLookupExpr(
const UnresolvedLookupExpr *S) {
2319 VisitOverloadExpr(S);
2322void StmtProfiler::VisitTypeTraitExpr(
const TypeTraitExpr *S) {
2326 for (
unsigned I = 0, N = S->
getNumArgs(); I != N; ++I)
2330void StmtProfiler::VisitArrayTypeTraitExpr(
const ArrayTypeTraitExpr *S) {
2336void StmtProfiler::VisitExpressionTraitExpr(
const ExpressionTraitExpr *S) {
2342void StmtProfiler::VisitDependentScopeDeclRefExpr(
2343 const DependentScopeDeclRefExpr *S) {
2352void StmtProfiler::VisitExprWithCleanups(
const ExprWithCleanups *S) {
2356void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2357 const CXXUnresolvedConstructExpr *S) {
2363void StmtProfiler::VisitDependentTemplateIdExpr(
2364 const DependentTemplateIdExpr *S) {
2371void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2372 const CXXDependentScopeMemberExpr *S) {
2385void StmtProfiler::VisitUnresolvedMemberExpr(
const UnresolvedMemberExpr *S) {
2398void StmtProfiler::VisitCXXNoexceptExpr(
const CXXNoexceptExpr *S) {
2402void StmtProfiler::VisitPackExpansionExpr(
const PackExpansionExpr *S) {
2406void StmtProfiler::VisitSizeOfPackExpr(
const SizeOfPackExpr *S) {
2410 ID.AddInteger(Args.size());
2411 for (
const auto &TA : Args)
2412 VisitTemplateArgument(TA);
2419void StmtProfiler::VisitPackIndexingExpr(
const PackIndexingExpr *E) {
2420 VisitStmtNoChildren(E);
2431void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2432 const SubstNonTypeTemplateParmPackExpr *S) {
2438void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2439 const SubstNonTypeTemplateParmExpr *E) {
2444void StmtProfiler::VisitFunctionParmPackExpr(
const FunctionParmPackExpr *S) {
2452void StmtProfiler::VisitMaterializeTemporaryExpr(
2453 const MaterializeTemporaryExpr *S) {
2457void StmtProfiler::VisitCXXFoldExpr(
const CXXFoldExpr *S) {
2458 VisitStmtNoChildren(S);
2481void StmtProfiler::VisitCXXParenListInitExpr(
const CXXParenListInitExpr *S) {
2485void StmtProfiler::VisitCoroutineBodyStmt(
const CoroutineBodyStmt *S) {
2489void StmtProfiler::VisitCoreturnStmt(
const CoreturnStmt *S) {
2493void StmtProfiler::VisitCoawaitExpr(
const CoawaitExpr *S) {
2497void StmtProfiler::VisitDependentCoawaitExpr(
const DependentCoawaitExpr *S) {
2501void StmtProfiler::VisitCoyieldExpr(
const CoyieldExpr *S) {
2505void StmtProfiler::VisitOpaqueValueExpr(
const OpaqueValueExpr *E) {
2509void StmtProfiler::VisitSourceLocExpr(
const SourceLocExpr *E) {
2513void StmtProfiler::VisitEmbedExpr(
const EmbedExpr *E) { VisitExpr(E); }
2515void StmtProfiler::VisitCXXExpansionSelectExpr(
2516 const CXXExpansionSelectExpr *E) {
2520void StmtProfiler::VisitRecoveryExpr(
const RecoveryExpr *E) { VisitExpr(E); }
2522void StmtProfiler::VisitObjCObjectLiteral(
const ObjCObjectLiteral *E) {
2526void StmtProfiler::VisitObjCStringLiteral(
const ObjCStringLiteral *S) {
2527 VisitObjCObjectLiteral(S);
2530void StmtProfiler::VisitObjCBoxedExpr(
const ObjCBoxedExpr *E) {
2531 VisitObjCObjectLiteral(E);
2534void StmtProfiler::VisitObjCArrayLiteral(
const ObjCArrayLiteral *E) {
2535 VisitObjCObjectLiteral(E);
2538void StmtProfiler::VisitObjCDictionaryLiteral(
const ObjCDictionaryLiteral *E) {
2539 VisitObjCObjectLiteral(E);
2542void StmtProfiler::VisitObjCEncodeExpr(
const ObjCEncodeExpr *S) {
2547void StmtProfiler::VisitObjCSelectorExpr(
const ObjCSelectorExpr *S) {
2552void StmtProfiler::VisitObjCProtocolExpr(
const ObjCProtocolExpr *S) {
2557void StmtProfiler::VisitObjCIvarRefExpr(
const ObjCIvarRefExpr *S) {
2564void StmtProfiler::VisitObjCPropertyRefExpr(
const ObjCPropertyRefExpr *S) {
2578void StmtProfiler::VisitObjCSubscriptRefExpr(
const ObjCSubscriptRefExpr *S) {
2584void StmtProfiler::VisitObjCMessageExpr(
const ObjCMessageExpr *S) {
2590void StmtProfiler::VisitObjCIsaExpr(
const ObjCIsaExpr *S) {
2595void StmtProfiler::VisitObjCBoolLiteralExpr(
const ObjCBoolLiteralExpr *S) {
2600void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2601 const ObjCIndirectCopyRestoreExpr *S) {
2606void StmtProfiler::VisitObjCBridgedCastExpr(
const ObjCBridgedCastExpr *S) {
2607 VisitExplicitCastExpr(S);
2611void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2612 const ObjCAvailabilityCheckExpr *S) {
2616void StmtProfiler::VisitTemplateArguments(
const TemplateArgumentLoc *Args,
2618 ID.AddInteger(NumArgs);
2619 for (
unsigned I = 0; I != NumArgs; ++I)
2623void StmtProfiler::VisitTemplateArgument(
const TemplateArgument &Arg) {
2666 VisitTemplateArgument(P);
2672class OpenACCClauseProfiler
2673 :
public OpenACCClauseVisitor<OpenACCClauseProfiler> {
2674 StmtProfiler &Profiler;
2677 OpenACCClauseProfiler(StmtProfiler &P) : Profiler(P) {}
2679 void VisitOpenACCClauseList(ArrayRef<const OpenACCClause *> Clauses) {
2680 for (
const OpenACCClause *Clause : Clauses) {
2687 void VisitClauseWithVarList(
const OpenACCClauseWithVarList &Clause) {
2689 Profiler.VisitStmt(E);
2692#define VISIT_CLAUSE(CLAUSE_NAME) \
2693 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
2695#include "clang/Basic/OpenACCClauses.def"
2699void OpenACCClauseProfiler::VisitDefaultClause(
2700 const OpenACCDefaultClause &Clause) {}
2702void OpenACCClauseProfiler::VisitIfClause(
const OpenACCIfClause &Clause) {
2704 "if clause requires a valid condition expr");
2708void OpenACCClauseProfiler::VisitCopyClause(
const OpenACCCopyClause &Clause) {
2709 VisitClauseWithVarList(Clause);
2712void OpenACCClauseProfiler::VisitLinkClause(
const OpenACCLinkClause &Clause) {
2713 VisitClauseWithVarList(Clause);
2716void OpenACCClauseProfiler::VisitDeviceResidentClause(
2717 const OpenACCDeviceResidentClause &Clause) {
2718 VisitClauseWithVarList(Clause);
2721void OpenACCClauseProfiler::VisitCopyInClause(
2722 const OpenACCCopyInClause &Clause) {
2723 VisitClauseWithVarList(Clause);
2726void OpenACCClauseProfiler::VisitCopyOutClause(
2727 const OpenACCCopyOutClause &Clause) {
2728 VisitClauseWithVarList(Clause);
2731void OpenACCClauseProfiler::VisitCreateClause(
2732 const OpenACCCreateClause &Clause) {
2733 VisitClauseWithVarList(Clause);
2736void OpenACCClauseProfiler::VisitHostClause(
const OpenACCHostClause &Clause) {
2737 VisitClauseWithVarList(Clause);
2740void OpenACCClauseProfiler::VisitDeviceClause(
2741 const OpenACCDeviceClause &Clause) {
2742 VisitClauseWithVarList(Clause);
2745void OpenACCClauseProfiler::VisitSelfClause(
const OpenACCSelfClause &Clause) {
2751 Profiler.VisitStmt(E);
2755void OpenACCClauseProfiler::VisitFinalizeClause(
2756 const OpenACCFinalizeClause &Clause) {}
2758void OpenACCClauseProfiler::VisitIfPresentClause(
2759 const OpenACCIfPresentClause &Clause) {}
2761void OpenACCClauseProfiler::VisitNumGangsClause(
2762 const OpenACCNumGangsClause &Clause) {
2764 Profiler.VisitStmt(E);
2767void OpenACCClauseProfiler::VisitTileClause(
const OpenACCTileClause &Clause) {
2769 Profiler.VisitStmt(E);
2772void OpenACCClauseProfiler::VisitNumWorkersClause(
2773 const OpenACCNumWorkersClause &Clause) {
2774 assert(Clause.
hasIntExpr() &&
"num_workers clause requires a valid int expr");
2778void OpenACCClauseProfiler::VisitCollapseClause(
2779 const OpenACCCollapseClause &Clause) {
2780 assert(Clause.
getLoopCount() &&
"collapse clause requires a valid int expr");
2784void OpenACCClauseProfiler::VisitPrivateClause(
2785 const OpenACCPrivateClause &Clause) {
2786 VisitClauseWithVarList(Clause);
2789 Profiler.VisitDecl(Recipe.AllocaDecl);
2793void OpenACCClauseProfiler::VisitFirstPrivateClause(
2794 const OpenACCFirstPrivateClause &Clause) {
2795 VisitClauseWithVarList(Clause);
2798 Profiler.VisitDecl(Recipe.AllocaDecl);
2799 Profiler.VisitDecl(Recipe.InitFromTemporary);
2803void OpenACCClauseProfiler::VisitAttachClause(
2804 const OpenACCAttachClause &Clause) {
2805 VisitClauseWithVarList(Clause);
2808void OpenACCClauseProfiler::VisitDetachClause(
2809 const OpenACCDetachClause &Clause) {
2810 VisitClauseWithVarList(Clause);
2813void OpenACCClauseProfiler::VisitDeleteClause(
2814 const OpenACCDeleteClause &Clause) {
2815 VisitClauseWithVarList(Clause);
2818void OpenACCClauseProfiler::VisitDevicePtrClause(
2819 const OpenACCDevicePtrClause &Clause) {
2820 VisitClauseWithVarList(Clause);
2823void OpenACCClauseProfiler::VisitNoCreateClause(
2824 const OpenACCNoCreateClause &Clause) {
2825 VisitClauseWithVarList(Clause);
2828void OpenACCClauseProfiler::VisitPresentClause(
2829 const OpenACCPresentClause &Clause) {
2830 VisitClauseWithVarList(Clause);
2833void OpenACCClauseProfiler::VisitUseDeviceClause(
2834 const OpenACCUseDeviceClause &Clause) {
2835 VisitClauseWithVarList(Clause);
2838void OpenACCClauseProfiler::VisitVectorLengthClause(
2839 const OpenACCVectorLengthClause &Clause) {
2841 "vector_length clause requires a valid int expr");
2845void OpenACCClauseProfiler::VisitAsyncClause(
const OpenACCAsyncClause &Clause) {
2850void OpenACCClauseProfiler::VisitDeviceNumClause(
2851 const OpenACCDeviceNumClause &Clause) {
2855void OpenACCClauseProfiler::VisitDefaultAsyncClause(
2856 const OpenACCDefaultAsyncClause &Clause) {
2860void OpenACCClauseProfiler::VisitWorkerClause(
2861 const OpenACCWorkerClause &Clause) {
2866void OpenACCClauseProfiler::VisitVectorClause(
2867 const OpenACCVectorClause &Clause) {
2872void OpenACCClauseProfiler::VisitWaitClause(
const OpenACCWaitClause &Clause) {
2876 Profiler.VisitStmt(E);
2880void OpenACCClauseProfiler::VisitDeviceTypeClause(
2881 const OpenACCDeviceTypeClause &Clause) {}
2883void OpenACCClauseProfiler::VisitAutoClause(
const OpenACCAutoClause &Clause) {}
2885void OpenACCClauseProfiler::VisitIndependentClause(
2886 const OpenACCIndependentClause &Clause) {}
2888void OpenACCClauseProfiler::VisitSeqClause(
const OpenACCSeqClause &Clause) {}
2889void OpenACCClauseProfiler::VisitNoHostClause(
2890 const OpenACCNoHostClause &Clause) {}
2892void OpenACCClauseProfiler::VisitGangClause(
const OpenACCGangClause &Clause) {
2893 for (
unsigned I = 0; I < Clause.
getNumExprs(); ++I) {
2894 Profiler.VisitStmt(Clause.
getExpr(I).second);
2898void OpenACCClauseProfiler::VisitReductionClause(
2899 const OpenACCReductionClause &Clause) {
2900 VisitClauseWithVarList(Clause);
2903 Profiler.VisitDecl(Recipe.AllocaDecl);
2908 static_assert(
sizeof(OpenACCReductionRecipe::CombinerRecipe) ==
2910 for (
auto &CombinerRecipe : Recipe.CombinerRecipes) {
2911 if (CombinerRecipe.Op) {
2912 Profiler.VisitDecl(CombinerRecipe.LHS);
2913 Profiler.VisitDecl(CombinerRecipe.RHS);
2914 Profiler.VisitStmt(CombinerRecipe.Op);
2920void OpenACCClauseProfiler::VisitBindClause(
const OpenACCBindClause &Clause) {
2921 assert(
false &&
"not implemented... what can we do about our expr?");
2925void StmtProfiler::VisitOpenACCComputeConstruct(
2930 OpenACCClauseProfiler P{*
this};
2931 P.VisitOpenACCClauseList(S->clauses());
2934void StmtProfiler::VisitOpenACCLoopConstruct(
const OpenACCLoopConstruct *S) {
2938 OpenACCClauseProfiler P{*
this};
2939 P.VisitOpenACCClauseList(S->clauses());
2942void StmtProfiler::VisitOpenACCCombinedConstruct(
2943 const OpenACCCombinedConstruct *S) {
2947 OpenACCClauseProfiler P{*
this};
2948 P.VisitOpenACCClauseList(S->clauses());
2951void StmtProfiler::VisitOpenACCDataConstruct(
const OpenACCDataConstruct *S) {
2954 OpenACCClauseProfiler P{*
this};
2955 P.VisitOpenACCClauseList(S->clauses());
2958void StmtProfiler::VisitOpenACCEnterDataConstruct(
2959 const OpenACCEnterDataConstruct *S) {
2962 OpenACCClauseProfiler P{*
this};
2963 P.VisitOpenACCClauseList(S->clauses());
2966void StmtProfiler::VisitOpenACCExitDataConstruct(
2967 const OpenACCExitDataConstruct *S) {
2970 OpenACCClauseProfiler P{*
this};
2971 P.VisitOpenACCClauseList(S->clauses());
2974void StmtProfiler::VisitOpenACCHostDataConstruct(
2975 const OpenACCHostDataConstruct *S) {
2978 OpenACCClauseProfiler P{*
this};
2979 P.VisitOpenACCClauseList(S->clauses());
2982void StmtProfiler::VisitOpenACCWaitConstruct(
const OpenACCWaitConstruct *S) {
2986 OpenACCClauseProfiler P{*
this};
2987 P.VisitOpenACCClauseList(S->clauses());
2990void StmtProfiler::VisitOpenACCCacheConstruct(
const OpenACCCacheConstruct *S) {
2995void StmtProfiler::VisitOpenACCInitConstruct(
const OpenACCInitConstruct *S) {
2997 OpenACCClauseProfiler P{*
this};
2998 P.VisitOpenACCClauseList(S->clauses());
3001void StmtProfiler::VisitOpenACCShutdownConstruct(
3002 const OpenACCShutdownConstruct *S) {
3004 OpenACCClauseProfiler P{*
this};
3005 P.VisitOpenACCClauseList(S->clauses());
3008void StmtProfiler::VisitOpenACCSetConstruct(
const OpenACCSetConstruct *S) {
3010 OpenACCClauseProfiler P{*
this};
3011 P.VisitOpenACCClauseList(S->clauses());
3014void StmtProfiler::VisitOpenACCUpdateConstruct(
3015 const OpenACCUpdateConstruct *S) {
3017 OpenACCClauseProfiler P{*
this};
3018 P.VisitOpenACCClauseList(S->clauses());
3021void StmtProfiler::VisitOpenACCAtomicConstruct(
3022 const OpenACCAtomicConstruct *S) {
3024 OpenACCClauseProfiler P{*
this};
3025 P.VisitOpenACCClauseList(S->clauses());
3028void StmtProfiler::VisitHLSLOutArgExpr(
const HLSLOutArgExpr *S) {
3033 bool Canonical,
bool ProfileLambdaExpr)
const {
3034 StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr);
3035 Profiler.Visit(
this);
3040 StmtProfilerWithoutPointers Profiler(ID, Hash);
3041 Profiler.Visit(
this);
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...
This file defines OpenMP AST classes for clauses.
static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S, UnaryOperatorKind &UnaryOp, BinaryOperatorKind &BinaryOp, unsigned &NumArgs)
static const TemplateArgument & getArgument(const TemplateArgument &A)
DeclarationNameInfo getDirectiveName() const
Return name of the directive.
const Expr * getReductionRef() const
Returns reference to the task_reduction return variable.
llvm::APInt getValue() const
void Profile(llvm::FoldingSetNodeID &ID) const
profile this value.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
LabelDecl * getLabel() const
ArrayTypeTrait getTrait() const
QualType getQueriedType() const
unsigned getNumClobbers() const
unsigned getNumOutputs() const
unsigned getNumInputs() const
const BlockDecl * getBlockDecl() const
CXXTemporary * getTemporary()
QualType getCaughtType() const
bool isElidable() const
Whether this construction is elidable.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
const ParmVarDecl * getParam() const
FieldDecl * getField()
Get the field whose initializer will be used.
FunctionDecl * getOperatorDelete() const
bool isGlobalDelete() const
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
bool isImplicitAccess() const
True if this is an implicit access, i.e.
bool shouldApplyLifetimeExtensionToPreamble() const
BinaryOperatorKind getOperator() const
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
QualType getAllocatedType() const
CXXNewInitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
FunctionDecl * getOperatorDelete() const
unsigned getNumPlacementArgs() const
bool isParenTypeId() const
FunctionDecl * getOperatorNew() const
A call to an overloaded operator written using operator syntax.
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
QualType getDestroyedType() const
Retrieve the type being destroyed.
NestedNameSpecifier getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name.
const IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
capture_const_range captures() const
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
bool isReversed() const
Determine whether this expression was rewritten in reverse form.
const CXXDestructorDecl * getDestructor() const
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const
bool isTypeOperand() const
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
bool isListInitialization() const
Determine whether this expression models list-initialization.
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
bool isTypeOperand() const
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
unsigned getValue() const
CharacterLiteralKind getKind() const
ArrayRef< TemplateArgument > getTemplateArguments() const
TemplateName getNamedConcept() const
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list.
NestedNameSpecifier getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
Decl - This represents one declaration (or definition), e.g.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
void * getAsOpaquePtr() const
Get the representation of this declaration name as an opaque pointer.
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
ArrayRef< TemplateArgumentLoc > template_arguments() const
TemplateName getTemplateName() const
unsigned getNumTemplateArgs() const
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
MutableArrayRef< Designator > designators()
IdentifierInfo & getAccessor() const
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to.
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * getQueriedExpression() const
ExpressionTrait getTrait() const
llvm::APInt getValue() const
Returns an internal integer representation of the literal.
llvm::APFloat getValue() const
const Expr * getSubExpr() const
ValueDecl *const * iterator
Iterators over the parameters which the parameter pack expanded into.
ValueDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
unsigned getNumExpansions() const
Get the number of parameters in this parameter pack.
unsigned getNumLabels() const
const Expr * getOutputConstraintExpr(unsigned i) const
StringRef getInputName(unsigned i) const
StringRef getOutputName(unsigned i) const
const Expr * getInputConstraintExpr(unsigned i) const
const Expr * getAsmStringExpr() const
Expr * getClobberExpr(unsigned i)
association_range associations()
AssociationTy< true > ConstAssociation
LabelDecl * getLabel() const
One of these records is kept for each identifier that is lexed.
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
InitListExpr * getSyntacticForm() const
LabelDecl * getDecl() const
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
bool isIfExists() const
Determine whether this is an __if_exists statement.
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we're testing for, along with location information.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
MSPropertyDecl * getPropertyDecl() const
NestedNameSpecifier getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NestedNameSpecifier getCanonical() const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
void Profile(llvm::FoldingSetNodeID &ID) const
void AddFunctionDecl(const FunctionDecl *Function, bool SkipBody=false)
Class that handles post-update expression for some clauses, like 'lastprivate', 'reduction' etc.
Class that handles pre-initialization statement for some clauses, like 'schedule',...
unsigned numOfIterators() const
Returns number of iterator definitions.
Decl * getIteratorDecl(unsigned I)
Gets the iterator declaration for the given iterator.
const VarDecl * getCatchParamDecl() const
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
QualType getEncodedType() const
bool shouldCopy() const
shouldCopy - True if we should do the 'copy' part of the copy-restore.
Selector getSelector() const
const ObjCMethodDecl * getMethodDecl() const
ObjCPropertyDecl * getExplicitProperty() const
ObjCMethodDecl * getImplicitPropertyGetter() const
QualType getSuperReceiverType() const
bool isImplicitProperty() const
ObjCMethodDecl * getImplicitPropertySetter() const
bool isSuperReceiver() const
ObjCProtocolDecl * getProtocol() const
Selector getSelector() const
ObjCMethodDecl * getAtIndexMethodDecl() const
ObjCMethodDecl * setAtIndexMethodDecl() const
const OffsetOfNode & getComponent(unsigned Idx) const
TypeSourceInfo * getTypeSourceInfo() const
unsigned getNumComponents() const
const IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
FieldDecl * getField() const
For a field offsetof node, returns the field.
@ Array
An index into an array.
@ Identifier
A field in a dependent type, known only by its name.
@ Base
An implicit indirection through a C++ base class, when the field found is in a base class.
Kind getKind() const
Determine what kind of offsetof node this is.
bool hasConditionExpr() const
const Expr * getConditionExpr() const
const Expr * getIntExpr() const
ArrayRef< Expr * > getVarList() const
const Expr * getLoopCount() const
ArrayRef< OpenACCFirstPrivateRecipe > getInitRecipes() const
unsigned getNumExprs() const
std::pair< OpenACCGangKind, const Expr * > getExpr(unsigned I) const
ArrayRef< Expr * > getIntExprs() const
ArrayRef< OpenACCPrivateRecipe > getInitRecipes() const
ArrayRef< OpenACCReductionRecipe > getRecipes() const
const Expr * getConditionExpr() const
bool isConditionExprClause() const
bool hasConditionExpr() const
ArrayRef< Expr * > getVarList() const
ArrayRef< Expr * > getSizeExprs() const
Expr * getDevNumExpr() const
bool hasDevNumExpr() const
ArrayRef< Expr * > getQueueIdExprs() const
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
NestedNameSpecifier getQualifier() const
Fetches the nested-name qualifier, if one was given.
decls_iterator decls_begin() const
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
TemplateArgumentLoc const * getTemplateArgs() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
Expr * getIndexExpr() const
ArrayRef< Expr * > getExpressions() const
Return the trailing expressions, regardless of the expansion.
bool expandsToEmptyPack() const
Determine if the expression was expanded to empty.
Expr * getPackIdExpression() const
PredefinedIdentKind getIdentKind() const
semantics_iterator semantics_end()
semantics_iterator semantics_begin()
const Expr *const * const_semantics_iterator
A (possibly-)qualified type.
ArrayRef< concepts::Requirement * > getRequirements() const
ArrayRef< ParmVarDecl * > getLocalParameters() const
TypeSourceInfo * getTypeSourceInfo()
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof... expression, such as is produced f...
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
NamedDecl * getPack() const
Retrieve the parameter pack.
Stmt - This represents one statement.
void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
Calculate a unique representation for a statement that is stable across compiler invocations.
StmtClass getStmtClass() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
StringLiteralKind getKind() const
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Expr * getReplacement() const
TemplateArgument getArgumentPack() const
Retrieve the template argument pack containing the substituted template arguments.
NonTypeTemplateParmDecl * getParameterPack() const
Retrieve the non-type template parameter pack being substituted.
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
Location wrapper for a TemplateArgument.
Represents a template argument.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
QualType getIntegralType() const
Retrieve the type of the integral value.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
Represents a C++ template name within the type system.
void Profile(llvm::FoldingSetNodeID &ID)
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
QualType getType() const
Return the type wrapped by this type source info.
TypeSourceInfo * getArg(unsigned I) const
Retrieve the Ith argument.
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
TypeTrait getTrait() const
Determine which type trait this expression uses.
const T * castAs() const
Member-template castAs<specific type>.
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs<specific type>'.
QualType getArgumentType() const
bool isArgumentType() const
UnaryExprOrTypeTrait getKind() const
DeclarationName getMemberName() const
Retrieve the name of the member that this expression refers to.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
bool isTypeConstraint() const
const TypeConstraint * getTypeConstraint() const
bool isSubstitutionFailure() const
Top level wrappers for InstallAPI frontend operations.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
const FunctionProtoType * T
U cast(CodeGen::Address addr)
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
DeclarationName getName() const
getName - Returns the embedded declaration name.