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::VisitOMPDepthClause(
const OMPDepthClause *
C) {
539 if (
const Expr *Depth =
C->getDepth())
540 Profiler->VisitExpr(Depth);
543void OMPClauseProfiler::VisitOMPLoopRangeClause(
const OMPLoopRangeClause *
C) {
544 if (
const Expr *
First =
C->getFirst())
545 Profiler->VisitExpr(
First);
546 if (
const Expr *Count =
C->getCount())
547 Profiler->VisitExpr(Count);
550void OMPClauseProfiler::VisitOMPAllocatorClause(
const OMPAllocatorClause *
C) {
551 if (
C->getAllocator())
552 Profiler->VisitStmt(
C->getAllocator());
555void OMPClauseProfiler::VisitOMPCollapseClause(
const OMPCollapseClause *
C) {
556 if (
C->getNumForLoops())
557 Profiler->VisitStmt(
C->getNumForLoops());
560void OMPClauseProfiler::VisitOMPDetachClause(
const OMPDetachClause *
C) {
561 if (Expr *Evt =
C->getEventHandler())
562 Profiler->VisitStmt(Evt);
565void OMPClauseProfiler::VisitOMPNovariantsClause(
const OMPNovariantsClause *
C) {
566 VisitOMPClauseWithPreInit(
C);
567 if (
C->getCondition())
568 Profiler->VisitStmt(
C->getCondition());
571void OMPClauseProfiler::VisitOMPNocontextClause(
const OMPNocontextClause *
C) {
572 VisitOMPClauseWithPreInit(
C);
573 if (
C->getCondition())
574 Profiler->VisitStmt(
C->getCondition());
577void OMPClauseProfiler::VisitOMPDefaultClause(
const OMPDefaultClause *
C) { }
579void OMPClauseProfiler::VisitOMPThreadsetClause(
const OMPThreadsetClause *
C) {}
581void OMPClauseProfiler::VisitOMPTransparentClause(
582 const OMPTransparentClause *
C) {
583 if (
C->getImpexType())
584 Profiler->VisitStmt(
C->getImpexType());
587void OMPClauseProfiler::VisitOMPProcBindClause(
const OMPProcBindClause *
C) { }
589void OMPClauseProfiler::VisitOMPUnifiedAddressClause(
590 const OMPUnifiedAddressClause *
C) {}
592void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause(
593 const OMPUnifiedSharedMemoryClause *
C) {}
595void OMPClauseProfiler::VisitOMPReverseOffloadClause(
596 const OMPReverseOffloadClause *
C) {}
598void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
599 const OMPDynamicAllocatorsClause *
C) {}
601void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause(
602 const OMPAtomicDefaultMemOrderClause *
C) {}
604void OMPClauseProfiler::VisitOMPSelfMapsClause(
const OMPSelfMapsClause *
C) {}
606void OMPClauseProfiler::VisitOMPAtClause(
const OMPAtClause *
C) {}
608void OMPClauseProfiler::VisitOMPSeverityClause(
const OMPSeverityClause *
C) {}
610void OMPClauseProfiler::VisitOMPMessageClause(
const OMPMessageClause *
C) {
611 if (
C->getMessageString())
612 Profiler->VisitStmt(
C->getMessageString());
615void OMPClauseProfiler::VisitOMPScheduleClause(
const OMPScheduleClause *
C) {
616 VisitOMPClauseWithPreInit(
C);
617 if (
auto *S =
C->getChunkSize())
618 Profiler->VisitStmt(S);
621void OMPClauseProfiler::VisitOMPOrderedClause(
const OMPOrderedClause *
C) {
622 if (
auto *
Num =
C->getNumForLoops())
623 Profiler->VisitStmt(
Num);
626void OMPClauseProfiler::VisitOMPNowaitClause(
const OMPNowaitClause *
C) {
627 if (
C->getCondition())
628 Profiler->VisitStmt(
C->getCondition());
631void OMPClauseProfiler::VisitOMPUntiedClause(
const OMPUntiedClause *) {}
633void OMPClauseProfiler::VisitOMPMergeableClause(
const OMPMergeableClause *) {}
635void OMPClauseProfiler::VisitOMPReadClause(
const OMPReadClause *) {}
637void OMPClauseProfiler::VisitOMPWriteClause(
const OMPWriteClause *) {}
639void OMPClauseProfiler::VisitOMPUpdateClause(
const OMPUpdateClause *) {}
641void OMPClauseProfiler::VisitOMPUpdateDependObjectsClause(
642 const OMPUpdateDependObjectsClause *) {}
644void OMPClauseProfiler::VisitOMPCaptureClause(
const OMPCaptureClause *) {}
646void OMPClauseProfiler::VisitOMPCompareClause(
const OMPCompareClause *) {}
648void OMPClauseProfiler::VisitOMPFailClause(
const OMPFailClause *) {}
650void OMPClauseProfiler::VisitOMPAbsentClause(
const OMPAbsentClause *) {}
652void OMPClauseProfiler::VisitOMPHoldsClause(
const OMPHoldsClause *) {}
654void OMPClauseProfiler::VisitOMPContainsClause(
const OMPContainsClause *) {}
656void OMPClauseProfiler::VisitOMPNoOpenMPClause(
const OMPNoOpenMPClause *) {}
658void OMPClauseProfiler::VisitOMPNoOpenMPRoutinesClause(
659 const OMPNoOpenMPRoutinesClause *) {}
661void OMPClauseProfiler::VisitOMPNoOpenMPConstructsClause(
662 const OMPNoOpenMPConstructsClause *) {}
664void OMPClauseProfiler::VisitOMPNoParallelismClause(
665 const OMPNoParallelismClause *) {}
667void OMPClauseProfiler::VisitOMPSeqCstClause(
const OMPSeqCstClause *) {}
669void OMPClauseProfiler::VisitOMPAcqRelClause(
const OMPAcqRelClause *) {}
671void OMPClauseProfiler::VisitOMPAcquireClause(
const OMPAcquireClause *) {}
673void OMPClauseProfiler::VisitOMPReleaseClause(
const OMPReleaseClause *) {}
675void OMPClauseProfiler::VisitOMPRelaxedClause(
const OMPRelaxedClause *) {}
677void OMPClauseProfiler::VisitOMPWeakClause(
const OMPWeakClause *) {}
679void OMPClauseProfiler::VisitOMPThreadsClause(
const OMPThreadsClause *) {}
681void OMPClauseProfiler::VisitOMPSIMDClause(
const OMPSIMDClause *) {}
683void OMPClauseProfiler::VisitOMPNogroupClause(
const OMPNogroupClause *) {}
685void OMPClauseProfiler::VisitOMPInitClause(
const OMPInitClause *
C) {
687 Profiler->VisitStmt(
C->getInteropVar());
688 Profiler->VisitInteger(
C->hasPreferAttrs() ? 1 : 0);
689 Profiler->VisitInteger(
C->varlist_size() - 1);
690 for (OMPInitClause::PrefView P :
C->prefs()) {
691 Profiler->VisitInteger(P.Fr ? 1 : 0);
693 Profiler->VisitStmt(P.Fr);
694 Profiler->VisitInteger(P.Attrs.size());
695 for (
const Expr *A : P.Attrs)
696 Profiler->VisitStmt(A);
700void OMPClauseProfiler::VisitOMPUseClause(
const OMPUseClause *
C) {
701 if (
C->getInteropVar())
702 Profiler->VisitStmt(
C->getInteropVar());
705void OMPClauseProfiler::VisitOMPDestroyClause(
const OMPDestroyClause *
C) {
706 if (
C->getInteropVar())
707 Profiler->VisitStmt(
C->getInteropVar());
710void OMPClauseProfiler::VisitOMPFilterClause(
const OMPFilterClause *
C) {
711 VisitOMPClauseWithPreInit(
C);
712 if (
C->getThreadID())
713 Profiler->VisitStmt(
C->getThreadID());
717void OMPClauseProfiler::VisitOMPClauseList(
T *Node) {
718 for (
auto *E : Node->varlist()) {
720 Profiler->VisitStmt(E);
724void OMPClauseProfiler::VisitOMPPrivateClause(
const OMPPrivateClause *
C) {
725 VisitOMPClauseList(
C);
726 for (
auto *E :
C->private_copies()) {
728 Profiler->VisitStmt(E);
732OMPClauseProfiler::VisitOMPFirstprivateClause(
const OMPFirstprivateClause *
C) {
733 VisitOMPClauseList(
C);
734 VisitOMPClauseWithPreInit(
C);
735 for (
auto *E :
C->private_copies()) {
737 Profiler->VisitStmt(E);
739 for (
auto *E :
C->inits()) {
741 Profiler->VisitStmt(E);
745OMPClauseProfiler::VisitOMPLastprivateClause(
const OMPLastprivateClause *
C) {
746 VisitOMPClauseList(
C);
747 VisitOMPClauseWithPostUpdate(
C);
748 for (
auto *E :
C->source_exprs()) {
750 Profiler->VisitStmt(E);
752 for (
auto *E :
C->destination_exprs()) {
754 Profiler->VisitStmt(E);
756 for (
auto *E :
C->assignment_ops()) {
758 Profiler->VisitStmt(E);
761void OMPClauseProfiler::VisitOMPSharedClause(
const OMPSharedClause *
C) {
762 VisitOMPClauseList(
C);
764void OMPClauseProfiler::VisitOMPReductionClause(
765 const OMPReductionClause *
C) {
766 Profiler->VisitNestedNameSpecifier(
767 C->getQualifierLoc().getNestedNameSpecifier());
768 Profiler->VisitName(
C->getNameInfo().getName());
769 VisitOMPClauseList(
C);
770 VisitOMPClauseWithPostUpdate(
C);
771 for (
auto *E :
C->privates()) {
773 Profiler->VisitStmt(E);
775 for (
auto *E :
C->lhs_exprs()) {
777 Profiler->VisitStmt(E);
779 for (
auto *E :
C->rhs_exprs()) {
781 Profiler->VisitStmt(E);
783 for (
auto *E :
C->reduction_ops()) {
785 Profiler->VisitStmt(E);
787 if (
C->getModifier() == clang::OMPC_REDUCTION_inscan) {
788 for (
auto *E :
C->copy_ops()) {
790 Profiler->VisitStmt(E);
792 for (
auto *E :
C->copy_array_temps()) {
794 Profiler->VisitStmt(E);
796 for (
auto *E :
C->copy_array_elems()) {
798 Profiler->VisitStmt(E);
802void OMPClauseProfiler::VisitOMPTaskReductionClause(
803 const OMPTaskReductionClause *
C) {
804 Profiler->VisitNestedNameSpecifier(
805 C->getQualifierLoc().getNestedNameSpecifier());
806 Profiler->VisitName(
C->getNameInfo().getName());
807 VisitOMPClauseList(
C);
808 VisitOMPClauseWithPostUpdate(
C);
809 for (
auto *E :
C->privates()) {
811 Profiler->VisitStmt(E);
813 for (
auto *E :
C->lhs_exprs()) {
815 Profiler->VisitStmt(E);
817 for (
auto *E :
C->rhs_exprs()) {
819 Profiler->VisitStmt(E);
821 for (
auto *E :
C->reduction_ops()) {
823 Profiler->VisitStmt(E);
826void OMPClauseProfiler::VisitOMPInReductionClause(
827 const OMPInReductionClause *
C) {
828 Profiler->VisitNestedNameSpecifier(
829 C->getQualifierLoc().getNestedNameSpecifier());
830 Profiler->VisitName(
C->getNameInfo().getName());
831 VisitOMPClauseList(
C);
832 VisitOMPClauseWithPostUpdate(
C);
833 for (
auto *E :
C->privates()) {
835 Profiler->VisitStmt(E);
837 for (
auto *E :
C->lhs_exprs()) {
839 Profiler->VisitStmt(E);
841 for (
auto *E :
C->rhs_exprs()) {
843 Profiler->VisitStmt(E);
845 for (
auto *E :
C->reduction_ops()) {
847 Profiler->VisitStmt(E);
849 for (
auto *E :
C->taskgroup_descriptors()) {
851 Profiler->VisitStmt(E);
854void OMPClauseProfiler::VisitOMPLinearClause(
const OMPLinearClause *
C) {
855 VisitOMPClauseList(
C);
856 VisitOMPClauseWithPostUpdate(
C);
857 for (
auto *E :
C->privates()) {
859 Profiler->VisitStmt(E);
861 for (
auto *E :
C->inits()) {
863 Profiler->VisitStmt(E);
865 for (
auto *E :
C->updates()) {
867 Profiler->VisitStmt(E);
869 for (
auto *E :
C->finals()) {
871 Profiler->VisitStmt(E);
874 Profiler->VisitStmt(
C->getStep());
875 if (
C->getCalcStep())
876 Profiler->VisitStmt(
C->getCalcStep());
878void OMPClauseProfiler::VisitOMPAlignedClause(
const OMPAlignedClause *
C) {
879 VisitOMPClauseList(
C);
880 if (
C->getAlignment())
881 Profiler->VisitStmt(
C->getAlignment());
883void OMPClauseProfiler::VisitOMPCopyinClause(
const OMPCopyinClause *
C) {
884 VisitOMPClauseList(
C);
885 for (
auto *E :
C->source_exprs()) {
887 Profiler->VisitStmt(E);
889 for (
auto *E :
C->destination_exprs()) {
891 Profiler->VisitStmt(E);
893 for (
auto *E :
C->assignment_ops()) {
895 Profiler->VisitStmt(E);
899OMPClauseProfiler::VisitOMPCopyprivateClause(
const OMPCopyprivateClause *
C) {
900 VisitOMPClauseList(
C);
901 for (
auto *E :
C->source_exprs()) {
903 Profiler->VisitStmt(E);
905 for (
auto *E :
C->destination_exprs()) {
907 Profiler->VisitStmt(E);
909 for (
auto *E :
C->assignment_ops()) {
911 Profiler->VisitStmt(E);
914void OMPClauseProfiler::VisitOMPFlushClause(
const OMPFlushClause *
C) {
915 VisitOMPClauseList(
C);
917void OMPClauseProfiler::VisitOMPDepobjClause(
const OMPDepobjClause *
C) {
918 if (
const Expr *Depobj =
C->getDepobj())
919 Profiler->VisitStmt(Depobj);
921void OMPClauseProfiler::VisitOMPDependClause(
const OMPDependClause *
C) {
922 VisitOMPClauseList(
C);
924void OMPClauseProfiler::VisitOMPDeviceClause(
const OMPDeviceClause *
C) {
926 Profiler->VisitStmt(
C->getDevice());
928void OMPClauseProfiler::VisitOMPMapClause(
const OMPMapClause *
C) {
929 VisitOMPClauseList(
C);
931void OMPClauseProfiler::VisitOMPAllocateClause(
const OMPAllocateClause *
C) {
932 if (Expr *Allocator =
C->getAllocator())
933 Profiler->VisitStmt(Allocator);
934 VisitOMPClauseList(
C);
936void OMPClauseProfiler::VisitOMPNumTeamsClause(
const OMPNumTeamsClause *
C) {
937 Profiler->VisitInteger(
C->getModifier());
938 if (
const Expr *Modifier =
C->getModifierExpr())
939 Profiler->VisitStmt(Modifier);
940 VisitOMPClauseList(
C);
941 VisitOMPClauseWithPreInit(
C);
943void OMPClauseProfiler::VisitOMPThreadLimitClause(
944 const OMPThreadLimitClause *
C) {
945 Profiler->VisitInteger(
C->getModifier());
946 if (
const Expr *Modifier =
C->getModifierExpr())
947 Profiler->VisitStmt(Modifier);
948 VisitOMPClauseList(
C);
949 VisitOMPClauseWithPreInit(
C);
951void OMPClauseProfiler::VisitOMPPriorityClause(
const OMPPriorityClause *
C) {
952 VisitOMPClauseWithPreInit(
C);
953 if (
C->getPriority())
954 Profiler->VisitStmt(
C->getPriority());
956void OMPClauseProfiler::VisitOMPGrainsizeClause(
const OMPGrainsizeClause *
C) {
957 VisitOMPClauseWithPreInit(
C);
958 if (
C->getGrainsize())
959 Profiler->VisitStmt(
C->getGrainsize());
961void OMPClauseProfiler::VisitOMPNumTasksClause(
const OMPNumTasksClause *
C) {
962 VisitOMPClauseWithPreInit(
C);
963 if (
C->getNumTasks())
964 Profiler->VisitStmt(
C->getNumTasks());
966void OMPClauseProfiler::VisitOMPHintClause(
const OMPHintClause *
C) {
968 Profiler->VisitStmt(
C->getHint());
970void OMPClauseProfiler::VisitOMPToClause(
const OMPToClause *
C) {
971 VisitOMPClauseList(
C);
973void OMPClauseProfiler::VisitOMPFromClause(
const OMPFromClause *
C) {
974 VisitOMPClauseList(
C);
976void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
977 const OMPUseDevicePtrClause *
C) {
978 VisitOMPClauseList(
C);
980void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
981 const OMPUseDeviceAddrClause *
C) {
982 VisitOMPClauseList(
C);
984void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
985 const OMPIsDevicePtrClause *
C) {
986 VisitOMPClauseList(
C);
988void OMPClauseProfiler::VisitOMPHasDeviceAddrClause(
989 const OMPHasDeviceAddrClause *
C) {
990 VisitOMPClauseList(
C);
992void OMPClauseProfiler::VisitOMPNontemporalClause(
993 const OMPNontemporalClause *
C) {
994 VisitOMPClauseList(
C);
995 for (
auto *E :
C->private_refs())
996 Profiler->VisitStmt(E);
998void OMPClauseProfiler::VisitOMPInclusiveClause(
const OMPInclusiveClause *
C) {
999 VisitOMPClauseList(
C);
1001void OMPClauseProfiler::VisitOMPExclusiveClause(
const OMPExclusiveClause *
C) {
1002 VisitOMPClauseList(
C);
1004void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
1005 const OMPUsesAllocatorsClause *
C) {
1006 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
1007 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
1013void OMPClauseProfiler::VisitOMPAffinityClause(
const OMPAffinityClause *
C) {
1014 if (
const Expr *Modifier =
C->getModifier())
1015 Profiler->VisitStmt(Modifier);
1016 for (
const Expr *E :
C->varlist())
1017 Profiler->VisitStmt(E);
1019void OMPClauseProfiler::VisitOMPOrderClause(
const OMPOrderClause *
C) {}
1020void OMPClauseProfiler::VisitOMPBindClause(
const OMPBindClause *
C) {}
1021void OMPClauseProfiler::VisitOMPXDynCGroupMemClause(
1022 const OMPXDynCGroupMemClause *
C) {
1023 VisitOMPClauseWithPreInit(
C);
1024 if (Expr *Size =
C->getSize())
1025 Profiler->VisitStmt(Size);
1027void OMPClauseProfiler::VisitOMPDynGroupprivateClause(
1028 const OMPDynGroupprivateClause *
C) {
1029 VisitOMPClauseWithPreInit(
C);
1030 if (
auto *Size =
C->getSize())
1031 Profiler->VisitStmt(Size);
1033void OMPClauseProfiler::VisitOMPDoacrossClause(
const OMPDoacrossClause *
C) {
1034 VisitOMPClauseList(
C);
1036void OMPClauseProfiler::VisitOMPXAttributeClause(
const OMPXAttributeClause *
C) {
1038void OMPClauseProfiler::VisitOMPXBareClause(
const OMPXBareClause *
C) {}
1042StmtProfiler::VisitOMPExecutableDirective(
const OMPExecutableDirective *S) {
1044 OMPClauseProfiler P(
this);
1045 ArrayRef<OMPClause *> Clauses = S->clauses();
1046 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
1052void StmtProfiler::VisitOMPCanonicalLoop(
const OMPCanonicalLoop *L) {
1056void StmtProfiler::VisitOMPLoopBasedDirective(
const OMPLoopBasedDirective *S) {
1057 VisitOMPExecutableDirective(S);
1060void StmtProfiler::VisitOMPLoopDirective(
const OMPLoopDirective *S) {
1061 VisitOMPLoopBasedDirective(S);
1064void StmtProfiler::VisitOMPMetaDirective(
const OMPMetaDirective *S) {
1065 VisitOMPExecutableDirective(S);
1068void StmtProfiler::VisitOMPParallelDirective(
const OMPParallelDirective *S) {
1069 VisitOMPExecutableDirective(S);
1072void StmtProfiler::VisitOMPSimdDirective(
const OMPSimdDirective *S) {
1073 VisitOMPLoopDirective(S);
1076void StmtProfiler::VisitOMPCanonicalLoopNestTransformationDirective(
1077 const OMPCanonicalLoopNestTransformationDirective *S) {
1078 VisitOMPLoopBasedDirective(S);
1081void StmtProfiler::VisitOMPTileDirective(
const OMPTileDirective *S) {
1082 VisitOMPCanonicalLoopNestTransformationDirective(S);
1085void StmtProfiler::VisitOMPStripeDirective(
const OMPStripeDirective *S) {
1086 VisitOMPCanonicalLoopNestTransformationDirective(S);
1089void StmtProfiler::VisitOMPUnrollDirective(
const OMPUnrollDirective *S) {
1090 VisitOMPCanonicalLoopNestTransformationDirective(S);
1093void StmtProfiler::VisitOMPReverseDirective(
const OMPReverseDirective *S) {
1094 VisitOMPCanonicalLoopNestTransformationDirective(S);
1097void StmtProfiler::VisitOMPInterchangeDirective(
1098 const OMPInterchangeDirective *S) {
1099 VisitOMPCanonicalLoopNestTransformationDirective(S);
1102void StmtProfiler::VisitOMPFlattenDirective(
const OMPFlattenDirective *S) {
1103 VisitOMPCanonicalLoopNestTransformationDirective(S);
1106void StmtProfiler::VisitOMPSplitDirective(
const OMPSplitDirective *S) {
1107 VisitOMPCanonicalLoopNestTransformationDirective(S);
1110void StmtProfiler::VisitOMPCanonicalLoopSequenceTransformationDirective(
1111 const OMPCanonicalLoopSequenceTransformationDirective *S) {
1112 VisitOMPExecutableDirective(S);
1115void StmtProfiler::VisitOMPFuseDirective(
const OMPFuseDirective *S) {
1116 VisitOMPCanonicalLoopSequenceTransformationDirective(S);
1119void StmtProfiler::VisitOMPForDirective(
const OMPForDirective *S) {
1120 VisitOMPLoopDirective(S);
1123void StmtProfiler::VisitOMPForSimdDirective(
const OMPForSimdDirective *S) {
1124 VisitOMPLoopDirective(S);
1127void StmtProfiler::VisitOMPSectionsDirective(
const OMPSectionsDirective *S) {
1128 VisitOMPExecutableDirective(S);
1131void StmtProfiler::VisitOMPSectionDirective(
const OMPSectionDirective *S) {
1132 VisitOMPExecutableDirective(S);
1135void StmtProfiler::VisitOMPScopeDirective(
const OMPScopeDirective *S) {
1136 VisitOMPExecutableDirective(S);
1139void StmtProfiler::VisitOMPSingleDirective(
const OMPSingleDirective *S) {
1140 VisitOMPExecutableDirective(S);
1143void StmtProfiler::VisitOMPMasterDirective(
const OMPMasterDirective *S) {
1144 VisitOMPExecutableDirective(S);
1147void StmtProfiler::VisitOMPCriticalDirective(
const OMPCriticalDirective *S) {
1148 VisitOMPExecutableDirective(S);
1153StmtProfiler::VisitOMPParallelForDirective(
const OMPParallelForDirective *S) {
1154 VisitOMPLoopDirective(S);
1157void StmtProfiler::VisitOMPParallelForSimdDirective(
1158 const OMPParallelForSimdDirective *S) {
1159 VisitOMPLoopDirective(S);
1162void StmtProfiler::VisitOMPParallelMasterDirective(
1163 const OMPParallelMasterDirective *S) {
1164 VisitOMPExecutableDirective(S);
1167void StmtProfiler::VisitOMPParallelMaskedDirective(
1168 const OMPParallelMaskedDirective *S) {
1169 VisitOMPExecutableDirective(S);
1172void StmtProfiler::VisitOMPParallelSectionsDirective(
1173 const OMPParallelSectionsDirective *S) {
1174 VisitOMPExecutableDirective(S);
1177void StmtProfiler::VisitOMPTaskDirective(
const OMPTaskDirective *S) {
1178 VisitOMPExecutableDirective(S);
1181void StmtProfiler::VisitOMPTaskyieldDirective(
const OMPTaskyieldDirective *S) {
1182 VisitOMPExecutableDirective(S);
1185void StmtProfiler::VisitOMPBarrierDirective(
const OMPBarrierDirective *S) {
1186 VisitOMPExecutableDirective(S);
1189void StmtProfiler::VisitOMPTaskwaitDirective(
const OMPTaskwaitDirective *S) {
1190 VisitOMPExecutableDirective(S);
1193void StmtProfiler::VisitOMPAssumeDirective(
const OMPAssumeDirective *S) {
1194 VisitOMPExecutableDirective(S);
1197void StmtProfiler::VisitOMPErrorDirective(
const OMPErrorDirective *S) {
1198 VisitOMPExecutableDirective(S);
1200void StmtProfiler::VisitOMPTaskgroupDirective(
const OMPTaskgroupDirective *S) {
1201 VisitOMPExecutableDirective(S);
1206void StmtProfiler::VisitOMPFlushDirective(
const OMPFlushDirective *S) {
1207 VisitOMPExecutableDirective(S);
1210void StmtProfiler::VisitOMPDepobjDirective(
const OMPDepobjDirective *S) {
1211 VisitOMPExecutableDirective(S);
1214void StmtProfiler::VisitOMPScanDirective(
const OMPScanDirective *S) {
1215 VisitOMPExecutableDirective(S);
1218void StmtProfiler::VisitOMPOrderedStandaloneDirective(
1219 const OMPOrderedStandaloneDirective *S) {
1220 VisitOMPExecutableDirective(S);
1223void StmtProfiler::VisitOMPOrderedBlockAssocDirective(
1224 const OMPOrderedBlockAssocDirective *S) {
1225 VisitOMPExecutableDirective(S);
1228void StmtProfiler::VisitOMPAtomicDirective(
const OMPAtomicDirective *S) {
1229 VisitOMPExecutableDirective(S);
1232void StmtProfiler::VisitOMPTargetDirective(
const OMPTargetDirective *S) {
1233 VisitOMPExecutableDirective(S);
1236void StmtProfiler::VisitOMPTargetDataDirective(
const OMPTargetDataDirective *S) {
1237 VisitOMPExecutableDirective(S);
1240void StmtProfiler::VisitOMPTargetEnterDataDirective(
1241 const OMPTargetEnterDataDirective *S) {
1242 VisitOMPExecutableDirective(S);
1245void StmtProfiler::VisitOMPTargetExitDataDirective(
1246 const OMPTargetExitDataDirective *S) {
1247 VisitOMPExecutableDirective(S);
1250void StmtProfiler::VisitOMPTargetParallelDirective(
1251 const OMPTargetParallelDirective *S) {
1252 VisitOMPExecutableDirective(S);
1255void StmtProfiler::VisitOMPTargetParallelForDirective(
1256 const OMPTargetParallelForDirective *S) {
1257 VisitOMPExecutableDirective(S);
1260void StmtProfiler::VisitOMPTeamsDirective(
const OMPTeamsDirective *S) {
1261 VisitOMPExecutableDirective(S);
1264void StmtProfiler::VisitOMPCancellationPointDirective(
1265 const OMPCancellationPointDirective *S) {
1266 VisitOMPExecutableDirective(S);
1269void StmtProfiler::VisitOMPCancelDirective(
const OMPCancelDirective *S) {
1270 VisitOMPExecutableDirective(S);
1273void StmtProfiler::VisitOMPTaskLoopDirective(
const OMPTaskLoopDirective *S) {
1274 VisitOMPLoopDirective(S);
1277void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1278 const OMPTaskLoopSimdDirective *S) {
1279 VisitOMPLoopDirective(S);
1282void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1283 const OMPMasterTaskLoopDirective *S) {
1284 VisitOMPLoopDirective(S);
1287void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1288 const OMPMaskedTaskLoopDirective *S) {
1289 VisitOMPLoopDirective(S);
1292void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1293 const OMPMasterTaskLoopSimdDirective *S) {
1294 VisitOMPLoopDirective(S);
1297void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1298 const OMPMaskedTaskLoopSimdDirective *S) {
1299 VisitOMPLoopDirective(S);
1302void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1303 const OMPParallelMasterTaskLoopDirective *S) {
1304 VisitOMPLoopDirective(S);
1307void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1308 const OMPParallelMaskedTaskLoopDirective *S) {
1309 VisitOMPLoopDirective(S);
1312void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1313 const OMPParallelMasterTaskLoopSimdDirective *S) {
1314 VisitOMPLoopDirective(S);
1317void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1318 const OMPParallelMaskedTaskLoopSimdDirective *S) {
1319 VisitOMPLoopDirective(S);
1322void StmtProfiler::VisitOMPDistributeDirective(
1323 const OMPDistributeDirective *S) {
1324 VisitOMPLoopDirective(S);
1327void OMPClauseProfiler::VisitOMPDistScheduleClause(
1328 const OMPDistScheduleClause *
C) {
1329 VisitOMPClauseWithPreInit(
C);
1330 if (
auto *S =
C->getChunkSize())
1331 Profiler->VisitStmt(S);
1334void OMPClauseProfiler::VisitOMPDefaultmapClause(
const OMPDefaultmapClause *) {}
1336void StmtProfiler::VisitOMPTargetUpdateDirective(
1337 const OMPTargetUpdateDirective *S) {
1338 VisitOMPExecutableDirective(S);
1341void StmtProfiler::VisitOMPDistributeParallelForDirective(
1342 const OMPDistributeParallelForDirective *S) {
1343 VisitOMPLoopDirective(S);
1346void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1347 const OMPDistributeParallelForSimdDirective *S) {
1348 VisitOMPLoopDirective(S);
1351void StmtProfiler::VisitOMPDistributeSimdDirective(
1352 const OMPDistributeSimdDirective *S) {
1353 VisitOMPLoopDirective(S);
1356void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1357 const OMPTargetParallelForSimdDirective *S) {
1358 VisitOMPLoopDirective(S);
1361void StmtProfiler::VisitOMPTargetSimdDirective(
1362 const OMPTargetSimdDirective *S) {
1363 VisitOMPLoopDirective(S);
1366void StmtProfiler::VisitOMPTeamsDistributeDirective(
1367 const OMPTeamsDistributeDirective *S) {
1368 VisitOMPLoopDirective(S);
1371void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1372 const OMPTeamsDistributeSimdDirective *S) {
1373 VisitOMPLoopDirective(S);
1376void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1377 const OMPTeamsDistributeParallelForSimdDirective *S) {
1378 VisitOMPLoopDirective(S);
1381void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1382 const OMPTeamsDistributeParallelForDirective *S) {
1383 VisitOMPLoopDirective(S);
1386void StmtProfiler::VisitOMPTargetTeamsDirective(
1387 const OMPTargetTeamsDirective *S) {
1388 VisitOMPExecutableDirective(S);
1391void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1392 const OMPTargetTeamsDistributeDirective *S) {
1393 VisitOMPLoopDirective(S);
1396void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1397 const OMPTargetTeamsDistributeParallelForDirective *S) {
1398 VisitOMPLoopDirective(S);
1401void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1402 const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
1403 VisitOMPLoopDirective(S);
1406void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1407 const OMPTargetTeamsDistributeSimdDirective *S) {
1408 VisitOMPLoopDirective(S);
1411void StmtProfiler::VisitOMPInteropDirective(
const OMPInteropDirective *S) {
1412 VisitOMPExecutableDirective(S);
1415void StmtProfiler::VisitOMPDispatchDirective(
const OMPDispatchDirective *S) {
1416 VisitOMPExecutableDirective(S);
1419void StmtProfiler::VisitOMPMaskedDirective(
const OMPMaskedDirective *S) {
1420 VisitOMPExecutableDirective(S);
1423void StmtProfiler::VisitOMPGenericLoopDirective(
1424 const OMPGenericLoopDirective *S) {
1425 VisitOMPLoopDirective(S);
1428void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1429 const OMPTeamsGenericLoopDirective *S) {
1430 VisitOMPLoopDirective(S);
1433void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1434 const OMPTargetTeamsGenericLoopDirective *S) {
1435 VisitOMPLoopDirective(S);
1438void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1439 const OMPParallelGenericLoopDirective *S) {
1440 VisitOMPLoopDirective(S);
1443void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1444 const OMPTargetParallelGenericLoopDirective *S) {
1445 VisitOMPLoopDirective(S);
1448void StmtProfiler::VisitExpr(
const Expr *S) {
1452void StmtProfiler::VisitConstantExpr(
const ConstantExpr *S) {
1457void StmtProfiler::VisitDeclRefExpr(
const DeclRefExpr *S) {
1469void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1470 const SYCLUniqueStableNameExpr *S) {
1475void StmtProfiler::VisitUnresolvedSYCLKernelCallStmt(
1476 const UnresolvedSYCLKernelCallStmt *S) {
1480void StmtProfiler::VisitPredefinedExpr(
const PredefinedExpr *S) {
1485void StmtProfiler::VisitOpenACCAsteriskSizeExpr(
1486 const OpenACCAsteriskSizeExpr *S) {
1490void StmtProfiler::VisitIntegerLiteral(
const IntegerLiteral *S) {
1496 T =
T.getCanonicalType();
1498 if (
auto BitIntT =
T->
getAs<BitIntType>()) {
1499 auto [IsUnsigned, NumBits] = BitIntT->getKey();
1500 ID.AddInteger(IsUnsigned);
1501 ID.AddInteger(NumBits);
1503 ID.AddInteger(
T->
castAs<BuiltinType>()->getKind());
1507void StmtProfiler::VisitFixedPointLiteral(
const FixedPointLiteral *S) {
1513void StmtProfiler::VisitCharacterLiteral(
const CharacterLiteral *S) {
1515 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1519void StmtProfiler::VisitFloatingLiteral(
const FloatingLiteral *S) {
1526void StmtProfiler::VisitImaginaryLiteral(
const ImaginaryLiteral *S) {
1530void StmtProfiler::VisitStringLiteral(
const StringLiteral *S) {
1533 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1536void StmtProfiler::VisitParenExpr(
const ParenExpr *S) {
1540void StmtProfiler::VisitParenListExpr(
const ParenListExpr *S) {
1544void StmtProfiler::VisitUnaryOperator(
const UnaryOperator *S) {
1549void StmtProfiler::VisitOffsetOfExpr(
const OffsetOfExpr *S) {
1552 for (
unsigned i = 0; i < n; ++i) {
1578StmtProfiler::VisitUnaryExprOrTypeTraitExpr(
const UnaryExprOrTypeTraitExpr *S) {
1585void StmtProfiler::VisitArraySubscriptExpr(
const ArraySubscriptExpr *S) {
1589void StmtProfiler::VisitMatrixSingleSubscriptExpr(
1590 const MatrixSingleSubscriptExpr *S) {
1594void StmtProfiler::VisitMatrixSubscriptExpr(
const MatrixSubscriptExpr *S) {
1598void StmtProfiler::VisitArraySectionExpr(
const ArraySectionExpr *S) {
1602void StmtProfiler::VisitOMPArrayShapingExpr(
const OMPArrayShapingExpr *S) {
1606void StmtProfiler::VisitOMPIteratorExpr(
const OMPIteratorExpr *S) {
1612void StmtProfiler::VisitCallExpr(
const CallExpr *S) {
1616void StmtProfiler::VisitMemberExpr(
const MemberExpr *S) {
1624void StmtProfiler::VisitCompoundLiteralExpr(
const CompoundLiteralExpr *S) {
1629void StmtProfiler::VisitCastExpr(
const CastExpr *S) {
1633void StmtProfiler::VisitImplicitCastExpr(
const ImplicitCastExpr *S) {
1638void StmtProfiler::VisitExplicitCastExpr(
const ExplicitCastExpr *S) {
1643void StmtProfiler::VisitCStyleCastExpr(
const CStyleCastExpr *S) {
1644 VisitExplicitCastExpr(S);
1647void StmtProfiler::VisitBinaryOperator(
const BinaryOperator *S) {
1653StmtProfiler::VisitCompoundAssignOperator(
const CompoundAssignOperator *S) {
1654 VisitBinaryOperator(S);
1657void StmtProfiler::VisitConditionalOperator(
const ConditionalOperator *S) {
1661void StmtProfiler::VisitBinaryConditionalOperator(
1662 const BinaryConditionalOperator *S) {
1666void StmtProfiler::VisitAddrLabelExpr(
const AddrLabelExpr *S) {
1671void StmtProfiler::VisitStmtExpr(
const StmtExpr *S) {
1675void StmtProfiler::VisitShuffleVectorExpr(
const ShuffleVectorExpr *S) {
1679void StmtProfiler::VisitConvertVectorExpr(
const ConvertVectorExpr *S) {
1683void StmtProfiler::VisitChooseExpr(
const ChooseExpr *S) {
1687void StmtProfiler::VisitGNUNullExpr(
const GNUNullExpr *S) {
1691void StmtProfiler::VisitVAArgExpr(
const VAArgExpr *S) {
1695void StmtProfiler::VisitInitListExpr(
const InitListExpr *S) {
1704void StmtProfiler::VisitDesignatedInitExpr(
const DesignatedInitExpr *S) {
1707 for (
const DesignatedInitExpr::Designator &D : S->
designators()) {
1708 if (D.isFieldDesignator()) {
1710 VisitName(D.getFieldName());
1714 if (D.isArrayDesignator()) {
1717 assert(D.isArrayRangeDesignator());
1720 ID.AddInteger(D.getArrayIndex());
1726void StmtProfiler::VisitDesignatedInitUpdateExpr(
1727 const DesignatedInitUpdateExpr *S) {
1728 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
1732void StmtProfiler::VisitArrayInitLoopExpr(
const ArrayInitLoopExpr *S) {
1736void StmtProfiler::VisitArrayInitIndexExpr(
const ArrayInitIndexExpr *S) {
1740void StmtProfiler::VisitNoInitExpr(
const NoInitExpr *S) {
1741 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
1744void StmtProfiler::VisitImplicitValueInitExpr(
const ImplicitValueInitExpr *S) {
1748void StmtProfiler::VisitExtVectorElementExpr(
const ExtVectorElementExpr *S) {
1753void StmtProfiler::VisitMatrixElementExpr(
const MatrixElementExpr *S) {
1758void StmtProfiler::VisitBlockExpr(
const BlockExpr *S) {
1763void StmtProfiler::VisitGenericSelectionExpr(
const GenericSelectionExpr *S) {
1767 QualType
T = Assoc.getType();
1769 ID.AddPointer(
nullptr);
1772 VisitExpr(Assoc.getAssociationExpr());
1776void StmtProfiler::VisitPseudoObjectExpr(
const PseudoObjectExpr *S) {
1781 if (
const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1782 Visit(OVE->getSourceExpr());
1785void StmtProfiler::VisitAtomicExpr(
const AtomicExpr *S) {
1790void StmtProfiler::VisitConceptSpecializationExpr(
1791 const ConceptSpecializationExpr *S) {
1795 VisitTemplateArgument(Arg);
1798void StmtProfiler::VisitRequiresExpr(
const RequiresExpr *S) {
1802 VisitDecl(LocalParam);
1805 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1807 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1808 if (!TypeReq->isSubstitutionFailure())
1809 VisitType(TypeReq->getType()->getType());
1810 }
else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1812 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1813 if (!ExprReq->isExprSubstitutionFailure())
1814 Visit(ExprReq->getExpr());
1819 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1820 const concepts::ExprRequirement::ReturnTypeRequirement &RetReq =
1821 ExprReq->getReturnTypeRequirement();
1834 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1835 if (!NestedReq->hasInvalidConstraint())
1836 Visit(NestedReq->getConstraintExpr());
1844 unsigned &NumArgs) {
1850 case OO_Array_Delete:
1852 case OO_Conditional:
1854 llvm_unreachable(
"Invalid operator call kind");
1859 return Stmt::UnaryOperatorClass;
1863 return Stmt::BinaryOperatorClass;
1868 return Stmt::UnaryOperatorClass;
1872 return Stmt::BinaryOperatorClass;
1877 return Stmt::UnaryOperatorClass;
1881 return Stmt::BinaryOperatorClass;
1885 return Stmt::BinaryOperatorClass;
1889 return Stmt::BinaryOperatorClass;
1893 return Stmt::BinaryOperatorClass;
1897 UnaryOp = UO_AddrOf;
1898 return Stmt::UnaryOperatorClass;
1902 return Stmt::BinaryOperatorClass;
1906 return Stmt::BinaryOperatorClass;
1910 return Stmt::UnaryOperatorClass;
1914 return Stmt::UnaryOperatorClass;
1917 BinaryOp = BO_Assign;
1918 return Stmt::BinaryOperatorClass;
1922 return Stmt::BinaryOperatorClass;
1926 return Stmt::BinaryOperatorClass;
1929 BinaryOp = BO_AddAssign;
1930 return Stmt::CompoundAssignOperatorClass;
1933 BinaryOp = BO_SubAssign;
1934 return Stmt::CompoundAssignOperatorClass;
1937 BinaryOp = BO_MulAssign;
1938 return Stmt::CompoundAssignOperatorClass;
1941 BinaryOp = BO_DivAssign;
1942 return Stmt::CompoundAssignOperatorClass;
1944 case OO_PercentEqual:
1945 BinaryOp = BO_RemAssign;
1946 return Stmt::CompoundAssignOperatorClass;
1949 BinaryOp = BO_XorAssign;
1950 return Stmt::CompoundAssignOperatorClass;
1953 BinaryOp = BO_AndAssign;
1954 return Stmt::CompoundAssignOperatorClass;
1957 BinaryOp = BO_OrAssign;
1958 return Stmt::CompoundAssignOperatorClass;
1962 return Stmt::BinaryOperatorClass;
1964 case OO_GreaterGreater:
1966 return Stmt::BinaryOperatorClass;
1968 case OO_LessLessEqual:
1969 BinaryOp = BO_ShlAssign;
1970 return Stmt::CompoundAssignOperatorClass;
1972 case OO_GreaterGreaterEqual:
1973 BinaryOp = BO_ShrAssign;
1974 return Stmt::CompoundAssignOperatorClass;
1978 return Stmt::BinaryOperatorClass;
1980 case OO_ExclaimEqual:
1982 return Stmt::BinaryOperatorClass;
1986 return Stmt::BinaryOperatorClass;
1988 case OO_GreaterEqual:
1990 return Stmt::BinaryOperatorClass;
1994 return Stmt::BinaryOperatorClass;
1998 return Stmt::BinaryOperatorClass;
2002 return Stmt::BinaryOperatorClass;
2005 UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc;
2007 return Stmt::UnaryOperatorClass;
2010 UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec;
2012 return Stmt::UnaryOperatorClass;
2015 BinaryOp = BO_Comma;
2016 return Stmt::BinaryOperatorClass;
2019 BinaryOp = BO_PtrMemI;
2020 return Stmt::BinaryOperatorClass;
2023 return Stmt::ArraySubscriptExprClass;
2026 return Stmt::CallExprClass;
2029 UnaryOp = UO_Coawait;
2030 return Stmt::UnaryOperatorClass;
2033 llvm_unreachable(
"Invalid overloaded operator expression");
2036#if defined(_MSC_VER) && !defined(__clang__)
2041#pragma optimize("", off)
2045void StmtProfiler::VisitCXXOperatorCallExpr(
const CXXOperatorCallExpr *S) {
2053 return Visit(S->
getArg(0));
2061 for (
unsigned I = 0; I != NumArgs; ++I)
2063 if (SC == Stmt::UnaryOperatorClass)
2064 ID.AddInteger(UnaryOp);
2065 else if (SC == Stmt::BinaryOperatorClass ||
2066 SC == Stmt::CompoundAssignOperatorClass)
2067 ID.AddInteger(BinaryOp);
2069 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
2078void StmtProfiler::VisitCXXRewrittenBinaryOperator(
2079 const CXXRewrittenBinaryOperator *S) {
2083 "resolved rewritten operator should never be type-dependent");
2088#if defined(_MSC_VER) && !defined(__clang__)
2090#pragma optimize("", on)
2094void StmtProfiler::VisitCXXMemberCallExpr(
const CXXMemberCallExpr *S) {
2098void StmtProfiler::VisitCUDAKernelCallExpr(
const CUDAKernelCallExpr *S) {
2102void StmtProfiler::VisitAsTypeExpr(
const AsTypeExpr *S) {
2106void StmtProfiler::VisitCXXNamedCastExpr(
const CXXNamedCastExpr *S) {
2107 VisitExplicitCastExpr(S);
2110void StmtProfiler::VisitCXXStaticCastExpr(
const CXXStaticCastExpr *S) {
2111 VisitCXXNamedCastExpr(S);
2114void StmtProfiler::VisitCXXDynamicCastExpr(
const CXXDynamicCastExpr *S) {
2115 VisitCXXNamedCastExpr(S);
2119StmtProfiler::VisitCXXReinterpretCastExpr(
const CXXReinterpretCastExpr *S) {
2120 VisitCXXNamedCastExpr(S);
2123void StmtProfiler::VisitCXXConstCastExpr(
const CXXConstCastExpr *S) {
2124 VisitCXXNamedCastExpr(S);
2127void StmtProfiler::VisitBuiltinBitCastExpr(
const BuiltinBitCastExpr *S) {
2132void StmtProfiler::VisitCXXAddrspaceCastExpr(
const CXXAddrspaceCastExpr *S) {
2133 VisitCXXNamedCastExpr(S);
2136void StmtProfiler::VisitUserDefinedLiteral(
const UserDefinedLiteral *S) {
2140void StmtProfiler::VisitCXXBoolLiteralExpr(
const CXXBoolLiteralExpr *S) {
2145void StmtProfiler::VisitCXXNullPtrLiteralExpr(
const CXXNullPtrLiteralExpr *S) {
2149void StmtProfiler::VisitCXXStdInitializerListExpr(
2150 const CXXStdInitializerListExpr *S) {
2154void StmtProfiler::VisitCXXTypeidExpr(
const CXXTypeidExpr *S) {
2160void StmtProfiler::VisitCXXUuidofExpr(
const CXXUuidofExpr *S) {
2166void StmtProfiler::VisitMSPropertyRefExpr(
const MSPropertyRefExpr *S) {
2171void StmtProfiler::VisitMSPropertySubscriptExpr(
2172 const MSPropertySubscriptExpr *S) {
2176void StmtProfiler::VisitCXXThisExpr(
const CXXThisExpr *S) {
2182void StmtProfiler::VisitCXXThrowExpr(
const CXXThrowExpr *S) {
2186void StmtProfiler::VisitCXXDefaultArgExpr(
const CXXDefaultArgExpr *S) {
2191void StmtProfiler::VisitCXXDefaultInitExpr(
const CXXDefaultInitExpr *S) {
2196void StmtProfiler::VisitCXXBindTemporaryExpr(
const CXXBindTemporaryExpr *S) {
2202void StmtProfiler::VisitCXXConstructExpr(
const CXXConstructExpr *S) {
2208void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2209 const CXXInheritedCtorInitExpr *S) {
2214void StmtProfiler::VisitCXXFunctionalCastExpr(
const CXXFunctionalCastExpr *S) {
2215 VisitExplicitCastExpr(S);
2219StmtProfiler::VisitCXXTemporaryObjectExpr(
const CXXTemporaryObjectExpr *S) {
2220 VisitCXXConstructExpr(S);
2224StmtProfiler::VisitLambdaExpr(
const LambdaExpr *S) {
2225 if (!ProfileLambdaExpr) {
2229 VisitStmtNoChildren(S);
2240 ID.AddInteger(
Capture.getCaptureKind());
2241 if (
Capture.capturesVariable())
2242 VisitDecl(
Capture.getCapturedVar());
2251 for (
auto *SubDecl : Lambda->
decls()) {
2252 FunctionDecl *
Call =
nullptr;
2253 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(SubDecl))
2254 Call = FTD->getTemplatedDecl();
2255 else if (
auto *FD = dyn_cast<FunctionDecl>(SubDecl))
2262 if (!
Call ||
Call->getOverloadedOperator() != OO_Call)
2270void StmtProfiler::VisitCXXReflectExpr(
const CXXReflectExpr *E) {
2272 assert(
false &&
"not implemented yet");
2276StmtProfiler::VisitCXXScalarValueInitExpr(
const CXXScalarValueInitExpr *S) {
2280void StmtProfiler::VisitCXXDeleteExpr(
const CXXDeleteExpr *S) {
2287void StmtProfiler::VisitCXXNewExpr(
const CXXNewExpr *S) {
2300StmtProfiler::VisitCXXPseudoDestructorExpr(
const CXXPseudoDestructorExpr *S) {
2314void StmtProfiler::VisitOverloadExpr(
const OverloadExpr *S) {
2316 bool DescribingDependentVarTemplate =
2318 if (DescribingDependentVarTemplate) {
2322 VisitName(S->
getName(),
true);
2330StmtProfiler::VisitUnresolvedLookupExpr(
const UnresolvedLookupExpr *S) {
2331 VisitOverloadExpr(S);
2334void StmtProfiler::VisitTypeTraitExpr(
const TypeTraitExpr *S) {
2338 for (
unsigned I = 0, N = S->
getNumArgs(); I != N; ++I)
2342void StmtProfiler::VisitArrayTypeTraitExpr(
const ArrayTypeTraitExpr *S) {
2348void StmtProfiler::VisitExpressionTraitExpr(
const ExpressionTraitExpr *S) {
2354void StmtProfiler::VisitDependentScopeDeclRefExpr(
2355 const DependentScopeDeclRefExpr *S) {
2364void StmtProfiler::VisitExprWithCleanups(
const ExprWithCleanups *S) {
2368void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2369 const CXXUnresolvedConstructExpr *S) {
2375void StmtProfiler::VisitDependentTemplateIdExpr(
2376 const DependentTemplateIdExpr *S) {
2383void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2384 const CXXDependentScopeMemberExpr *S) {
2397void StmtProfiler::VisitUnresolvedMemberExpr(
const UnresolvedMemberExpr *S) {
2410void StmtProfiler::VisitCXXNoexceptExpr(
const CXXNoexceptExpr *S) {
2414void StmtProfiler::VisitPackExpansionExpr(
const PackExpansionExpr *S) {
2418void StmtProfiler::VisitSizeOfPackExpr(
const SizeOfPackExpr *S) {
2422 ID.AddInteger(Args.size());
2423 for (
const auto &TA : Args)
2424 VisitTemplateArgument(TA);
2431void StmtProfiler::VisitPackIndexingExpr(
const PackIndexingExpr *E) {
2432 VisitStmtNoChildren(E);
2443void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2444 const SubstNonTypeTemplateParmPackExpr *S) {
2450void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2451 const SubstNonTypeTemplateParmExpr *E) {
2456void StmtProfiler::VisitFunctionParmPackExpr(
const FunctionParmPackExpr *S) {
2464void StmtProfiler::VisitMaterializeTemporaryExpr(
2465 const MaterializeTemporaryExpr *S) {
2469void StmtProfiler::VisitCXXFoldExpr(
const CXXFoldExpr *S) {
2470 VisitStmtNoChildren(S);
2493void StmtProfiler::VisitCXXParenListInitExpr(
const CXXParenListInitExpr *S) {
2497void StmtProfiler::VisitCoroutineBodyStmt(
const CoroutineBodyStmt *S) {
2501void StmtProfiler::VisitCoreturnStmt(
const CoreturnStmt *S) {
2505void StmtProfiler::VisitCoawaitExpr(
const CoawaitExpr *S) {
2509void StmtProfiler::VisitDependentCoawaitExpr(
const DependentCoawaitExpr *S) {
2513void StmtProfiler::VisitCoyieldExpr(
const CoyieldExpr *S) {
2517void StmtProfiler::VisitOpaqueValueExpr(
const OpaqueValueExpr *E) {
2521void StmtProfiler::VisitSourceLocExpr(
const SourceLocExpr *E) {
2525void StmtProfiler::VisitEmbedExpr(
const EmbedExpr *E) { VisitExpr(E); }
2527void StmtProfiler::VisitCXXExpansionSelectExpr(
2528 const CXXExpansionSelectExpr *E) {
2532void StmtProfiler::VisitRecoveryExpr(
const RecoveryExpr *E) { VisitExpr(E); }
2534void StmtProfiler::VisitObjCObjectLiteral(
const ObjCObjectLiteral *E) {
2538void StmtProfiler::VisitObjCStringLiteral(
const ObjCStringLiteral *S) {
2539 VisitObjCObjectLiteral(S);
2542void StmtProfiler::VisitObjCBoxedExpr(
const ObjCBoxedExpr *E) {
2543 VisitObjCObjectLiteral(E);
2546void StmtProfiler::VisitObjCArrayLiteral(
const ObjCArrayLiteral *E) {
2547 VisitObjCObjectLiteral(E);
2550void StmtProfiler::VisitObjCDictionaryLiteral(
const ObjCDictionaryLiteral *E) {
2551 VisitObjCObjectLiteral(E);
2554void StmtProfiler::VisitObjCEncodeExpr(
const ObjCEncodeExpr *S) {
2559void StmtProfiler::VisitObjCSelectorExpr(
const ObjCSelectorExpr *S) {
2564void StmtProfiler::VisitObjCProtocolExpr(
const ObjCProtocolExpr *S) {
2569void StmtProfiler::VisitObjCIvarRefExpr(
const ObjCIvarRefExpr *S) {
2576void StmtProfiler::VisitObjCPropertyRefExpr(
const ObjCPropertyRefExpr *S) {
2590void StmtProfiler::VisitObjCSubscriptRefExpr(
const ObjCSubscriptRefExpr *S) {
2596void StmtProfiler::VisitObjCMessageExpr(
const ObjCMessageExpr *S) {
2602void StmtProfiler::VisitObjCIsaExpr(
const ObjCIsaExpr *S) {
2607void StmtProfiler::VisitObjCBoolLiteralExpr(
const ObjCBoolLiteralExpr *S) {
2612void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2613 const ObjCIndirectCopyRestoreExpr *S) {
2618void StmtProfiler::VisitObjCBridgedCastExpr(
const ObjCBridgedCastExpr *S) {
2619 VisitExplicitCastExpr(S);
2623void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2624 const ObjCAvailabilityCheckExpr *S) {
2628void StmtProfiler::VisitTemplateArguments(
const TemplateArgumentLoc *Args,
2630 ID.AddInteger(NumArgs);
2631 for (
unsigned I = 0; I != NumArgs; ++I)
2635void StmtProfiler::VisitTemplateArgument(
const TemplateArgument &Arg) {
2678 VisitTemplateArgument(P);
2684class OpenACCClauseProfiler
2685 :
public OpenACCClauseVisitor<OpenACCClauseProfiler> {
2686 StmtProfiler &Profiler;
2689 OpenACCClauseProfiler(StmtProfiler &P) : Profiler(P) {}
2691 void VisitOpenACCClauseList(ArrayRef<const OpenACCClause *> Clauses) {
2692 for (
const OpenACCClause *Clause : Clauses) {
2699 void VisitClauseWithVarList(
const OpenACCClauseWithVarList &Clause) {
2701 Profiler.VisitStmt(E);
2704#define VISIT_CLAUSE(CLAUSE_NAME) \
2705 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
2707#include "clang/Basic/OpenACCClauses.def"
2711void OpenACCClauseProfiler::VisitDefaultClause(
2712 const OpenACCDefaultClause &Clause) {}
2714void OpenACCClauseProfiler::VisitIfClause(
const OpenACCIfClause &Clause) {
2716 "if clause requires a valid condition expr");
2720void OpenACCClauseProfiler::VisitCopyClause(
const OpenACCCopyClause &Clause) {
2721 VisitClauseWithVarList(Clause);
2724void OpenACCClauseProfiler::VisitLinkClause(
const OpenACCLinkClause &Clause) {
2725 VisitClauseWithVarList(Clause);
2728void OpenACCClauseProfiler::VisitDeviceResidentClause(
2729 const OpenACCDeviceResidentClause &Clause) {
2730 VisitClauseWithVarList(Clause);
2733void OpenACCClauseProfiler::VisitCopyInClause(
2734 const OpenACCCopyInClause &Clause) {
2735 VisitClauseWithVarList(Clause);
2738void OpenACCClauseProfiler::VisitCopyOutClause(
2739 const OpenACCCopyOutClause &Clause) {
2740 VisitClauseWithVarList(Clause);
2743void OpenACCClauseProfiler::VisitCreateClause(
2744 const OpenACCCreateClause &Clause) {
2745 VisitClauseWithVarList(Clause);
2748void OpenACCClauseProfiler::VisitHostClause(
const OpenACCHostClause &Clause) {
2749 VisitClauseWithVarList(Clause);
2752void OpenACCClauseProfiler::VisitDeviceClause(
2753 const OpenACCDeviceClause &Clause) {
2754 VisitClauseWithVarList(Clause);
2757void OpenACCClauseProfiler::VisitSelfClause(
const OpenACCSelfClause &Clause) {
2763 Profiler.VisitStmt(E);
2767void OpenACCClauseProfiler::VisitFinalizeClause(
2768 const OpenACCFinalizeClause &Clause) {}
2770void OpenACCClauseProfiler::VisitIfPresentClause(
2771 const OpenACCIfPresentClause &Clause) {}
2773void OpenACCClauseProfiler::VisitNumGangsClause(
2774 const OpenACCNumGangsClause &Clause) {
2776 Profiler.VisitStmt(E);
2779void OpenACCClauseProfiler::VisitTileClause(
const OpenACCTileClause &Clause) {
2781 Profiler.VisitStmt(E);
2784void OpenACCClauseProfiler::VisitNumWorkersClause(
2785 const OpenACCNumWorkersClause &Clause) {
2786 assert(Clause.
hasIntExpr() &&
"num_workers clause requires a valid int expr");
2790void OpenACCClauseProfiler::VisitCollapseClause(
2791 const OpenACCCollapseClause &Clause) {
2792 assert(Clause.
getLoopCount() &&
"collapse clause requires a valid int expr");
2796void OpenACCClauseProfiler::VisitPrivateClause(
2797 const OpenACCPrivateClause &Clause) {
2798 VisitClauseWithVarList(Clause);
2801 Profiler.VisitDecl(Recipe.AllocaDecl);
2805void OpenACCClauseProfiler::VisitFirstPrivateClause(
2806 const OpenACCFirstPrivateClause &Clause) {
2807 VisitClauseWithVarList(Clause);
2810 Profiler.VisitDecl(Recipe.AllocaDecl);
2811 Profiler.VisitDecl(Recipe.InitFromTemporary);
2815void OpenACCClauseProfiler::VisitAttachClause(
2816 const OpenACCAttachClause &Clause) {
2817 VisitClauseWithVarList(Clause);
2820void OpenACCClauseProfiler::VisitDetachClause(
2821 const OpenACCDetachClause &Clause) {
2822 VisitClauseWithVarList(Clause);
2825void OpenACCClauseProfiler::VisitDeleteClause(
2826 const OpenACCDeleteClause &Clause) {
2827 VisitClauseWithVarList(Clause);
2830void OpenACCClauseProfiler::VisitDevicePtrClause(
2831 const OpenACCDevicePtrClause &Clause) {
2832 VisitClauseWithVarList(Clause);
2835void OpenACCClauseProfiler::VisitNoCreateClause(
2836 const OpenACCNoCreateClause &Clause) {
2837 VisitClauseWithVarList(Clause);
2840void OpenACCClauseProfiler::VisitPresentClause(
2841 const OpenACCPresentClause &Clause) {
2842 VisitClauseWithVarList(Clause);
2845void OpenACCClauseProfiler::VisitUseDeviceClause(
2846 const OpenACCUseDeviceClause &Clause) {
2847 VisitClauseWithVarList(Clause);
2850void OpenACCClauseProfiler::VisitVectorLengthClause(
2851 const OpenACCVectorLengthClause &Clause) {
2853 "vector_length clause requires a valid int expr");
2857void OpenACCClauseProfiler::VisitAsyncClause(
const OpenACCAsyncClause &Clause) {
2862void OpenACCClauseProfiler::VisitDeviceNumClause(
2863 const OpenACCDeviceNumClause &Clause) {
2867void OpenACCClauseProfiler::VisitDefaultAsyncClause(
2868 const OpenACCDefaultAsyncClause &Clause) {
2872void OpenACCClauseProfiler::VisitWorkerClause(
2873 const OpenACCWorkerClause &Clause) {
2878void OpenACCClauseProfiler::VisitVectorClause(
2879 const OpenACCVectorClause &Clause) {
2884void OpenACCClauseProfiler::VisitWaitClause(
const OpenACCWaitClause &Clause) {
2888 Profiler.VisitStmt(E);
2892void OpenACCClauseProfiler::VisitDeviceTypeClause(
2893 const OpenACCDeviceTypeClause &Clause) {}
2895void OpenACCClauseProfiler::VisitAutoClause(
const OpenACCAutoClause &Clause) {}
2897void OpenACCClauseProfiler::VisitIndependentClause(
2898 const OpenACCIndependentClause &Clause) {}
2900void OpenACCClauseProfiler::VisitSeqClause(
const OpenACCSeqClause &Clause) {}
2901void OpenACCClauseProfiler::VisitNoHostClause(
2902 const OpenACCNoHostClause &Clause) {}
2904void OpenACCClauseProfiler::VisitGangClause(
const OpenACCGangClause &Clause) {
2905 for (
unsigned I = 0; I < Clause.
getNumExprs(); ++I) {
2906 Profiler.VisitStmt(Clause.
getExpr(I).second);
2910void OpenACCClauseProfiler::VisitReductionClause(
2911 const OpenACCReductionClause &Clause) {
2912 VisitClauseWithVarList(Clause);
2915 Profiler.VisitDecl(Recipe.AllocaDecl);
2920 static_assert(
sizeof(OpenACCReductionRecipe::CombinerRecipe) ==
2922 for (
auto &CombinerRecipe : Recipe.CombinerRecipes) {
2923 if (CombinerRecipe.Op) {
2924 Profiler.VisitDecl(CombinerRecipe.LHS);
2925 Profiler.VisitDecl(CombinerRecipe.RHS);
2926 Profiler.VisitStmt(CombinerRecipe.Op);
2932void OpenACCClauseProfiler::VisitBindClause(
const OpenACCBindClause &Clause) {
2933 assert(
false &&
"not implemented... what can we do about our expr?");
2937void StmtProfiler::VisitOpenACCComputeConstruct(
2942 OpenACCClauseProfiler P{*
this};
2943 P.VisitOpenACCClauseList(S->clauses());
2946void StmtProfiler::VisitOpenACCLoopConstruct(
const OpenACCLoopConstruct *S) {
2950 OpenACCClauseProfiler P{*
this};
2951 P.VisitOpenACCClauseList(S->clauses());
2954void StmtProfiler::VisitOpenACCCombinedConstruct(
2955 const OpenACCCombinedConstruct *S) {
2959 OpenACCClauseProfiler P{*
this};
2960 P.VisitOpenACCClauseList(S->clauses());
2963void StmtProfiler::VisitOpenACCDataConstruct(
const OpenACCDataConstruct *S) {
2966 OpenACCClauseProfiler P{*
this};
2967 P.VisitOpenACCClauseList(S->clauses());
2970void StmtProfiler::VisitOpenACCEnterDataConstruct(
2971 const OpenACCEnterDataConstruct *S) {
2974 OpenACCClauseProfiler P{*
this};
2975 P.VisitOpenACCClauseList(S->clauses());
2978void StmtProfiler::VisitOpenACCExitDataConstruct(
2979 const OpenACCExitDataConstruct *S) {
2982 OpenACCClauseProfiler P{*
this};
2983 P.VisitOpenACCClauseList(S->clauses());
2986void StmtProfiler::VisitOpenACCHostDataConstruct(
2987 const OpenACCHostDataConstruct *S) {
2990 OpenACCClauseProfiler P{*
this};
2991 P.VisitOpenACCClauseList(S->clauses());
2994void StmtProfiler::VisitOpenACCWaitConstruct(
const OpenACCWaitConstruct *S) {
2998 OpenACCClauseProfiler P{*
this};
2999 P.VisitOpenACCClauseList(S->clauses());
3002void StmtProfiler::VisitOpenACCCacheConstruct(
const OpenACCCacheConstruct *S) {
3007void StmtProfiler::VisitOpenACCInitConstruct(
const OpenACCInitConstruct *S) {
3009 OpenACCClauseProfiler P{*
this};
3010 P.VisitOpenACCClauseList(S->clauses());
3013void StmtProfiler::VisitOpenACCShutdownConstruct(
3014 const OpenACCShutdownConstruct *S) {
3016 OpenACCClauseProfiler P{*
this};
3017 P.VisitOpenACCClauseList(S->clauses());
3020void StmtProfiler::VisitOpenACCSetConstruct(
const OpenACCSetConstruct *S) {
3022 OpenACCClauseProfiler P{*
this};
3023 P.VisitOpenACCClauseList(S->clauses());
3026void StmtProfiler::VisitOpenACCUpdateConstruct(
3027 const OpenACCUpdateConstruct *S) {
3029 OpenACCClauseProfiler P{*
this};
3030 P.VisitOpenACCClauseList(S->clauses());
3033void StmtProfiler::VisitOpenACCAtomicConstruct(
3034 const OpenACCAtomicConstruct *S) {
3036 OpenACCClauseProfiler P{*
this};
3037 P.VisitOpenACCClauseList(S->clauses());
3040void StmtProfiler::VisitHLSLOutArgExpr(
const HLSLOutArgExpr *S) {
3045 bool Canonical,
bool ProfileLambdaExpr)
const {
3046 StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr);
3047 Profiler.Visit(
this);
3052 StmtProfilerWithoutPointers Profiler(ID, Hash);
3053 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.