24#include "llvm/ADT/FoldingSet.h"
30 llvm::FoldingSetNodeID &ID;
32 bool ProfileLambdaExpr;
35 StmtProfiler(llvm::FoldingSetNodeID &ID,
bool Canonical,
36 bool ProfileLambdaExpr)
37 : ID(ID), Canonical(Canonical), ProfileLambdaExpr(ProfileLambdaExpr) {}
39 virtual ~StmtProfiler() {}
41 void VisitStmt(
const Stmt *S);
44 void VisitInteger(uint64_t
Value) { ID.AddInteger(
Value); }
46 void VisitStmtNoChildren(
const Stmt *S) {
52#define STMT(Node, Base) void Visit##Node(const Node *S);
53#include "clang/AST/StmtNodes.inc"
57 virtual void VisitDecl(
const Decl *D) = 0;
64 virtual void VisitName(
DeclarationName Name,
bool TreatAsDecl =
false) = 0;
86 class StmtProfilerWithPointers :
public StmtProfiler {
87 const ASTContext &Context;
90 StmtProfilerWithPointers(llvm::FoldingSetNodeID &ID,
91 const ASTContext &Context,
bool Canonical,
92 bool ProfileLambdaExpr)
93 : StmtProfiler(
ID, Canonical, ProfileLambdaExpr), Context(Context) {}
100 void VisitDecl(
const Decl *D)
override {
103 if (Canonical && D) {
104 if (
const NonTypeTemplateParmDecl *NTTP =
105 dyn_cast<NonTypeTemplateParmDecl>(D)) {
106 ID.AddInteger(NTTP->getDepth());
107 ID.AddInteger(NTTP->getIndex());
108 ID.AddBoolean(NTTP->isParameterPack());
117 VisitType(Context.getUnconstrainedType(NTTP->getType()));
121 if (
const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
132 VisitType(Parm->getType());
133 ID.AddInteger(Parm->getFunctionScopeDepth());
134 ID.AddInteger(Parm->getFunctionScopeIndex());
138 if (
const TemplateTypeParmDecl *TTP =
139 dyn_cast<TemplateTypeParmDecl>(D)) {
140 ID.AddInteger(TTP->getDepth());
141 ID.AddInteger(TTP->getIndex());
142 ID.AddBoolean(TTP->isParameterPack());
146 if (
const TemplateTemplateParmDecl *TTP =
147 dyn_cast<TemplateTemplateParmDecl>(D)) {
148 ID.AddInteger(TTP->getDepth());
149 ID.AddInteger(TTP->getIndex());
150 ID.AddBoolean(TTP->isParameterPack());
158 void VisitType(QualType
T)
override {
159 if (Canonical && !
T.isNull())
160 T = Context.getCanonicalType(
T);
162 ID.AddPointer(
T.getAsOpaquePtr());
165 void VisitName(DeclarationName Name,
bool )
override {
169 void VisitIdentifierInfo(
const IdentifierInfo *II)
override {
173 void VisitNestedNameSpecifier(NestedNameSpecifier NNS)
override {
181 Name = Context.getCanonicalTemplateName(Name);
187 class StmtProfilerWithoutPointers :
public StmtProfiler {
190 StmtProfilerWithoutPointers(llvm::FoldingSetNodeID &ID, ODRHash &Hash)
196 if (SC == Stmt::UnresolvedLookupExprClass) {
199 ID.AddInteger(Stmt::DeclRefExprClass);
205 void VisitType(QualType
T)
override {
209 void VisitName(DeclarationName Name,
bool TreatAsDecl)
override {
215 Hash.AddDeclarationName(Name, TreatAsDecl);
217 void VisitIdentifierInfo(
const IdentifierInfo *II)
override {
220 Hash.AddIdentifierInfo(II);
223 void VisitDecl(
const Decl *D)
override {
230 Hash.AddTemplateName(Name);
232 void VisitNestedNameSpecifier(NestedNameSpecifier NNS)
override {
233 ID.AddBoolean(
bool(NNS));
235 Hash.AddNestedNameSpecifier(NNS);
240void StmtProfiler::VisitStmt(
const Stmt *S) {
241 assert(S &&
"Requires non-null Stmt pointer");
243 VisitStmtNoChildren(S);
245 for (
const Stmt *SubStmt : S->
children()) {
253void StmtProfiler::VisitDeclStmt(
const DeclStmt *S) {
255 for (
const auto *D : S->
decls())
259void StmtProfiler::VisitNullStmt(
const NullStmt *S) {
263void StmtProfiler::VisitCompoundStmt(
const CompoundStmt *S) {
267void StmtProfiler::VisitCaseStmt(
const CaseStmt *S) {
271void StmtProfiler::VisitDefaultStmt(
const DefaultStmt *S) {
275void StmtProfiler::VisitLabelStmt(
const LabelStmt *S) {
280void StmtProfiler::VisitAttributedStmt(
const AttributedStmt *S) {
285void StmtProfiler::VisitIfStmt(
const IfStmt *S) {
290void StmtProfiler::VisitSwitchStmt(
const SwitchStmt *S) {
295void StmtProfiler::VisitWhileStmt(
const WhileStmt *S) {
300void StmtProfiler::VisitDoStmt(
const DoStmt *S) {
304void StmtProfiler::VisitForStmt(
const ForStmt *S) {
308void StmtProfiler::VisitGotoStmt(
const GotoStmt *S) {
313void StmtProfiler::VisitIndirectGotoStmt(
const IndirectGotoStmt *S) {
317void StmtProfiler::VisitContinueStmt(
const ContinueStmt *S) {
321void StmtProfiler::VisitBreakStmt(
const BreakStmt *S) {
325void StmtProfiler::VisitReturnStmt(
const ReturnStmt *S) {
329void StmtProfiler::VisitDeferStmt(
const DeferStmt *S) { VisitStmt(S); }
331void StmtProfiler::VisitGCCAsmStmt(
const GCCAsmStmt *S) {
342 for (
unsigned I = 0, N = S->
getNumInputs(); I != N; ++I) {
350 for (
auto *L : S->
labels())
351 VisitDecl(L->getLabel());
354void StmtProfiler::VisitMSAsmStmt(
const MSAsmStmt *S) {
359void StmtProfiler::VisitCXXCatchStmt(
const CXXCatchStmt *S) {
364void StmtProfiler::VisitCXXTryStmt(
const CXXTryStmt *S) {
368void StmtProfiler::VisitCXXForRangeStmt(
const CXXForRangeStmt *S) {
372void StmtProfiler::VisitCXXExpansionStmtPattern(
373 const CXXExpansionStmtPattern *S) {
377void StmtProfiler::VisitCXXExpansionStmtInstantiation(
378 const CXXExpansionStmtInstantiation *S) {
383void StmtProfiler::VisitMSDependentExistsStmt(
const MSDependentExistsStmt *S) {
390void StmtProfiler::VisitSEHTryStmt(
const SEHTryStmt *S) {
394void StmtProfiler::VisitSEHFinallyStmt(
const SEHFinallyStmt *S) {
398void StmtProfiler::VisitSEHExceptStmt(
const SEHExceptStmt *S) {
402void StmtProfiler::VisitSEHLeaveStmt(
const SEHLeaveStmt *S) {
406void StmtProfiler::VisitCapturedStmt(
const CapturedStmt *S) {
410void StmtProfiler::VisitSYCLKernelCallStmt(
const SYCLKernelCallStmt *S) {
414void StmtProfiler::VisitObjCForCollectionStmt(
const ObjCForCollectionStmt *S) {
418void StmtProfiler::VisitObjCAtCatchStmt(
const ObjCAtCatchStmt *S) {
425void StmtProfiler::VisitObjCAtFinallyStmt(
const ObjCAtFinallyStmt *S) {
429void StmtProfiler::VisitObjCAtTryStmt(
const ObjCAtTryStmt *S) {
434StmtProfiler::VisitObjCAtSynchronizedStmt(
const ObjCAtSynchronizedStmt *S) {
438void StmtProfiler::VisitObjCAtThrowStmt(
const ObjCAtThrowStmt *S) {
443StmtProfiler::VisitObjCAutoreleasePoolStmt(
const ObjCAutoreleasePoolStmt *S) {
448class OMPClauseProfiler :
public ConstOMPClauseVisitor<OMPClauseProfiler> {
449 StmtProfiler *Profiler;
451 template <
typename T>
452 void VisitOMPClauseList(
T *Node);
455 OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { }
456#define GEN_CLANG_CLAUSE_CLASS
457#define CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C);
458#include "llvm/Frontend/OpenMP/OMP.inc"
463void OMPClauseProfiler::VisitOMPClauseWithPreInit(
464 const OMPClauseWithPreInit *
C) {
465 if (
auto *S =
C->getPreInitStmt())
466 Profiler->VisitStmt(S);
469void OMPClauseProfiler::VisitOMPClauseWithPostUpdate(
470 const OMPClauseWithPostUpdate *
C) {
471 VisitOMPClauseWithPreInit(
C);
472 if (
auto *E =
C->getPostUpdateExpr())
473 Profiler->VisitStmt(E);
476void OMPClauseProfiler::VisitOMPIfClause(
const OMPIfClause *
C) {
477 VisitOMPClauseWithPreInit(
C);
478 if (
C->getCondition())
479 Profiler->VisitStmt(
C->getCondition());
482void OMPClauseProfiler::VisitOMPFinalClause(
const OMPFinalClause *
C) {
483 VisitOMPClauseWithPreInit(
C);
484 if (
C->getCondition())
485 Profiler->VisitStmt(
C->getCondition());
488void OMPClauseProfiler::VisitOMPNumThreadsClause(
const OMPNumThreadsClause *
C) {
489 VisitOMPClauseWithPreInit(
C);
490 if (
C->getNumThreads())
491 Profiler->VisitStmt(
C->getNumThreads());
494void OMPClauseProfiler::VisitOMPAlignClause(
const OMPAlignClause *
C) {
495 if (
C->getAlignment())
496 Profiler->VisitStmt(
C->getAlignment());
499void OMPClauseProfiler::VisitOMPSafelenClause(
const OMPSafelenClause *
C) {
501 Profiler->VisitStmt(
C->getSafelen());
504void OMPClauseProfiler::VisitOMPSimdlenClause(
const OMPSimdlenClause *
C) {
506 Profiler->VisitStmt(
C->getSimdlen());
509void OMPClauseProfiler::VisitOMPSizesClause(
const OMPSizesClause *
C) {
510 for (
auto *E :
C->getSizesRefs())
512 Profiler->VisitExpr(E);
515void OMPClauseProfiler::VisitOMPCountsClause(
const OMPCountsClause *
C) {
516 for (
auto *E :
C->getCountsRefs())
518 Profiler->VisitExpr(E);
521void OMPClauseProfiler::VisitOMPPermutationClause(
522 const OMPPermutationClause *
C) {
523 for (Expr *E :
C->getArgsRefs())
525 Profiler->VisitExpr(E);
528void OMPClauseProfiler::VisitOMPFullClause(
const OMPFullClause *
C) {}
530void OMPClauseProfiler::VisitOMPPartialClause(
const OMPPartialClause *
C) {
531 if (
const Expr *Factor =
C->getFactor())
532 Profiler->VisitExpr(Factor);
535void OMPClauseProfiler::VisitOMPLoopRangeClause(
const OMPLoopRangeClause *
C) {
536 if (
const Expr *
First =
C->getFirst())
537 Profiler->VisitExpr(
First);
538 if (
const Expr *Count =
C->getCount())
539 Profiler->VisitExpr(Count);
542void OMPClauseProfiler::VisitOMPAllocatorClause(
const OMPAllocatorClause *
C) {
543 if (
C->getAllocator())
544 Profiler->VisitStmt(
C->getAllocator());
547void OMPClauseProfiler::VisitOMPCollapseClause(
const OMPCollapseClause *
C) {
548 if (
C->getNumForLoops())
549 Profiler->VisitStmt(
C->getNumForLoops());
552void OMPClauseProfiler::VisitOMPDetachClause(
const OMPDetachClause *
C) {
553 if (Expr *Evt =
C->getEventHandler())
554 Profiler->VisitStmt(Evt);
557void OMPClauseProfiler::VisitOMPNovariantsClause(
const OMPNovariantsClause *
C) {
558 VisitOMPClauseWithPreInit(
C);
559 if (
C->getCondition())
560 Profiler->VisitStmt(
C->getCondition());
563void OMPClauseProfiler::VisitOMPNocontextClause(
const OMPNocontextClause *
C) {
564 VisitOMPClauseWithPreInit(
C);
565 if (
C->getCondition())
566 Profiler->VisitStmt(
C->getCondition());
569void OMPClauseProfiler::VisitOMPDefaultClause(
const OMPDefaultClause *
C) { }
571void OMPClauseProfiler::VisitOMPThreadsetClause(
const OMPThreadsetClause *
C) {}
573void OMPClauseProfiler::VisitOMPTransparentClause(
574 const OMPTransparentClause *
C) {
575 if (
C->getImpexType())
576 Profiler->VisitStmt(
C->getImpexType());
579void OMPClauseProfiler::VisitOMPProcBindClause(
const OMPProcBindClause *
C) { }
581void OMPClauseProfiler::VisitOMPUnifiedAddressClause(
582 const OMPUnifiedAddressClause *
C) {}
584void OMPClauseProfiler::VisitOMPUnifiedSharedMemoryClause(
585 const OMPUnifiedSharedMemoryClause *
C) {}
587void OMPClauseProfiler::VisitOMPReverseOffloadClause(
588 const OMPReverseOffloadClause *
C) {}
590void OMPClauseProfiler::VisitOMPDynamicAllocatorsClause(
591 const OMPDynamicAllocatorsClause *
C) {}
593void OMPClauseProfiler::VisitOMPAtomicDefaultMemOrderClause(
594 const OMPAtomicDefaultMemOrderClause *
C) {}
596void OMPClauseProfiler::VisitOMPSelfMapsClause(
const OMPSelfMapsClause *
C) {}
598void OMPClauseProfiler::VisitOMPAtClause(
const OMPAtClause *
C) {}
600void OMPClauseProfiler::VisitOMPSeverityClause(
const OMPSeverityClause *
C) {}
602void OMPClauseProfiler::VisitOMPMessageClause(
const OMPMessageClause *
C) {
603 if (
C->getMessageString())
604 Profiler->VisitStmt(
C->getMessageString());
607void OMPClauseProfiler::VisitOMPScheduleClause(
const OMPScheduleClause *
C) {
608 VisitOMPClauseWithPreInit(
C);
609 if (
auto *S =
C->getChunkSize())
610 Profiler->VisitStmt(S);
613void OMPClauseProfiler::VisitOMPOrderedClause(
const OMPOrderedClause *
C) {
614 if (
auto *
Num =
C->getNumForLoops())
615 Profiler->VisitStmt(
Num);
618void OMPClauseProfiler::VisitOMPNowaitClause(
const OMPNowaitClause *
C) {
619 if (
C->getCondition())
620 Profiler->VisitStmt(
C->getCondition());
623void OMPClauseProfiler::VisitOMPUntiedClause(
const OMPUntiedClause *) {}
625void OMPClauseProfiler::VisitOMPMergeableClause(
const OMPMergeableClause *) {}
627void OMPClauseProfiler::VisitOMPReadClause(
const OMPReadClause *) {}
629void OMPClauseProfiler::VisitOMPWriteClause(
const OMPWriteClause *) {}
631void OMPClauseProfiler::VisitOMPUpdateClause(
const OMPUpdateClause *) {}
633void OMPClauseProfiler::VisitOMPUpdateDependObjectsClause(
634 const OMPUpdateDependObjectsClause *) {}
636void OMPClauseProfiler::VisitOMPCaptureClause(
const OMPCaptureClause *) {}
638void OMPClauseProfiler::VisitOMPCompareClause(
const OMPCompareClause *) {}
640void OMPClauseProfiler::VisitOMPFailClause(
const OMPFailClause *) {}
642void OMPClauseProfiler::VisitOMPAbsentClause(
const OMPAbsentClause *) {}
644void OMPClauseProfiler::VisitOMPHoldsClause(
const OMPHoldsClause *) {}
646void OMPClauseProfiler::VisitOMPContainsClause(
const OMPContainsClause *) {}
648void OMPClauseProfiler::VisitOMPNoOpenMPClause(
const OMPNoOpenMPClause *) {}
650void OMPClauseProfiler::VisitOMPNoOpenMPRoutinesClause(
651 const OMPNoOpenMPRoutinesClause *) {}
653void OMPClauseProfiler::VisitOMPNoOpenMPConstructsClause(
654 const OMPNoOpenMPConstructsClause *) {}
656void OMPClauseProfiler::VisitOMPNoParallelismClause(
657 const OMPNoParallelismClause *) {}
659void OMPClauseProfiler::VisitOMPSeqCstClause(
const OMPSeqCstClause *) {}
661void OMPClauseProfiler::VisitOMPAcqRelClause(
const OMPAcqRelClause *) {}
663void OMPClauseProfiler::VisitOMPAcquireClause(
const OMPAcquireClause *) {}
665void OMPClauseProfiler::VisitOMPReleaseClause(
const OMPReleaseClause *) {}
667void OMPClauseProfiler::VisitOMPRelaxedClause(
const OMPRelaxedClause *) {}
669void OMPClauseProfiler::VisitOMPWeakClause(
const OMPWeakClause *) {}
671void OMPClauseProfiler::VisitOMPThreadsClause(
const OMPThreadsClause *) {}
673void OMPClauseProfiler::VisitOMPSIMDClause(
const OMPSIMDClause *) {}
675void OMPClauseProfiler::VisitOMPNogroupClause(
const OMPNogroupClause *) {}
677void OMPClauseProfiler::VisitOMPInitClause(
const OMPInitClause *
C) {
679 Profiler->VisitStmt(
C->getInteropVar());
680 Profiler->VisitInteger(
C->hasPreferAttrs() ? 1 : 0);
681 Profiler->VisitInteger(
C->varlist_size() - 1);
682 for (OMPInitClause::PrefView P :
C->prefs()) {
683 Profiler->VisitInteger(P.Fr ? 1 : 0);
685 Profiler->VisitStmt(P.Fr);
686 Profiler->VisitInteger(P.Attrs.size());
687 for (
const Expr *A : P.Attrs)
688 Profiler->VisitStmt(A);
692void OMPClauseProfiler::VisitOMPUseClause(
const OMPUseClause *
C) {
693 if (
C->getInteropVar())
694 Profiler->VisitStmt(
C->getInteropVar());
697void OMPClauseProfiler::VisitOMPDestroyClause(
const OMPDestroyClause *
C) {
698 if (
C->getInteropVar())
699 Profiler->VisitStmt(
C->getInteropVar());
702void OMPClauseProfiler::VisitOMPFilterClause(
const OMPFilterClause *
C) {
703 VisitOMPClauseWithPreInit(
C);
704 if (
C->getThreadID())
705 Profiler->VisitStmt(
C->getThreadID());
709void OMPClauseProfiler::VisitOMPClauseList(
T *Node) {
710 for (
auto *E : Node->varlist()) {
712 Profiler->VisitStmt(E);
716void OMPClauseProfiler::VisitOMPPrivateClause(
const OMPPrivateClause *
C) {
717 VisitOMPClauseList(
C);
718 for (
auto *E :
C->private_copies()) {
720 Profiler->VisitStmt(E);
724OMPClauseProfiler::VisitOMPFirstprivateClause(
const OMPFirstprivateClause *
C) {
725 VisitOMPClauseList(
C);
726 VisitOMPClauseWithPreInit(
C);
727 for (
auto *E :
C->private_copies()) {
729 Profiler->VisitStmt(E);
731 for (
auto *E :
C->inits()) {
733 Profiler->VisitStmt(E);
737OMPClauseProfiler::VisitOMPLastprivateClause(
const OMPLastprivateClause *
C) {
738 VisitOMPClauseList(
C);
739 VisitOMPClauseWithPostUpdate(
C);
740 for (
auto *E :
C->source_exprs()) {
742 Profiler->VisitStmt(E);
744 for (
auto *E :
C->destination_exprs()) {
746 Profiler->VisitStmt(E);
748 for (
auto *E :
C->assignment_ops()) {
750 Profiler->VisitStmt(E);
753void OMPClauseProfiler::VisitOMPSharedClause(
const OMPSharedClause *
C) {
754 VisitOMPClauseList(
C);
756void OMPClauseProfiler::VisitOMPReductionClause(
757 const OMPReductionClause *
C) {
758 Profiler->VisitNestedNameSpecifier(
759 C->getQualifierLoc().getNestedNameSpecifier());
760 Profiler->VisitName(
C->getNameInfo().getName());
761 VisitOMPClauseList(
C);
762 VisitOMPClauseWithPostUpdate(
C);
763 for (
auto *E :
C->privates()) {
765 Profiler->VisitStmt(E);
767 for (
auto *E :
C->lhs_exprs()) {
769 Profiler->VisitStmt(E);
771 for (
auto *E :
C->rhs_exprs()) {
773 Profiler->VisitStmt(E);
775 for (
auto *E :
C->reduction_ops()) {
777 Profiler->VisitStmt(E);
779 if (
C->getModifier() == clang::OMPC_REDUCTION_inscan) {
780 for (
auto *E :
C->copy_ops()) {
782 Profiler->VisitStmt(E);
784 for (
auto *E :
C->copy_array_temps()) {
786 Profiler->VisitStmt(E);
788 for (
auto *E :
C->copy_array_elems()) {
790 Profiler->VisitStmt(E);
794void OMPClauseProfiler::VisitOMPTaskReductionClause(
795 const OMPTaskReductionClause *
C) {
796 Profiler->VisitNestedNameSpecifier(
797 C->getQualifierLoc().getNestedNameSpecifier());
798 Profiler->VisitName(
C->getNameInfo().getName());
799 VisitOMPClauseList(
C);
800 VisitOMPClauseWithPostUpdate(
C);
801 for (
auto *E :
C->privates()) {
803 Profiler->VisitStmt(E);
805 for (
auto *E :
C->lhs_exprs()) {
807 Profiler->VisitStmt(E);
809 for (
auto *E :
C->rhs_exprs()) {
811 Profiler->VisitStmt(E);
813 for (
auto *E :
C->reduction_ops()) {
815 Profiler->VisitStmt(E);
818void OMPClauseProfiler::VisitOMPInReductionClause(
819 const OMPInReductionClause *
C) {
820 Profiler->VisitNestedNameSpecifier(
821 C->getQualifierLoc().getNestedNameSpecifier());
822 Profiler->VisitName(
C->getNameInfo().getName());
823 VisitOMPClauseList(
C);
824 VisitOMPClauseWithPostUpdate(
C);
825 for (
auto *E :
C->privates()) {
827 Profiler->VisitStmt(E);
829 for (
auto *E :
C->lhs_exprs()) {
831 Profiler->VisitStmt(E);
833 for (
auto *E :
C->rhs_exprs()) {
835 Profiler->VisitStmt(E);
837 for (
auto *E :
C->reduction_ops()) {
839 Profiler->VisitStmt(E);
841 for (
auto *E :
C->taskgroup_descriptors()) {
843 Profiler->VisitStmt(E);
846void OMPClauseProfiler::VisitOMPLinearClause(
const OMPLinearClause *
C) {
847 VisitOMPClauseList(
C);
848 VisitOMPClauseWithPostUpdate(
C);
849 for (
auto *E :
C->privates()) {
851 Profiler->VisitStmt(E);
853 for (
auto *E :
C->inits()) {
855 Profiler->VisitStmt(E);
857 for (
auto *E :
C->updates()) {
859 Profiler->VisitStmt(E);
861 for (
auto *E :
C->finals()) {
863 Profiler->VisitStmt(E);
866 Profiler->VisitStmt(
C->getStep());
867 if (
C->getCalcStep())
868 Profiler->VisitStmt(
C->getCalcStep());
870void OMPClauseProfiler::VisitOMPAlignedClause(
const OMPAlignedClause *
C) {
871 VisitOMPClauseList(
C);
872 if (
C->getAlignment())
873 Profiler->VisitStmt(
C->getAlignment());
875void OMPClauseProfiler::VisitOMPCopyinClause(
const OMPCopyinClause *
C) {
876 VisitOMPClauseList(
C);
877 for (
auto *E :
C->source_exprs()) {
879 Profiler->VisitStmt(E);
881 for (
auto *E :
C->destination_exprs()) {
883 Profiler->VisitStmt(E);
885 for (
auto *E :
C->assignment_ops()) {
887 Profiler->VisitStmt(E);
891OMPClauseProfiler::VisitOMPCopyprivateClause(
const OMPCopyprivateClause *
C) {
892 VisitOMPClauseList(
C);
893 for (
auto *E :
C->source_exprs()) {
895 Profiler->VisitStmt(E);
897 for (
auto *E :
C->destination_exprs()) {
899 Profiler->VisitStmt(E);
901 for (
auto *E :
C->assignment_ops()) {
903 Profiler->VisitStmt(E);
906void OMPClauseProfiler::VisitOMPFlushClause(
const OMPFlushClause *
C) {
907 VisitOMPClauseList(
C);
909void OMPClauseProfiler::VisitOMPDepobjClause(
const OMPDepobjClause *
C) {
910 if (
const Expr *Depobj =
C->getDepobj())
911 Profiler->VisitStmt(Depobj);
913void OMPClauseProfiler::VisitOMPDependClause(
const OMPDependClause *
C) {
914 VisitOMPClauseList(
C);
916void OMPClauseProfiler::VisitOMPDeviceClause(
const OMPDeviceClause *
C) {
918 Profiler->VisitStmt(
C->getDevice());
920void OMPClauseProfiler::VisitOMPMapClause(
const OMPMapClause *
C) {
921 VisitOMPClauseList(
C);
923void OMPClauseProfiler::VisitOMPAllocateClause(
const OMPAllocateClause *
C) {
924 if (Expr *Allocator =
C->getAllocator())
925 Profiler->VisitStmt(Allocator);
926 VisitOMPClauseList(
C);
928void OMPClauseProfiler::VisitOMPNumTeamsClause(
const OMPNumTeamsClause *
C) {
929 Profiler->VisitInteger(
C->getModifier());
930 if (
const Expr *Modifier =
C->getModifierExpr())
931 Profiler->VisitStmt(Modifier);
932 VisitOMPClauseList(
C);
933 VisitOMPClauseWithPreInit(
C);
935void OMPClauseProfiler::VisitOMPThreadLimitClause(
936 const OMPThreadLimitClause *
C) {
937 Profiler->VisitInteger(
C->getModifier());
938 if (
const Expr *Modifier =
C->getModifierExpr())
939 Profiler->VisitStmt(Modifier);
940 VisitOMPClauseList(
C);
941 VisitOMPClauseWithPreInit(
C);
943void OMPClauseProfiler::VisitOMPPriorityClause(
const OMPPriorityClause *
C) {
944 VisitOMPClauseWithPreInit(
C);
945 if (
C->getPriority())
946 Profiler->VisitStmt(
C->getPriority());
948void OMPClauseProfiler::VisitOMPGrainsizeClause(
const OMPGrainsizeClause *
C) {
949 VisitOMPClauseWithPreInit(
C);
950 if (
C->getGrainsize())
951 Profiler->VisitStmt(
C->getGrainsize());
953void OMPClauseProfiler::VisitOMPNumTasksClause(
const OMPNumTasksClause *
C) {
954 VisitOMPClauseWithPreInit(
C);
955 if (
C->getNumTasks())
956 Profiler->VisitStmt(
C->getNumTasks());
958void OMPClauseProfiler::VisitOMPHintClause(
const OMPHintClause *
C) {
960 Profiler->VisitStmt(
C->getHint());
962void OMPClauseProfiler::VisitOMPToClause(
const OMPToClause *
C) {
963 VisitOMPClauseList(
C);
965void OMPClauseProfiler::VisitOMPFromClause(
const OMPFromClause *
C) {
966 VisitOMPClauseList(
C);
968void OMPClauseProfiler::VisitOMPUseDevicePtrClause(
969 const OMPUseDevicePtrClause *
C) {
970 VisitOMPClauseList(
C);
972void OMPClauseProfiler::VisitOMPUseDeviceAddrClause(
973 const OMPUseDeviceAddrClause *
C) {
974 VisitOMPClauseList(
C);
976void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
977 const OMPIsDevicePtrClause *
C) {
978 VisitOMPClauseList(
C);
980void OMPClauseProfiler::VisitOMPHasDeviceAddrClause(
981 const OMPHasDeviceAddrClause *
C) {
982 VisitOMPClauseList(
C);
984void OMPClauseProfiler::VisitOMPNontemporalClause(
985 const OMPNontemporalClause *
C) {
986 VisitOMPClauseList(
C);
987 for (
auto *E :
C->private_refs())
988 Profiler->VisitStmt(E);
990void OMPClauseProfiler::VisitOMPInclusiveClause(
const OMPInclusiveClause *
C) {
991 VisitOMPClauseList(
C);
993void OMPClauseProfiler::VisitOMPExclusiveClause(
const OMPExclusiveClause *
C) {
994 VisitOMPClauseList(
C);
996void OMPClauseProfiler::VisitOMPUsesAllocatorsClause(
997 const OMPUsesAllocatorsClause *
C) {
998 for (
unsigned I = 0, E =
C->getNumberOfAllocators(); I < E; ++I) {
999 OMPUsesAllocatorsClause::Data D =
C->getAllocatorData(I);
1005void OMPClauseProfiler::VisitOMPAffinityClause(
const OMPAffinityClause *
C) {
1006 if (
const Expr *Modifier =
C->getModifier())
1007 Profiler->VisitStmt(Modifier);
1008 for (
const Expr *E :
C->varlist())
1009 Profiler->VisitStmt(E);
1011void OMPClauseProfiler::VisitOMPOrderClause(
const OMPOrderClause *
C) {}
1012void OMPClauseProfiler::VisitOMPBindClause(
const OMPBindClause *
C) {}
1013void OMPClauseProfiler::VisitOMPXDynCGroupMemClause(
1014 const OMPXDynCGroupMemClause *
C) {
1015 VisitOMPClauseWithPreInit(
C);
1016 if (Expr *Size =
C->getSize())
1017 Profiler->VisitStmt(Size);
1019void OMPClauseProfiler::VisitOMPDynGroupprivateClause(
1020 const OMPDynGroupprivateClause *
C) {
1021 VisitOMPClauseWithPreInit(
C);
1022 if (
auto *Size =
C->getSize())
1023 Profiler->VisitStmt(Size);
1025void OMPClauseProfiler::VisitOMPDoacrossClause(
const OMPDoacrossClause *
C) {
1026 VisitOMPClauseList(
C);
1028void OMPClauseProfiler::VisitOMPXAttributeClause(
const OMPXAttributeClause *
C) {
1030void OMPClauseProfiler::VisitOMPXBareClause(
const OMPXBareClause *
C) {}
1034StmtProfiler::VisitOMPExecutableDirective(
const OMPExecutableDirective *S) {
1036 OMPClauseProfiler P(
this);
1037 ArrayRef<OMPClause *> Clauses = S->clauses();
1038 for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
1044void StmtProfiler::VisitOMPCanonicalLoop(
const OMPCanonicalLoop *L) {
1048void StmtProfiler::VisitOMPLoopBasedDirective(
const OMPLoopBasedDirective *S) {
1049 VisitOMPExecutableDirective(S);
1052void StmtProfiler::VisitOMPLoopDirective(
const OMPLoopDirective *S) {
1053 VisitOMPLoopBasedDirective(S);
1056void StmtProfiler::VisitOMPMetaDirective(
const OMPMetaDirective *S) {
1057 VisitOMPExecutableDirective(S);
1060void StmtProfiler::VisitOMPParallelDirective(
const OMPParallelDirective *S) {
1061 VisitOMPExecutableDirective(S);
1064void StmtProfiler::VisitOMPSimdDirective(
const OMPSimdDirective *S) {
1065 VisitOMPLoopDirective(S);
1068void StmtProfiler::VisitOMPCanonicalLoopNestTransformationDirective(
1069 const OMPCanonicalLoopNestTransformationDirective *S) {
1070 VisitOMPLoopBasedDirective(S);
1073void StmtProfiler::VisitOMPTileDirective(
const OMPTileDirective *S) {
1074 VisitOMPCanonicalLoopNestTransformationDirective(S);
1077void StmtProfiler::VisitOMPStripeDirective(
const OMPStripeDirective *S) {
1078 VisitOMPCanonicalLoopNestTransformationDirective(S);
1081void StmtProfiler::VisitOMPUnrollDirective(
const OMPUnrollDirective *S) {
1082 VisitOMPCanonicalLoopNestTransformationDirective(S);
1085void StmtProfiler::VisitOMPReverseDirective(
const OMPReverseDirective *S) {
1086 VisitOMPCanonicalLoopNestTransformationDirective(S);
1089void StmtProfiler::VisitOMPInterchangeDirective(
1090 const OMPInterchangeDirective *S) {
1091 VisitOMPCanonicalLoopNestTransformationDirective(S);
1094void StmtProfiler::VisitOMPSplitDirective(
const OMPSplitDirective *S) {
1095 VisitOMPCanonicalLoopNestTransformationDirective(S);
1098void StmtProfiler::VisitOMPCanonicalLoopSequenceTransformationDirective(
1099 const OMPCanonicalLoopSequenceTransformationDirective *S) {
1100 VisitOMPExecutableDirective(S);
1103void StmtProfiler::VisitOMPFuseDirective(
const OMPFuseDirective *S) {
1104 VisitOMPCanonicalLoopSequenceTransformationDirective(S);
1107void StmtProfiler::VisitOMPForDirective(
const OMPForDirective *S) {
1108 VisitOMPLoopDirective(S);
1111void StmtProfiler::VisitOMPForSimdDirective(
const OMPForSimdDirective *S) {
1112 VisitOMPLoopDirective(S);
1115void StmtProfiler::VisitOMPSectionsDirective(
const OMPSectionsDirective *S) {
1116 VisitOMPExecutableDirective(S);
1119void StmtProfiler::VisitOMPSectionDirective(
const OMPSectionDirective *S) {
1120 VisitOMPExecutableDirective(S);
1123void StmtProfiler::VisitOMPScopeDirective(
const OMPScopeDirective *S) {
1124 VisitOMPExecutableDirective(S);
1127void StmtProfiler::VisitOMPSingleDirective(
const OMPSingleDirective *S) {
1128 VisitOMPExecutableDirective(S);
1131void StmtProfiler::VisitOMPMasterDirective(
const OMPMasterDirective *S) {
1132 VisitOMPExecutableDirective(S);
1135void StmtProfiler::VisitOMPCriticalDirective(
const OMPCriticalDirective *S) {
1136 VisitOMPExecutableDirective(S);
1137 VisitName(S->getDirectiveName().getName());
1141StmtProfiler::VisitOMPParallelForDirective(
const OMPParallelForDirective *S) {
1142 VisitOMPLoopDirective(S);
1145void StmtProfiler::VisitOMPParallelForSimdDirective(
1146 const OMPParallelForSimdDirective *S) {
1147 VisitOMPLoopDirective(S);
1150void StmtProfiler::VisitOMPParallelMasterDirective(
1151 const OMPParallelMasterDirective *S) {
1152 VisitOMPExecutableDirective(S);
1155void StmtProfiler::VisitOMPParallelMaskedDirective(
1156 const OMPParallelMaskedDirective *S) {
1157 VisitOMPExecutableDirective(S);
1160void StmtProfiler::VisitOMPParallelSectionsDirective(
1161 const OMPParallelSectionsDirective *S) {
1162 VisitOMPExecutableDirective(S);
1165void StmtProfiler::VisitOMPTaskDirective(
const OMPTaskDirective *S) {
1166 VisitOMPExecutableDirective(S);
1169void StmtProfiler::VisitOMPTaskyieldDirective(
const OMPTaskyieldDirective *S) {
1170 VisitOMPExecutableDirective(S);
1173void StmtProfiler::VisitOMPBarrierDirective(
const OMPBarrierDirective *S) {
1174 VisitOMPExecutableDirective(S);
1177void StmtProfiler::VisitOMPTaskwaitDirective(
const OMPTaskwaitDirective *S) {
1178 VisitOMPExecutableDirective(S);
1181void StmtProfiler::VisitOMPAssumeDirective(
const OMPAssumeDirective *S) {
1182 VisitOMPExecutableDirective(S);
1185void StmtProfiler::VisitOMPErrorDirective(
const OMPErrorDirective *S) {
1186 VisitOMPExecutableDirective(S);
1188void StmtProfiler::VisitOMPTaskgroupDirective(
const OMPTaskgroupDirective *S) {
1189 VisitOMPExecutableDirective(S);
1190 if (
const Expr *E = S->getReductionRef())
1194void StmtProfiler::VisitOMPFlushDirective(
const OMPFlushDirective *S) {
1195 VisitOMPExecutableDirective(S);
1198void StmtProfiler::VisitOMPDepobjDirective(
const OMPDepobjDirective *S) {
1199 VisitOMPExecutableDirective(S);
1202void StmtProfiler::VisitOMPScanDirective(
const OMPScanDirective *S) {
1203 VisitOMPExecutableDirective(S);
1206void StmtProfiler::VisitOMPOrderedDirective(
const OMPOrderedDirective *S) {
1207 VisitOMPExecutableDirective(S);
1210void StmtProfiler::VisitOMPAtomicDirective(
const OMPAtomicDirective *S) {
1211 VisitOMPExecutableDirective(S);
1214void StmtProfiler::VisitOMPTargetDirective(
const OMPTargetDirective *S) {
1215 VisitOMPExecutableDirective(S);
1218void StmtProfiler::VisitOMPTargetDataDirective(
const OMPTargetDataDirective *S) {
1219 VisitOMPExecutableDirective(S);
1222void StmtProfiler::VisitOMPTargetEnterDataDirective(
1223 const OMPTargetEnterDataDirective *S) {
1224 VisitOMPExecutableDirective(S);
1227void StmtProfiler::VisitOMPTargetExitDataDirective(
1228 const OMPTargetExitDataDirective *S) {
1229 VisitOMPExecutableDirective(S);
1232void StmtProfiler::VisitOMPTargetParallelDirective(
1233 const OMPTargetParallelDirective *S) {
1234 VisitOMPExecutableDirective(S);
1237void StmtProfiler::VisitOMPTargetParallelForDirective(
1238 const OMPTargetParallelForDirective *S) {
1239 VisitOMPExecutableDirective(S);
1242void StmtProfiler::VisitOMPTeamsDirective(
const OMPTeamsDirective *S) {
1243 VisitOMPExecutableDirective(S);
1246void StmtProfiler::VisitOMPCancellationPointDirective(
1247 const OMPCancellationPointDirective *S) {
1248 VisitOMPExecutableDirective(S);
1251void StmtProfiler::VisitOMPCancelDirective(
const OMPCancelDirective *S) {
1252 VisitOMPExecutableDirective(S);
1255void StmtProfiler::VisitOMPTaskLoopDirective(
const OMPTaskLoopDirective *S) {
1256 VisitOMPLoopDirective(S);
1259void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1260 const OMPTaskLoopSimdDirective *S) {
1261 VisitOMPLoopDirective(S);
1264void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1265 const OMPMasterTaskLoopDirective *S) {
1266 VisitOMPLoopDirective(S);
1269void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1270 const OMPMaskedTaskLoopDirective *S) {
1271 VisitOMPLoopDirective(S);
1274void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1275 const OMPMasterTaskLoopSimdDirective *S) {
1276 VisitOMPLoopDirective(S);
1279void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1280 const OMPMaskedTaskLoopSimdDirective *S) {
1281 VisitOMPLoopDirective(S);
1284void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1285 const OMPParallelMasterTaskLoopDirective *S) {
1286 VisitOMPLoopDirective(S);
1289void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1290 const OMPParallelMaskedTaskLoopDirective *S) {
1291 VisitOMPLoopDirective(S);
1294void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1295 const OMPParallelMasterTaskLoopSimdDirective *S) {
1296 VisitOMPLoopDirective(S);
1299void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1300 const OMPParallelMaskedTaskLoopSimdDirective *S) {
1301 VisitOMPLoopDirective(S);
1304void StmtProfiler::VisitOMPDistributeDirective(
1305 const OMPDistributeDirective *S) {
1306 VisitOMPLoopDirective(S);
1309void OMPClauseProfiler::VisitOMPDistScheduleClause(
1310 const OMPDistScheduleClause *
C) {
1311 VisitOMPClauseWithPreInit(
C);
1312 if (
auto *S =
C->getChunkSize())
1313 Profiler->VisitStmt(S);
1316void OMPClauseProfiler::VisitOMPDefaultmapClause(
const OMPDefaultmapClause *) {}
1318void StmtProfiler::VisitOMPTargetUpdateDirective(
1319 const OMPTargetUpdateDirective *S) {
1320 VisitOMPExecutableDirective(S);
1323void StmtProfiler::VisitOMPDistributeParallelForDirective(
1324 const OMPDistributeParallelForDirective *S) {
1325 VisitOMPLoopDirective(S);
1328void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1329 const OMPDistributeParallelForSimdDirective *S) {
1330 VisitOMPLoopDirective(S);
1333void StmtProfiler::VisitOMPDistributeSimdDirective(
1334 const OMPDistributeSimdDirective *S) {
1335 VisitOMPLoopDirective(S);
1338void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1339 const OMPTargetParallelForSimdDirective *S) {
1340 VisitOMPLoopDirective(S);
1343void StmtProfiler::VisitOMPTargetSimdDirective(
1344 const OMPTargetSimdDirective *S) {
1345 VisitOMPLoopDirective(S);
1348void StmtProfiler::VisitOMPTeamsDistributeDirective(
1349 const OMPTeamsDistributeDirective *S) {
1350 VisitOMPLoopDirective(S);
1353void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1354 const OMPTeamsDistributeSimdDirective *S) {
1355 VisitOMPLoopDirective(S);
1358void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1359 const OMPTeamsDistributeParallelForSimdDirective *S) {
1360 VisitOMPLoopDirective(S);
1363void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1364 const OMPTeamsDistributeParallelForDirective *S) {
1365 VisitOMPLoopDirective(S);
1368void StmtProfiler::VisitOMPTargetTeamsDirective(
1369 const OMPTargetTeamsDirective *S) {
1370 VisitOMPExecutableDirective(S);
1373void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1374 const OMPTargetTeamsDistributeDirective *S) {
1375 VisitOMPLoopDirective(S);
1378void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1379 const OMPTargetTeamsDistributeParallelForDirective *S) {
1380 VisitOMPLoopDirective(S);
1383void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1384 const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
1385 VisitOMPLoopDirective(S);
1388void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1389 const OMPTargetTeamsDistributeSimdDirective *S) {
1390 VisitOMPLoopDirective(S);
1393void StmtProfiler::VisitOMPInteropDirective(
const OMPInteropDirective *S) {
1394 VisitOMPExecutableDirective(S);
1397void StmtProfiler::VisitOMPDispatchDirective(
const OMPDispatchDirective *S) {
1398 VisitOMPExecutableDirective(S);
1401void StmtProfiler::VisitOMPMaskedDirective(
const OMPMaskedDirective *S) {
1402 VisitOMPExecutableDirective(S);
1405void StmtProfiler::VisitOMPGenericLoopDirective(
1406 const OMPGenericLoopDirective *S) {
1407 VisitOMPLoopDirective(S);
1410void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1411 const OMPTeamsGenericLoopDirective *S) {
1412 VisitOMPLoopDirective(S);
1415void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1416 const OMPTargetTeamsGenericLoopDirective *S) {
1417 VisitOMPLoopDirective(S);
1420void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1421 const OMPParallelGenericLoopDirective *S) {
1422 VisitOMPLoopDirective(S);
1425void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1426 const OMPTargetParallelGenericLoopDirective *S) {
1427 VisitOMPLoopDirective(S);
1430void StmtProfiler::VisitExpr(
const Expr *S) {
1434void StmtProfiler::VisitConstantExpr(
const ConstantExpr *S) {
1439void StmtProfiler::VisitDeclRefExpr(
const DeclRefExpr *S) {
1451void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1452 const SYCLUniqueStableNameExpr *S) {
1457void StmtProfiler::VisitUnresolvedSYCLKernelCallStmt(
1458 const UnresolvedSYCLKernelCallStmt *S) {
1462void StmtProfiler::VisitPredefinedExpr(
const PredefinedExpr *S) {
1467void StmtProfiler::VisitOpenACCAsteriskSizeExpr(
1468 const OpenACCAsteriskSizeExpr *S) {
1472void StmtProfiler::VisitIntegerLiteral(
const IntegerLiteral *S) {
1478 T =
T.getCanonicalType();
1480 if (
auto BitIntT =
T->
getAs<BitIntType>())
1481 BitIntT->Profile(ID);
1483 ID.AddInteger(
T->
castAs<BuiltinType>()->getKind());
1486void StmtProfiler::VisitFixedPointLiteral(
const FixedPointLiteral *S) {
1492void StmtProfiler::VisitCharacterLiteral(
const CharacterLiteral *S) {
1494 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1498void StmtProfiler::VisitFloatingLiteral(
const FloatingLiteral *S) {
1505void StmtProfiler::VisitImaginaryLiteral(
const ImaginaryLiteral *S) {
1509void StmtProfiler::VisitStringLiteral(
const StringLiteral *S) {
1512 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1515void StmtProfiler::VisitParenExpr(
const ParenExpr *S) {
1519void StmtProfiler::VisitParenListExpr(
const ParenListExpr *S) {
1523void StmtProfiler::VisitUnaryOperator(
const UnaryOperator *S) {
1528void StmtProfiler::VisitOffsetOfExpr(
const OffsetOfExpr *S) {
1531 for (
unsigned i = 0; i < n; ++i) {
1557StmtProfiler::VisitUnaryExprOrTypeTraitExpr(
const UnaryExprOrTypeTraitExpr *S) {
1564void StmtProfiler::VisitArraySubscriptExpr(
const ArraySubscriptExpr *S) {
1568void StmtProfiler::VisitMatrixSingleSubscriptExpr(
1569 const MatrixSingleSubscriptExpr *S) {
1573void StmtProfiler::VisitMatrixSubscriptExpr(
const MatrixSubscriptExpr *S) {
1577void StmtProfiler::VisitArraySectionExpr(
const ArraySectionExpr *S) {
1581void StmtProfiler::VisitOMPArrayShapingExpr(
const OMPArrayShapingExpr *S) {
1585void StmtProfiler::VisitOMPIteratorExpr(
const OMPIteratorExpr *S) {
1591void StmtProfiler::VisitCallExpr(
const CallExpr *S) {
1595void StmtProfiler::VisitMemberExpr(
const MemberExpr *S) {
1603void StmtProfiler::VisitCompoundLiteralExpr(
const CompoundLiteralExpr *S) {
1608void StmtProfiler::VisitCastExpr(
const CastExpr *S) {
1612void StmtProfiler::VisitImplicitCastExpr(
const ImplicitCastExpr *S) {
1617void StmtProfiler::VisitExplicitCastExpr(
const ExplicitCastExpr *S) {
1622void StmtProfiler::VisitCStyleCastExpr(
const CStyleCastExpr *S) {
1623 VisitExplicitCastExpr(S);
1626void StmtProfiler::VisitBinaryOperator(
const BinaryOperator *S) {
1632StmtProfiler::VisitCompoundAssignOperator(
const CompoundAssignOperator *S) {
1633 VisitBinaryOperator(S);
1636void StmtProfiler::VisitConditionalOperator(
const ConditionalOperator *S) {
1640void StmtProfiler::VisitBinaryConditionalOperator(
1641 const BinaryConditionalOperator *S) {
1645void StmtProfiler::VisitAddrLabelExpr(
const AddrLabelExpr *S) {
1650void StmtProfiler::VisitStmtExpr(
const StmtExpr *S) {
1654void StmtProfiler::VisitShuffleVectorExpr(
const ShuffleVectorExpr *S) {
1658void StmtProfiler::VisitConvertVectorExpr(
const ConvertVectorExpr *S) {
1662void StmtProfiler::VisitChooseExpr(
const ChooseExpr *S) {
1666void StmtProfiler::VisitGNUNullExpr(
const GNUNullExpr *S) {
1670void StmtProfiler::VisitVAArgExpr(
const VAArgExpr *S) {
1674void StmtProfiler::VisitInitListExpr(
const InitListExpr *S) {
1683void StmtProfiler::VisitDesignatedInitExpr(
const DesignatedInitExpr *S) {
1686 for (
const DesignatedInitExpr::Designator &D : S->
designators()) {
1687 if (D.isFieldDesignator()) {
1689 VisitName(D.getFieldName());
1693 if (D.isArrayDesignator()) {
1696 assert(D.isArrayRangeDesignator());
1699 ID.AddInteger(D.getArrayIndex());
1705void StmtProfiler::VisitDesignatedInitUpdateExpr(
1706 const DesignatedInitUpdateExpr *S) {
1707 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
1711void StmtProfiler::VisitArrayInitLoopExpr(
const ArrayInitLoopExpr *S) {
1715void StmtProfiler::VisitArrayInitIndexExpr(
const ArrayInitIndexExpr *S) {
1719void StmtProfiler::VisitNoInitExpr(
const NoInitExpr *S) {
1720 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
1723void StmtProfiler::VisitImplicitValueInitExpr(
const ImplicitValueInitExpr *S) {
1727void StmtProfiler::VisitExtVectorElementExpr(
const ExtVectorElementExpr *S) {
1732void StmtProfiler::VisitMatrixElementExpr(
const MatrixElementExpr *S) {
1737void StmtProfiler::VisitBlockExpr(
const BlockExpr *S) {
1742void StmtProfiler::VisitGenericSelectionExpr(
const GenericSelectionExpr *S) {
1746 QualType
T = Assoc.getType();
1748 ID.AddPointer(
nullptr);
1751 VisitExpr(Assoc.getAssociationExpr());
1755void StmtProfiler::VisitPseudoObjectExpr(
const PseudoObjectExpr *S) {
1760 if (
const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1761 Visit(OVE->getSourceExpr());
1764void StmtProfiler::VisitAtomicExpr(
const AtomicExpr *S) {
1769void StmtProfiler::VisitConceptSpecializationExpr(
1770 const ConceptSpecializationExpr *S) {
1774 VisitTemplateArgument(Arg);
1777void StmtProfiler::VisitRequiresExpr(
const RequiresExpr *S) {
1781 VisitDecl(LocalParam);
1784 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1786 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1787 if (!TypeReq->isSubstitutionFailure())
1788 VisitType(TypeReq->getType()->getType());
1789 }
else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1791 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1792 if (!ExprReq->isExprSubstitutionFailure())
1793 Visit(ExprReq->getExpr());
1798 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1799 const concepts::ExprRequirement::ReturnTypeRequirement &RetReq =
1800 ExprReq->getReturnTypeRequirement();
1813 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1814 if (!NestedReq->hasInvalidConstraint())
1815 Visit(NestedReq->getConstraintExpr());
1823 unsigned &NumArgs) {
1829 case OO_Array_Delete:
1831 case OO_Conditional:
1833 llvm_unreachable(
"Invalid operator call kind");
1838 return Stmt::UnaryOperatorClass;
1842 return Stmt::BinaryOperatorClass;
1847 return Stmt::UnaryOperatorClass;
1851 return Stmt::BinaryOperatorClass;
1856 return Stmt::UnaryOperatorClass;
1860 return Stmt::BinaryOperatorClass;
1864 return Stmt::BinaryOperatorClass;
1868 return Stmt::BinaryOperatorClass;
1872 return Stmt::BinaryOperatorClass;
1876 UnaryOp = UO_AddrOf;
1877 return Stmt::UnaryOperatorClass;
1881 return Stmt::BinaryOperatorClass;
1885 return Stmt::BinaryOperatorClass;
1889 return Stmt::UnaryOperatorClass;
1893 return Stmt::UnaryOperatorClass;
1896 BinaryOp = BO_Assign;
1897 return Stmt::BinaryOperatorClass;
1901 return Stmt::BinaryOperatorClass;
1905 return Stmt::BinaryOperatorClass;
1908 BinaryOp = BO_AddAssign;
1909 return Stmt::CompoundAssignOperatorClass;
1912 BinaryOp = BO_SubAssign;
1913 return Stmt::CompoundAssignOperatorClass;
1916 BinaryOp = BO_MulAssign;
1917 return Stmt::CompoundAssignOperatorClass;
1920 BinaryOp = BO_DivAssign;
1921 return Stmt::CompoundAssignOperatorClass;
1923 case OO_PercentEqual:
1924 BinaryOp = BO_RemAssign;
1925 return Stmt::CompoundAssignOperatorClass;
1928 BinaryOp = BO_XorAssign;
1929 return Stmt::CompoundAssignOperatorClass;
1932 BinaryOp = BO_AndAssign;
1933 return Stmt::CompoundAssignOperatorClass;
1936 BinaryOp = BO_OrAssign;
1937 return Stmt::CompoundAssignOperatorClass;
1941 return Stmt::BinaryOperatorClass;
1943 case OO_GreaterGreater:
1945 return Stmt::BinaryOperatorClass;
1947 case OO_LessLessEqual:
1948 BinaryOp = BO_ShlAssign;
1949 return Stmt::CompoundAssignOperatorClass;
1951 case OO_GreaterGreaterEqual:
1952 BinaryOp = BO_ShrAssign;
1953 return Stmt::CompoundAssignOperatorClass;
1957 return Stmt::BinaryOperatorClass;
1959 case OO_ExclaimEqual:
1961 return Stmt::BinaryOperatorClass;
1965 return Stmt::BinaryOperatorClass;
1967 case OO_GreaterEqual:
1969 return Stmt::BinaryOperatorClass;
1973 return Stmt::BinaryOperatorClass;
1977 return Stmt::BinaryOperatorClass;
1981 return Stmt::BinaryOperatorClass;
1984 UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc;
1986 return Stmt::UnaryOperatorClass;
1989 UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec;
1991 return Stmt::UnaryOperatorClass;
1994 BinaryOp = BO_Comma;
1995 return Stmt::BinaryOperatorClass;
1998 BinaryOp = BO_PtrMemI;
1999 return Stmt::BinaryOperatorClass;
2002 return Stmt::ArraySubscriptExprClass;
2005 return Stmt::CallExprClass;
2008 UnaryOp = UO_Coawait;
2009 return Stmt::UnaryOperatorClass;
2012 llvm_unreachable(
"Invalid overloaded operator expression");
2015#if defined(_MSC_VER) && !defined(__clang__)
2020#pragma optimize("", off)
2024void StmtProfiler::VisitCXXOperatorCallExpr(
const CXXOperatorCallExpr *S) {
2032 return Visit(S->
getArg(0));
2040 for (
unsigned I = 0; I != NumArgs; ++I)
2042 if (SC == Stmt::UnaryOperatorClass)
2043 ID.AddInteger(UnaryOp);
2044 else if (SC == Stmt::BinaryOperatorClass ||
2045 SC == Stmt::CompoundAssignOperatorClass)
2046 ID.AddInteger(BinaryOp);
2048 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
2057void StmtProfiler::VisitCXXRewrittenBinaryOperator(
2058 const CXXRewrittenBinaryOperator *S) {
2062 "resolved rewritten operator should never be type-dependent");
2067#if defined(_MSC_VER) && !defined(__clang__)
2069#pragma optimize("", on)
2073void StmtProfiler::VisitCXXMemberCallExpr(
const CXXMemberCallExpr *S) {
2077void StmtProfiler::VisitCUDAKernelCallExpr(
const CUDAKernelCallExpr *S) {
2081void StmtProfiler::VisitAsTypeExpr(
const AsTypeExpr *S) {
2085void StmtProfiler::VisitCXXNamedCastExpr(
const CXXNamedCastExpr *S) {
2086 VisitExplicitCastExpr(S);
2089void StmtProfiler::VisitCXXStaticCastExpr(
const CXXStaticCastExpr *S) {
2090 VisitCXXNamedCastExpr(S);
2093void StmtProfiler::VisitCXXDynamicCastExpr(
const CXXDynamicCastExpr *S) {
2094 VisitCXXNamedCastExpr(S);
2098StmtProfiler::VisitCXXReinterpretCastExpr(
const CXXReinterpretCastExpr *S) {
2099 VisitCXXNamedCastExpr(S);
2102void StmtProfiler::VisitCXXConstCastExpr(
const CXXConstCastExpr *S) {
2103 VisitCXXNamedCastExpr(S);
2106void StmtProfiler::VisitBuiltinBitCastExpr(
const BuiltinBitCastExpr *S) {
2111void StmtProfiler::VisitCXXAddrspaceCastExpr(
const CXXAddrspaceCastExpr *S) {
2112 VisitCXXNamedCastExpr(S);
2115void StmtProfiler::VisitUserDefinedLiteral(
const UserDefinedLiteral *S) {
2119void StmtProfiler::VisitCXXBoolLiteralExpr(
const CXXBoolLiteralExpr *S) {
2124void StmtProfiler::VisitCXXNullPtrLiteralExpr(
const CXXNullPtrLiteralExpr *S) {
2128void StmtProfiler::VisitCXXStdInitializerListExpr(
2129 const CXXStdInitializerListExpr *S) {
2133void StmtProfiler::VisitCXXTypeidExpr(
const CXXTypeidExpr *S) {
2139void StmtProfiler::VisitCXXUuidofExpr(
const CXXUuidofExpr *S) {
2145void StmtProfiler::VisitMSPropertyRefExpr(
const MSPropertyRefExpr *S) {
2150void StmtProfiler::VisitMSPropertySubscriptExpr(
2151 const MSPropertySubscriptExpr *S) {
2155void StmtProfiler::VisitCXXThisExpr(
const CXXThisExpr *S) {
2161void StmtProfiler::VisitCXXThrowExpr(
const CXXThrowExpr *S) {
2165void StmtProfiler::VisitCXXDefaultArgExpr(
const CXXDefaultArgExpr *S) {
2170void StmtProfiler::VisitCXXDefaultInitExpr(
const CXXDefaultInitExpr *S) {
2175void StmtProfiler::VisitCXXBindTemporaryExpr(
const CXXBindTemporaryExpr *S) {
2181void StmtProfiler::VisitCXXConstructExpr(
const CXXConstructExpr *S) {
2187void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2188 const CXXInheritedCtorInitExpr *S) {
2193void StmtProfiler::VisitCXXFunctionalCastExpr(
const CXXFunctionalCastExpr *S) {
2194 VisitExplicitCastExpr(S);
2198StmtProfiler::VisitCXXTemporaryObjectExpr(
const CXXTemporaryObjectExpr *S) {
2199 VisitCXXConstructExpr(S);
2203StmtProfiler::VisitLambdaExpr(
const LambdaExpr *S) {
2204 if (!ProfileLambdaExpr) {
2208 VisitStmtNoChildren(S);
2219 ID.AddInteger(
Capture.getCaptureKind());
2220 if (
Capture.capturesVariable())
2221 VisitDecl(
Capture.getCapturedVar());
2230 for (
auto *SubDecl : Lambda->
decls()) {
2231 FunctionDecl *
Call =
nullptr;
2232 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(SubDecl))
2233 Call = FTD->getTemplatedDecl();
2234 else if (
auto *FD = dyn_cast<FunctionDecl>(SubDecl))
2245void StmtProfiler::VisitCXXReflectExpr(
const CXXReflectExpr *E) {
2247 assert(
false &&
"not implemented yet");
2251StmtProfiler::VisitCXXScalarValueInitExpr(
const CXXScalarValueInitExpr *S) {
2255void StmtProfiler::VisitCXXDeleteExpr(
const CXXDeleteExpr *S) {
2262void StmtProfiler::VisitCXXNewExpr(
const CXXNewExpr *S) {
2275StmtProfiler::VisitCXXPseudoDestructorExpr(
const CXXPseudoDestructorExpr *S) {
2289void StmtProfiler::VisitOverloadExpr(
const OverloadExpr *S) {
2291 bool DescribingDependentVarTemplate =
2293 if (DescribingDependentVarTemplate) {
2297 VisitName(S->
getName(),
true);
2305StmtProfiler::VisitUnresolvedLookupExpr(
const UnresolvedLookupExpr *S) {
2306 VisitOverloadExpr(S);
2309void StmtProfiler::VisitTypeTraitExpr(
const TypeTraitExpr *S) {
2313 for (
unsigned I = 0, N = S->
getNumArgs(); I != N; ++I)
2317void StmtProfiler::VisitArrayTypeTraitExpr(
const ArrayTypeTraitExpr *S) {
2323void StmtProfiler::VisitExpressionTraitExpr(
const ExpressionTraitExpr *S) {
2329void StmtProfiler::VisitDependentScopeDeclRefExpr(
2330 const DependentScopeDeclRefExpr *S) {
2339void StmtProfiler::VisitExprWithCleanups(
const ExprWithCleanups *S) {
2343void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2344 const CXXUnresolvedConstructExpr *S) {
2350void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2351 const CXXDependentScopeMemberExpr *S) {
2364void StmtProfiler::VisitUnresolvedMemberExpr(
const UnresolvedMemberExpr *S) {
2377void StmtProfiler::VisitCXXNoexceptExpr(
const CXXNoexceptExpr *S) {
2381void StmtProfiler::VisitPackExpansionExpr(
const PackExpansionExpr *S) {
2385void StmtProfiler::VisitSizeOfPackExpr(
const SizeOfPackExpr *S) {
2389 ID.AddInteger(Args.size());
2390 for (
const auto &TA : Args)
2391 VisitTemplateArgument(TA);
2398void StmtProfiler::VisitPackIndexingExpr(
const PackIndexingExpr *E) {
2399 VisitStmtNoChildren(E);
2410void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2411 const SubstNonTypeTemplateParmPackExpr *S) {
2417void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2418 const SubstNonTypeTemplateParmExpr *E) {
2423void StmtProfiler::VisitFunctionParmPackExpr(
const FunctionParmPackExpr *S) {
2431void StmtProfiler::VisitMaterializeTemporaryExpr(
2432 const MaterializeTemporaryExpr *S) {
2436void StmtProfiler::VisitCXXFoldExpr(
const CXXFoldExpr *S) {
2437 VisitStmtNoChildren(S);
2460void StmtProfiler::VisitCXXParenListInitExpr(
const CXXParenListInitExpr *S) {
2464void StmtProfiler::VisitCoroutineBodyStmt(
const CoroutineBodyStmt *S) {
2468void StmtProfiler::VisitCoreturnStmt(
const CoreturnStmt *S) {
2472void StmtProfiler::VisitCoawaitExpr(
const CoawaitExpr *S) {
2476void StmtProfiler::VisitDependentCoawaitExpr(
const DependentCoawaitExpr *S) {
2480void StmtProfiler::VisitCoyieldExpr(
const CoyieldExpr *S) {
2484void StmtProfiler::VisitOpaqueValueExpr(
const OpaqueValueExpr *E) {
2488void StmtProfiler::VisitSourceLocExpr(
const SourceLocExpr *E) {
2492void StmtProfiler::VisitEmbedExpr(
const EmbedExpr *E) { VisitExpr(E); }
2494void StmtProfiler::VisitCXXExpansionSelectExpr(
2495 const CXXExpansionSelectExpr *E) {
2499void StmtProfiler::VisitRecoveryExpr(
const RecoveryExpr *E) { VisitExpr(E); }
2501void StmtProfiler::VisitObjCObjectLiteral(
const ObjCObjectLiteral *E) {
2505void StmtProfiler::VisitObjCStringLiteral(
const ObjCStringLiteral *S) {
2506 VisitObjCObjectLiteral(S);
2509void StmtProfiler::VisitObjCBoxedExpr(
const ObjCBoxedExpr *E) {
2510 VisitObjCObjectLiteral(E);
2513void StmtProfiler::VisitObjCArrayLiteral(
const ObjCArrayLiteral *E) {
2514 VisitObjCObjectLiteral(E);
2517void StmtProfiler::VisitObjCDictionaryLiteral(
const ObjCDictionaryLiteral *E) {
2518 VisitObjCObjectLiteral(E);
2521void StmtProfiler::VisitObjCEncodeExpr(
const ObjCEncodeExpr *S) {
2526void StmtProfiler::VisitObjCSelectorExpr(
const ObjCSelectorExpr *S) {
2531void StmtProfiler::VisitObjCProtocolExpr(
const ObjCProtocolExpr *S) {
2536void StmtProfiler::VisitObjCIvarRefExpr(
const ObjCIvarRefExpr *S) {
2543void StmtProfiler::VisitObjCPropertyRefExpr(
const ObjCPropertyRefExpr *S) {
2557void StmtProfiler::VisitObjCSubscriptRefExpr(
const ObjCSubscriptRefExpr *S) {
2563void StmtProfiler::VisitObjCMessageExpr(
const ObjCMessageExpr *S) {
2569void StmtProfiler::VisitObjCIsaExpr(
const ObjCIsaExpr *S) {
2574void StmtProfiler::VisitObjCBoolLiteralExpr(
const ObjCBoolLiteralExpr *S) {
2579void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2580 const ObjCIndirectCopyRestoreExpr *S) {
2585void StmtProfiler::VisitObjCBridgedCastExpr(
const ObjCBridgedCastExpr *S) {
2586 VisitExplicitCastExpr(S);
2590void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2591 const ObjCAvailabilityCheckExpr *S) {
2595void StmtProfiler::VisitTemplateArguments(
const TemplateArgumentLoc *Args,
2597 ID.AddInteger(NumArgs);
2598 for (
unsigned I = 0; I != NumArgs; ++I)
2602void StmtProfiler::VisitTemplateArgument(
const TemplateArgument &Arg) {
2645 VisitTemplateArgument(P);
2651class OpenACCClauseProfiler
2652 :
public OpenACCClauseVisitor<OpenACCClauseProfiler> {
2653 StmtProfiler &Profiler;
2656 OpenACCClauseProfiler(StmtProfiler &P) : Profiler(P) {}
2658 void VisitOpenACCClauseList(ArrayRef<const OpenACCClause *> Clauses) {
2659 for (
const OpenACCClause *Clause : Clauses) {
2666 void VisitClauseWithVarList(
const OpenACCClauseWithVarList &Clause) {
2668 Profiler.VisitStmt(E);
2671#define VISIT_CLAUSE(CLAUSE_NAME) \
2672 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
2674#include "clang/Basic/OpenACCClauses.def"
2678void OpenACCClauseProfiler::VisitDefaultClause(
2679 const OpenACCDefaultClause &Clause) {}
2681void OpenACCClauseProfiler::VisitIfClause(
const OpenACCIfClause &Clause) {
2683 "if clause requires a valid condition expr");
2687void OpenACCClauseProfiler::VisitCopyClause(
const OpenACCCopyClause &Clause) {
2688 VisitClauseWithVarList(Clause);
2691void OpenACCClauseProfiler::VisitLinkClause(
const OpenACCLinkClause &Clause) {
2692 VisitClauseWithVarList(Clause);
2695void OpenACCClauseProfiler::VisitDeviceResidentClause(
2696 const OpenACCDeviceResidentClause &Clause) {
2697 VisitClauseWithVarList(Clause);
2700void OpenACCClauseProfiler::VisitCopyInClause(
2701 const OpenACCCopyInClause &Clause) {
2702 VisitClauseWithVarList(Clause);
2705void OpenACCClauseProfiler::VisitCopyOutClause(
2706 const OpenACCCopyOutClause &Clause) {
2707 VisitClauseWithVarList(Clause);
2710void OpenACCClauseProfiler::VisitCreateClause(
2711 const OpenACCCreateClause &Clause) {
2712 VisitClauseWithVarList(Clause);
2715void OpenACCClauseProfiler::VisitHostClause(
const OpenACCHostClause &Clause) {
2716 VisitClauseWithVarList(Clause);
2719void OpenACCClauseProfiler::VisitDeviceClause(
2720 const OpenACCDeviceClause &Clause) {
2721 VisitClauseWithVarList(Clause);
2724void OpenACCClauseProfiler::VisitSelfClause(
const OpenACCSelfClause &Clause) {
2730 Profiler.VisitStmt(E);
2734void OpenACCClauseProfiler::VisitFinalizeClause(
2735 const OpenACCFinalizeClause &Clause) {}
2737void OpenACCClauseProfiler::VisitIfPresentClause(
2738 const OpenACCIfPresentClause &Clause) {}
2740void OpenACCClauseProfiler::VisitNumGangsClause(
2741 const OpenACCNumGangsClause &Clause) {
2743 Profiler.VisitStmt(E);
2746void OpenACCClauseProfiler::VisitTileClause(
const OpenACCTileClause &Clause) {
2748 Profiler.VisitStmt(E);
2751void OpenACCClauseProfiler::VisitNumWorkersClause(
2752 const OpenACCNumWorkersClause &Clause) {
2753 assert(Clause.
hasIntExpr() &&
"num_workers clause requires a valid int expr");
2757void OpenACCClauseProfiler::VisitCollapseClause(
2758 const OpenACCCollapseClause &Clause) {
2759 assert(Clause.
getLoopCount() &&
"collapse clause requires a valid int expr");
2763void OpenACCClauseProfiler::VisitPrivateClause(
2764 const OpenACCPrivateClause &Clause) {
2765 VisitClauseWithVarList(Clause);
2768 Profiler.VisitDecl(Recipe.AllocaDecl);
2772void OpenACCClauseProfiler::VisitFirstPrivateClause(
2773 const OpenACCFirstPrivateClause &Clause) {
2774 VisitClauseWithVarList(Clause);
2777 Profiler.VisitDecl(Recipe.AllocaDecl);
2778 Profiler.VisitDecl(Recipe.InitFromTemporary);
2782void OpenACCClauseProfiler::VisitAttachClause(
2783 const OpenACCAttachClause &Clause) {
2784 VisitClauseWithVarList(Clause);
2787void OpenACCClauseProfiler::VisitDetachClause(
2788 const OpenACCDetachClause &Clause) {
2789 VisitClauseWithVarList(Clause);
2792void OpenACCClauseProfiler::VisitDeleteClause(
2793 const OpenACCDeleteClause &Clause) {
2794 VisitClauseWithVarList(Clause);
2797void OpenACCClauseProfiler::VisitDevicePtrClause(
2798 const OpenACCDevicePtrClause &Clause) {
2799 VisitClauseWithVarList(Clause);
2802void OpenACCClauseProfiler::VisitNoCreateClause(
2803 const OpenACCNoCreateClause &Clause) {
2804 VisitClauseWithVarList(Clause);
2807void OpenACCClauseProfiler::VisitPresentClause(
2808 const OpenACCPresentClause &Clause) {
2809 VisitClauseWithVarList(Clause);
2812void OpenACCClauseProfiler::VisitUseDeviceClause(
2813 const OpenACCUseDeviceClause &Clause) {
2814 VisitClauseWithVarList(Clause);
2817void OpenACCClauseProfiler::VisitVectorLengthClause(
2818 const OpenACCVectorLengthClause &Clause) {
2820 "vector_length clause requires a valid int expr");
2824void OpenACCClauseProfiler::VisitAsyncClause(
const OpenACCAsyncClause &Clause) {
2829void OpenACCClauseProfiler::VisitDeviceNumClause(
2830 const OpenACCDeviceNumClause &Clause) {
2834void OpenACCClauseProfiler::VisitDefaultAsyncClause(
2835 const OpenACCDefaultAsyncClause &Clause) {
2839void OpenACCClauseProfiler::VisitWorkerClause(
2840 const OpenACCWorkerClause &Clause) {
2845void OpenACCClauseProfiler::VisitVectorClause(
2846 const OpenACCVectorClause &Clause) {
2851void OpenACCClauseProfiler::VisitWaitClause(
const OpenACCWaitClause &Clause) {
2855 Profiler.VisitStmt(E);
2859void OpenACCClauseProfiler::VisitDeviceTypeClause(
2860 const OpenACCDeviceTypeClause &Clause) {}
2862void OpenACCClauseProfiler::VisitAutoClause(
const OpenACCAutoClause &Clause) {}
2864void OpenACCClauseProfiler::VisitIndependentClause(
2865 const OpenACCIndependentClause &Clause) {}
2867void OpenACCClauseProfiler::VisitSeqClause(
const OpenACCSeqClause &Clause) {}
2868void OpenACCClauseProfiler::VisitNoHostClause(
2869 const OpenACCNoHostClause &Clause) {}
2871void OpenACCClauseProfiler::VisitGangClause(
const OpenACCGangClause &Clause) {
2872 for (
unsigned I = 0; I < Clause.
getNumExprs(); ++I) {
2873 Profiler.VisitStmt(Clause.
getExpr(I).second);
2877void OpenACCClauseProfiler::VisitReductionClause(
2878 const OpenACCReductionClause &Clause) {
2879 VisitClauseWithVarList(Clause);
2882 Profiler.VisitDecl(Recipe.AllocaDecl);
2887 static_assert(
sizeof(OpenACCReductionRecipe::CombinerRecipe) ==
2889 for (
auto &CombinerRecipe : Recipe.CombinerRecipes) {
2890 if (CombinerRecipe.Op) {
2891 Profiler.VisitDecl(CombinerRecipe.LHS);
2892 Profiler.VisitDecl(CombinerRecipe.RHS);
2893 Profiler.VisitStmt(CombinerRecipe.Op);
2899void OpenACCClauseProfiler::VisitBindClause(
const OpenACCBindClause &Clause) {
2900 assert(
false &&
"not implemented... what can we do about our expr?");
2904void StmtProfiler::VisitOpenACCComputeConstruct(
2909 OpenACCClauseProfiler P{*
this};
2910 P.VisitOpenACCClauseList(S->clauses());
2913void StmtProfiler::VisitOpenACCLoopConstruct(
const OpenACCLoopConstruct *S) {
2917 OpenACCClauseProfiler P{*
this};
2918 P.VisitOpenACCClauseList(S->clauses());
2921void StmtProfiler::VisitOpenACCCombinedConstruct(
2922 const OpenACCCombinedConstruct *S) {
2926 OpenACCClauseProfiler P{*
this};
2927 P.VisitOpenACCClauseList(S->clauses());
2930void StmtProfiler::VisitOpenACCDataConstruct(
const OpenACCDataConstruct *S) {
2933 OpenACCClauseProfiler P{*
this};
2934 P.VisitOpenACCClauseList(S->clauses());
2937void StmtProfiler::VisitOpenACCEnterDataConstruct(
2938 const OpenACCEnterDataConstruct *S) {
2941 OpenACCClauseProfiler P{*
this};
2942 P.VisitOpenACCClauseList(S->clauses());
2945void StmtProfiler::VisitOpenACCExitDataConstruct(
2946 const OpenACCExitDataConstruct *S) {
2949 OpenACCClauseProfiler P{*
this};
2950 P.VisitOpenACCClauseList(S->clauses());
2953void StmtProfiler::VisitOpenACCHostDataConstruct(
2954 const OpenACCHostDataConstruct *S) {
2957 OpenACCClauseProfiler P{*
this};
2958 P.VisitOpenACCClauseList(S->clauses());
2961void StmtProfiler::VisitOpenACCWaitConstruct(
const OpenACCWaitConstruct *S) {
2965 OpenACCClauseProfiler P{*
this};
2966 P.VisitOpenACCClauseList(S->clauses());
2969void StmtProfiler::VisitOpenACCCacheConstruct(
const OpenACCCacheConstruct *S) {
2974void StmtProfiler::VisitOpenACCInitConstruct(
const OpenACCInitConstruct *S) {
2976 OpenACCClauseProfiler P{*
this};
2977 P.VisitOpenACCClauseList(S->clauses());
2980void StmtProfiler::VisitOpenACCShutdownConstruct(
2981 const OpenACCShutdownConstruct *S) {
2983 OpenACCClauseProfiler P{*
this};
2984 P.VisitOpenACCClauseList(S->clauses());
2987void StmtProfiler::VisitOpenACCSetConstruct(
const OpenACCSetConstruct *S) {
2989 OpenACCClauseProfiler P{*
this};
2990 P.VisitOpenACCClauseList(S->clauses());
2993void StmtProfiler::VisitOpenACCUpdateConstruct(
2994 const OpenACCUpdateConstruct *S) {
2996 OpenACCClauseProfiler P{*
this};
2997 P.VisitOpenACCClauseList(S->clauses());
3000void StmtProfiler::VisitOpenACCAtomicConstruct(
3001 const OpenACCAtomicConstruct *S) {
3003 OpenACCClauseProfiler P{*
this};
3004 P.VisitOpenACCClauseList(S->clauses());
3007void StmtProfiler::VisitHLSLOutArgExpr(
const HLSLOutArgExpr *S) {
3012 bool Canonical,
bool ProfileLambdaExpr)
const {
3013 StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr);
3014 Profiler.Visit(
this);
3019 StmtProfilerWithoutPointers Profiler(ID, Hash);
3020 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.
bool shouldApplyLifetimeExtensionToPreamble() const
BinaryOperatorKind getOperator() const
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
QualType getAllocatedType() const
CXXNewInitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
FunctionDecl * getOperatorDelete() const
unsigned getNumPlacementArgs() const
bool isParenTypeId() const
FunctionDecl * getOperatorNew() const
A call to an overloaded operator written using operator syntax.
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise,...
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
QualType getDestroyedType() const
Retrieve the type being destroyed.
NestedNameSpecifier getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name.
const IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
capture_const_range captures() const
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
bool isReversed() const
Determine whether this expression was rewritten in reverse form.
const CXXDestructorDecl * getDestructor() const
bool isCapturedByCopyInLambdaWithExplicitObjectParameter() const
bool isTypeOperand() const
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
bool isListInitialization() const
Determine whether this expression models list-initialization.
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
bool isTypeOperand() const
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
unsigned getValue() const
CharacterLiteralKind getKind() const
ArrayRef< TemplateArgument > getTemplateArguments() const
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.
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)
const FunctionProtoType * T
U cast(CodeGen::Address addr)
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
DeclarationName getName() const
getName - Returns the embedded declaration name.