1*0b57cec5SDimitry Andric //===-- MPIFunctionClassifier.cpp - classifies MPI functions ----*- C++ -*-===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric ///
9*0b57cec5SDimitry Andric /// \file
10*0b57cec5SDimitry Andric /// This file defines functionality to identify and classify MPI functions.
11*0b57cec5SDimitry Andric ///
12*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
13*0b57cec5SDimitry Andric 
14*0b57cec5SDimitry Andric #include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h"
15*0b57cec5SDimitry Andric #include "llvm/ADT/STLExtras.h"
16*0b57cec5SDimitry Andric 
17*0b57cec5SDimitry Andric namespace clang {
18*0b57cec5SDimitry Andric namespace ento {
19*0b57cec5SDimitry Andric namespace mpi {
20*0b57cec5SDimitry Andric 
identifierInit(ASTContext & ASTCtx)21*0b57cec5SDimitry Andric void MPIFunctionClassifier::identifierInit(ASTContext &ASTCtx) {
22*0b57cec5SDimitry Andric   // Initialize function identifiers.
23*0b57cec5SDimitry Andric   initPointToPointIdentifiers(ASTCtx);
24*0b57cec5SDimitry Andric   initCollectiveIdentifiers(ASTCtx);
25*0b57cec5SDimitry Andric   initAdditionalIdentifiers(ASTCtx);
26*0b57cec5SDimitry Andric }
27*0b57cec5SDimitry Andric 
initPointToPointIdentifiers(ASTContext & ASTCtx)28*0b57cec5SDimitry Andric void MPIFunctionClassifier::initPointToPointIdentifiers(ASTContext &ASTCtx) {
29*0b57cec5SDimitry Andric   // Copy identifiers into the correct classification containers.
30*0b57cec5SDimitry Andric   IdentInfo_MPI_Send = &ASTCtx.Idents.get("MPI_Send");
31*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Send);
32*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Send);
33*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Send);
34*0b57cec5SDimitry Andric 
35*0b57cec5SDimitry Andric   IdentInfo_MPI_Isend = &ASTCtx.Idents.get("MPI_Isend");
36*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Isend);
37*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Isend);
38*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Isend);
39*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Isend);
40*0b57cec5SDimitry Andric 
41*0b57cec5SDimitry Andric   IdentInfo_MPI_Ssend = &ASTCtx.Idents.get("MPI_Ssend");
42*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Ssend);
43*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Ssend);
44*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Ssend);
45*0b57cec5SDimitry Andric 
46*0b57cec5SDimitry Andric   IdentInfo_MPI_Issend = &ASTCtx.Idents.get("MPI_Issend");
47*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Issend);
48*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Issend);
49*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Issend);
50*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Issend);
51*0b57cec5SDimitry Andric 
52*0b57cec5SDimitry Andric   IdentInfo_MPI_Bsend = &ASTCtx.Idents.get("MPI_Bsend");
53*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Bsend);
54*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Bsend);
55*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Bsend);
56*0b57cec5SDimitry Andric 
57*0b57cec5SDimitry Andric   IdentInfo_MPI_Ibsend = &ASTCtx.Idents.get("MPI_Ibsend");
58*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Ibsend);
59*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Ibsend);
60*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Ibsend);
61*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Ibsend);
62*0b57cec5SDimitry Andric 
63*0b57cec5SDimitry Andric   IdentInfo_MPI_Rsend = &ASTCtx.Idents.get("MPI_Rsend");
64*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Rsend);
65*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Rsend);
66*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Rsend);
67*0b57cec5SDimitry Andric 
68*0b57cec5SDimitry Andric   IdentInfo_MPI_Irsend = &ASTCtx.Idents.get("MPI_Irsend");
69*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Irsend);
70*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Irsend);
71*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Irsend);
72*0b57cec5SDimitry Andric 
73*0b57cec5SDimitry Andric   IdentInfo_MPI_Recv = &ASTCtx.Idents.get("MPI_Recv");
74*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Recv);
75*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Recv);
76*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Recv);
77*0b57cec5SDimitry Andric 
78*0b57cec5SDimitry Andric   IdentInfo_MPI_Irecv = &ASTCtx.Idents.get("MPI_Irecv");
79*0b57cec5SDimitry Andric   MPIPointToPointTypes.push_back(IdentInfo_MPI_Irecv);
80*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Irecv);
81*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Irecv);
82*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Irecv);
83*0b57cec5SDimitry Andric }
84*0b57cec5SDimitry Andric 
initCollectiveIdentifiers(ASTContext & ASTCtx)85*0b57cec5SDimitry Andric void MPIFunctionClassifier::initCollectiveIdentifiers(ASTContext &ASTCtx) {
86*0b57cec5SDimitry Andric   // Copy identifiers into the correct classification containers.
87*0b57cec5SDimitry Andric   IdentInfo_MPI_Scatter = &ASTCtx.Idents.get("MPI_Scatter");
88*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Scatter);
89*0b57cec5SDimitry Andric   MPIPointToCollTypes.push_back(IdentInfo_MPI_Scatter);
90*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Scatter);
91*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Scatter);
92*0b57cec5SDimitry Andric 
93*0b57cec5SDimitry Andric   IdentInfo_MPI_Iscatter = &ASTCtx.Idents.get("MPI_Iscatter");
94*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Iscatter);
95*0b57cec5SDimitry Andric   MPIPointToCollTypes.push_back(IdentInfo_MPI_Iscatter);
96*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Iscatter);
97*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Iscatter);
98*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Iscatter);
99*0b57cec5SDimitry Andric 
100*0b57cec5SDimitry Andric   IdentInfo_MPI_Gather = &ASTCtx.Idents.get("MPI_Gather");
101*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Gather);
102*0b57cec5SDimitry Andric   MPICollToPointTypes.push_back(IdentInfo_MPI_Gather);
103*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Gather);
104*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Gather);
105*0b57cec5SDimitry Andric 
106*0b57cec5SDimitry Andric   IdentInfo_MPI_Igather = &ASTCtx.Idents.get("MPI_Igather");
107*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Igather);
108*0b57cec5SDimitry Andric   MPICollToPointTypes.push_back(IdentInfo_MPI_Igather);
109*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Igather);
110*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Igather);
111*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Igather);
112*0b57cec5SDimitry Andric 
113*0b57cec5SDimitry Andric   IdentInfo_MPI_Allgather = &ASTCtx.Idents.get("MPI_Allgather");
114*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Allgather);
115*0b57cec5SDimitry Andric   MPICollToCollTypes.push_back(IdentInfo_MPI_Allgather);
116*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Allgather);
117*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Allgather);
118*0b57cec5SDimitry Andric 
119*0b57cec5SDimitry Andric   IdentInfo_MPI_Iallgather = &ASTCtx.Idents.get("MPI_Iallgather");
120*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Iallgather);
121*0b57cec5SDimitry Andric   MPICollToCollTypes.push_back(IdentInfo_MPI_Iallgather);
122*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Iallgather);
123*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Iallgather);
124*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Iallgather);
125*0b57cec5SDimitry Andric 
126*0b57cec5SDimitry Andric   IdentInfo_MPI_Bcast = &ASTCtx.Idents.get("MPI_Bcast");
127*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Bcast);
128*0b57cec5SDimitry Andric   MPIPointToCollTypes.push_back(IdentInfo_MPI_Bcast);
129*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Bcast);
130*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Bcast);
131*0b57cec5SDimitry Andric 
132*0b57cec5SDimitry Andric   IdentInfo_MPI_Ibcast = &ASTCtx.Idents.get("MPI_Ibcast");
133*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Ibcast);
134*0b57cec5SDimitry Andric   MPIPointToCollTypes.push_back(IdentInfo_MPI_Ibcast);
135*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Ibcast);
136*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Ibcast);
137*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Ibcast);
138*0b57cec5SDimitry Andric 
139*0b57cec5SDimitry Andric   IdentInfo_MPI_Reduce = &ASTCtx.Idents.get("MPI_Reduce");
140*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Reduce);
141*0b57cec5SDimitry Andric   MPICollToPointTypes.push_back(IdentInfo_MPI_Reduce);
142*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Reduce);
143*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Reduce);
144*0b57cec5SDimitry Andric 
145*0b57cec5SDimitry Andric   IdentInfo_MPI_Ireduce = &ASTCtx.Idents.get("MPI_Ireduce");
146*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Ireduce);
147*0b57cec5SDimitry Andric   MPICollToPointTypes.push_back(IdentInfo_MPI_Ireduce);
148*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Ireduce);
149*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Ireduce);
150*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Ireduce);
151*0b57cec5SDimitry Andric 
152*0b57cec5SDimitry Andric   IdentInfo_MPI_Allreduce = &ASTCtx.Idents.get("MPI_Allreduce");
153*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Allreduce);
154*0b57cec5SDimitry Andric   MPICollToCollTypes.push_back(IdentInfo_MPI_Allreduce);
155*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Allreduce);
156*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Allreduce);
157*0b57cec5SDimitry Andric 
158*0b57cec5SDimitry Andric   IdentInfo_MPI_Iallreduce = &ASTCtx.Idents.get("MPI_Iallreduce");
159*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Iallreduce);
160*0b57cec5SDimitry Andric   MPICollToCollTypes.push_back(IdentInfo_MPI_Iallreduce);
161*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Iallreduce);
162*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Iallreduce);
163*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Iallreduce);
164*0b57cec5SDimitry Andric 
165*0b57cec5SDimitry Andric   IdentInfo_MPI_Alltoall = &ASTCtx.Idents.get("MPI_Alltoall");
166*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Alltoall);
167*0b57cec5SDimitry Andric   MPICollToCollTypes.push_back(IdentInfo_MPI_Alltoall);
168*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Alltoall);
169*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Alltoall);
170*0b57cec5SDimitry Andric 
171*0b57cec5SDimitry Andric   IdentInfo_MPI_Ialltoall = &ASTCtx.Idents.get("MPI_Ialltoall");
172*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Ialltoall);
173*0b57cec5SDimitry Andric   MPICollToCollTypes.push_back(IdentInfo_MPI_Ialltoall);
174*0b57cec5SDimitry Andric   MPINonBlockingTypes.push_back(IdentInfo_MPI_Ialltoall);
175*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Ialltoall);
176*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Ialltoall);
177*0b57cec5SDimitry Andric }
178*0b57cec5SDimitry Andric 
initAdditionalIdentifiers(ASTContext & ASTCtx)179*0b57cec5SDimitry Andric void MPIFunctionClassifier::initAdditionalIdentifiers(ASTContext &ASTCtx) {
180*0b57cec5SDimitry Andric   IdentInfo_MPI_Comm_rank = &ASTCtx.Idents.get("MPI_Comm_rank");
181*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Comm_rank);
182*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Comm_rank);
183*0b57cec5SDimitry Andric 
184*0b57cec5SDimitry Andric   IdentInfo_MPI_Comm_size = &ASTCtx.Idents.get("MPI_Comm_size");
185*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Comm_size);
186*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Comm_size);
187*0b57cec5SDimitry Andric 
188*0b57cec5SDimitry Andric   IdentInfo_MPI_Wait = &ASTCtx.Idents.get("MPI_Wait");
189*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Wait);
190*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Wait);
191*0b57cec5SDimitry Andric 
192*0b57cec5SDimitry Andric   IdentInfo_MPI_Waitall = &ASTCtx.Idents.get("MPI_Waitall");
193*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Waitall);
194*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Waitall);
195*0b57cec5SDimitry Andric 
196*0b57cec5SDimitry Andric   IdentInfo_MPI_Barrier = &ASTCtx.Idents.get("MPI_Barrier");
197*0b57cec5SDimitry Andric   MPICollectiveTypes.push_back(IdentInfo_MPI_Barrier);
198*0b57cec5SDimitry Andric   MPIType.push_back(IdentInfo_MPI_Barrier);
199*0b57cec5SDimitry Andric   assert(IdentInfo_MPI_Barrier);
200*0b57cec5SDimitry Andric }
201*0b57cec5SDimitry Andric 
202*0b57cec5SDimitry Andric // general identifiers
isMPIType(const IdentifierInfo * IdentInfo) const203*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isMPIType(const IdentifierInfo *IdentInfo) const {
204*0b57cec5SDimitry Andric   return llvm::is_contained(MPIType, IdentInfo);
205*0b57cec5SDimitry Andric }
206*0b57cec5SDimitry Andric 
isNonBlockingType(const IdentifierInfo * IdentInfo) const207*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isNonBlockingType(
208*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
209*0b57cec5SDimitry Andric   return llvm::is_contained(MPINonBlockingTypes, IdentInfo);
210*0b57cec5SDimitry Andric }
211*0b57cec5SDimitry Andric 
212*0b57cec5SDimitry Andric // point-to-point identifiers
isPointToPointType(const IdentifierInfo * IdentInfo) const213*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isPointToPointType(
214*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
215*0b57cec5SDimitry Andric   return llvm::is_contained(MPIPointToPointTypes, IdentInfo);
216*0b57cec5SDimitry Andric }
217*0b57cec5SDimitry Andric 
218*0b57cec5SDimitry Andric // collective identifiers
isCollectiveType(const IdentifierInfo * IdentInfo) const219*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isCollectiveType(
220*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
221*0b57cec5SDimitry Andric   return llvm::is_contained(MPICollectiveTypes, IdentInfo);
222*0b57cec5SDimitry Andric }
223*0b57cec5SDimitry Andric 
isCollToColl(const IdentifierInfo * IdentInfo) const224*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isCollToColl(
225*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
226*0b57cec5SDimitry Andric   return llvm::is_contained(MPICollToCollTypes, IdentInfo);
227*0b57cec5SDimitry Andric }
228*0b57cec5SDimitry Andric 
isScatterType(const IdentifierInfo * IdentInfo) const229*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isScatterType(
230*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
231*0b57cec5SDimitry Andric   return IdentInfo == IdentInfo_MPI_Scatter ||
232*0b57cec5SDimitry Andric          IdentInfo == IdentInfo_MPI_Iscatter;
233*0b57cec5SDimitry Andric }
234*0b57cec5SDimitry Andric 
isGatherType(const IdentifierInfo * IdentInfo) const235*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isGatherType(
236*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
237*0b57cec5SDimitry Andric   return IdentInfo == IdentInfo_MPI_Gather ||
238*0b57cec5SDimitry Andric          IdentInfo == IdentInfo_MPI_Igather ||
239*0b57cec5SDimitry Andric          IdentInfo == IdentInfo_MPI_Allgather ||
240*0b57cec5SDimitry Andric          IdentInfo == IdentInfo_MPI_Iallgather;
241*0b57cec5SDimitry Andric }
242*0b57cec5SDimitry Andric 
isAllgatherType(const IdentifierInfo * IdentInfo) const243*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isAllgatherType(
244*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
245*0b57cec5SDimitry Andric   return IdentInfo == IdentInfo_MPI_Allgather ||
246*0b57cec5SDimitry Andric          IdentInfo == IdentInfo_MPI_Iallgather;
247*0b57cec5SDimitry Andric }
248*0b57cec5SDimitry Andric 
isAlltoallType(const IdentifierInfo * IdentInfo) const249*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isAlltoallType(
250*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
251*0b57cec5SDimitry Andric   return IdentInfo == IdentInfo_MPI_Alltoall ||
252*0b57cec5SDimitry Andric          IdentInfo == IdentInfo_MPI_Ialltoall;
253*0b57cec5SDimitry Andric }
254*0b57cec5SDimitry Andric 
isBcastType(const IdentifierInfo * IdentInfo) const255*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isBcastType(const IdentifierInfo *IdentInfo) const {
256*0b57cec5SDimitry Andric   return IdentInfo == IdentInfo_MPI_Bcast || IdentInfo == IdentInfo_MPI_Ibcast;
257*0b57cec5SDimitry Andric }
258*0b57cec5SDimitry Andric 
isReduceType(const IdentifierInfo * IdentInfo) const259*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isReduceType(
260*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
261*0b57cec5SDimitry Andric   return IdentInfo == IdentInfo_MPI_Reduce ||
262*0b57cec5SDimitry Andric          IdentInfo == IdentInfo_MPI_Ireduce ||
263*0b57cec5SDimitry Andric          IdentInfo == IdentInfo_MPI_Allreduce ||
264*0b57cec5SDimitry Andric          IdentInfo == IdentInfo_MPI_Iallreduce;
265*0b57cec5SDimitry Andric }
266*0b57cec5SDimitry Andric 
267*0b57cec5SDimitry Andric // additional identifiers
isMPI_Wait(const IdentifierInfo * IdentInfo) const268*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isMPI_Wait(const IdentifierInfo *IdentInfo) const {
269*0b57cec5SDimitry Andric   return IdentInfo == IdentInfo_MPI_Wait;
270*0b57cec5SDimitry Andric }
271*0b57cec5SDimitry Andric 
isMPI_Waitall(const IdentifierInfo * IdentInfo) const272*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isMPI_Waitall(
273*0b57cec5SDimitry Andric     const IdentifierInfo *IdentInfo) const {
274*0b57cec5SDimitry Andric   return IdentInfo == IdentInfo_MPI_Waitall;
275*0b57cec5SDimitry Andric }
276*0b57cec5SDimitry Andric 
isWaitType(const IdentifierInfo * IdentInfo) const277*0b57cec5SDimitry Andric bool MPIFunctionClassifier::isWaitType(const IdentifierInfo *IdentInfo) const {
278*0b57cec5SDimitry Andric   return IdentInfo == IdentInfo_MPI_Wait || IdentInfo == IdentInfo_MPI_Waitall;
279*0b57cec5SDimitry Andric }
280*0b57cec5SDimitry Andric 
281*0b57cec5SDimitry Andric } // end of namespace: mpi
282*0b57cec5SDimitry Andric } // end of namespace: ento
283*0b57cec5SDimitry Andric } // end of namespace: clang
284