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;
61 virtual void VisitType(
QualType T) = 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())
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::VisitMSDependentExistsStmt(
const MSDependentExistsStmt *S) {
379void StmtProfiler::VisitSEHTryStmt(
const SEHTryStmt *S) {
383void StmtProfiler::VisitSEHFinallyStmt(
const SEHFinallyStmt *S) {
387void StmtProfiler::VisitSEHExceptStmt(
const SEHExceptStmt *S) {
391void StmtProfiler::VisitSEHLeaveStmt(
const SEHLeaveStmt *S) {
395void StmtProfiler::VisitCapturedStmt(
const CapturedStmt *S) {
399void StmtProfiler::VisitSYCLKernelCallStmt(
const SYCLKernelCallStmt *S) {
403void StmtProfiler::VisitObjCForCollectionStmt(
const ObjCForCollectionStmt *S) {
407void StmtProfiler::VisitObjCAtCatchStmt(
const ObjCAtCatchStmt *S) {
414void StmtProfiler::VisitObjCAtFinallyStmt(
const ObjCAtFinallyStmt *S) {
418void StmtProfiler::VisitObjCAtTryStmt(
const ObjCAtTryStmt *S) {
423StmtProfiler::VisitObjCAtSynchronizedStmt(
const ObjCAtSynchronizedStmt *S) {
427void StmtProfiler::VisitObjCAtThrowStmt(
const ObjCAtThrowStmt *S) {
432StmtProfiler::VisitObjCAutoreleasePoolStmt(
const ObjCAutoreleasePoolStmt *S) {
437class OMPClauseProfiler :
public ConstOMPClauseVisitor<OMPClauseProfiler> {
438 StmtProfiler *Profiler;
440 template <
typename T>
441 void VisitOMPClauseList(T *Node);
444 OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
445#define GEN_CLANG_CLAUSE_CLASS
446#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C);
447#include "llvm/Frontend/OpenMP/OMP.inc"
452void OMPClauseProfiler::VisitOMPClauseWithPreInit(
453 const OMPClauseWithPreInit *
C) {
454 if (
auto *S =
C->getPreInitStmt())
455 Profiler->VisitStmt(S);
458void OMPClauseProfiler::VisitOMPClauseWithPostUpdate(
459 const OMPClauseWithPostUpdate *
C) {
460 VisitOMPClauseWithPreInit(
C);
461 if (
auto *E =
C->getPostUpdateExpr())
462 Profiler->VisitStmt(E);
465void OMPClauseProfiler::VisitOMPIfClause(
const OMPIfClause *
C) {
466 VisitOMPClauseWithPreInit(
C);
467 if (
C->getCondition())
468 Profiler->VisitStmt(
C->getCondition());
471void OMPClauseProfiler::VisitOMPFinalClause(
const OMPFinalClause *
C) {
472 VisitOMPClauseWithPreInit(
C);
473 if (
C->getCondition())
474 Profiler->VisitStmt(
C->getCondition());
477void OMPClauseProfiler::VisitOMPNumThreadsClause(
const OMPNumThreadsClause *
C) {
478 VisitOMPClauseWithPreInit(
C);
479 if (
C->getNumThreads())
480 Profiler->VisitStmt(
C->getNumThreads());
483void OMPClauseProfiler::VisitOMPAlignClause(
const OMPAlignClause *
C) {
484 if (
C->getAlignment())
485 Profiler->VisitStmt(
C->getAlignment());
488void OMPClauseProfiler::VisitOMPSafelenClause(
const OMPSafelenClause *
C) {
490 Profiler->VisitStmt(
C->getSafelen());
493void OMPClauseProfiler::VisitOMPSimdlenClause(
const OMPSimdlenClause *
C) {
495 Profiler->VisitStmt(
C->getSimdlen());
498void OMPClauseProfiler::VisitOMPSizesClause(
const OMPSizesClause *
C) {
499 for (
auto *E :
C->getSizesRefs())
501 Profiler->VisitExpr(E);
504void OMPClauseProfiler::VisitOMPCountsClause(
const OMPCountsClause *
C) {
505 for (
auto *E :
C->getCountsRefs())
507 Profiler->VisitExpr(E);
510void OMPClauseProfiler::VisitOMPPermutationClause(
511 const OMPPermutationClause *
C) {
512 for (Expr *E :
C->getArgsRefs())
514 Profiler->VisitExpr(E);
517void OMPClauseProfiler::VisitOMPFullClause(
const OMPFullClause *
C) {}
519void OMPClauseProfiler::VisitOMPPartialClause(
const OMPPartialClause *
C) {
520 if (
const Expr *Factor =
C->getFactor())
521 Profiler->VisitExpr(Factor);
524void OMPClauseProfiler::VisitOMPLoopRangeClause(
const OMPLoopRangeClause *
C) {
525 if (
const Expr *
First =
C->getFirst())
526 Profiler->VisitExpr(
First);
527 if (
const Expr *Count =
C->getCount())
528 Profiler->VisitExpr(Count);
531void OMPClauseProfiler::VisitOMPAllocatorClause(
const OMPAllocatorClause *
C) {
532 if (
C->getAllocator())
533 Profiler->VisitStmt(
C->getAllocator());
536void OMPClauseProfiler::VisitOMPCollapseClause(
const OMPCollapseClause *
C) {
537 if (
C->getNumForLoops())
538 Profiler->VisitStmt(
C->getNumForLoops());
541void OMPClauseProfiler::VisitOMPDetachClause(
const OMPDetachClause *
C) {
542 if (Expr *Evt =
C->getEventHandler())
543 Profiler->VisitStmt(Evt);
546void OMPClauseProfiler::VisitOMPNovariantsClause(
const OMPNovariantsClause *
C) {
547 VisitOMPClauseWithPreInit(
C);
548 if (
C->getCondition())
549 Profiler->VisitStmt(
C->getCondition());
552void OMPClauseProfiler::VisitOMPNocontextClause(
const OMPNocontextClause *
C) {
553 VisitOMPClauseWithPreInit(
C);
554 if (
C->getCondition())
555 Profiler->VisitStmt(
C->getCondition());
558void OMPClauseProfiler::VisitOMPDefaultClause(
const OMPDefaultClause *
C) { }
560void OMPClauseProfiler::VisitOMPThreadsetClause(
const OMPThreadsetClause *
C) {}
562void OMPClauseProfiler::VisitOMPTransparentClause(
563 const OMPTransparentClause *
C) {
564 if (
C->getImpexType())
565 Profiler->VisitStmt(
C->getImpexType());
568void OMPClauseProfiler::VisitOMPProcBindClause(
const OMPProcBindClause *
C) { }
570void OMPClauseProfiler::VisitOMPUnifiedAddressClause(
571 const OMPUnifiedAddressClause *
C) {}
573void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause(
574 const OMPUnifiedSharedMemoryClause *
C) {}
576void OMPClauseProfiler::VisitOMPReverseOffloadClause(
577 const OMPReverseOffloadClause *
C) {}
579void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
580 const OMPDynamicAllocatorsClause *
C) {}
582void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause(
583 const OMPAtomicDefaultMemOrderClause *
C) {}
585void OMPClauseProfiler::VisitOMPSelfMapsClause(
const OMPSelfMapsClause *
C) {}
587void OMPClauseProfiler::VisitOMPAtClause(
const OMPAtClause *
C) {}
589void OMPClauseProfiler::VisitOMPSeverityClause(
const OMPSeverityClause *
C) {}
591void OMPClauseProfiler::VisitOMPMessageClause(
const OMPMessageClause *
C) {
592 if (
C->getMessageString())
593 Profiler->VisitStmt(
C->getMessageString());
596void OMPClauseProfiler::VisitOMPScheduleClause(
const OMPScheduleClause *
C) {
597 VisitOMPClauseWithPreInit(
C);
598 if (
auto *S =
C->getChunkSize())
599 Profiler->VisitStmt(S);
602void OMPClauseProfiler::VisitOMPOrderedClause(
const OMPOrderedClause *
C) {
603 if (
auto *
Num =
C->getNumForLoops())
604 Profiler->VisitStmt(
Num);
607void OMPClauseProfiler::VisitOMPNowaitClause(
const OMPNowaitClause *
C) {
608 if (
C->getCondition())
609 Profiler->VisitStmt(
C->getCondition());
612void OMPClauseProfiler::VisitOMPUntiedClause(
const OMPUntiedClause *) {}
614void OMPClauseProfiler::VisitOMPMergeableClause(
const OMPMergeableClause *) {}
616void OMPClauseProfiler::VisitOMPReadClause(
const OMPReadClause *) {}
618void OMPClauseProfiler::VisitOMPWriteClause(
const OMPWriteClause *) {}
620void OMPClauseProfiler::VisitOMPUpdateClause(
const OMPUpdateClause *) {}
622void OMPClauseProfiler::VisitOMPCaptureClause(
const OMPCaptureClause *) {}
624void OMPClauseProfiler::VisitOMPCompareClause(
const OMPCompareClause *) {}
626void OMPClauseProfiler::VisitOMPFailClause(
const OMPFailClause *) {}
628void OMPClauseProfiler::VisitOMPAbsentClause(
const OMPAbsentClause *) {}
630void OMPClauseProfiler::VisitOMPHoldsClause(
const OMPHoldsClause *) {}
632void OMPClauseProfiler::VisitOMPContainsClause(
const OMPContainsClause *) {}
634void OMPClauseProfiler::VisitOMPNoOpenMPClause(
const OMPNoOpenMPClause *) {}
636void OMPClauseProfiler::VisitOMPNoOpenMPRoutinesClause(
637 const OMPNoOpenMPRoutinesClause *) {}
639void OMPClauseProfiler::VisitOMPNoOpenMPConstructsClause(
640 const OMPNoOpenMPConstructsClause *) {}
642void OMPClauseProfiler::VisitOMPNoParallelismClause(
643 const OMPNoParallelismClause *) {}
645void OMPClauseProfiler::VisitOMPSeqCstClause(
const OMPSeqCstClause *) {}
647void OMPClauseProfiler::VisitOMPAcqRelClause(
const OMPAcqRelClause *) {}
649void OMPClauseProfiler::VisitOMPAcquireClause(
const OMPAcquireClause *) {}
651void OMPClauseProfiler::VisitOMPReleaseClause(
const OMPReleaseClause *) {}
653void OMPClauseProfiler::VisitOMPRelaxedClause(
const OMPRelaxedClause *) {}
655void OMPClauseProfiler::VisitOMPWeakClause(
const OMPWeakClause *) {}
657void OMPClauseProfiler::VisitOMPThreadsClause(
const OMPThreadsClause *) {}
659void OMPClauseProfiler::VisitOMPSIMDClause(
const OMPSIMDClause *) {}
661void OMPClauseProfiler::VisitOMPNogroupClause(
const OMPNogroupClause *) {}
663void OMPClauseProfiler::VisitOMPInitClause(
const OMPInitClause *
C) {
665 Profiler->VisitStmt(
C->getInteropVar());
666 Profiler->VisitInteger(
C->hasPreferAttrs() ? 1 : 0);
667 Profiler->VisitInteger(
C->varlist_size() - 1);
668 for (OMPInitClause::PrefView P :
C->prefs()) {
669 Profiler->VisitInteger(P.Fr ? 1 : 0);
671 Profiler->VisitStmt(P.Fr);
672 Profiler->VisitInteger(P.Attrs.size());
673 for (
const Expr *A : P.Attrs)
674 Profiler->VisitStmt(A);
678void OMPClauseProfiler::VisitOMPUseClause(
const OMPUseClause *
C) {
679 if (
C->getInteropVar())
680 Profiler->VisitStmt(
C->getInteropVar());
683void OMPClauseProfiler::VisitOMPDestroyClause(
const OMPDestroyClause *
C) {
684 if (
C->getInteropVar())
685 Profiler->VisitStmt(
C->getInteropVar());
688void OMPClauseProfiler::VisitOMPFilterClause(
const OMPFilterClause *
C) {
689 VisitOMPClauseWithPreInit(
C);
690 if (
C->getThreadID())
691 Profiler->VisitStmt(
C->getThreadID());
695void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
696 for (
auto *E : Node->varlist()) {
698 Profiler->VisitStmt(E);
702void OMPClauseProfiler::VisitOMPPrivateClause(
const OMPPrivateClause *
C) {
703 VisitOMPClauseList(
C);
704 for (
auto *E :
C->private_copies()) {
706 Profiler->VisitStmt(E);
710OMPClauseProfiler::VisitOMPFirstprivateClause(
const OMPFirstprivateClause *
C) {
711 VisitOMPClauseList(
C);
712 VisitOMPClauseWithPreInit(
C);
713 for (
auto *E :
C->private_copies()) {
715 Profiler->VisitStmt(E);
717 for (
auto *E :
C->inits()) {
719 Profiler->VisitStmt(E);
723OMPClauseProfiler::VisitOMPLastprivateClause(
const OMPLastprivateClause *
C) {
724 VisitOMPClauseList(
C);
725 VisitOMPClauseWithPostUpdate(
C);
726 for (
auto *E :
C->source_exprs()) {
728 Profiler->VisitStmt(E);
730 for (
auto *E :
C->destination_exprs()) {
732 Profiler->VisitStmt(E);
734 for (
auto *E :
C->assignment_ops()) {
736 Profiler->VisitStmt(E);
739void OMPClauseProfiler::VisitOMPSharedClause(
const OMPSharedClause *
C) {
740 VisitOMPClauseList(
C);
742void OMPClauseProfiler::VisitOMPReductionClause(
743 const OMPReductionClause *
C) {
744 Profiler->VisitNestedNameSpecifier(
745 C->getQualifierLoc().getNestedNameSpecifier());
746 Profiler->VisitName(
C->getNameInfo().getName());
747 VisitOMPClauseList(
C);
748 VisitOMPClauseWithPostUpdate(
C);
749 for (
auto *E :
C->privates()) {
751 Profiler->VisitStmt(E);
753 for (
auto *E :
C->lhs_exprs()) {
755 Profiler->VisitStmt(E);
757 for (
auto *E :
C->rhs_exprs()) {
759 Profiler->VisitStmt(E);
761 for (
auto *E :
C->reduction_ops()) {
763 Profiler->VisitStmt(E);
765 if (
C->getModifier() == clang::OMPC_REDUCTION_inscan) {
766 for (
auto *E :
C->copy_ops()) {
768 Profiler->VisitStmt(E);
770 for (
auto *E :
C->copy_array_temps()) {
772 Profiler->VisitStmt(E);
774 for (
auto *E :
C->copy_array_elems()) {
776 Profiler->VisitStmt(E);
780void OMPClauseProfiler::VisitOMPTaskReductionClause(
781 const OMPTaskReductionClause *
C) {
782 Profiler->VisitNestedNameSpecifier(
783 C->getQualifierLoc().getNestedNameSpecifier());
784 Profiler->VisitName(
C->getNameInfo().getName());
785 VisitOMPClauseList(
C);
786 VisitOMPClauseWithPostUpdate(
C);
787 for (
auto *E :
C->privates()) {
789 Profiler->VisitStmt(E);
791 for (
auto *E :
C->lhs_exprs()) {
793 Profiler->VisitStmt(E);
795 for (
auto *E :
C->rhs_exprs()) {
797 Profiler->VisitStmt(E);
799 for (
auto *E :
C->reduction_ops()) {
801 Profiler->VisitStmt(E);
804void OMPClauseProfiler::VisitOMPInReductionClause(
805 const OMPInReductionClause *
C) {
806 Profiler->VisitNestedNameSpecifier(
807 C->getQualifierLoc().getNestedNameSpecifier());
808 Profiler->VisitName(
C->getNameInfo().getName());
809 VisitOMPClauseList(
C);
810 VisitOMPClauseWithPostUpdate(
C);
811 for (
auto *E :
C->privates()) {
813 Profiler->VisitStmt(E);
815 for (
auto *E :
C->lhs_exprs()) {
817 Profiler->VisitStmt(E);
819 for (
auto *E :
C->rhs_exprs()) {
821 Profiler->VisitStmt(E);
823 for (
auto *E :
C->reduction_ops()) {
825 Profiler->VisitStmt(E);
827 for (
auto *E :
C->taskgroup_descriptors()) {
829 Profiler->VisitStmt(E);
832void OMPClauseProfiler::VisitOMPLinearClause(
const OMPLinearClause *
C) {
833 VisitOMPClauseList(
C);
834 VisitOMPClauseWithPostUpdate(
C);
835 for (
auto *E :
C->privates()) {
837 Profiler->VisitStmt(E);
839 for (
auto *E :
C->inits()) {
841 Profiler->VisitStmt(E);
843 for (
auto *E :
C->updates()) {
845 Profiler->VisitStmt(E);
847 for (
auto *E :
C->finals()) {
849 Profiler->VisitStmt(E);
852 Profiler->VisitStmt(
C->getStep());
853 if (
C->getCalcStep())
854 Profiler->VisitStmt(
C->getCalcStep());
856void OMPClauseProfiler::VisitOMPAlignedClause(
const OMPAlignedClause *
C) {
857 VisitOMPClauseList(
C);
858 if (
C->getAlignment())
859 Profiler->VisitStmt(
C->getAlignment());
861void OMPClauseProfiler::VisitOMPCopyinClause(
const OMPCopyinClause *
C) {
862 VisitOMPClauseList(
C);
863 for (
auto *E :
C->source_exprs()) {
865 Profiler->VisitStmt(E);
867 for (
auto *E :
C->destination_exprs()) {
869 Profiler->VisitStmt(E);
871 for (
auto *E :
C->assignment_ops()) {
873 Profiler->VisitStmt(E);
877OMPClauseProfiler::VisitOMPCopyprivateClause(
const OMPCopyprivateClause *
C) {
878 VisitOMPClauseList(
C);
879 for (
auto *E :
C->source_exprs()) {
881 Profiler->VisitStmt(E);
883 for (
auto *E :
C->destination_exprs()) {
885 Profiler->VisitStmt(E);
887 for (
auto *E :
C->assignment_ops()) {
889 Profiler->VisitStmt(E);
892void OMPClauseProfiler::VisitOMPFlushClause(
const OMPFlushClause *
C) {
893 VisitOMPClauseList(
C);
895void OMPClauseProfiler::VisitOMPDepobjClause(
const OMPDepobjClause *
C) {
896 if (
const Expr *Depobj =
C->getDepobj())
897 Profiler->VisitStmt(Depobj);
899void OMPClauseProfiler::VisitOMPDependClause(
const OMPDependClause *
C) {
900 VisitOMPClauseList(
C);
902void OMPClauseProfiler::VisitOMPDeviceClause(
const OMPDeviceClause *
C) {
904 Profiler->VisitStmt(
C->getDevice());
906void OMPClauseProfiler::VisitOMPMapClause(
const OMPMapClause *
C) {
907 VisitOMPClauseList(
C);
909void OMPClauseProfiler::VisitOMPAllocateClause(
const OMPAllocateClause *
C) {
910 if (Expr *Allocator =
C->getAllocator())
911 Profiler->VisitStmt(Allocator);
912 VisitOMPClauseList(
C);
914void OMPClauseProfiler::VisitOMPNumTeamsClause(
const OMPNumTeamsClause *
C) {
915 Profiler->VisitInteger(
C->getModifier());
916 if (
const Expr *Modifier =
C->getModifierExpr())
917 Profiler->VisitStmt(Modifier);
918 VisitOMPClauseList(
C);
919 VisitOMPClauseWithPreInit(
C);
921void OMPClauseProfiler::VisitOMPThreadLimitClause(
922 const OMPThreadLimitClause *
C) {
923 VisitOMPClauseList(
C);
924 VisitOMPClauseWithPreInit(
C);
926void OMPClauseProfiler::VisitOMPPriorityClause(
const OMPPriorityClause *
C) {
927 VisitOMPClauseWithPreInit(
C);
928 if (
C->getPriority())
929 Profiler->VisitStmt(
C->getPriority());
931void OMPClauseProfiler::VisitOMPGrainsizeClause(
const OMPGrainsizeClause *
C) {
932 VisitOMPClauseWithPreInit(
C);
933 if (
C->getGrainsize())
934 Profiler->VisitStmt(
C->getGrainsize());
936void OMPClauseProfiler::VisitOMPNumTasksClause(
const OMPNumTasksClause *
C) {
937 VisitOMPClauseWithPreInit(
C);
938 if (
C->getNumTasks())
939 Profiler->VisitStmt(
C->getNumTasks());
941void OMPClauseProfiler::VisitOMPHintClause(
const OMPHintClause *
C) {
943 Profiler->VisitStmt(
C->getHint());
945void OMPClauseProfiler::VisitOMPToClause(
const OMPToClause *
C) {
946 VisitOMPClauseList(
C);
948void OMPClauseProfiler::VisitOMPFromClause(
const OMPFromClause *
C) {
949 VisitOMPClauseList(
C);
951void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
952 const OMPUseDevicePtrClause *
C) {
953 VisitOMPClauseList(
C);
955void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
956 const OMPUseDeviceAddrClause *
C) {
957 VisitOMPClauseList(
C);
959void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
960 const OMPIsDevicePtrClause *
C) {
961 VisitOMPClauseList(
C);
963void OMPClauseProfiler::VisitOMPHasDeviceAddrClause(
964 const OMPHasDeviceAddrClause *
C) {
965 VisitOMPClauseList(
C);
967void OMPClauseProfiler::VisitOMPNontemporalClause(
968 const OMPNontemporalClause *
C) {
969 VisitOMPClauseList(
C);
970 for (
auto *E :
C->private_refs())
971 Profiler->VisitStmt(E);
973void OMPClauseProfiler::VisitOMPInclusiveClause(
const OMPInclusiveClause *
C) {
974 VisitOMPClauseList(
C);
976void OMPClauseProfiler::VisitOMPExclusiveClause(
const OMPExclusiveClause *
C) {
977 VisitOMPClauseList(
C);
979void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
980 const OMPUsesAllocatorsClause *
C) {
981 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
982 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
988void OMPClauseProfiler::VisitOMPAffinityClause(
const OMPAffinityClause *
C) {
989 if (
const Expr *Modifier =
C->getModifier())
990 Profiler->VisitStmt(Modifier);
991 for (
const Expr *E :
C->varlist())
992 Profiler->VisitStmt(E);
994void OMPClauseProfiler::VisitOMPOrderClause(
const OMPOrderClause *
C) {}
995void OMPClauseProfiler::VisitOMPBindClause(
const OMPBindClause *
C) {}
996void OMPClauseProfiler::VisitOMPXDynCGroupMemClause(
997 const OMPXDynCGroupMemClause *
C) {
998 VisitOMPClauseWithPreInit(
C);
999 if (Expr *Size =
C->getSize())
1000 Profiler->VisitStmt(Size);
1002void OMPClauseProfiler::VisitOMPDynGroupprivateClause(
1003 const OMPDynGroupprivateClause *
C) {
1004 VisitOMPClauseWithPreInit(
C);
1005 if (
auto *Size =
C->getSize())
1006 Profiler->VisitStmt(Size);
1008void OMPClauseProfiler::VisitOMPDoacrossClause(
const OMPDoacrossClause *
C) {
1009 VisitOMPClauseList(
C);
1011void OMPClauseProfiler::VisitOMPXAttributeClause(
const OMPXAttributeClause *
C) {
1013void OMPClauseProfiler::VisitOMPXBareClause(
const OMPXBareClause *
C) {}
1017StmtProfiler::VisitOMPExecutableDirective(
const OMPExecutableDirective *S) {
1019 OMPClauseProfiler P(
this);
1020 ArrayRef<OMPClause *> Clauses = S->clauses();
1021 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
1027void StmtProfiler::VisitOMPCanonicalLoop(
const OMPCanonicalLoop *L) {
1031void StmtProfiler::VisitOMPLoopBasedDirective(
const OMPLoopBasedDirective *S) {
1032 VisitOMPExecutableDirective(S);
1035void StmtProfiler::VisitOMPLoopDirective(
const OMPLoopDirective *S) {
1036 VisitOMPLoopBasedDirective(S);
1039void StmtProfiler::VisitOMPMetaDirective(
const OMPMetaDirective *S) {
1040 VisitOMPExecutableDirective(S);
1043void StmtProfiler::VisitOMPParallelDirective(
const OMPParallelDirective *S) {
1044 VisitOMPExecutableDirective(S);
1047void StmtProfiler::VisitOMPSimdDirective(
const OMPSimdDirective *S) {
1048 VisitOMPLoopDirective(S);
1051void StmtProfiler::VisitOMPCanonicalLoopNestTransformationDirective(
1052 const OMPCanonicalLoopNestTransformationDirective *S) {
1053 VisitOMPLoopBasedDirective(S);
1056void StmtProfiler::VisitOMPTileDirective(
const OMPTileDirective *S) {
1057 VisitOMPCanonicalLoopNestTransformationDirective(S);
1060void StmtProfiler::VisitOMPStripeDirective(
const OMPStripeDirective *S) {
1061 VisitOMPCanonicalLoopNestTransformationDirective(S);
1064void StmtProfiler::VisitOMPUnrollDirective(
const OMPUnrollDirective *S) {
1065 VisitOMPCanonicalLoopNestTransformationDirective(S);
1068void StmtProfiler::VisitOMPReverseDirective(
const OMPReverseDirective *S) {
1069 VisitOMPCanonicalLoopNestTransformationDirective(S);
1072void StmtProfiler::VisitOMPInterchangeDirective(
1073 const OMPInterchangeDirective *S) {
1074 VisitOMPCanonicalLoopNestTransformationDirective(S);
1077void StmtProfiler::VisitOMPSplitDirective(
const OMPSplitDirective *S) {
1078 VisitOMPCanonicalLoopNestTransformationDirective(S);
1081void StmtProfiler::VisitOMPCanonicalLoopSequenceTransformationDirective(
1082 const OMPCanonicalLoopSequenceTransformationDirective *S) {
1083 VisitOMPExecutableDirective(S);
1086void StmtProfiler::VisitOMPFuseDirective(
const OMPFuseDirective *S) {
1087 VisitOMPCanonicalLoopSequenceTransformationDirective(S);
1090void StmtProfiler::VisitOMPForDirective(
const OMPForDirective *S) {
1091 VisitOMPLoopDirective(S);
1094void StmtProfiler::VisitOMPForSimdDirective(
const OMPForSimdDirective *S) {
1095 VisitOMPLoopDirective(S);
1098void StmtProfiler::VisitOMPSectionsDirective(
const OMPSectionsDirective *S) {
1099 VisitOMPExecutableDirective(S);
1102void StmtProfiler::VisitOMPSectionDirective(
const OMPSectionDirective *S) {
1103 VisitOMPExecutableDirective(S);
1106void StmtProfiler::VisitOMPScopeDirective(
const OMPScopeDirective *S) {
1107 VisitOMPExecutableDirective(S);
1110void StmtProfiler::VisitOMPSingleDirective(
const OMPSingleDirective *S) {
1111 VisitOMPExecutableDirective(S);
1114void StmtProfiler::VisitOMPMasterDirective(
const OMPMasterDirective *S) {
1115 VisitOMPExecutableDirective(S);
1118void StmtProfiler::VisitOMPCriticalDirective(
const OMPCriticalDirective *S) {
1119 VisitOMPExecutableDirective(S);
1120 VisitName(S->getDirectiveName().getName());
1124StmtProfiler::VisitOMPParallelForDirective(
const OMPParallelForDirective *S) {
1125 VisitOMPLoopDirective(S);
1128void StmtProfiler::VisitOMPParallelForSimdDirective(
1129 const OMPParallelForSimdDirective *S) {
1130 VisitOMPLoopDirective(S);
1133void StmtProfiler::VisitOMPParallelMasterDirective(
1134 const OMPParallelMasterDirective *S) {
1135 VisitOMPExecutableDirective(S);
1138void StmtProfiler::VisitOMPParallelMaskedDirective(
1139 const OMPParallelMaskedDirective *S) {
1140 VisitOMPExecutableDirective(S);
1143void StmtProfiler::VisitOMPParallelSectionsDirective(
1144 const OMPParallelSectionsDirective *S) {
1145 VisitOMPExecutableDirective(S);
1148void StmtProfiler::VisitOMPTaskDirective(
const OMPTaskDirective *S) {
1149 VisitOMPExecutableDirective(S);
1152void StmtProfiler::VisitOMPTaskyieldDirective(
const OMPTaskyieldDirective *S) {
1153 VisitOMPExecutableDirective(S);
1156void StmtProfiler::VisitOMPBarrierDirective(
const OMPBarrierDirective *S) {
1157 VisitOMPExecutableDirective(S);
1160void StmtProfiler::VisitOMPTaskwaitDirective(
const OMPTaskwaitDirective *S) {
1161 VisitOMPExecutableDirective(S);
1164void StmtProfiler::VisitOMPAssumeDirective(
const OMPAssumeDirective *S) {
1165 VisitOMPExecutableDirective(S);
1168void StmtProfiler::VisitOMPErrorDirective(
const OMPErrorDirective *S) {
1169 VisitOMPExecutableDirective(S);
1171void StmtProfiler::VisitOMPTaskgroupDirective(
const OMPTaskgroupDirective *S) {
1172 VisitOMPExecutableDirective(S);
1173 if (
const Expr *E = S->getReductionRef())
1177void StmtProfiler::VisitOMPFlushDirective(
const OMPFlushDirective *S) {
1178 VisitOMPExecutableDirective(S);
1181void StmtProfiler::VisitOMPDepobjDirective(
const OMPDepobjDirective *S) {
1182 VisitOMPExecutableDirective(S);
1185void StmtProfiler::VisitOMPScanDirective(
const OMPScanDirective *S) {
1186 VisitOMPExecutableDirective(S);
1189void StmtProfiler::VisitOMPOrderedDirective(
const OMPOrderedDirective *S) {
1190 VisitOMPExecutableDirective(S);
1193void StmtProfiler::VisitOMPAtomicDirective(
const OMPAtomicDirective *S) {
1194 VisitOMPExecutableDirective(S);
1197void StmtProfiler::VisitOMPTargetDirective(
const OMPTargetDirective *S) {
1198 VisitOMPExecutableDirective(S);
1201void StmtProfiler::VisitOMPTargetDataDirective(
const OMPTargetDataDirective *S) {
1202 VisitOMPExecutableDirective(S);
1205void StmtProfiler::VisitOMPTargetEnterDataDirective(
1206 const OMPTargetEnterDataDirective *S) {
1207 VisitOMPExecutableDirective(S);
1210void StmtProfiler::VisitOMPTargetExitDataDirective(
1211 const OMPTargetExitDataDirective *S) {
1212 VisitOMPExecutableDirective(S);
1215void StmtProfiler::VisitOMPTargetParallelDirective(
1216 const OMPTargetParallelDirective *S) {
1217 VisitOMPExecutableDirective(S);
1220void StmtProfiler::VisitOMPTargetParallelForDirective(
1221 const OMPTargetParallelForDirective *S) {
1222 VisitOMPExecutableDirective(S);
1225void StmtProfiler::VisitOMPTeamsDirective(
const OMPTeamsDirective *S) {
1226 VisitOMPExecutableDirective(S);
1229void StmtProfiler::VisitOMPCancellationPointDirective(
1230 const OMPCancellationPointDirective *S) {
1231 VisitOMPExecutableDirective(S);
1234void StmtProfiler::VisitOMPCancelDirective(
const OMPCancelDirective *S) {
1235 VisitOMPExecutableDirective(S);
1238void StmtProfiler::VisitOMPTaskLoopDirective(
const OMPTaskLoopDirective *S) {
1239 VisitOMPLoopDirective(S);
1242void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1243 const OMPTaskLoopSimdDirective *S) {
1244 VisitOMPLoopDirective(S);
1247void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1248 const OMPMasterTaskLoopDirective *S) {
1249 VisitOMPLoopDirective(S);
1252void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1253 const OMPMaskedTaskLoopDirective *S) {
1254 VisitOMPLoopDirective(S);
1257void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1258 const OMPMasterTaskLoopSimdDirective *S) {
1259 VisitOMPLoopDirective(S);
1262void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1263 const OMPMaskedTaskLoopSimdDirective *S) {
1264 VisitOMPLoopDirective(S);
1267void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1268 const OMPParallelMasterTaskLoopDirective *S) {
1269 VisitOMPLoopDirective(S);
1272void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1273 const OMPParallelMaskedTaskLoopDirective *S) {
1274 VisitOMPLoopDirective(S);
1277void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1278 const OMPParallelMasterTaskLoopSimdDirective *S) {
1279 VisitOMPLoopDirective(S);
1282void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1283 const OMPParallelMaskedTaskLoopSimdDirective *S) {
1284 VisitOMPLoopDirective(S);
1287void StmtProfiler::VisitOMPDistributeDirective(
1288 const OMPDistributeDirective *S) {
1289 VisitOMPLoopDirective(S);
1292void OMPClauseProfiler::VisitOMPDistScheduleClause(
1293 const OMPDistScheduleClause *
C) {
1294 VisitOMPClauseWithPreInit(
C);
1295 if (
auto *S =
C->getChunkSize())
1296 Profiler->VisitStmt(S);
1299void OMPClauseProfiler::VisitOMPDefaultmapClause(
const OMPDefaultmapClause *) {}
1301void StmtProfiler::VisitOMPTargetUpdateDirective(
1302 const OMPTargetUpdateDirective *S) {
1303 VisitOMPExecutableDirective(S);
1306void StmtProfiler::VisitOMPDistributeParallelForDirective(
1307 const OMPDistributeParallelForDirective *S) {
1308 VisitOMPLoopDirective(S);
1311void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1312 const OMPDistributeParallelForSimdDirective *S) {
1313 VisitOMPLoopDirective(S);
1316void StmtProfiler::VisitOMPDistributeSimdDirective(
1317 const OMPDistributeSimdDirective *S) {
1318 VisitOMPLoopDirective(S);
1321void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1322 const OMPTargetParallelForSimdDirective *S) {
1323 VisitOMPLoopDirective(S);
1326void StmtProfiler::VisitOMPTargetSimdDirective(
1327 const OMPTargetSimdDirective *S) {
1328 VisitOMPLoopDirective(S);
1331void StmtProfiler::VisitOMPTeamsDistributeDirective(
1332 const OMPTeamsDistributeDirective *S) {
1333 VisitOMPLoopDirective(S);
1336void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1337 const OMPTeamsDistributeSimdDirective *S) {
1338 VisitOMPLoopDirective(S);
1341void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1342 const OMPTeamsDistributeParallelForSimdDirective *S) {
1343 VisitOMPLoopDirective(S);
1346void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1347 const OMPTeamsDistributeParallelForDirective *S) {
1348 VisitOMPLoopDirective(S);
1351void StmtProfiler::VisitOMPTargetTeamsDirective(
1352 const OMPTargetTeamsDirective *S) {
1353 VisitOMPExecutableDirective(S);
1356void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1357 const OMPTargetTeamsDistributeDirective *S) {
1358 VisitOMPLoopDirective(S);
1361void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1362 const OMPTargetTeamsDistributeParallelForDirective *S) {
1363 VisitOMPLoopDirective(S);
1366void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1367 const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
1368 VisitOMPLoopDirective(S);
1371void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1372 const OMPTargetTeamsDistributeSimdDirective *S) {
1373 VisitOMPLoopDirective(S);
1376void StmtProfiler::VisitOMPInteropDirective(
const OMPInteropDirective *S) {
1377 VisitOMPExecutableDirective(S);
1380void StmtProfiler::VisitOMPDispatchDirective(
const OMPDispatchDirective *S) {
1381 VisitOMPExecutableDirective(S);
1384void StmtProfiler::VisitOMPMaskedDirective(
const OMPMaskedDirective *S) {
1385 VisitOMPExecutableDirective(S);
1388void StmtProfiler::VisitOMPGenericLoopDirective(
1389 const OMPGenericLoopDirective *S) {
1390 VisitOMPLoopDirective(S);
1393void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1394 const OMPTeamsGenericLoopDirective *S) {
1395 VisitOMPLoopDirective(S);
1398void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1399 const OMPTargetTeamsGenericLoopDirective *S) {
1400 VisitOMPLoopDirective(S);
1403void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1404 const OMPParallelGenericLoopDirective *S) {
1405 VisitOMPLoopDirective(S);
1408void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1409 const OMPTargetParallelGenericLoopDirective *S) {
1410 VisitOMPLoopDirective(S);
1413void StmtProfiler::VisitExpr(
const Expr *S) {
1417void StmtProfiler::VisitConstantExpr(
const ConstantExpr *S) {
1422void StmtProfiler::VisitDeclRefExpr(
const DeclRefExpr *S) {
1434void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1435 const SYCLUniqueStableNameExpr *S) {
1440void StmtProfiler::VisitUnresolvedSYCLKernelCallStmt(
1441 const UnresolvedSYCLKernelCallStmt *S) {
1445void StmtProfiler::VisitPredefinedExpr(
const PredefinedExpr *S) {
1450void StmtProfiler::VisitOpenACCAsteriskSizeExpr(
1451 const OpenACCAsteriskSizeExpr *S) {
1455void StmtProfiler::VisitIntegerLiteral(
const IntegerLiteral *S) {
1463 if (
auto BitIntT = T->
getAs<BitIntType>())
1464 BitIntT->Profile(ID);
1466 ID.AddInteger(T->
castAs<BuiltinType>()->getKind());
1469void StmtProfiler::VisitFixedPointLiteral(
const FixedPointLiteral *S) {
1475void StmtProfiler::VisitCharacterLiteral(
const CharacterLiteral *S) {
1477 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1481void StmtProfiler::VisitFloatingLiteral(
const FloatingLiteral *S) {
1488void StmtProfiler::VisitImaginaryLiteral(
const ImaginaryLiteral *S) {
1492void StmtProfiler::VisitStringLiteral(
const StringLiteral *S) {
1495 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1498void StmtProfiler::VisitParenExpr(
const ParenExpr *S) {
1502void StmtProfiler::VisitParenListExpr(
const ParenListExpr *S) {
1506void StmtProfiler::VisitUnaryOperator(
const UnaryOperator *S) {
1511void StmtProfiler::VisitOffsetOfExpr(
const OffsetOfExpr *S) {
1514 for (
unsigned i = 0; i < n; ++i) {
1540StmtProfiler::VisitUnaryExprOrTypeTraitExpr(
const UnaryExprOrTypeTraitExpr *S) {
1547void StmtProfiler::VisitArraySubscriptExpr(
const ArraySubscriptExpr *S) {
1551void StmtProfiler::VisitMatrixSingleSubscriptExpr(
1552 const MatrixSingleSubscriptExpr *S) {
1556void StmtProfiler::VisitMatrixSubscriptExpr(
const MatrixSubscriptExpr *S) {
1560void StmtProfiler::VisitArraySectionExpr(
const ArraySectionExpr *S) {
1564void StmtProfiler::VisitOMPArrayShapingExpr(
const OMPArrayShapingExpr *S) {
1568void StmtProfiler::VisitOMPIteratorExpr(
const OMPIteratorExpr *S) {
1574void StmtProfiler::VisitCallExpr(
const CallExpr *S) {
1578void StmtProfiler::VisitMemberExpr(
const MemberExpr *S) {
1586void StmtProfiler::VisitCompoundLiteralExpr(
const CompoundLiteralExpr *S) {
1591void StmtProfiler::VisitCastExpr(
const CastExpr *S) {
1595void StmtProfiler::VisitImplicitCastExpr(
const ImplicitCastExpr *S) {
1600void StmtProfiler::VisitExplicitCastExpr(
const ExplicitCastExpr *S) {
1605void StmtProfiler::VisitCStyleCastExpr(
const CStyleCastExpr *S) {
1606 VisitExplicitCastExpr(S);
1609void StmtProfiler::VisitBinaryOperator(
const BinaryOperator *S) {
1615StmtProfiler::VisitCompoundAssignOperator(
const CompoundAssignOperator *S) {
1616 VisitBinaryOperator(S);
1619void StmtProfiler::VisitConditionalOperator(
const ConditionalOperator *S) {
1623void StmtProfiler::VisitBinaryConditionalOperator(
1624 const BinaryConditionalOperator *S) {
1628void StmtProfiler::VisitAddrLabelExpr(
const AddrLabelExpr *S) {
1633void StmtProfiler::VisitStmtExpr(
const StmtExpr *S) {
1637void StmtProfiler::VisitShuffleVectorExpr(
const ShuffleVectorExpr *S) {
1641void StmtProfiler::VisitConvertVectorExpr(
const ConvertVectorExpr *S) {
1645void StmtProfiler::VisitChooseExpr(
const ChooseExpr *S) {
1649void StmtProfiler::VisitGNUNullExpr(
const GNUNullExpr *S) {
1653void StmtProfiler::VisitVAArgExpr(
const VAArgExpr *S) {
1657void StmtProfiler::VisitInitListExpr(
const InitListExpr *S) {
1666void StmtProfiler::VisitDesignatedInitExpr(
const DesignatedInitExpr *S) {
1669 for (
const DesignatedInitExpr::Designator &D : S->
designators()) {
1670 if (D.isFieldDesignator()) {
1672 VisitName(D.getFieldName());
1676 if (D.isArrayDesignator()) {
1679 assert(D.isArrayRangeDesignator());
1682 ID.AddInteger(D.getArrayIndex());
1688void StmtProfiler::VisitDesignatedInitUpdateExpr(
1689 const DesignatedInitUpdateExpr *S) {
1690 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
1694void StmtProfiler::VisitArrayInitLoopExpr(
const ArrayInitLoopExpr *S) {
1698void StmtProfiler::VisitArrayInitIndexExpr(
const ArrayInitIndexExpr *S) {
1702void StmtProfiler::VisitNoInitExpr(
const NoInitExpr *S) {
1703 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
1706void StmtProfiler::VisitImplicitValueInitExpr(
const ImplicitValueInitExpr *S) {
1710void StmtProfiler::VisitExtVectorElementExpr(
const ExtVectorElementExpr *S) {
1715void StmtProfiler::VisitMatrixElementExpr(
const MatrixElementExpr *S) {
1720void StmtProfiler::VisitBlockExpr(
const BlockExpr *S) {
1725void StmtProfiler::VisitGenericSelectionExpr(
const GenericSelectionExpr *S) {
1729 QualType T = Assoc.getType();
1731 ID.AddPointer(
nullptr);
1734 VisitExpr(Assoc.getAssociationExpr());
1738void StmtProfiler::VisitPseudoObjectExpr(
const PseudoObjectExpr *S) {
1743 if (
const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1744 Visit(OVE->getSourceExpr());
1747void StmtProfiler::VisitAtomicExpr(
const AtomicExpr *S) {
1752void StmtProfiler::VisitConceptSpecializationExpr(
1753 const ConceptSpecializationExpr *S) {
1757 VisitTemplateArgument(Arg);
1760void StmtProfiler::VisitRequiresExpr(
const RequiresExpr *S) {
1764 VisitDecl(LocalParam);
1767 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1769 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1770 if (!TypeReq->isSubstitutionFailure())
1771 VisitType(TypeReq->getType()->getType());
1772 }
else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1774 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1775 if (!ExprReq->isExprSubstitutionFailure())
1776 Visit(ExprReq->getExpr());
1781 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1782 const concepts::ExprRequirement::ReturnTypeRequirement &RetReq =
1783 ExprReq->getReturnTypeRequirement();
1796 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1797 if (!NestedReq->hasInvalidConstraint())
1798 Visit(NestedReq->getConstraintExpr());
1806 unsigned &NumArgs) {
1812 case OO_Array_Delete:
1814 case OO_Conditional:
1816 llvm_unreachable(
"Invalid operator call kind");
1821 return Stmt::UnaryOperatorClass;
1825 return Stmt::BinaryOperatorClass;
1830 return Stmt::UnaryOperatorClass;
1834 return Stmt::BinaryOperatorClass;
1839 return Stmt::UnaryOperatorClass;
1843 return Stmt::BinaryOperatorClass;
1847 return Stmt::BinaryOperatorClass;
1851 return Stmt::BinaryOperatorClass;
1855 return Stmt::BinaryOperatorClass;
1859 UnaryOp = UO_AddrOf;
1860 return Stmt::UnaryOperatorClass;
1864 return Stmt::BinaryOperatorClass;
1868 return Stmt::BinaryOperatorClass;
1872 return Stmt::UnaryOperatorClass;
1876 return Stmt::UnaryOperatorClass;
1879 BinaryOp = BO_Assign;
1880 return Stmt::BinaryOperatorClass;
1884 return Stmt::BinaryOperatorClass;
1888 return Stmt::BinaryOperatorClass;
1891 BinaryOp = BO_AddAssign;
1892 return Stmt::CompoundAssignOperatorClass;
1895 BinaryOp = BO_SubAssign;
1896 return Stmt::CompoundAssignOperatorClass;
1899 BinaryOp = BO_MulAssign;
1900 return Stmt::CompoundAssignOperatorClass;
1903 BinaryOp = BO_DivAssign;
1904 return Stmt::CompoundAssignOperatorClass;
1906 case OO_PercentEqual:
1907 BinaryOp = BO_RemAssign;
1908 return Stmt::CompoundAssignOperatorClass;
1911 BinaryOp = BO_XorAssign;
1912 return Stmt::CompoundAssignOperatorClass;
1915 BinaryOp = BO_AndAssign;
1916 return Stmt::CompoundAssignOperatorClass;
1919 BinaryOp = BO_OrAssign;
1920 return Stmt::CompoundAssignOperatorClass;
1924 return Stmt::BinaryOperatorClass;
1926 case OO_GreaterGreater:
1928 return Stmt::BinaryOperatorClass;
1930 case OO_LessLessEqual:
1931 BinaryOp = BO_ShlAssign;
1932 return Stmt::CompoundAssignOperatorClass;
1934 case OO_GreaterGreaterEqual:
1935 BinaryOp = BO_ShrAssign;
1936 return Stmt::CompoundAssignOperatorClass;
1940 return Stmt::BinaryOperatorClass;
1942 case OO_ExclaimEqual:
1944 return Stmt::BinaryOperatorClass;
1948 return Stmt::BinaryOperatorClass;
1950 case OO_GreaterEqual:
1952 return Stmt::BinaryOperatorClass;
1956 return Stmt::BinaryOperatorClass;
1960 return Stmt::BinaryOperatorClass;
1964 return Stmt::BinaryOperatorClass;
1967 UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc;
1969 return Stmt::UnaryOperatorClass;
1972 UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec;
1974 return Stmt::UnaryOperatorClass;
1977 BinaryOp = BO_Comma;
1978 return Stmt::BinaryOperatorClass;
1981 BinaryOp = BO_PtrMemI;
1982 return Stmt::BinaryOperatorClass;
1985 return Stmt::ArraySubscriptExprClass;
1988 return Stmt::CallExprClass;
1991 UnaryOp = UO_Coawait;
1992 return Stmt::UnaryOperatorClass;
1995 llvm_unreachable(
"Invalid overloaded operator expression");
1998#if defined(_MSC_VER) && !defined(__clang__)
2003#pragma optimize("", off)
2007void StmtProfiler::VisitCXXOperatorCallExpr(
const CXXOperatorCallExpr *S) {
2015 return Visit(S->
getArg(0));
2023 for (
unsigned I = 0; I != NumArgs; ++I)
2025 if (SC == Stmt::UnaryOperatorClass)
2026 ID.AddInteger(UnaryOp);
2027 else if (SC == Stmt::BinaryOperatorClass ||
2028 SC == Stmt::CompoundAssignOperatorClass)
2029 ID.AddInteger(BinaryOp);
2031 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
2040void StmtProfiler::VisitCXXRewrittenBinaryOperator(
2041 const CXXRewrittenBinaryOperator *S) {
2045 "resolved rewritten operator should never be type-dependent");
2050#if defined(_MSC_VER) && !defined(__clang__)
2052#pragma optimize("", on)
2056void StmtProfiler::VisitCXXMemberCallExpr(
const CXXMemberCallExpr *S) {
2060void StmtProfiler::VisitCUDAKernelCallExpr(
const CUDAKernelCallExpr *S) {
2064void StmtProfiler::VisitAsTypeExpr(
const AsTypeExpr *S) {
2068void StmtProfiler::VisitCXXNamedCastExpr(
const CXXNamedCastExpr *S) {
2069 VisitExplicitCastExpr(S);
2072void StmtProfiler::VisitCXXStaticCastExpr(
const CXXStaticCastExpr *S) {
2073 VisitCXXNamedCastExpr(S);
2076void StmtProfiler::VisitCXXDynamicCastExpr(
const CXXDynamicCastExpr *S) {
2077 VisitCXXNamedCastExpr(S);
2081StmtProfiler::VisitCXXReinterpretCastExpr(
const CXXReinterpretCastExpr *S) {
2082 VisitCXXNamedCastExpr(S);
2085void StmtProfiler::VisitCXXConstCastExpr(
const CXXConstCastExpr *S) {
2086 VisitCXXNamedCastExpr(S);
2089void StmtProfiler::VisitBuiltinBitCastExpr(
const BuiltinBitCastExpr *S) {
2094void StmtProfiler::VisitCXXAddrspaceCastExpr(
const CXXAddrspaceCastExpr *S) {
2095 VisitCXXNamedCastExpr(S);
2098void StmtProfiler::VisitUserDefinedLiteral(
const UserDefinedLiteral *S) {
2102void StmtProfiler::VisitCXXBoolLiteralExpr(
const CXXBoolLiteralExpr *S) {
2107void StmtProfiler::VisitCXXNullPtrLiteralExpr(
const CXXNullPtrLiteralExpr *S) {
2111void StmtProfiler::VisitCXXStdInitializerListExpr(
2112 const CXXStdInitializerListExpr *S) {
2116void StmtProfiler::VisitCXXTypeidExpr(
const CXXTypeidExpr *S) {
2122void StmtProfiler::VisitCXXUuidofExpr(
const CXXUuidofExpr *S) {
2128void StmtProfiler::VisitMSPropertyRefExpr(
const MSPropertyRefExpr *S) {
2133void StmtProfiler::VisitMSPropertySubscriptExpr(
2134 const MSPropertySubscriptExpr *S) {
2138void StmtProfiler::VisitCXXThisExpr(
const CXXThisExpr *S) {
2144void StmtProfiler::VisitCXXThrowExpr(
const CXXThrowExpr *S) {
2148void StmtProfiler::VisitCXXDefaultArgExpr(
const CXXDefaultArgExpr *S) {
2153void StmtProfiler::VisitCXXDefaultInitExpr(
const CXXDefaultInitExpr *S) {
2158void StmtProfiler::VisitCXXBindTemporaryExpr(
const CXXBindTemporaryExpr *S) {
2164void StmtProfiler::VisitCXXConstructExpr(
const CXXConstructExpr *S) {
2170void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2171 const CXXInheritedCtorInitExpr *S) {
2176void StmtProfiler::VisitCXXFunctionalCastExpr(
const CXXFunctionalCastExpr *S) {
2177 VisitExplicitCastExpr(S);
2181StmtProfiler::VisitCXXTemporaryObjectExpr(
const CXXTemporaryObjectExpr *S) {
2182 VisitCXXConstructExpr(S);
2186StmtProfiler::VisitLambdaExpr(
const LambdaExpr *S) {
2187 if (!ProfileLambdaExpr) {
2191 VisitStmtNoChildren(S);
2202 ID.AddInteger(
Capture.getCaptureKind());
2203 if (
Capture.capturesVariable())
2204 VisitDecl(
Capture.getCapturedVar());
2213 for (
auto *SubDecl : Lambda->
decls()) {
2214 FunctionDecl *
Call =
nullptr;
2215 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(SubDecl))
2216 Call = FTD->getTemplatedDecl();
2217 else if (
auto *FD = dyn_cast<FunctionDecl>(SubDecl))
2228void StmtProfiler::VisitCXXReflectExpr(
const CXXReflectExpr *E) {
2230 assert(
false &&
"not implemented yet");
2234StmtProfiler::VisitCXXScalarValueInitExpr(
const CXXScalarValueInitExpr *S) {
2238void StmtProfiler::VisitCXXDeleteExpr(
const CXXDeleteExpr *S) {
2245void StmtProfiler::VisitCXXNewExpr(
const CXXNewExpr *S) {
2258StmtProfiler::VisitCXXPseudoDestructorExpr(
const CXXPseudoDestructorExpr *S) {
2272void StmtProfiler::VisitOverloadExpr(
const OverloadExpr *S) {
2274 bool DescribingDependentVarTemplate =
2276 if (DescribingDependentVarTemplate) {
2280 VisitName(S->
getName(),
true);
2288StmtProfiler::VisitUnresolvedLookupExpr(
const UnresolvedLookupExpr *S) {
2289 VisitOverloadExpr(S);
2292void StmtProfiler::VisitTypeTraitExpr(
const TypeTraitExpr *S) {
2296 for (
unsigned I = 0, N = S->
getNumArgs(); I != N; ++I)
2300void StmtProfiler::VisitArrayTypeTraitExpr(
const ArrayTypeTraitExpr *S) {
2306void StmtProfiler::VisitExpressionTraitExpr(
const ExpressionTraitExpr *S) {
2312void StmtProfiler::VisitDependentScopeDeclRefExpr(
2313 const DependentScopeDeclRefExpr *S) {
2322void StmtProfiler::VisitExprWithCleanups(
const ExprWithCleanups *S) {
2326void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2327 const CXXUnresolvedConstructExpr *S) {
2333void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2334 const CXXDependentScopeMemberExpr *S) {
2347void StmtProfiler::VisitUnresolvedMemberExpr(
const UnresolvedMemberExpr *S) {
2360void StmtProfiler::VisitCXXNoexceptExpr(
const CXXNoexceptExpr *S) {
2364void StmtProfiler::VisitPackExpansionExpr(
const PackExpansionExpr *S) {
2368void StmtProfiler::VisitSizeOfPackExpr(
const SizeOfPackExpr *S) {
2372 ID.AddInteger(Args.size());
2373 for (
const auto &TA : Args)
2374 VisitTemplateArgument(TA);
2381void StmtProfiler::VisitPackIndexingExpr(
const PackIndexingExpr *E) {
2382 VisitStmtNoChildren(E);
2393void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2394 const SubstNonTypeTemplateParmPackExpr *S) {
2400void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2401 const SubstNonTypeTemplateParmExpr *E) {
2406void StmtProfiler::VisitFunctionParmPackExpr(
const FunctionParmPackExpr *S) {
2414void StmtProfiler::VisitMaterializeTemporaryExpr(
2415 const MaterializeTemporaryExpr *S) {
2419void StmtProfiler::VisitCXXFoldExpr(
const CXXFoldExpr *S) {
2420 VisitStmtNoChildren(S);
2443void StmtProfiler::VisitCXXParenListInitExpr(
const CXXParenListInitExpr *S) {
2447void StmtProfiler::VisitCoroutineBodyStmt(
const CoroutineBodyStmt *S) {
2451void StmtProfiler::VisitCoreturnStmt(
const CoreturnStmt *S) {
2455void StmtProfiler::VisitCoawaitExpr(
const CoawaitExpr *S) {
2459void StmtProfiler::VisitDependentCoawaitExpr(
const DependentCoawaitExpr *S) {
2463void StmtProfiler::VisitCoyieldExpr(
const CoyieldExpr *S) {
2467void StmtProfiler::VisitOpaqueValueExpr(
const OpaqueValueExpr *E) {
2471void StmtProfiler::VisitSourceLocExpr(
const SourceLocExpr *E) {
2475void StmtProfiler::VisitEmbedExpr(
const EmbedExpr *E) { VisitExpr(E); }
2477void StmtProfiler::VisitRecoveryExpr(
const RecoveryExpr *E) { VisitExpr(E); }
2479void StmtProfiler::VisitObjCObjectLiteral(
const ObjCObjectLiteral *E) {
2483void StmtProfiler::VisitObjCStringLiteral(
const ObjCStringLiteral *S) {
2484 VisitObjCObjectLiteral(S);
2487void StmtProfiler::VisitObjCBoxedExpr(
const ObjCBoxedExpr *E) {
2488 VisitObjCObjectLiteral(E);
2491void StmtProfiler::VisitObjCArrayLiteral(
const ObjCArrayLiteral *E) {
2492 VisitObjCObjectLiteral(E);
2495void StmtProfiler::VisitObjCDictionaryLiteral(
const ObjCDictionaryLiteral *E) {
2496 VisitObjCObjectLiteral(E);
2499void StmtProfiler::VisitObjCEncodeExpr(
const ObjCEncodeExpr *S) {
2504void StmtProfiler::VisitObjCSelectorExpr(
const ObjCSelectorExpr *S) {
2509void StmtProfiler::VisitObjCProtocolExpr(
const ObjCProtocolExpr *S) {
2514void StmtProfiler::VisitObjCIvarRefExpr(
const ObjCIvarRefExpr *S) {
2521void StmtProfiler::VisitObjCPropertyRefExpr(
const ObjCPropertyRefExpr *S) {
2535void StmtProfiler::VisitObjCSubscriptRefExpr(
const ObjCSubscriptRefExpr *S) {
2541void StmtProfiler::VisitObjCMessageExpr(
const ObjCMessageExpr *S) {
2547void StmtProfiler::VisitObjCIsaExpr(
const ObjCIsaExpr *S) {
2552void StmtProfiler::VisitObjCBoolLiteralExpr(
const ObjCBoolLiteralExpr *S) {
2557void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2558 const ObjCIndirectCopyRestoreExpr *S) {
2563void StmtProfiler::VisitObjCBridgedCastExpr(
const ObjCBridgedCastExpr *S) {
2564 VisitExplicitCastExpr(S);
2568void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2569 const ObjCAvailabilityCheckExpr *S) {
2573void StmtProfiler::VisitTemplateArguments(
const TemplateArgumentLoc *Args,
2575 ID.AddInteger(NumArgs);
2576 for (
unsigned I = 0; I != NumArgs; ++I)
2580void StmtProfiler::VisitTemplateArgument(
const TemplateArgument &Arg) {
2623 VisitTemplateArgument(P);
2629class OpenACCClauseProfiler
2630 :
public OpenACCClauseVisitor<OpenACCClauseProfiler> {
2631 StmtProfiler &Profiler;
2634 OpenACCClauseProfiler(StmtProfiler &P) : Profiler(P) {}
2636 void VisitOpenACCClauseList(ArrayRef<const OpenACCClause *> Clauses) {
2637 for (
const OpenACCClause *Clause : Clauses) {
2644 void VisitClauseWithVarList(
const OpenACCClauseWithVarList &Clause) {
2646 Profiler.VisitStmt(E);
2649#define VISIT_CLAUSE(CLAUSE_NAME) \
2650 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
2652#include "clang/Basic/OpenACCClauses.def"
2656void OpenACCClauseProfiler::VisitDefaultClause(
2657 const OpenACCDefaultClause &Clause) {}
2659void OpenACCClauseProfiler::VisitIfClause(
const OpenACCIfClause &Clause) {
2661 "if clause requires a valid condition expr");
2665void OpenACCClauseProfiler::VisitCopyClause(
const OpenACCCopyClause &Clause) {
2666 VisitClauseWithVarList(Clause);
2669void OpenACCClauseProfiler::VisitLinkClause(
const OpenACCLinkClause &Clause) {
2670 VisitClauseWithVarList(Clause);
2673void OpenACCClauseProfiler::VisitDeviceResidentClause(
2674 const OpenACCDeviceResidentClause &Clause) {
2675 VisitClauseWithVarList(Clause);
2678void OpenACCClauseProfiler::VisitCopyInClause(
2679 const OpenACCCopyInClause &Clause) {
2680 VisitClauseWithVarList(Clause);
2683void OpenACCClauseProfiler::VisitCopyOutClause(
2684 const OpenACCCopyOutClause &Clause) {
2685 VisitClauseWithVarList(Clause);
2688void OpenACCClauseProfiler::VisitCreateClause(
2689 const OpenACCCreateClause &Clause) {
2690 VisitClauseWithVarList(Clause);
2693void OpenACCClauseProfiler::VisitHostClause(
const OpenACCHostClause &Clause) {
2694 VisitClauseWithVarList(Clause);
2697void OpenACCClauseProfiler::VisitDeviceClause(
2698 const OpenACCDeviceClause &Clause) {
2699 VisitClauseWithVarList(Clause);
2702void OpenACCClauseProfiler::VisitSelfClause(
const OpenACCSelfClause &Clause) {
2708 Profiler.VisitStmt(E);
2712void OpenACCClauseProfiler::VisitFinalizeClause(
2713 const OpenACCFinalizeClause &Clause) {}
2715void OpenACCClauseProfiler::VisitIfPresentClause(
2716 const OpenACCIfPresentClause &Clause) {}
2718void OpenACCClauseProfiler::VisitNumGangsClause(
2719 const OpenACCNumGangsClause &Clause) {
2721 Profiler.VisitStmt(E);
2724void OpenACCClauseProfiler::VisitTileClause(
const OpenACCTileClause &Clause) {
2726 Profiler.VisitStmt(E);
2729void OpenACCClauseProfiler::VisitNumWorkersClause(
2730 const OpenACCNumWorkersClause &Clause) {
2731 assert(Clause.
hasIntExpr() &&
"num_workers clause requires a valid int expr");
2735void OpenACCClauseProfiler::VisitCollapseClause(
2736 const OpenACCCollapseClause &Clause) {
2737 assert(Clause.
getLoopCount() &&
"collapse clause requires a valid int expr");
2741void OpenACCClauseProfiler::VisitPrivateClause(
2742 const OpenACCPrivateClause &Clause) {
2743 VisitClauseWithVarList(Clause);
2746 Profiler.VisitDecl(Recipe.AllocaDecl);
2750void OpenACCClauseProfiler::VisitFirstPrivateClause(
2751 const OpenACCFirstPrivateClause &Clause) {
2752 VisitClauseWithVarList(Clause);
2755 Profiler.VisitDecl(Recipe.AllocaDecl);
2756 Profiler.VisitDecl(Recipe.InitFromTemporary);
2760void OpenACCClauseProfiler::VisitAttachClause(
2761 const OpenACCAttachClause &Clause) {
2762 VisitClauseWithVarList(Clause);
2765void OpenACCClauseProfiler::VisitDetachClause(
2766 const OpenACCDetachClause &Clause) {
2767 VisitClauseWithVarList(Clause);
2770void OpenACCClauseProfiler::VisitDeleteClause(
2771 const OpenACCDeleteClause &Clause) {
2772 VisitClauseWithVarList(Clause);
2775void OpenACCClauseProfiler::VisitDevicePtrClause(
2776 const OpenACCDevicePtrClause &Clause) {
2777 VisitClauseWithVarList(Clause);
2780void OpenACCClauseProfiler::VisitNoCreateClause(
2781 const OpenACCNoCreateClause &Clause) {
2782 VisitClauseWithVarList(Clause);
2785void OpenACCClauseProfiler::VisitPresentClause(
2786 const OpenACCPresentClause &Clause) {
2787 VisitClauseWithVarList(Clause);
2790void OpenACCClauseProfiler::VisitUseDeviceClause(
2791 const OpenACCUseDeviceClause &Clause) {
2792 VisitClauseWithVarList(Clause);
2795void OpenACCClauseProfiler::VisitVectorLengthClause(
2796 const OpenACCVectorLengthClause &Clause) {
2798 "vector_length clause requires a valid int expr");
2802void OpenACCClauseProfiler::VisitAsyncClause(
const OpenACCAsyncClause &Clause) {
2807void OpenACCClauseProfiler::VisitDeviceNumClause(
2808 const OpenACCDeviceNumClause &Clause) {
2812void OpenACCClauseProfiler::VisitDefaultAsyncClause(
2813 const OpenACCDefaultAsyncClause &Clause) {
2817void OpenACCClauseProfiler::VisitWorkerClause(
2818 const OpenACCWorkerClause &Clause) {
2823void OpenACCClauseProfiler::VisitVectorClause(
2824 const OpenACCVectorClause &Clause) {
2829void OpenACCClauseProfiler::VisitWaitClause(
const OpenACCWaitClause &Clause) {
2833 Profiler.VisitStmt(E);
2837void OpenACCClauseProfiler::VisitDeviceTypeClause(
2838 const OpenACCDeviceTypeClause &Clause) {}
2840void OpenACCClauseProfiler::VisitAutoClause(
const OpenACCAutoClause &Clause) {}
2842void OpenACCClauseProfiler::VisitIndependentClause(
2843 const OpenACCIndependentClause &Clause) {}
2845void OpenACCClauseProfiler::VisitSeqClause(
const OpenACCSeqClause &Clause) {}
2846void OpenACCClauseProfiler::VisitNoHostClause(
2847 const OpenACCNoHostClause &Clause) {}
2849void OpenACCClauseProfiler::VisitGangClause(
const OpenACCGangClause &Clause) {
2850 for (
unsigned I = 0; I < Clause.
getNumExprs(); ++I) {
2851 Profiler.VisitStmt(Clause.
getExpr(I).second);
2855void OpenACCClauseProfiler::VisitReductionClause(
2856 const OpenACCReductionClause &Clause) {
2857 VisitClauseWithVarList(Clause);
2860 Profiler.VisitDecl(Recipe.AllocaDecl);
2865 static_assert(
sizeof(OpenACCReductionRecipe::CombinerRecipe) ==
2867 for (
auto &CombinerRecipe : Recipe.CombinerRecipes) {
2868 if (CombinerRecipe.Op) {
2869 Profiler.VisitDecl(CombinerRecipe.LHS);
2870 Profiler.VisitDecl(CombinerRecipe.RHS);
2871 Profiler.VisitStmt(CombinerRecipe.Op);
2877void OpenACCClauseProfiler::VisitBindClause(
const OpenACCBindClause &Clause) {
2878 assert(
false &&
"not implemented... what can we do about our expr?");
2882void StmtProfiler::VisitOpenACCComputeConstruct(
2887 OpenACCClauseProfiler P{*
this};
2888 P.VisitOpenACCClauseList(S->clauses());
2891void StmtProfiler::VisitOpenACCLoopConstruct(
const OpenACCLoopConstruct *S) {
2895 OpenACCClauseProfiler P{*
this};
2896 P.VisitOpenACCClauseList(S->clauses());
2899void StmtProfiler::VisitOpenACCCombinedConstruct(
2900 const OpenACCCombinedConstruct *S) {
2904 OpenACCClauseProfiler P{*
this};
2905 P.VisitOpenACCClauseList(S->clauses());
2908void StmtProfiler::VisitOpenACCDataConstruct(
const OpenACCDataConstruct *S) {
2911 OpenACCClauseProfiler P{*
this};
2912 P.VisitOpenACCClauseList(S->clauses());
2915void StmtProfiler::VisitOpenACCEnterDataConstruct(
2916 const OpenACCEnterDataConstruct *S) {
2919 OpenACCClauseProfiler P{*
this};
2920 P.VisitOpenACCClauseList(S->clauses());
2923void StmtProfiler::VisitOpenACCExitDataConstruct(
2924 const OpenACCExitDataConstruct *S) {
2927 OpenACCClauseProfiler P{*
this};
2928 P.VisitOpenACCClauseList(S->clauses());
2931void StmtProfiler::VisitOpenACCHostDataConstruct(
2932 const OpenACCHostDataConstruct *S) {
2935 OpenACCClauseProfiler P{*
this};
2936 P.VisitOpenACCClauseList(S->clauses());
2939void StmtProfiler::VisitOpenACCWaitConstruct(
const OpenACCWaitConstruct *S) {
2943 OpenACCClauseProfiler P{*
this};
2944 P.VisitOpenACCClauseList(S->clauses());
2947void StmtProfiler::VisitOpenACCCacheConstruct(
const OpenACCCacheConstruct *S) {
2952void StmtProfiler::VisitOpenACCInitConstruct(
const OpenACCInitConstruct *S) {
2954 OpenACCClauseProfiler P{*
this};
2955 P.VisitOpenACCClauseList(S->clauses());
2958void StmtProfiler::VisitOpenACCShutdownConstruct(
2959 const OpenACCShutdownConstruct *S) {
2961 OpenACCClauseProfiler P{*
this};
2962 P.VisitOpenACCClauseList(S->clauses());
2965void StmtProfiler::VisitOpenACCSetConstruct(
const OpenACCSetConstruct *S) {
2967 OpenACCClauseProfiler P{*
this};
2968 P.VisitOpenACCClauseList(S->clauses());
2971void StmtProfiler::VisitOpenACCUpdateConstruct(
2972 const OpenACCUpdateConstruct *S) {
2974 OpenACCClauseProfiler P{*
this};
2975 P.VisitOpenACCClauseList(S->clauses());
2978void StmtProfiler::VisitOpenACCAtomicConstruct(
2979 const OpenACCAtomicConstruct *S) {
2981 OpenACCClauseProfiler P{*
this};
2982 P.VisitOpenACCClauseList(S->clauses());
2985void StmtProfiler::VisitHLSLOutArgExpr(
const HLSLOutArgExpr *S) {
2990 bool Canonical,
bool ProfileLambdaExpr)
const {
2991 StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr);
2992 Profiler.Visit(
this);
2997 StmtProfilerWithoutPointers Profiler(ID, Hash);
2998 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)
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.
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
ConceptDecl * 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
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.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getCanonicalType() const
void * getAsOpaquePtr() const
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
The JSON file list parser is used to communicate input to InstallAPI.
@ 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)
U cast(CodeGen::Address addr)
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
DeclarationName getName() const
getName - Returns the embedded declaration name.