| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_MPICHECKER_MPIFUNCTIONCLASSIFIER_H |
| 15 | #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_MPICHECKER_MPIFUNCTIONCLASSIFIER_H |
| 16 | |
| 17 | #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" |
| 18 | |
| 19 | namespace clang { |
| 20 | namespace ento { |
| 21 | namespace mpi { |
| 22 | |
| 23 | class MPIFunctionClassifier { |
| 24 | public: |
| 25 | MPIFunctionClassifier(ASTContext &ASTCtx) { identifierInit(ASTCtx); } |
| 26 | |
| 27 | |
| 28 | bool isMPIType(const IdentifierInfo *const IdentInfo) const; |
| 29 | bool isNonBlockingType(const IdentifierInfo *const IdentInfo) const; |
| 30 | |
| 31 | |
| 32 | bool isPointToPointType(const IdentifierInfo *const IdentInfo) const; |
| 33 | |
| 34 | |
| 35 | bool isCollectiveType(const IdentifierInfo *const IdentInfo) const; |
| 36 | bool isCollToColl(const IdentifierInfo *const IdentInfo) const; |
| 37 | bool isScatterType(const IdentifierInfo *const IdentInfo) const; |
| 38 | bool isGatherType(const IdentifierInfo *const IdentInfo) const; |
| 39 | bool isAllgatherType(const IdentifierInfo *const IdentInfo) const; |
| 40 | bool isAlltoallType(const IdentifierInfo *const IdentInfo) const; |
| 41 | bool isReduceType(const IdentifierInfo *const IdentInfo) const; |
| 42 | bool isBcastType(const IdentifierInfo *const IdentInfo) const; |
| 43 | |
| 44 | |
| 45 | bool isMPI_Wait(const IdentifierInfo *const IdentInfo) const; |
| 46 | bool isMPI_Waitall(const IdentifierInfo *const IdentInfo) const; |
| 47 | bool isWaitType(const IdentifierInfo *const IdentInfo) const; |
| 48 | |
| 49 | private: |
| 50 | |
| 51 | void identifierInit(ASTContext &ASTCtx); |
| 52 | void initPointToPointIdentifiers(ASTContext &ASTCtx); |
| 53 | void initCollectiveIdentifiers(ASTContext &ASTCtx); |
| 54 | void initAdditionalIdentifiers(ASTContext &ASTCtx); |
| 55 | |
| 56 | |
| 57 | |
| 58 | llvm::SmallVector<IdentifierInfo *, 12> MPINonBlockingTypes; |
| 59 | |
| 60 | llvm::SmallVector<IdentifierInfo *, 10> MPIPointToPointTypes; |
| 61 | llvm::SmallVector<IdentifierInfo *, 16> MPICollectiveTypes; |
| 62 | |
| 63 | llvm::SmallVector<IdentifierInfo *, 4> MPIPointToCollTypes; |
| 64 | llvm::SmallVector<IdentifierInfo *, 4> MPICollToPointTypes; |
| 65 | llvm::SmallVector<IdentifierInfo *, 6> MPICollToCollTypes; |
| 66 | |
| 67 | llvm::SmallVector<IdentifierInfo *, 32> MPIType; |
| 68 | |
| 69 | |
| 70 | IdentifierInfo *IdentInfo_MPI_Send = nullptr, *IdentInfo_MPI_Isend = nullptr, |
| 71 | *IdentInfo_MPI_Ssend = nullptr, *IdentInfo_MPI_Issend = nullptr, |
| 72 | *IdentInfo_MPI_Bsend = nullptr, *IdentInfo_MPI_Ibsend = nullptr, |
| 73 | *IdentInfo_MPI_Rsend = nullptr, *IdentInfo_MPI_Irsend = nullptr, |
| 74 | *IdentInfo_MPI_Recv = nullptr, *IdentInfo_MPI_Irecv = nullptr; |
| 75 | |
| 76 | |
| 77 | IdentifierInfo *IdentInfo_MPI_Scatter = nullptr, |
| 78 | *IdentInfo_MPI_Iscatter = nullptr, *IdentInfo_MPI_Gather = nullptr, |
| 79 | *IdentInfo_MPI_Igather = nullptr, *IdentInfo_MPI_Allgather = nullptr, |
| 80 | *IdentInfo_MPI_Iallgather = nullptr, *IdentInfo_MPI_Bcast = nullptr, |
| 81 | *IdentInfo_MPI_Ibcast = nullptr, *IdentInfo_MPI_Reduce = nullptr, |
| 82 | *IdentInfo_MPI_Ireduce = nullptr, *IdentInfo_MPI_Allreduce = nullptr, |
| 83 | *IdentInfo_MPI_Iallreduce = nullptr, *IdentInfo_MPI_Alltoall = nullptr, |
| 84 | *IdentInfo_MPI_Ialltoall = nullptr, *IdentInfo_MPI_Barrier = nullptr; |
| 85 | |
| 86 | |
| 87 | IdentifierInfo *IdentInfo_MPI_Comm_rank = nullptr, |
| 88 | *IdentInfo_MPI_Comm_size = nullptr, *IdentInfo_MPI_Wait = nullptr, |
| 89 | *IdentInfo_MPI_Waitall = nullptr; |
| 90 | }; |
| 91 | |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | #endif |
| 97 | |