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::VisitOMPOrderedStandaloneDirective(
1207 const OMPOrderedStandaloneDirective *S) {
1208 VisitOMPExecutableDirective(S);
1211void StmtProfiler::VisitOMPOrderedBlockAssocDirective(
1212 const OMPOrderedBlockAssocDirective *S) {
1213 VisitOMPExecutableDirective(S);
1216void StmtProfiler::VisitOMPAtomicDirective(
const OMPAtomicDirective *S) {
1217 VisitOMPExecutableDirective(S);
1220void StmtProfiler::VisitOMPTargetDirective(
const OMPTargetDirective *S) {
1221 VisitOMPExecutableDirective(S);
1224void StmtProfiler::VisitOMPTargetDataDirective(
const OMPTargetDataDirective *S) {
1225 VisitOMPExecutableDirective(S);
1228void StmtProfiler::VisitOMPTargetEnterDataDirective(
1229 const OMPTargetEnterDataDirective *S) {
1230 VisitOMPExecutableDirective(S);
1233void StmtProfiler::VisitOMPTargetExitDataDirective(
1234 const OMPTargetExitDataDirective *S) {
1235 VisitOMPExecutableDirective(S);
1238void StmtProfiler::VisitOMPTargetParallelDirective(
1239 const OMPTargetParallelDirective *S) {
1240 VisitOMPExecutableDirective(S);
1243void StmtProfiler::VisitOMPTargetParallelForDirective(
1244 const OMPTargetParallelForDirective *S) {
1245 VisitOMPExecutableDirective(S);
1248void StmtProfiler::VisitOMPTeamsDirective(
const OMPTeamsDirective *S) {
1249 VisitOMPExecutableDirective(S);
1252void StmtProfiler::VisitOMPCancellationPointDirective(
1253 const OMPCancellationPointDirective *S) {
1254 VisitOMPExecutableDirective(S);
1257void StmtProfiler::VisitOMPCancelDirective(
const OMPCancelDirective *S) {
1258 VisitOMPExecutableDirective(S);
1261void StmtProfiler::VisitOMPTaskLoopDirective(
const OMPTaskLoopDirective *S) {
1262 VisitOMPLoopDirective(S);
1265void StmtProfiler::VisitOMPTaskLoopSimdDirective(
1266 const OMPTaskLoopSimdDirective *S) {
1267 VisitOMPLoopDirective(S);
1270void StmtProfiler::VisitOMPMasterTaskLoopDirective(
1271 const OMPMasterTaskLoopDirective *S) {
1272 VisitOMPLoopDirective(S);
1275void StmtProfiler::VisitOMPMaskedTaskLoopDirective(
1276 const OMPMaskedTaskLoopDirective *S) {
1277 VisitOMPLoopDirective(S);
1280void StmtProfiler::VisitOMPMasterTaskLoopSimdDirective(
1281 const OMPMasterTaskLoopSimdDirective *S) {
1282 VisitOMPLoopDirective(S);
1285void StmtProfiler::VisitOMPMaskedTaskLoopSimdDirective(
1286 const OMPMaskedTaskLoopSimdDirective *S) {
1287 VisitOMPLoopDirective(S);
1290void StmtProfiler::VisitOMPParallelMasterTaskLoopDirective(
1291 const OMPParallelMasterTaskLoopDirective *S) {
1292 VisitOMPLoopDirective(S);
1295void StmtProfiler::VisitOMPParallelMaskedTaskLoopDirective(
1296 const OMPParallelMaskedTaskLoopDirective *S) {
1297 VisitOMPLoopDirective(S);
1300void StmtProfiler::VisitOMPParallelMasterTaskLoopSimdDirective(
1301 const OMPParallelMasterTaskLoopSimdDirective *S) {
1302 VisitOMPLoopDirective(S);
1305void StmtProfiler::VisitOMPParallelMaskedTaskLoopSimdDirective(
1306 const OMPParallelMaskedTaskLoopSimdDirective *S) {
1307 VisitOMPLoopDirective(S);
1310void StmtProfiler::VisitOMPDistributeDirective(
1311 const OMPDistributeDirective *S) {
1312 VisitOMPLoopDirective(S);
1315void OMPClauseProfiler::VisitOMPDistScheduleClause(
1316 const OMPDistScheduleClause *
C) {
1317 VisitOMPClauseWithPreInit(
C);
1318 if (
auto *S =
C->getChunkSize())
1319 Profiler->VisitStmt(S);
1322void OMPClauseProfiler::VisitOMPDefaultmapClause(
const OMPDefaultmapClause *) {}
1324void StmtProfiler::VisitOMPTargetUpdateDirective(
1325 const OMPTargetUpdateDirective *S) {
1326 VisitOMPExecutableDirective(S);
1329void StmtProfiler::VisitOMPDistributeParallelForDirective(
1330 const OMPDistributeParallelForDirective *S) {
1331 VisitOMPLoopDirective(S);
1334void StmtProfiler::VisitOMPDistributeParallelForSimdDirective(
1335 const OMPDistributeParallelForSimdDirective *S) {
1336 VisitOMPLoopDirective(S);
1339void StmtProfiler::VisitOMPDistributeSimdDirective(
1340 const OMPDistributeSimdDirective *S) {
1341 VisitOMPLoopDirective(S);
1344void StmtProfiler::VisitOMPTargetParallelForSimdDirective(
1345 const OMPTargetParallelForSimdDirective *S) {
1346 VisitOMPLoopDirective(S);
1349void StmtProfiler::VisitOMPTargetSimdDirective(
1350 const OMPTargetSimdDirective *S) {
1351 VisitOMPLoopDirective(S);
1354void StmtProfiler::VisitOMPTeamsDistributeDirective(
1355 const OMPTeamsDistributeDirective *S) {
1356 VisitOMPLoopDirective(S);
1359void StmtProfiler::VisitOMPTeamsDistributeSimdDirective(
1360 const OMPTeamsDistributeSimdDirective *S) {
1361 VisitOMPLoopDirective(S);
1364void StmtProfiler::VisitOMPTeamsDistributeParallelForSimdDirective(
1365 const OMPTeamsDistributeParallelForSimdDirective *S) {
1366 VisitOMPLoopDirective(S);
1369void StmtProfiler::VisitOMPTeamsDistributeParallelForDirective(
1370 const OMPTeamsDistributeParallelForDirective *S) {
1371 VisitOMPLoopDirective(S);
1374void StmtProfiler::VisitOMPTargetTeamsDirective(
1375 const OMPTargetTeamsDirective *S) {
1376 VisitOMPExecutableDirective(S);
1379void StmtProfiler::VisitOMPTargetTeamsDistributeDirective(
1380 const OMPTargetTeamsDistributeDirective *S) {
1381 VisitOMPLoopDirective(S);
1384void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective(
1385 const OMPTargetTeamsDistributeParallelForDirective *S) {
1386 VisitOMPLoopDirective(S);
1389void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForSimdDirective(
1390 const OMPTargetTeamsDistributeParallelForSimdDirective *S) {
1391 VisitOMPLoopDirective(S);
1394void StmtProfiler::VisitOMPTargetTeamsDistributeSimdDirective(
1395 const OMPTargetTeamsDistributeSimdDirective *S) {
1396 VisitOMPLoopDirective(S);
1399void StmtProfiler::VisitOMPInteropDirective(
const OMPInteropDirective *S) {
1400 VisitOMPExecutableDirective(S);
1403void StmtProfiler::VisitOMPDispatchDirective(
const OMPDispatchDirective *S) {
1404 VisitOMPExecutableDirective(S);
1407void StmtProfiler::VisitOMPMaskedDirective(
const OMPMaskedDirective *S) {
1408 VisitOMPExecutableDirective(S);
1411void StmtProfiler::VisitOMPGenericLoopDirective(
1412 const OMPGenericLoopDirective *S) {
1413 VisitOMPLoopDirective(S);
1416void StmtProfiler::VisitOMPTeamsGenericLoopDirective(
1417 const OMPTeamsGenericLoopDirective *S) {
1418 VisitOMPLoopDirective(S);
1421void StmtProfiler::VisitOMPTargetTeamsGenericLoopDirective(
1422 const OMPTargetTeamsGenericLoopDirective *S) {
1423 VisitOMPLoopDirective(S);
1426void StmtProfiler::VisitOMPParallelGenericLoopDirective(
1427 const OMPParallelGenericLoopDirective *S) {
1428 VisitOMPLoopDirective(S);
1431void StmtProfiler::VisitOMPTargetParallelGenericLoopDirective(
1432 const OMPTargetParallelGenericLoopDirective *S) {
1433 VisitOMPLoopDirective(S);
1436void StmtProfiler::VisitExpr(
const Expr *S) {
1440void StmtProfiler::VisitConstantExpr(
const ConstantExpr *S) {
1445void StmtProfiler::VisitDeclRefExpr(
const DeclRefExpr *S) {
1457void StmtProfiler::VisitSYCLUniqueStableNameExpr(
1458 const SYCLUniqueStableNameExpr *S) {
1463void StmtProfiler::VisitUnresolvedSYCLKernelCallStmt(
1464 const UnresolvedSYCLKernelCallStmt *S) {
1468void StmtProfiler::VisitPredefinedExpr(
const PredefinedExpr *S) {
1473void StmtProfiler::VisitOpenACCAsteriskSizeExpr(
1474 const OpenACCAsteriskSizeExpr *S) {
1478void StmtProfiler::VisitIntegerLiteral(
const IntegerLiteral *S) {
1484 T =
T.getCanonicalType();
1486 if (
auto BitIntT =
T->
getAs<BitIntType>())
1487 BitIntT->Profile(ID);
1489 ID.AddInteger(
T->
castAs<BuiltinType>()->getKind());
1492void StmtProfiler::VisitFixedPointLiteral(
const FixedPointLiteral *S) {
1498void StmtProfiler::VisitCharacterLiteral(
const CharacterLiteral *S) {
1500 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1504void StmtProfiler::VisitFloatingLiteral(
const FloatingLiteral *S) {
1511void StmtProfiler::VisitImaginaryLiteral(
const ImaginaryLiteral *S) {
1515void StmtProfiler::VisitStringLiteral(
const StringLiteral *S) {
1518 ID.AddInteger(llvm::to_underlying(S->
getKind()));
1521void StmtProfiler::VisitParenExpr(
const ParenExpr *S) {
1525void StmtProfiler::VisitParenListExpr(
const ParenListExpr *S) {
1529void StmtProfiler::VisitUnaryOperator(
const UnaryOperator *S) {
1534void StmtProfiler::VisitOffsetOfExpr(
const OffsetOfExpr *S) {
1537 for (
unsigned i = 0; i < n; ++i) {
1563StmtProfiler::VisitUnaryExprOrTypeTraitExpr(
const UnaryExprOrTypeTraitExpr *S) {
1570void StmtProfiler::VisitArraySubscriptExpr(
const ArraySubscriptExpr *S) {
1574void StmtProfiler::VisitMatrixSingleSubscriptExpr(
1575 const MatrixSingleSubscriptExpr *S) {
1579void StmtProfiler::VisitMatrixSubscriptExpr(
const MatrixSubscriptExpr *S) {
1583void StmtProfiler::VisitArraySectionExpr(
const ArraySectionExpr *S) {
1587void StmtProfiler::VisitOMPArrayShapingExpr(
const OMPArrayShapingExpr *S) {
1591void StmtProfiler::VisitOMPIteratorExpr(
const OMPIteratorExpr *S) {
1597void StmtProfiler::VisitCallExpr(
const CallExpr *S) {
1601void StmtProfiler::VisitMemberExpr(
const MemberExpr *S) {
1609void StmtProfiler::VisitCompoundLiteralExpr(
const CompoundLiteralExpr *S) {
1614void StmtProfiler::VisitCastExpr(
const CastExpr *S) {
1618void StmtProfiler::VisitImplicitCastExpr(
const ImplicitCastExpr *S) {
1623void StmtProfiler::VisitExplicitCastExpr(
const ExplicitCastExpr *S) {
1628void StmtProfiler::VisitCStyleCastExpr(
const CStyleCastExpr *S) {
1629 VisitExplicitCastExpr(S);
1632void StmtProfiler::VisitBinaryOperator(
const BinaryOperator *S) {
1638StmtProfiler::VisitCompoundAssignOperator(
const CompoundAssignOperator *S) {
1639 VisitBinaryOperator(S);
1642void StmtProfiler::VisitConditionalOperator(
const ConditionalOperator *S) {
1646void StmtProfiler::VisitBinaryConditionalOperator(
1647 const BinaryConditionalOperator *S) {
1651void StmtProfiler::VisitAddrLabelExpr(
const AddrLabelExpr *S) {
1656void StmtProfiler::VisitStmtExpr(
const StmtExpr *S) {
1660void StmtProfiler::VisitShuffleVectorExpr(
const ShuffleVectorExpr *S) {
1664void StmtProfiler::VisitConvertVectorExpr(
const ConvertVectorExpr *S) {
1668void StmtProfiler::VisitChooseExpr(
const ChooseExpr *S) {
1672void StmtProfiler::VisitGNUNullExpr(
const GNUNullExpr *S) {
1676void StmtProfiler::VisitVAArgExpr(
const VAArgExpr *S) {
1680void StmtProfiler::VisitInitListExpr(
const InitListExpr *S) {
1689void StmtProfiler::VisitDesignatedInitExpr(
const DesignatedInitExpr *S) {
1692 for (
const DesignatedInitExpr::Designator &D : S->
designators()) {
1693 if (D.isFieldDesignator()) {
1695 VisitName(D.getFieldName());
1699 if (D.isArrayDesignator()) {
1702 assert(D.isArrayRangeDesignator());
1705 ID.AddInteger(D.getArrayIndex());
1711void StmtProfiler::VisitDesignatedInitUpdateExpr(
1712 const DesignatedInitUpdateExpr *S) {
1713 llvm_unreachable(
"Unexpected DesignatedInitUpdateExpr in syntactic form of "
1717void StmtProfiler::VisitArrayInitLoopExpr(
const ArrayInitLoopExpr *S) {
1721void StmtProfiler::VisitArrayInitIndexExpr(
const ArrayInitIndexExpr *S) {
1725void StmtProfiler::VisitNoInitExpr(
const NoInitExpr *S) {
1726 llvm_unreachable(
"Unexpected NoInitExpr in syntactic form of initializer");
1729void StmtProfiler::VisitImplicitValueInitExpr(
const ImplicitValueInitExpr *S) {
1733void StmtProfiler::VisitExtVectorElementExpr(
const ExtVectorElementExpr *S) {
1738void StmtProfiler::VisitMatrixElementExpr(
const MatrixElementExpr *S) {
1743void StmtProfiler::VisitBlockExpr(
const BlockExpr *S) {
1748void StmtProfiler::VisitGenericSelectionExpr(
const GenericSelectionExpr *S) {
1752 QualType
T = Assoc.getType();
1754 ID.AddPointer(
nullptr);
1757 VisitExpr(Assoc.getAssociationExpr());
1761void StmtProfiler::VisitPseudoObjectExpr(
const PseudoObjectExpr *S) {
1766 if (
const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(*i))
1767 Visit(OVE->getSourceExpr());
1770void StmtProfiler::VisitAtomicExpr(
const AtomicExpr *S) {
1775void StmtProfiler::VisitConceptSpecializationExpr(
1776 const ConceptSpecializationExpr *S) {
1780 VisitTemplateArgument(Arg);
1783void StmtProfiler::VisitRequiresExpr(
const RequiresExpr *S) {
1787 VisitDecl(LocalParam);
1790 if (
auto *TypeReq = dyn_cast<concepts::TypeRequirement>(Req)) {
1792 ID.AddBoolean(TypeReq->isSubstitutionFailure());
1793 if (!TypeReq->isSubstitutionFailure())
1794 VisitType(TypeReq->getType()->getType());
1795 }
else if (
auto *ExprReq = dyn_cast<concepts::ExprRequirement>(Req)) {
1797 ID.AddBoolean(ExprReq->isExprSubstitutionFailure());
1798 if (!ExprReq->isExprSubstitutionFailure())
1799 Visit(ExprReq->getExpr());
1804 ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());
1805 const concepts::ExprRequirement::ReturnTypeRequirement &RetReq =
1806 ExprReq->getReturnTypeRequirement();
1819 ID.AddBoolean(NestedReq->hasInvalidConstraint());
1820 if (!NestedReq->hasInvalidConstraint())
1821 Visit(NestedReq->getConstraintExpr());
1829 unsigned &NumArgs) {
1835 case OO_Array_Delete:
1837 case OO_Conditional:
1839 llvm_unreachable(
"Invalid operator call kind");
1844 return Stmt::UnaryOperatorClass;
1848 return Stmt::BinaryOperatorClass;
1853 return Stmt::UnaryOperatorClass;
1857 return Stmt::BinaryOperatorClass;
1862 return Stmt::UnaryOperatorClass;
1866 return Stmt::BinaryOperatorClass;
1870 return Stmt::BinaryOperatorClass;
1874 return Stmt::BinaryOperatorClass;
1878 return Stmt::BinaryOperatorClass;
1882 UnaryOp = UO_AddrOf;
1883 return Stmt::UnaryOperatorClass;
1887 return Stmt::BinaryOperatorClass;
1891 return Stmt::BinaryOperatorClass;
1895 return Stmt::UnaryOperatorClass;
1899 return Stmt::UnaryOperatorClass;
1902 BinaryOp = BO_Assign;
1903 return Stmt::BinaryOperatorClass;
1907 return Stmt::BinaryOperatorClass;
1911 return Stmt::BinaryOperatorClass;
1914 BinaryOp = BO_AddAssign;
1915 return Stmt::CompoundAssignOperatorClass;
1918 BinaryOp = BO_SubAssign;
1919 return Stmt::CompoundAssignOperatorClass;
1922 BinaryOp = BO_MulAssign;
1923 return Stmt::CompoundAssignOperatorClass;
1926 BinaryOp = BO_DivAssign;
1927 return Stmt::CompoundAssignOperatorClass;
1929 case OO_PercentEqual:
1930 BinaryOp = BO_RemAssign;
1931 return Stmt::CompoundAssignOperatorClass;
1934 BinaryOp = BO_XorAssign;
1935 return Stmt::CompoundAssignOperatorClass;
1938 BinaryOp = BO_AndAssign;
1939 return Stmt::CompoundAssignOperatorClass;
1942 BinaryOp = BO_OrAssign;
1943 return Stmt::CompoundAssignOperatorClass;
1947 return Stmt::BinaryOperatorClass;
1949 case OO_GreaterGreater:
1951 return Stmt::BinaryOperatorClass;
1953 case OO_LessLessEqual:
1954 BinaryOp = BO_ShlAssign;
1955 return Stmt::CompoundAssignOperatorClass;
1957 case OO_GreaterGreaterEqual:
1958 BinaryOp = BO_ShrAssign;
1959 return Stmt::CompoundAssignOperatorClass;
1963 return Stmt::BinaryOperatorClass;
1965 case OO_ExclaimEqual:
1967 return Stmt::BinaryOperatorClass;
1971 return Stmt::BinaryOperatorClass;
1973 case OO_GreaterEqual:
1975 return Stmt::BinaryOperatorClass;
1979 return Stmt::BinaryOperatorClass;
1983 return Stmt::BinaryOperatorClass;
1987 return Stmt::BinaryOperatorClass;
1990 UnaryOp = NumArgs == 1 ? UO_PreInc : UO_PostInc;
1992 return Stmt::UnaryOperatorClass;
1995 UnaryOp = NumArgs == 1 ? UO_PreDec : UO_PostDec;
1997 return Stmt::UnaryOperatorClass;
2000 BinaryOp = BO_Comma;
2001 return Stmt::BinaryOperatorClass;
2004 BinaryOp = BO_PtrMemI;
2005 return Stmt::BinaryOperatorClass;
2008 return Stmt::ArraySubscriptExprClass;
2011 return Stmt::CallExprClass;
2014 UnaryOp = UO_Coawait;
2015 return Stmt::UnaryOperatorClass;
2018 llvm_unreachable(
"Invalid overloaded operator expression");
2021#if defined(_MSC_VER) && !defined(__clang__)
2026#pragma optimize("", off)
2030void StmtProfiler::VisitCXXOperatorCallExpr(
const CXXOperatorCallExpr *S) {
2038 return Visit(S->
getArg(0));
2046 for (
unsigned I = 0; I != NumArgs; ++I)
2048 if (SC == Stmt::UnaryOperatorClass)
2049 ID.AddInteger(UnaryOp);
2050 else if (SC == Stmt::BinaryOperatorClass ||
2051 SC == Stmt::CompoundAssignOperatorClass)
2052 ID.AddInteger(BinaryOp);
2054 assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
2063void StmtProfiler::VisitCXXRewrittenBinaryOperator(
2064 const CXXRewrittenBinaryOperator *S) {
2068 "resolved rewritten operator should never be type-dependent");
2073#if defined(_MSC_VER) && !defined(__clang__)
2075#pragma optimize("", on)
2079void StmtProfiler::VisitCXXMemberCallExpr(
const CXXMemberCallExpr *S) {
2083void StmtProfiler::VisitCUDAKernelCallExpr(
const CUDAKernelCallExpr *S) {
2087void StmtProfiler::VisitAsTypeExpr(
const AsTypeExpr *S) {
2091void StmtProfiler::VisitCXXNamedCastExpr(
const CXXNamedCastExpr *S) {
2092 VisitExplicitCastExpr(S);
2095void StmtProfiler::VisitCXXStaticCastExpr(
const CXXStaticCastExpr *S) {
2096 VisitCXXNamedCastExpr(S);
2099void StmtProfiler::VisitCXXDynamicCastExpr(
const CXXDynamicCastExpr *S) {
2100 VisitCXXNamedCastExpr(S);
2104StmtProfiler::VisitCXXReinterpretCastExpr(
const CXXReinterpretCastExpr *S) {
2105 VisitCXXNamedCastExpr(S);
2108void StmtProfiler::VisitCXXConstCastExpr(
const CXXConstCastExpr *S) {
2109 VisitCXXNamedCastExpr(S);
2112void StmtProfiler::VisitBuiltinBitCastExpr(
const BuiltinBitCastExpr *S) {
2117void StmtProfiler::VisitCXXAddrspaceCastExpr(
const CXXAddrspaceCastExpr *S) {
2118 VisitCXXNamedCastExpr(S);
2121void StmtProfiler::VisitUserDefinedLiteral(
const UserDefinedLiteral *S) {
2125void StmtProfiler::VisitCXXBoolLiteralExpr(
const CXXBoolLiteralExpr *S) {
2130void StmtProfiler::VisitCXXNullPtrLiteralExpr(
const CXXNullPtrLiteralExpr *S) {
2134void StmtProfiler::VisitCXXStdInitializerListExpr(
2135 const CXXStdInitializerListExpr *S) {
2139void StmtProfiler::VisitCXXTypeidExpr(
const CXXTypeidExpr *S) {
2145void StmtProfiler::VisitCXXUuidofExpr(
const CXXUuidofExpr *S) {
2151void StmtProfiler::VisitMSPropertyRefExpr(
const MSPropertyRefExpr *S) {
2156void StmtProfiler::VisitMSPropertySubscriptExpr(
2157 const MSPropertySubscriptExpr *S) {
2161void StmtProfiler::VisitCXXThisExpr(
const CXXThisExpr *S) {
2167void StmtProfiler::VisitCXXThrowExpr(
const CXXThrowExpr *S) {
2171void StmtProfiler::VisitCXXDefaultArgExpr(
const CXXDefaultArgExpr *S) {
2176void StmtProfiler::VisitCXXDefaultInitExpr(
const CXXDefaultInitExpr *S) {
2181void StmtProfiler::VisitCXXBindTemporaryExpr(
const CXXBindTemporaryExpr *S) {
2187void StmtProfiler::VisitCXXConstructExpr(
const CXXConstructExpr *S) {
2193void StmtProfiler::VisitCXXInheritedCtorInitExpr(
2194 const CXXInheritedCtorInitExpr *S) {
2199void StmtProfiler::VisitCXXFunctionalCastExpr(
const CXXFunctionalCastExpr *S) {
2200 VisitExplicitCastExpr(S);
2204StmtProfiler::VisitCXXTemporaryObjectExpr(
const CXXTemporaryObjectExpr *S) {
2205 VisitCXXConstructExpr(S);
2209StmtProfiler::VisitLambdaExpr(
const LambdaExpr *S) {
2210 if (!ProfileLambdaExpr) {
2214 VisitStmtNoChildren(S);
2225 ID.AddInteger(
Capture.getCaptureKind());
2226 if (
Capture.capturesVariable())
2227 VisitDecl(
Capture.getCapturedVar());
2236 for (
auto *SubDecl : Lambda->
decls()) {
2237 FunctionDecl *
Call =
nullptr;
2238 if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(SubDecl))
2239 Call = FTD->getTemplatedDecl();
2240 else if (
auto *FD = dyn_cast<FunctionDecl>(SubDecl))
2251void StmtProfiler::VisitCXXReflectExpr(
const CXXReflectExpr *E) {
2253 assert(
false &&
"not implemented yet");
2257StmtProfiler::VisitCXXScalarValueInitExpr(
const CXXScalarValueInitExpr *S) {
2261void StmtProfiler::VisitCXXDeleteExpr(
const CXXDeleteExpr *S) {
2268void StmtProfiler::VisitCXXNewExpr(
const CXXNewExpr *S) {
2281StmtProfiler::VisitCXXPseudoDestructorExpr(
const CXXPseudoDestructorExpr *S) {
2295void StmtProfiler::VisitOverloadExpr(
const OverloadExpr *S) {
2297 bool DescribingDependentVarTemplate =
2299 if (DescribingDependentVarTemplate) {
2303 VisitName(S->
getName(),
true);
2311StmtProfiler::VisitUnresolvedLookupExpr(
const UnresolvedLookupExpr *S) {
2312 VisitOverloadExpr(S);
2315void StmtProfiler::VisitTypeTraitExpr(
const TypeTraitExpr *S) {
2319 for (
unsigned I = 0, N = S->
getNumArgs(); I != N; ++I)
2323void StmtProfiler::VisitArrayTypeTraitExpr(
const ArrayTypeTraitExpr *S) {
2329void StmtProfiler::VisitExpressionTraitExpr(
const ExpressionTraitExpr *S) {
2335void StmtProfiler::VisitDependentScopeDeclRefExpr(
2336 const DependentScopeDeclRefExpr *S) {
2345void StmtProfiler::VisitExprWithCleanups(
const ExprWithCleanups *S) {
2349void StmtProfiler::VisitCXXUnresolvedConstructExpr(
2350 const CXXUnresolvedConstructExpr *S) {
2356void StmtProfiler::VisitCXXDependentScopeMemberExpr(
2357 const CXXDependentScopeMemberExpr *S) {
2370void StmtProfiler::VisitUnresolvedMemberExpr(
const UnresolvedMemberExpr *S) {
2383void StmtProfiler::VisitCXXNoexceptExpr(
const CXXNoexceptExpr *S) {
2387void StmtProfiler::VisitPackExpansionExpr(
const PackExpansionExpr *S) {
2391void StmtProfiler::VisitSizeOfPackExpr(
const SizeOfPackExpr *S) {
2395 ID.AddInteger(Args.size());
2396 for (
const auto &TA : Args)
2397 VisitTemplateArgument(TA);
2404void StmtProfiler::VisitPackIndexingExpr(
const PackIndexingExpr *E) {
2405 VisitStmtNoChildren(E);
2416void StmtProfiler::VisitSubstNonTypeTemplateParmPackExpr(
2417 const SubstNonTypeTemplateParmPackExpr *S) {
2423void StmtProfiler::VisitSubstNonTypeTemplateParmExpr(
2424 const SubstNonTypeTemplateParmExpr *E) {
2429void StmtProfiler::VisitFunctionParmPackExpr(
const FunctionParmPackExpr *S) {
2437void StmtProfiler::VisitMaterializeTemporaryExpr(
2438 const MaterializeTemporaryExpr *S) {
2442void StmtProfiler::VisitCXXFoldExpr(
const CXXFoldExpr *S) {
2443 VisitStmtNoChildren(S);
2466void StmtProfiler::VisitCXXParenListInitExpr(
const CXXParenListInitExpr *S) {
2470void StmtProfiler::VisitCoroutineBodyStmt(
const CoroutineBodyStmt *S) {
2474void StmtProfiler::VisitCoreturnStmt(
const CoreturnStmt *S) {
2478void StmtProfiler::VisitCoawaitExpr(
const CoawaitExpr *S) {
2482void StmtProfiler::VisitDependentCoawaitExpr(
const DependentCoawaitExpr *S) {
2486void StmtProfiler::VisitCoyieldExpr(
const CoyieldExpr *S) {
2490void StmtProfiler::VisitOpaqueValueExpr(
const OpaqueValueExpr *E) {
2494void StmtProfiler::VisitSourceLocExpr(
const SourceLocExpr *E) {
2498void StmtProfiler::VisitEmbedExpr(
const EmbedExpr *E) { VisitExpr(E); }
2500void StmtProfiler::VisitCXXExpansionSelectExpr(
2501 const CXXExpansionSelectExpr *E) {
2505void StmtProfiler::VisitRecoveryExpr(
const RecoveryExpr *E) { VisitExpr(E); }
2507void StmtProfiler::VisitObjCObjectLiteral(
const ObjCObjectLiteral *E) {
2511void StmtProfiler::VisitObjCStringLiteral(
const ObjCStringLiteral *S) {
2512 VisitObjCObjectLiteral(S);
2515void StmtProfiler::VisitObjCBoxedExpr(
const ObjCBoxedExpr *E) {
2516 VisitObjCObjectLiteral(E);
2519void StmtProfiler::VisitObjCArrayLiteral(
const ObjCArrayLiteral *E) {
2520 VisitObjCObjectLiteral(E);
2523void StmtProfiler::VisitObjCDictionaryLiteral(
const ObjCDictionaryLiteral *E) {
2524 VisitObjCObjectLiteral(E);
2527void StmtProfiler::VisitObjCEncodeExpr(
const ObjCEncodeExpr *S) {
2532void StmtProfiler::VisitObjCSelectorExpr(
const ObjCSelectorExpr *S) {
2537void StmtProfiler::VisitObjCProtocolExpr(
const ObjCProtocolExpr *S) {
2542void StmtProfiler::VisitObjCIvarRefExpr(
const ObjCIvarRefExpr *S) {
2549void StmtProfiler::VisitObjCPropertyRefExpr(
const ObjCPropertyRefExpr *S) {
2563void StmtProfiler::VisitObjCSubscriptRefExpr(
const ObjCSubscriptRefExpr *S) {
2569void StmtProfiler::VisitObjCMessageExpr(
const ObjCMessageExpr *S) {
2575void StmtProfiler::VisitObjCIsaExpr(
const ObjCIsaExpr *S) {
2580void StmtProfiler::VisitObjCBoolLiteralExpr(
const ObjCBoolLiteralExpr *S) {
2585void StmtProfiler::VisitObjCIndirectCopyRestoreExpr(
2586 const ObjCIndirectCopyRestoreExpr *S) {
2591void StmtProfiler::VisitObjCBridgedCastExpr(
const ObjCBridgedCastExpr *S) {
2592 VisitExplicitCastExpr(S);
2596void StmtProfiler::VisitObjCAvailabilityCheckExpr(
2597 const ObjCAvailabilityCheckExpr *S) {
2601void StmtProfiler::VisitTemplateArguments(
const TemplateArgumentLoc *Args,
2603 ID.AddInteger(NumArgs);
2604 for (
unsigned I = 0; I != NumArgs; ++I)
2608void StmtProfiler::VisitTemplateArgument(
const TemplateArgument &Arg) {
2651 VisitTemplateArgument(P);
2657class OpenACCClauseProfiler
2658 :
public OpenACCClauseVisitor<OpenACCClauseProfiler> {
2659 StmtProfiler &Profiler;
2662 OpenACCClauseProfiler(StmtProfiler &P) : Profiler(P) {}
2664 void VisitOpenACCClauseList(ArrayRef<const OpenACCClause *> Clauses) {
2665 for (
const OpenACCClause *Clause : Clauses) {
2672 void VisitClauseWithVarList(
const OpenACCClauseWithVarList &Clause) {
2674 Profiler.VisitStmt(E);
2677#define VISIT_CLAUSE(CLAUSE_NAME) \
2678 void Visit##CLAUSE_NAME##Clause(const OpenACC##CLAUSE_NAME##Clause &Clause);
2680#include "clang/Basic/OpenACCClauses.def"
2684void OpenACCClauseProfiler::VisitDefaultClause(
2685 const OpenACCDefaultClause &Clause) {}
2687void OpenACCClauseProfiler::VisitIfClause(
const OpenACCIfClause &Clause) {
2689 "if clause requires a valid condition expr");
2693void OpenACCClauseProfiler::VisitCopyClause(
const OpenACCCopyClause &Clause) {
2694 VisitClauseWithVarList(Clause);
2697void OpenACCClauseProfiler::VisitLinkClause(
const OpenACCLinkClause &Clause) {
2698 VisitClauseWithVarList(Clause);
2701void OpenACCClauseProfiler::VisitDeviceResidentClause(
2702 const OpenACCDeviceResidentClause &Clause) {
2703 VisitClauseWithVarList(Clause);
2706void OpenACCClauseProfiler::VisitCopyInClause(
2707 const OpenACCCopyInClause &Clause) {
2708 VisitClauseWithVarList(Clause);
2711void OpenACCClauseProfiler::VisitCopyOutClause(
2712 const OpenACCCopyOutClause &Clause) {
2713 VisitClauseWithVarList(Clause);
2716void OpenACCClauseProfiler::VisitCreateClause(
2717 const OpenACCCreateClause &Clause) {
2718 VisitClauseWithVarList(Clause);
2721void OpenACCClauseProfiler::VisitHostClause(
const OpenACCHostClause &Clause) {
2722 VisitClauseWithVarList(Clause);
2725void OpenACCClauseProfiler::VisitDeviceClause(
2726 const OpenACCDeviceClause &Clause) {
2727 VisitClauseWithVarList(Clause);
2730void OpenACCClauseProfiler::VisitSelfClause(
const OpenACCSelfClause &Clause) {
2736 Profiler.VisitStmt(E);
2740void OpenACCClauseProfiler::VisitFinalizeClause(
2741 const OpenACCFinalizeClause &Clause) {}
2743void OpenACCClauseProfiler::VisitIfPresentClause(
2744 const OpenACCIfPresentClause &Clause) {}
2746void OpenACCClauseProfiler::VisitNumGangsClause(
2747 const OpenACCNumGangsClause &Clause) {
2749 Profiler.VisitStmt(E);
2752void OpenACCClauseProfiler::VisitTileClause(
const OpenACCTileClause &Clause) {
2754 Profiler.VisitStmt(E);
2757void OpenACCClauseProfiler::VisitNumWorkersClause(
2758 const OpenACCNumWorkersClause &Clause) {
2759 assert(Clause.
hasIntExpr() &&
"num_workers clause requires a valid int expr");
2763void OpenACCClauseProfiler::VisitCollapseClause(
2764 const OpenACCCollapseClause &Clause) {
2765 assert(Clause.
getLoopCount() &&
"collapse clause requires a valid int expr");
2769void OpenACCClauseProfiler::VisitPrivateClause(
2770 const OpenACCPrivateClause &Clause) {
2771 VisitClauseWithVarList(Clause);
2774 Profiler.VisitDecl(Recipe.AllocaDecl);
2778void OpenACCClauseProfiler::VisitFirstPrivateClause(
2779 const OpenACCFirstPrivateClause &Clause) {
2780 VisitClauseWithVarList(Clause);
2783 Profiler.VisitDecl(Recipe.AllocaDecl);
2784 Profiler.VisitDecl(Recipe.InitFromTemporary);
2788void OpenACCClauseProfiler::VisitAttachClause(
2789 const OpenACCAttachClause &Clause) {
2790 VisitClauseWithVarList(Clause);
2793void OpenACCClauseProfiler::VisitDetachClause(
2794 const OpenACCDetachClause &Clause) {
2795 VisitClauseWithVarList(Clause);
2798void OpenACCClauseProfiler::VisitDeleteClause(
2799 const OpenACCDeleteClause &Clause) {
2800 VisitClauseWithVarList(Clause);
2803void OpenACCClauseProfiler::VisitDevicePtrClause(
2804 const OpenACCDevicePtrClause &Clause) {
2805 VisitClauseWithVarList(Clause);
2808void OpenACCClauseProfiler::VisitNoCreateClause(
2809 const OpenACCNoCreateClause &Clause) {
2810 VisitClauseWithVarList(Clause);
2813void OpenACCClauseProfiler::VisitPresentClause(
2814 const OpenACCPresentClause &Clause) {
2815 VisitClauseWithVarList(Clause);
2818void OpenACCClauseProfiler::VisitUseDeviceClause(
2819 const OpenACCUseDeviceClause &Clause) {
2820 VisitClauseWithVarList(Clause);
2823void OpenACCClauseProfiler::VisitVectorLengthClause(
2824 const OpenACCVectorLengthClause &Clause) {
2826 "vector_length clause requires a valid int expr");
2830void OpenACCClauseProfiler::VisitAsyncClause(
const OpenACCAsyncClause &Clause) {
2835void OpenACCClauseProfiler::VisitDeviceNumClause(
2836 const OpenACCDeviceNumClause &Clause) {
2840void OpenACCClauseProfiler::VisitDefaultAsyncClause(
2841 const OpenACCDefaultAsyncClause &Clause) {
2845void OpenACCClauseProfiler::VisitWorkerClause(
2846 const OpenACCWorkerClause &Clause) {
2851void OpenACCClauseProfiler::VisitVectorClause(
2852 const OpenACCVectorClause &Clause) {
2857void OpenACCClauseProfiler::VisitWaitClause(
const OpenACCWaitClause &Clause) {
2861 Profiler.VisitStmt(E);
2865void OpenACCClauseProfiler::VisitDeviceTypeClause(
2866 const OpenACCDeviceTypeClause &Clause) {}
2868void OpenACCClauseProfiler::VisitAutoClause(
const OpenACCAutoClause &Clause) {}
2870void OpenACCClauseProfiler::VisitIndependentClause(
2871 const OpenACCIndependentClause &Clause) {}
2873void OpenACCClauseProfiler::VisitSeqClause(
const OpenACCSeqClause &Clause) {}
2874void OpenACCClauseProfiler::VisitNoHostClause(
2875 const OpenACCNoHostClause &Clause) {}
2877void OpenACCClauseProfiler::VisitGangClause(
const OpenACCGangClause &Clause) {
2878 for (
unsigned I = 0; I < Clause.
getNumExprs(); ++I) {
2879 Profiler.VisitStmt(Clause.
getExpr(I).second);
2883void OpenACCClauseProfiler::VisitReductionClause(
2884 const OpenACCReductionClause &Clause) {
2885 VisitClauseWithVarList(Clause);
2888 Profiler.VisitDecl(Recipe.AllocaDecl);
2893 static_assert(
sizeof(OpenACCReductionRecipe::CombinerRecipe) ==
2895 for (
auto &CombinerRecipe : Recipe.CombinerRecipes) {
2896 if (CombinerRecipe.Op) {
2897 Profiler.VisitDecl(CombinerRecipe.LHS);
2898 Profiler.VisitDecl(CombinerRecipe.RHS);
2899 Profiler.VisitStmt(CombinerRecipe.Op);
2905void OpenACCClauseProfiler::VisitBindClause(
const OpenACCBindClause &Clause) {
2906 assert(
false &&
"not implemented... what can we do about our expr?");
2910void StmtProfiler::VisitOpenACCComputeConstruct(
2915 OpenACCClauseProfiler P{*
this};
2916 P.VisitOpenACCClauseList(S->clauses());
2919void StmtProfiler::VisitOpenACCLoopConstruct(
const OpenACCLoopConstruct *S) {
2923 OpenACCClauseProfiler P{*
this};
2924 P.VisitOpenACCClauseList(S->clauses());
2927void StmtProfiler::VisitOpenACCCombinedConstruct(
2928 const OpenACCCombinedConstruct *S) {
2932 OpenACCClauseProfiler P{*
this};
2933 P.VisitOpenACCClauseList(S->clauses());
2936void StmtProfiler::VisitOpenACCDataConstruct(
const OpenACCDataConstruct *S) {
2939 OpenACCClauseProfiler P{*
this};
2940 P.VisitOpenACCClauseList(S->clauses());
2943void StmtProfiler::VisitOpenACCEnterDataConstruct(
2944 const OpenACCEnterDataConstruct *S) {
2947 OpenACCClauseProfiler P{*
this};
2948 P.VisitOpenACCClauseList(S->clauses());
2951void StmtProfiler::VisitOpenACCExitDataConstruct(
2952 const OpenACCExitDataConstruct *S) {
2955 OpenACCClauseProfiler P{*
this};
2956 P.VisitOpenACCClauseList(S->clauses());
2959void StmtProfiler::VisitOpenACCHostDataConstruct(
2960 const OpenACCHostDataConstruct *S) {
2963 OpenACCClauseProfiler P{*
this};
2964 P.VisitOpenACCClauseList(S->clauses());
2967void StmtProfiler::VisitOpenACCWaitConstruct(
const OpenACCWaitConstruct *S) {
2971 OpenACCClauseProfiler P{*
this};
2972 P.VisitOpenACCClauseList(S->clauses());
2975void StmtProfiler::VisitOpenACCCacheConstruct(
const OpenACCCacheConstruct *S) {
2980void StmtProfiler::VisitOpenACCInitConstruct(
const OpenACCInitConstruct *S) {
2982 OpenACCClauseProfiler P{*
this};
2983 P.VisitOpenACCClauseList(S->clauses());
2986void StmtProfiler::VisitOpenACCShutdownConstruct(
2987 const OpenACCShutdownConstruct *S) {
2989 OpenACCClauseProfiler P{*
this};
2990 P.VisitOpenACCClauseList(S->clauses());
2993void StmtProfiler::VisitOpenACCSetConstruct(
const OpenACCSetConstruct *S) {
2995 OpenACCClauseProfiler P{*
this};
2996 P.VisitOpenACCClauseList(S->clauses());
2999void StmtProfiler::VisitOpenACCUpdateConstruct(
3000 const OpenACCUpdateConstruct *S) {
3002 OpenACCClauseProfiler P{*
this};
3003 P.VisitOpenACCClauseList(S->clauses());
3006void StmtProfiler::VisitOpenACCAtomicConstruct(
3007 const OpenACCAtomicConstruct *S) {
3009 OpenACCClauseProfiler P{*
this};
3010 P.VisitOpenACCClauseList(S->clauses());
3013void StmtProfiler::VisitHLSLOutArgExpr(
const HLSLOutArgExpr *S) {
3018 bool Canonical,
bool ProfileLambdaExpr)
const {
3019 StmtProfilerWithPointers Profiler(ID, Context, Canonical, ProfileLambdaExpr);
3020 Profiler.Visit(
this);
3025 StmtProfilerWithoutPointers Profiler(ID, Hash);
3026 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
Top level wrappers for InstallAPI frontend operations.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
bool isa(CodeGen::Address addr)
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
const FunctionProtoType * T
U cast(CodeGen::Address addr)
Expr * AllocatorTraits
Allocator traits.
Expr * Allocator
Allocator.
DeclarationName getName() const
getName - Returns the embedded declaration name.