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 VisitOMPClauseList(
C);
916 VisitOMPClauseWithPreInit(
C);
918void OMPClauseProfiler::VisitOMPThreadLimitClause(
919 const OMPThreadLimitClause *
C) {
920 VisitOMPClauseList(
C);
921 VisitOMPClauseWithPreInit(
C);
923void OMPClauseProfiler::VisitOMPPriorityClause(
const OMPPriorityClause *
C) {
924 VisitOMPClauseWithPreInit(
C);
925 if (
C->getPriority())
926 Profiler->VisitStmt(
C->getPriority());
928void OMPClauseProfiler::VisitOMPGrainsizeClause(
const OMPGrainsizeClause *
C) {
929 VisitOMPClauseWithPreInit(
C);
930 if (
C->getGrainsize())
931 Profiler->VisitStmt(
C->getGrainsize());
933void OMPClauseProfiler::VisitOMPNumTasksClause(
const OMPNumTasksClause *
C) {
934 VisitOMPClauseWithPreInit(
C);
935 if (
C->getNumTasks())
936 Profiler->VisitStmt(
C->getNumTasks());
938void OMPClauseProfiler::VisitOMPHintClause(
const OMPHintClause *
C) {
940 Profiler->VisitStmt(
C->getHint());
942void OMPClauseProfiler::VisitOMPToClause(
const OMPToClause *
C) {
943 VisitOMPClauseList(
C);
945void OMPClauseProfiler::VisitOMPFromClause(
const OMPFromClause *
C) {
946 VisitOMPClauseList(
C);
948void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
949 const OMPUseDevicePtrClause *
C) {
950 VisitOMPClauseList(
C);
952void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
953 const OMPUseDeviceAddrClause *
C) {
954 VisitOMPClauseList(
C);
956void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
957 const OMPIsDevicePtrClause *
C) {
958 VisitOMPClauseList(
C);
960void OMPClauseProfiler::VisitOMPHasDeviceAddrClause(
961 const OMPHasDeviceAddrClause *
C) {
962 VisitOMPClauseList(
C);
964void OMPClauseProfiler::VisitOMPNontemporalClause(
965 const OMPNontemporalClause *
C) {
966 VisitOMPClauseList(
C);
967 for (
auto *E :
C->private_refs())
968 Profiler->VisitStmt(E);
970void OMPClauseProfiler::VisitOMPInclusiveClause(
const OMPInclusiveClause *
C) {
971 VisitOMPClauseList(
C);
973void OMPClauseProfiler::VisitOMPExclusiveClause(
const OMPExclusiveClause *
C) {
974 VisitOMPClauseList(
C);
976void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
977 const OMPUsesAllocatorsClause *
C) {
978 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
979 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
985void OMPClauseProfiler::VisitOMPAffinityClause(
const OMPAffinityClause *
C) {
986 if (
const Expr *Modifier =
C->getModifier())
987 Profiler->VisitStmt(Modifier);
988 for (
const Expr *E :
C->varlist())
989 Profiler->VisitStmt(E);
991void OMPClauseProfiler::VisitOMPOrderClause(
const OMPOrderClause *
C) {}
992void OMPClauseProfiler::VisitOMPBindClause(
const OMPBindClause *
C) {}
993void OMPClauseProfiler::VisitOMPXDynCGroupMemClause(
994 const OMPXDynCGroupMemClause *
C) {
995 VisitOMPClauseWithPreInit(
C);
996 if (Expr *Size =
C->getSize())
997 Profiler->VisitStmt(Size);
999void OMPClauseProfiler::VisitOMPDynGroupprivateClause(
1000 const OMPDynGroupprivateClause *
C) {
1001 VisitOMPClauseWithPreInit(
C);
1002 if (
auto *Size =
C->getSize())
1003 Profiler->VisitStmt(Size);
1005void OMPClauseProfiler::VisitOMPDoacrossClause(
const OMPDoacrossClause *
C) {
1006 VisitOMPClauseList(
C);
1008void OMPClauseProfiler::VisitOMPXAttributeClause(
const OMPXAttributeClause *
C) {
1010void OMPClauseProfiler::VisitOMPXBareClause(
const OMPXBareClause *
C) {}
1014StmtProfiler::VisitOMPExecutableDirective(
const OMPExecutableDirective *S) {
1016 OMPClauseProfiler P(
this);
1017 ArrayRef<OMPClause *> Clauses = S->clauses();
1018 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
1024void StmtProfiler::VisitOMPCanonicalLoop(
const OMPCanonicalLoop *L) {
1028void StmtProfiler::VisitOMPLoopBasedDirective(
const OMPLoopBasedDirective *S) {
1029 VisitOMPExecutableDirective(S);
1032void StmtProfiler::VisitOMPLoopDirective(
const OMPLoopDirective *S) {
1033 VisitOMPLoopBasedDirective(S);
1036void StmtProfiler::VisitOMPMetaDirective(
const OMPMetaDirective *S) {
1037 VisitOMPExecutableDirective(S);
1040void StmtProfiler::VisitOMPParallelDirective(
const OMPParallelDirective *S) {
1041 VisitOMPExecutableDirective(S);
1044void StmtProfiler::VisitOMPSimdDirective(
const OMPSimdDirective *S) {
1045 VisitOMPLoopDirective(S);
1048void StmtProfiler::VisitOMPCanonicalLoopNestTransformationDirective(
1049 const OMPCanonicalLoopNestTransformationDirective *S) {
1050 VisitOMPLoopBasedDirective(S);
1053void StmtProfiler::VisitOMPTileDirective(
const OMPTileDirective *S) {
1054 VisitOMPCanonicalLoopNestTransformationDirective(S);
1057void StmtProfiler::VisitOMPStripeDirective(
const OMPStripeDirective *S) {
1058 VisitOMPCanonicalLoopNestTransformationDirective(S);
1061void StmtProfiler::VisitOMPUnrollDirective(
const OMPUnrollDirective *S) {
1062 VisitOMPCanonicalLoopNestTransformationDirective(S);
1065void StmtProfiler::VisitOMPReverseDirective(
const OMPReverseDirective *S) {
1066 VisitOMPCanonicalLoopNestTransformationDirective(S);
1069void StmtProfiler::VisitOMPInterchangeDirective(
1070 const OMPInterchangeDirective *S) {
1071 VisitOMPCanonicalLoopNestTransformationDirective(S);
1074void StmtProfiler::VisitOMPSplitDirective(
const OMPSplitDirective *S) {
1075 VisitOMPCanonicalLoopNestTransformationDirective(S);
1078void StmtProfiler::VisitOMPCanonicalLoopSequenceTransformationDirective(
1079 const OMPCanonicalLoopSequenceTransformationDirective *S) {
1080 VisitOMPExecutableDirective(S);
1083void StmtProfiler::VisitOMPFuseDirective(
const OMPFuseDirective *S) {
1084 VisitOMPCanonicalLoopSequenceTransformationDirective(S);
1087void StmtProfiler::VisitOMPForDirective(
const OMPForDirective *S) {
1088 VisitOMPLoopDirective(S);
1091void StmtProfiler::VisitOMPForSimdDirective(
const OMPForSimdDirective *S) {
1092 VisitOMPLoopDirective(S);
1095void StmtProfiler::VisitOMPSectionsDirective(
const OMPSectionsDirective *S) {
1096 VisitOMPExecutableDirective(S);
1099void StmtProfiler::VisitOMPSectionDirective(
const OMPSectionDirective *S) {
1100 VisitOMPExecutableDirective(S);
1103void StmtProfiler::VisitOMPScopeDirective(
const OMPScopeDirective *S) {
1104 VisitOMPExecutableDirective(S);
1107void StmtProfiler::VisitOMPSingleDirective(
const OMPSingleDirective *S) {
1108 VisitOMPExecutableDirective(S);
1111void StmtProfiler::VisitOMPMasterDirective(
const OMPMasterDirective *S) {
1112 VisitOMPExecutableDirective(S);
1115void StmtProfiler::VisitOMPCriticalDirective(
const OMPCriticalDirective *S) {
1116 VisitOMPExecutableDirective(S);
1117 VisitName(S->getDirectiveName().getName());
1121StmtProfiler::VisitOMPParallelForDirective(
const OMPParallelForDirective *S) {
1122 VisitOMPLoopDirective(S);
1125void StmtProfiler::VisitOMPParallelForSimdDirective(
1126 const OMPParallelForSimdDirective *S) {
1127 VisitOMPLoopDirective(S);
1130void StmtProfiler::VisitOMPParallelMasterDirective(
1131 const OMPParallelMasterDirective *S) {
1132 VisitOMPExecutableDirective(S);
1135void StmtProfiler::VisitOMPParallelMaskedDirective(
1136 const OMPParallelMaskedDirective *S) {
1137 VisitOMPExecutableDirective(S);
1140void StmtProfiler::VisitOMPParallelSectionsDirective(
1141 const OMPParallelSectionsDirective *S) {
1142 VisitOMPExecutableDirective(S);
1145void StmtProfiler::VisitOMPTaskDirective(
const OMPTaskDirective *S) {
1146 VisitOMPExecutableDirective(S);
1149void StmtProfiler::VisitOMPTaskyieldDirective(
const OMPTaskyieldDirective *S) {
1150 VisitOMPExecutableDirective(S);
1153void StmtProfiler::VisitOMPBarrierDirective(
const OMPBarrierDirective *S) {
1154 VisitOMPExecutableDirective(S);
1157void StmtProfiler::VisitOMPTaskwaitDirective(
const OMPTaskwaitDirective *S) {
1158 VisitOMPExecutableDirective(S);
1161void StmtProfiler::VisitOMPAssumeDirective(
const OMPAssumeDirective *S) {
1162 VisitOMPExecutableDirective(S);
1165void StmtProfiler::VisitOMPErrorDirective(
const OMPErrorDirective *S) {
1166 VisitOMPExecutableDirective(S);
1168void StmtProfiler::VisitOMPTaskgroupDirective(
const OMPTaskgroupDirective *S) {
1169 VisitOMPExecutableDirective(S);
1170 if (
const Expr *E = S->getReductionRef())
1174void StmtProfiler::VisitOMPFlushDirective(
const OMPFlushDirective *S) {
1175 VisitOMPExecutableDirective(S);
1178void StmtProfiler::VisitOMPDepobjDirective(
const OMPDepobjDirective *S) {
1179 VisitOMPExecutableDirective(S);
1182void StmtProfiler::VisitOMPScanDirective(
const OMPScanDirective *S) {
1183 VisitOMPExecutableDirective(S);
1186void StmtProfiler::VisitOMPOrderedDirective(
const OMPOrderedDirective *S) {
1187 VisitOMPExecutableDirective(S);
1190void StmtProfiler::VisitOMPAtomicDirective(
const OMPAtomicDirective *S) {
1191 VisitOMPExecutableDirective(S);
1194void StmtProfiler::VisitOMPTargetDirective(
const OMPTargetDirective *S) {
1195 VisitOMPExecutableDirective(S);
1198void StmtProfiler::VisitOMPTargetDataDirective(
const OMPTargetDataDirective *S) {
1199 VisitOMPExecutableDirective(S);
1202void StmtProfiler::VisitOMPTargetEnterDataDirective(
1203 const OMPTargetEnterDataDirective *S) {
1204 VisitOMPExecutableDirective(S);
1207void StmtProfiler::VisitOMPTargetExitDataDirective(
1208 const OMPTargetExitDataDirective *S) {
1209 VisitOMPExecutableDirective(S);
1212void StmtProfiler::VisitOMPTargetParallelDirective(
1213 const OMPTargetParallelDirective *S) {
1214 VisitOMPExecutableDirective(S);
1217void StmtProfiler::VisitOMPTargetParallelForDirective(
1218 const OMPTargetParallelForDirective *S) {
1219 VisitOMPExecutableDirective(S);
1222void StmtProfiler::VisitOMPTeamsDirective(
const OMPTeamsDirective *S) {
1223 VisitOMPExecutableDirective(S);
1226void StmtProfiler::VisitOMPCancellationPointDirective(
1227 const OMPCancellationPointDirective *S) {
1228 VisitOMPExecutableDirective(S);
1231void StmtProfiler::VisitOMPCancelDirective(
const OMPCancelDirective *S) {
1232 VisitOMPExecutableDirective(S);
1235void StmtProfiler::VisitOMPTaskLoopDirective(
const OMPTaskLoopDirective *S) {
1236 VisitOMPLoopDirective(S);
1239void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1240 const OMPTaskLoopSimdDirective *S) {
1241 VisitOMPLoopDirective(S);
1244void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1245 const OMPMasterTaskLoopDirective *S) {
1246 VisitOMPLoopDirective(S);
1249void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1250 const OMPMaskedTaskLoopDirective *S) {
1251 VisitOMPLoopDirective(S);
1254void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1255 const OMPMasterTaskLoopSimdDirective *S) {
1256 VisitOMPLoopDirective(S);
1259void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1260 const OMPMaskedTaskLoopSimdDirective *S) {
1261 VisitOMPLoopDirective(S);
1264void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1265 const OMPParallelMasterTaskLoopDirective *S) {
1266 VisitOMPLoopDirective(S);
1269void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1270 const OMPParallelMaskedTaskLoopDirective *S) {
1271 VisitOMPLoopDirective(S);
1274void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1275 const OMPParallelMasterTaskLoopSimdDirective *S) {
1276 VisitOMPLoopDirective(S);
1279void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1280 const OMPParallelMaskedTaskLoopSimdDirective *S) {
1281 VisitOMPLoopDirective(S);
1284void StmtProfiler::VisitOMPDistributeDirective(
1285 const OMPDistributeDirective *S) {
1286 VisitOMPLoopDirective(S);
1289void OMPClauseProfiler::VisitOMPDistScheduleClause(
1290 const OMPDistScheduleClause *
C) {
1291 VisitOMPClauseWithPreInit(
C);
1292 if (
auto *S =
C->getChunkSize())
1293 Profiler->VisitStmt(S);
1296void OMPClauseProfiler::VisitOMPDefaultmapClause(
const OMPDefaultmapClause *) {}
1298void StmtProfiler::VisitOMPTargetUpdateDirective(
1299 const OMPTargetUpdateDirective *S) {
1300 VisitOMPExecutableDirective(S);
1303void StmtProfiler::VisitOMPDistributeParallelForDirective(
1304 const OMPDistributeParallelForDirective *S) {
1305 VisitOMPLoopDirective(S);
1308void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1309 const OMPDistributeParallelForSimdDirective *S) {
1310 VisitOMPLoopDirective(S);
1313void StmtProfiler::VisitOMPDistributeSimdDirective(
1314 const OMPDistributeSimdDirective *S) {
1315 VisitOMPLoopDirective(S);
1318void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1319 const OMPTargetParallelForSimdDirective *S) {
1320 VisitOMPLoopDirective(S);
1323void StmtProfiler::VisitOMPTargetSimdDirective(
1324 const OMPTargetSimdDirective *S) {
1325 VisitOMPLoopDirective(S);
1328void StmtProfiler::VisitOMPTeamsDistributeDirective(
1329 const OMPTeamsDistributeDirective *S) {
1330 VisitOMPLoopDirective(S);
1333void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1334 const OMPTeamsDistributeSimdDirective *S) {
1335 VisitOMPLoopDirective(S);
1338void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1339 const OMPTeamsDistributeParallelForSimdDirective *S) {
1340 VisitOMPLoopDirective(S);
1343void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1344 const OMPTeamsDistributeParallelForDirective *S) {
1345 VisitOMPLoopDirective(S);
1348void StmtProfiler::VisitOMPTargetTeamsDirective(
1349 const OMPTargetTeamsDirective *S) {
1350 VisitOMPExecutableDirective(S);
1353void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1354 const OMPTargetTeamsDistributeDirective *S) {
1355 VisitOMPLoopDirective(S);
1358void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1359 const OMPTargetTeamsDistributeParallelForDirective *S) {
1360 VisitOMPLoopDirective(S);
1363void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1364 const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
1365 VisitOMPLoopDirective(S);
1368void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1369 const OMPTargetTeamsDistributeSimdDirective *S) {
1370 VisitOMPLoopDirective(S);
1373void StmtProfiler::VisitOMPInteropDirective(
const OMPInteropDirective *S) {
1374 VisitOMPExecutableDirective(S);
1377void StmtProfiler::VisitOMPDispatchDirective(
const OMPDispatchDirective *S) {
1378 VisitOMPExecutableDirective(S);
1381void StmtProfiler::VisitOMPMaskedDirective(
const OMPMaskedDirective *S) {
1382 VisitOMPExecutableDirective(S);
1385void StmtProfiler::VisitOMPGenericLoopDirective(
1386 const OMPGenericLoopDirective *S) {
1387 VisitOMPLoopDirective(S);
1390void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1391 const OMPTeamsGenericLoopDirective *S) {
1392 VisitOMPLoopDirective(S);
1395void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1396 const OMPTargetTeamsGenericLoopDirective *S) {
1397 VisitOMPLoopDirective(S);
1400void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1401 const OMPParallelGenericLoopDirective *S) {
1402 VisitOMPLoopDirective(S);
1405void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1406 const OMPTargetParallelGenericLoopDirective *S) {
1407 VisitOMPLoopDirective(S);
1410void StmtProfiler::VisitExpr(
const Expr *S) {
1414void StmtProfiler::VisitConstantExpr(
const ConstantExpr *S) {
1419void StmtProfiler::VisitDeclRefExpr(
const DeclRefExpr *S) {
1431void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1432 const SYCLUniqueStableNameExpr *S) {
1437void StmtProfiler::VisitUnresolvedSYCLKernelCallStmt(
1438 const UnresolvedSYCLKernelCallStmt *S) {
1442void StmtProfiler::VisitPredefinedExpr(
const PredefinedExpr *S) {
1447void StmtProfiler::VisitOpenACCAsteriskSizeExpr(
1448 const OpenACCAsteriskSizeExpr *S) {
1452void StmtProfiler::VisitIntegerLiteral(
const IntegerLiteral *S) {
1460 if (
auto BitIntT = T->
getAs<BitIntType>())
1461 BitIntT->Profile(ID);
1463 ID.AddInteger(T->
castAs<BuiltinType>()->getKind());
1466void StmtProfiler::VisitFixedPointLiteral(
const FixedPointLiteral *S) {
1472void StmtProfiler::VisitCharacterLiteral(
const CharacterLiteral *S) {
1474 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1478void StmtProfiler::VisitFloatingLiteral(
const FloatingLiteral *S) {
1485void StmtProfiler::VisitImaginaryLiteral(
const ImaginaryLiteral *S) {
1489void StmtProfiler::VisitStringLiteral(
const StringLiteral *S) {
1492 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1495void StmtProfiler::VisitParenExpr(
const ParenExpr *S) {
1499void StmtProfiler::VisitParenListExpr(
const ParenListExpr *S) {
1503void StmtProfiler::VisitUnaryOperator(
const UnaryOperator *S) {
1508void StmtProfiler::VisitOffsetOfExpr(
const OffsetOfExpr *S) {
1511 for (
unsigned i = 0; i < n; ++i) {
1537StmtProfiler::VisitUnaryExprOrTypeTraitExpr(
const UnaryExprOrTypeTraitExpr *S) {
1544void StmtProfiler::VisitArraySubscriptExpr(
const ArraySubscriptExpr *S) {
1548void StmtProfiler::VisitMatrixSingleSubscriptExpr(
1549 const MatrixSingleSubscriptExpr *S) {
1553void StmtProfiler::VisitMatrixSubscriptExpr(
const MatrixSubscriptExpr *S) {
1557void StmtProfiler::VisitArraySectionExpr(
const ArraySectionExpr *S) {
1561void StmtProfiler::VisitOMPArrayShapingExpr(
const OMPArrayShapingExpr *S) {
1565void StmtProfiler::VisitOMPIteratorExpr(
const OMPIteratorExpr *S) {
1571void StmtProfiler::VisitCallExpr(
const CallExpr *S) {
1575void StmtProfiler::VisitMemberExpr(
const MemberExpr *S) {
1583void StmtProfiler::VisitCompoundLiteralExpr(
const CompoundLiteralExpr *S) {
1588void StmtProfiler::VisitCastExpr(
const CastExpr *S) {
1592void StmtProfiler::VisitImplicitCastExpr(
const ImplicitCastExpr *S) {
1597void StmtProfiler::VisitExplicitCastExpr(
const ExplicitCastExpr *S) {
1602void StmtProfiler::VisitCStyleCastExpr(
const CStyleCastExpr *S) {
1603 VisitExplicitCastExpr(S);
1606void StmtProfiler::VisitBinaryOperator(
const BinaryOperator *S) {
1612StmtProfiler::VisitCompoundAssignOperator(
const CompoundAssignOperator *S) {
1613 VisitBinaryOperator(S);
1616void StmtProfiler::VisitConditionalOperator(
const ConditionalOperator *S) {
1620void StmtProfiler::VisitBinaryConditionalOperator(
1621 const BinaryConditionalOperator *S) {
1625void StmtProfiler::VisitAddrLabelExpr(
const AddrLabelExpr *S) {
1630void StmtProfiler::VisitStmtExpr(
const StmtExpr *S) {
1634void StmtProfiler::VisitShuffleVectorExpr(
const ShuffleVectorExpr *S) {
1638void StmtProfiler::VisitConvertVectorExpr(
const ConvertVectorExpr *S) {
1642void StmtProfiler::VisitChooseExpr(
const ChooseExpr *S) {
1646void StmtProfiler::VisitGNUNullExpr(
const GNUNullExpr *S) {
1650void StmtProfiler::VisitVAArgExpr(
const VAArgExpr *S) {
1654void StmtProfiler::VisitInitListExpr(
const InitListExpr *S) {
1663void StmtProfiler::VisitDesignatedInitExpr(
const DesignatedInitExpr *S) {
1666 for (
const DesignatedInitExpr::Designator &D : S->
designators()) {
1667 if (D.isFieldDesignator()) {
1669 VisitName(D.getFieldName());
1673 if (D.isArrayDesignator()) {
1676 assert(D.isArrayRangeDesignator());
1679 ID.AddInteger(D.getArrayIndex());
1685void StmtProfiler::VisitDesignatedInitUpdateExpr(
1686 const DesignatedInitUpdateExpr *S) {
1687 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
1691void StmtProfiler::VisitArrayInitLoopExpr(
const ArrayInitLoopExpr *S) {
1695void StmtProfiler::VisitArrayInitIndexExpr(
const ArrayInitIndexExpr *S) {
1699void StmtProfiler::VisitNoInitExpr(
const NoInitExpr *S) {
1700 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
1703void StmtProfiler::VisitImplicitValueInitExpr(
const ImplicitValueInitExpr *S) {
1707void StmtProfiler::VisitExtVectorElementExpr(
const ExtVectorElementExpr *S) {
1712void StmtProfiler::VisitMatrixElementExpr(
const MatrixElementExpr *S) {
1717void StmtProfiler::VisitBlockExpr(
const BlockExpr *S) {
1722void StmtProfiler::VisitGenericSelectionExpr(
const GenericSelectionExpr *S) {
1726 QualType T = Assoc.getType();
1728 ID.AddPointer(
nullptr);
1731 VisitExpr(Assoc.getAssociationExpr());
1735void StmtProfiler::VisitPseudoObjectExpr(
const PseudoObjectExpr *S) {
1740 if (
const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1741 Visit(OVE->getSourceExpr());
1744void StmtProfiler::VisitAtomicExpr(
const AtomicExpr *S) {
1749void StmtProfiler::VisitConceptSpecializationExpr(
1750 const ConceptSpecializationExpr *S) {
1754 VisitTemplateArgument(Arg);
1757void StmtProfiler::VisitRequiresExpr(
const RequiresExpr *S) {
1761 VisitDecl(LocalParam);
1764 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1766 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1767 if (!TypeReq->isSubstitutionFailure())
1768 VisitType(TypeReq->getType()->getType());
1769 }
else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1771 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1772 if (!ExprReq->isExprSubstitutionFailure())
1773 Visit(ExprReq->getExpr());
1778 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1779 const concepts::ExprRequirement::ReturnTypeRequirement &RetReq =
1780 ExprReq->getReturnTypeRequirement();
1793 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1794 if (!NestedReq->hasInvalidConstraint())
1795 Visit(NestedReq->getConstraintExpr());
1803 unsigned &NumArgs) {
1809 case OO_Array_Delete:
1811 case OO_Conditional:
1813 llvm_unreachable(
"Invalid operator call kind");
1818 return Stmt::UnaryOperatorClass;
1822 return Stmt::BinaryOperatorClass;
1827 return Stmt::UnaryOperatorClass;
1831 return Stmt::BinaryOperatorClass;
1836 return Stmt::UnaryOperatorClass;
1840 return Stmt::BinaryOperatorClass;
1844 return Stmt::BinaryOperatorClass;
1848 return Stmt::BinaryOperatorClass;
1852 return Stmt::BinaryOperatorClass;
1856 UnaryOp = UO_AddrOf;
1857 return Stmt::UnaryOperatorClass;
1861 return Stmt::BinaryOperatorClass;
1865 return Stmt::BinaryOperatorClass;
1869 return Stmt::UnaryOperatorClass;
1873 return Stmt::UnaryOperatorClass;
1876 BinaryOp = BO_Assign;
1877 return Stmt::BinaryOperatorClass;
1881 return Stmt::BinaryOperatorClass;
1885 return Stmt::BinaryOperatorClass;
1888 BinaryOp = BO_AddAssign;
1889 return Stmt::CompoundAssignOperatorClass;
1892 BinaryOp = BO_SubAssign;
1893 return Stmt::CompoundAssignOperatorClass;
1896 BinaryOp = BO_MulAssign;
1897 return Stmt::CompoundAssignOperatorClass;
1900 BinaryOp = BO_DivAssign;
1901 return Stmt::CompoundAssignOperatorClass;
1903 case OO_PercentEqual:
1904 BinaryOp = BO_RemAssign;
1905 return Stmt::CompoundAssignOperatorClass;
1908 BinaryOp = BO_XorAssign;
1909 return Stmt::CompoundAssignOperatorClass;
1912 BinaryOp = BO_AndAssign;
1913 return Stmt::CompoundAssignOperatorClass;
1916 BinaryOp = BO_OrAssign;
1917 return Stmt::CompoundAssignOperatorClass;
1921 return Stmt::BinaryOperatorClass;
1923 case OO_GreaterGreater:
1925 return Stmt::BinaryOperatorClass;
1927 case OO_LessLessEqual:
1928 BinaryOp = BO_ShlAssign;
1929 return Stmt::CompoundAssignOperatorClass;
1931 case OO_GreaterGreaterEqual:
1932 BinaryOp = BO_ShrAssign;
1933 return Stmt::CompoundAssignOperatorClass;
1937 return Stmt::BinaryOperatorClass;
1939 case OO_ExclaimEqual:
1941 return Stmt::BinaryOperatorClass;
1945 return Stmt::BinaryOperatorClass;
1947 case OO_GreaterEqual:
1949 return Stmt::BinaryOperatorClass;
1953 return Stmt::BinaryOperatorClass;
1957 return Stmt::BinaryOperatorClass;
1961 return Stmt::BinaryOperatorClass;
1964 UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc;
1966 return Stmt::UnaryOperatorClass;
1969 UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec;
1971 return Stmt::UnaryOperatorClass;
1974 BinaryOp = BO_Comma;
1975 return Stmt::BinaryOperatorClass;
1978 BinaryOp = BO_PtrMemI;
1979 return Stmt::BinaryOperatorClass;
1982 return Stmt::ArraySubscriptExprClass;
1985 return Stmt::CallExprClass;
1988 UnaryOp = UO_Coawait;
1989 return Stmt::UnaryOperatorClass;
1992 llvm_unreachable(
"Invalid overloaded operator expression");
1995#if defined(_MSC_VER) && !defined(__clang__)
2000#pragma optimize("", off)
2004void StmtProfiler::VisitCXXOperatorCallExpr(
const CXXOperatorCallExpr *S) {
2012 return Visit(S->
getArg(0));
2020 for (
unsigned I = 0; I != NumArgs; ++I)
2022 if (SC == Stmt::UnaryOperatorClass)
2023 ID.AddInteger(UnaryOp);
2024 else if (SC == Stmt::BinaryOperatorClass ||
2025 SC == Stmt::CompoundAssignOperatorClass)
2026 ID.AddInteger(BinaryOp);
2028 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
2037void StmtProfiler::VisitCXXRewrittenBinaryOperator(
2038 const CXXRewrittenBinaryOperator *S) {
2042 "resolved rewritten operator should never be type-dependent");
2047#if defined(_MSC_VER) && !defined(__clang__)
2049#pragma optimize("", on)
2053void StmtProfiler::VisitCXXMemberCallExpr(
const CXXMemberCallExpr *S) {
2057void StmtProfiler::VisitCUDAKernelCallExpr(
const CUDAKernelCallExpr *S) {
2061void StmtProfiler::VisitAsTypeExpr(
const AsTypeExpr *S) {
2065void StmtProfiler::VisitCXXNamedCastExpr(
const CXXNamedCastExpr *S) {
2066 VisitExplicitCastExpr(S);
2069void StmtProfiler::VisitCXXStaticCastExpr(
const CXXStaticCastExpr *S) {
2070 VisitCXXNamedCastExpr(S);
2073void StmtProfiler::VisitCXXDynamicCastExpr(
const CXXDynamicCastExpr *S) {
2074 VisitCXXNamedCastExpr(S);
2078StmtProfiler::VisitCXXReinterpretCastExpr(
const CXXReinterpretCastExpr *S) {
2079 VisitCXXNamedCastExpr(S);
2082void StmtProfiler::VisitCXXConstCastExpr(
const CXXConstCastExpr *S) {
2083 VisitCXXNamedCastExpr(S);
2086void StmtProfiler::VisitBuiltinBitCastExpr(
const BuiltinBitCastExpr *S) {
2091void StmtProfiler::VisitCXXAddrspaceCastExpr(
const CXXAddrspaceCastExpr *S) {
2092 VisitCXXNamedCastExpr(S);
2095void StmtProfiler::VisitUserDefinedLiteral(
const UserDefinedLiteral *S) {
2099void StmtProfiler::VisitCXXBoolLiteralExpr(
const CXXBoolLiteralExpr *S) {
2104void StmtProfiler::VisitCXXNullPtrLiteralExpr(
const CXXNullPtrLiteralExpr *S) {
2108void StmtProfiler::VisitCXXStdInitializerListExpr(
2109 const CXXStdInitializerListExpr *S) {
2113void StmtProfiler::VisitCXXTypeidExpr(
const CXXTypeidExpr *S) {
2119void StmtProfiler::VisitCXXUuidofExpr(
const CXXUuidofExpr *S) {
2125void StmtProfiler::VisitMSPropertyRefExpr(
const MSPropertyRefExpr *S) {
2130void StmtProfiler::VisitMSPropertySubscriptExpr(
2131 const MSPropertySubscriptExpr *S) {
2135void StmtProfiler::VisitCXXThisExpr(
const CXXThisExpr *S) {
2141void StmtProfiler::VisitCXXThrowExpr(
const CXXThrowExpr *S) {
2145void StmtProfiler::VisitCXXDefaultArgExpr(
const CXXDefaultArgExpr *S) {
2150void StmtProfiler::VisitCXXDefaultInitExpr(
const CXXDefaultInitExpr *S) {
2155void StmtProfiler::VisitCXXBindTemporaryExpr(
const CXXBindTemporaryExpr *S) {
2161void StmtProfiler::VisitCXXConstructExpr(
const CXXConstructExpr *S) {
2167void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2168 const CXXInheritedCtorInitExpr *S) {
2173void StmtProfiler::VisitCXXFunctionalCastExpr(
const CXXFunctionalCastExpr *S) {
2174 VisitExplicitCastExpr(S);
2178StmtProfiler::VisitCXXTemporaryObjectExpr(
const CXXTemporaryObjectExpr *S) {
2179 VisitCXXConstructExpr(S);
2183StmtProfiler::VisitLambdaExpr(
const LambdaExpr *S) {
2184 if (!ProfileLambdaExpr) {
2188 VisitStmtNoChildren(S);
2199 ID.AddInteger(
Capture.getCaptureKind());
2200 if (
Capture.capturesVariable())
2201 VisitDecl(
Capture.getCapturedVar());
2210 for (
auto *SubDecl : Lambda->
decls()) {
2211 FunctionDecl *
Call =
nullptr;
2212 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(SubDecl))
2213 Call = FTD->getTemplatedDecl();
2214 else if (
auto *FD = dyn_cast<FunctionDecl>(SubDecl))
2225void StmtProfiler::VisitCXXReflectExpr(
const CXXReflectExpr *E) {
2227 assert(
false &&
"not implemented yet");
2231StmtProfiler::VisitCXXScalarValueInitExpr(
const CXXScalarValueInitExpr *S) {
2235void StmtProfiler::VisitCXXDeleteExpr(
const CXXDeleteExpr *S) {
2242void StmtProfiler::VisitCXXNewExpr(
const CXXNewExpr *S) {
2255StmtProfiler::VisitCXXPseudoDestructorExpr(
const CXXPseudoDestructorExpr *S) {
2269void StmtProfiler::VisitOverloadExpr(
const OverloadExpr *S) {
2271 bool DescribingDependentVarTemplate =
2273 if (DescribingDependentVarTemplate) {
2277 VisitName(S->
getName(),
true);
2285StmtProfiler::VisitUnresolvedLookupExpr(
const UnresolvedLookupExpr *S) {
2286 VisitOverloadExpr(S);
2289void StmtProfiler::VisitTypeTraitExpr(
const TypeTraitExpr *S) {
2293 for (
unsigned I = 0, N = S->
getNumArgs(); I != N; ++I)
2297void StmtProfiler::VisitArrayTypeTraitExpr(
const ArrayTypeTraitExpr *S) {
2303void StmtProfiler::VisitExpressionTraitExpr(
const ExpressionTraitExpr *S) {
2309void StmtProfiler::VisitDependentScopeDeclRefExpr(
2310 const DependentScopeDeclRefExpr *S) {
2319void StmtProfiler::VisitExprWithCleanups(
const ExprWithCleanups *S) {
2323void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2324 const CXXUnresolvedConstructExpr *S) {
2330void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2331 const CXXDependentScopeMemberExpr *S) {
2344void StmtProfiler::VisitUnresolvedMemberExpr(
const UnresolvedMemberExpr *S) {
2357void StmtProfiler::VisitCXXNoexceptExpr(
const CXXNoexceptExpr *S) {
2361void StmtProfiler::VisitPackExpansionExpr(
const PackExpansionExpr *S) {
2365void StmtProfiler::VisitSizeOfPackExpr(
const SizeOfPackExpr *S) {
2369 ID.AddInteger(Args.size());
2370 for (
const auto &TA : Args)
2371 VisitTemplateArgument(TA);
2378void StmtProfiler::VisitPackIndexingExpr(
const PackIndexingExpr *E) {
2379 VisitStmtNoChildren(E);
2390void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2391 const SubstNonTypeTemplateParmPackExpr *S) {
2397void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2398 const SubstNonTypeTemplateParmExpr *E) {
2403void StmtProfiler::VisitFunctionParmPackExpr(
const FunctionParmPackExpr *S) {
2411void StmtProfiler::VisitMaterializeTemporaryExpr(
2412 const MaterializeTemporaryExpr *S) {
2416void StmtProfiler::VisitCXXFoldExpr(
const CXXFoldExpr *S) {
2417 VisitStmtNoChildren(S);
2440void StmtProfiler::VisitCXXParenListInitExpr(
const CXXParenListInitExpr *S) {
2444void StmtProfiler::VisitCoroutineBodyStmt(
const CoroutineBodyStmt *S) {
2448void StmtProfiler::VisitCoreturnStmt(
const CoreturnStmt *S) {
2452void StmtProfiler::VisitCoawaitExpr(
const CoawaitExpr *S) {
2456void StmtProfiler::VisitDependentCoawaitExpr(
const DependentCoawaitExpr *S) {
2460void StmtProfiler::VisitCoyieldExpr(
const CoyieldExpr *S) {
2464void StmtProfiler::VisitOpaqueValueExpr(
const OpaqueValueExpr *E) {
2468void StmtProfiler::VisitSourceLocExpr(
const SourceLocExpr *E) {
2472void StmtProfiler::VisitEmbedExpr(
const EmbedExpr *E) { VisitExpr(E); }
2474void StmtProfiler::VisitRecoveryExpr(
const RecoveryExpr *E) { VisitExpr(E); }
2476void StmtProfiler::VisitObjCObjectLiteral(
const ObjCObjectLiteral *E) {
2480void StmtProfiler::VisitObjCStringLiteral(
const ObjCStringLiteral *S) {
2481 VisitObjCObjectLiteral(S);
2484void StmtProfiler::VisitObjCBoxedExpr(
const ObjCBoxedExpr *E) {
2485 VisitObjCObjectLiteral(E);
2488void StmtProfiler::VisitObjCArrayLiteral(
const ObjCArrayLiteral *E) {
2489 VisitObjCObjectLiteral(E);
2492void StmtProfiler::VisitObjCDictionaryLiteral(
const ObjCDictionaryLiteral *E) {
2493 VisitObjCObjectLiteral(E);
2496void StmtProfiler::VisitObjCEncodeExpr(
const ObjCEncodeExpr *S) {
2501void StmtProfiler::VisitObjCSelectorExpr(
const ObjCSelectorExpr *S) {
2506void StmtProfiler::VisitObjCProtocolExpr(
const ObjCProtocolExpr *S) {
2511void StmtProfiler::VisitObjCIvarRefExpr(
const ObjCIvarRefExpr *S) {
2518void StmtProfiler::VisitObjCPropertyRefExpr(
const ObjCPropertyRefExpr *S) {
2532void StmtProfiler::VisitObjCSubscriptRefExpr(
const ObjCSubscriptRefExpr *S) {
2538void StmtProfiler::VisitObjCMessageExpr(
const ObjCMessageExpr *S) {
2544void StmtProfiler::VisitObjCIsaExpr(
const ObjCIsaExpr *S) {
2549void StmtProfiler::VisitObjCBoolLiteralExpr(
const ObjCBoolLiteralExpr *S) {
2554void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2555 const ObjCIndirectCopyRestoreExpr *S) {
2560void StmtProfiler::VisitObjCBridgedCastExpr(
const ObjCBridgedCastExpr *S) {
2561 VisitExplicitCastExpr(S);
2565void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2566 const ObjCAvailabilityCheckExpr *S) {
2570void StmtProfiler::VisitTemplateArguments(
const TemplateArgumentLoc *Args,
2572 ID.AddInteger(NumArgs);
2573 for (
unsigned I = 0; I != NumArgs; ++I)
2577void StmtProfiler::VisitTemplateArgument(
const TemplateArgument &Arg) {
2620 VisitTemplateArgument(P);
2626class OpenACCClauseProfiler
2627 :
public OpenACCClauseVisitor<OpenACCClauseProfiler> {
2628 StmtProfiler &Profiler;
2631 OpenACCClauseProfiler(StmtProfiler &P) : Profiler(P) {}
2633 void VisitOpenACCClauseList(ArrayRef<const OpenACCClause *> Clauses) {
2634 for (
const OpenACCClause *Clause : Clauses) {
2641 void VisitClauseWithVarList(
const OpenACCClauseWithVarList &Clause) {
2643 Profiler.VisitStmt(E);
2646#define VISIT_CLAUSE(CLAUSE_NAME) \
2647 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
2649#include "clang/Basic/OpenACCClauses.def"
2653void OpenACCClauseProfiler::VisitDefaultClause(
2654 const OpenACCDefaultClause &Clause) {}
2656void OpenACCClauseProfiler::VisitIfClause(
const OpenACCIfClause &Clause) {
2658 "if clause requires a valid condition expr");
2662void OpenACCClauseProfiler::VisitCopyClause(
const OpenACCCopyClause &Clause) {
2663 VisitClauseWithVarList(Clause);
2666void OpenACCClauseProfiler::VisitLinkClause(
const OpenACCLinkClause &Clause) {
2667 VisitClauseWithVarList(Clause);
2670void OpenACCClauseProfiler::VisitDeviceResidentClause(
2671 const OpenACCDeviceResidentClause &Clause) {
2672 VisitClauseWithVarList(Clause);
2675void OpenACCClauseProfiler::VisitCopyInClause(
2676 const OpenACCCopyInClause &Clause) {
2677 VisitClauseWithVarList(Clause);
2680void OpenACCClauseProfiler::VisitCopyOutClause(
2681 const OpenACCCopyOutClause &Clause) {
2682 VisitClauseWithVarList(Clause);
2685void OpenACCClauseProfiler::VisitCreateClause(
2686 const OpenACCCreateClause &Clause) {
2687 VisitClauseWithVarList(Clause);
2690void OpenACCClauseProfiler::VisitHostClause(
const OpenACCHostClause &Clause) {
2691 VisitClauseWithVarList(Clause);
2694void OpenACCClauseProfiler::VisitDeviceClause(
2695 const OpenACCDeviceClause &Clause) {
2696 VisitClauseWithVarList(Clause);
2699void OpenACCClauseProfiler::VisitSelfClause(
const OpenACCSelfClause &Clause) {
2705 Profiler.VisitStmt(E);
2709void OpenACCClauseProfiler::VisitFinalizeClause(
2710 const OpenACCFinalizeClause &Clause) {}
2712void OpenACCClauseProfiler::VisitIfPresentClause(
2713 const OpenACCIfPresentClause &Clause) {}
2715void OpenACCClauseProfiler::VisitNumGangsClause(
2716 const OpenACCNumGangsClause &Clause) {
2718 Profiler.VisitStmt(E);
2721void OpenACCClauseProfiler::VisitTileClause(
const OpenACCTileClause &Clause) {
2723 Profiler.VisitStmt(E);
2726void OpenACCClauseProfiler::VisitNumWorkersClause(
2727 const OpenACCNumWorkersClause &Clause) {
2728 assert(Clause.
hasIntExpr() &&
"num_workers clause requires a valid int expr");
2732void OpenACCClauseProfiler::VisitCollapseClause(
2733 const OpenACCCollapseClause &Clause) {
2734 assert(Clause.
getLoopCount() &&
"collapse clause requires a valid int expr");
2738void OpenACCClauseProfiler::VisitPrivateClause(
2739 const OpenACCPrivateClause &Clause) {
2740 VisitClauseWithVarList(Clause);
2743 Profiler.VisitDecl(Recipe.AllocaDecl);
2747void OpenACCClauseProfiler::VisitFirstPrivateClause(
2748 const OpenACCFirstPrivateClause &Clause) {
2749 VisitClauseWithVarList(Clause);
2752 Profiler.VisitDecl(Recipe.AllocaDecl);
2753 Profiler.VisitDecl(Recipe.InitFromTemporary);
2757void OpenACCClauseProfiler::VisitAttachClause(
2758 const OpenACCAttachClause &Clause) {
2759 VisitClauseWithVarList(Clause);
2762void OpenACCClauseProfiler::VisitDetachClause(
2763 const OpenACCDetachClause &Clause) {
2764 VisitClauseWithVarList(Clause);
2767void OpenACCClauseProfiler::VisitDeleteClause(
2768 const OpenACCDeleteClause &Clause) {
2769 VisitClauseWithVarList(Clause);
2772void OpenACCClauseProfiler::VisitDevicePtrClause(
2773 const OpenACCDevicePtrClause &Clause) {
2774 VisitClauseWithVarList(Clause);
2777void OpenACCClauseProfiler::VisitNoCreateClause(
2778 const OpenACCNoCreateClause &Clause) {
2779 VisitClauseWithVarList(Clause);
2782void OpenACCClauseProfiler::VisitPresentClause(
2783 const OpenACCPresentClause &Clause) {
2784 VisitClauseWithVarList(Clause);
2787void OpenACCClauseProfiler::VisitUseDeviceClause(
2788 const OpenACCUseDeviceClause &Clause) {
2789 VisitClauseWithVarList(Clause);
2792void OpenACCClauseProfiler::VisitVectorLengthClause(
2793 const OpenACCVectorLengthClause &Clause) {
2795 "vector_length clause requires a valid int expr");
2799void OpenACCClauseProfiler::VisitAsyncClause(
const OpenACCAsyncClause &Clause) {
2804void OpenACCClauseProfiler::VisitDeviceNumClause(
2805 const OpenACCDeviceNumClause &Clause) {
2809void OpenACCClauseProfiler::VisitDefaultAsyncClause(
2810 const OpenACCDefaultAsyncClause &Clause) {
2814void OpenACCClauseProfiler::VisitWorkerClause(
2815 const OpenACCWorkerClause &Clause) {
2820void OpenACCClauseProfiler::VisitVectorClause(
2821 const OpenACCVectorClause &Clause) {
2826void OpenACCClauseProfiler::VisitWaitClause(
const OpenACCWaitClause &Clause) {
2830 Profiler.VisitStmt(E);
2834void OpenACCClauseProfiler::VisitDeviceTypeClause(
2835 const OpenACCDeviceTypeClause &Clause) {}
2837void OpenACCClauseProfiler::VisitAutoClause(
const OpenACCAutoClause &Clause) {}
2839void OpenACCClauseProfiler::VisitIndependentClause(
2840 const OpenACCIndependentClause &Clause) {}
2842void OpenACCClauseProfiler::VisitSeqClause(
const OpenACCSeqClause &Clause) {}
2843void OpenACCClauseProfiler::VisitNoHostClause(
2844 const OpenACCNoHostClause &Clause) {}
2846void OpenACCClauseProfiler::VisitGangClause(
const OpenACCGangClause &Clause) {
2847 for (
unsigned I = 0; I < Clause.
getNumExprs(); ++I) {
2848 Profiler.VisitStmt(Clause.
getExpr(I).second);
2852void OpenACCClauseProfiler::VisitReductionClause(
2853 const OpenACCReductionClause &Clause) {
2854 VisitClauseWithVarList(Clause);
2857 Profiler.VisitDecl(Recipe.AllocaDecl);
2862 static_assert(
sizeof(OpenACCReductionRecipe::CombinerRecipe) ==
2864 for (
auto &CombinerRecipe : Recipe.CombinerRecipes) {
2865 if (CombinerRecipe.Op) {
2866 Profiler.VisitDecl(CombinerRecipe.LHS);
2867 Profiler.VisitDecl(CombinerRecipe.RHS);
2868 Profiler.VisitStmt(CombinerRecipe.Op);
2874void OpenACCClauseProfiler::VisitBindClause(
const OpenACCBindClause &Clause) {
2875 assert(
false &&
"not implemented... what can we do about our expr?");
2879void StmtProfiler::VisitOpenACCComputeConstruct(
2884 OpenACCClauseProfiler P{*
this};
2885 P.VisitOpenACCClauseList(S->clauses());
2888void StmtProfiler::VisitOpenACCLoopConstruct(
const OpenACCLoopConstruct *S) {
2892 OpenACCClauseProfiler P{*
this};
2893 P.VisitOpenACCClauseList(S->clauses());
2896void StmtProfiler::VisitOpenACCCombinedConstruct(
2897 const OpenACCCombinedConstruct *S) {
2901 OpenACCClauseProfiler P{*
this};
2902 P.VisitOpenACCClauseList(S->clauses());
2905void StmtProfiler::VisitOpenACCDataConstruct(
const OpenACCDataConstruct *S) {
2908 OpenACCClauseProfiler P{*
this};
2909 P.VisitOpenACCClauseList(S->clauses());
2912void StmtProfiler::VisitOpenACCEnterDataConstruct(
2913 const OpenACCEnterDataConstruct *S) {
2916 OpenACCClauseProfiler P{*
this};
2917 P.VisitOpenACCClauseList(S->clauses());
2920void StmtProfiler::VisitOpenACCExitDataConstruct(
2921 const OpenACCExitDataConstruct *S) {
2924 OpenACCClauseProfiler P{*
this};
2925 P.VisitOpenACCClauseList(S->clauses());
2928void StmtProfiler::VisitOpenACCHostDataConstruct(
2929 const OpenACCHostDataConstruct *S) {
2932 OpenACCClauseProfiler P{*
this};
2933 P.VisitOpenACCClauseList(S->clauses());
2936void StmtProfiler::VisitOpenACCWaitConstruct(
const OpenACCWaitConstruct *S) {
2940 OpenACCClauseProfiler P{*
this};
2941 P.VisitOpenACCClauseList(S->clauses());
2944void StmtProfiler::VisitOpenACCCacheConstruct(
const OpenACCCacheConstruct *S) {
2949void StmtProfiler::VisitOpenACCInitConstruct(
const OpenACCInitConstruct *S) {
2951 OpenACCClauseProfiler P{*
this};
2952 P.VisitOpenACCClauseList(S->clauses());
2955void StmtProfiler::VisitOpenACCShutdownConstruct(
2956 const OpenACCShutdownConstruct *S) {
2958 OpenACCClauseProfiler P{*
this};
2959 P.VisitOpenACCClauseList(S->clauses());
2962void StmtProfiler::VisitOpenACCSetConstruct(
const OpenACCSetConstruct *S) {
2964 OpenACCClauseProfiler P{*
this};
2965 P.VisitOpenACCClauseList(S->clauses());
2968void StmtProfiler::VisitOpenACCUpdateConstruct(
2969 const OpenACCUpdateConstruct *S) {
2971 OpenACCClauseProfiler P{*
this};
2972 P.VisitOpenACCClauseList(S->clauses());
2975void StmtProfiler::VisitOpenACCAtomicConstruct(
2976 const OpenACCAtomicConstruct *S) {
2978 OpenACCClauseProfiler P{*
this};
2979 P.VisitOpenACCClauseList(S->clauses());
2982void StmtProfiler::VisitHLSLOutArgExpr(
const HLSLOutArgExpr *S) {
2987 bool Canonical,
bool ProfileLambdaExpr)
const {
2988 StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr);
2989 Profiler.Visit(
this);
2994 StmtProfilerWithoutPointers Profiler(ID, Hash);
2995 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
FieldDecl * getField() const
For a field offsetof node, returns the field.
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of 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.