xref: /llvm-project/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.cpp (revision 2946cd701067404b99c39fb29dc9c74bd7193eb3)
1160f19cdSDevin Coughlin //===-- MPIFunctionClassifier.cpp - classifies MPI functions ----*- C++ -*-===//
2160f19cdSDevin Coughlin //
3*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
5*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6160f19cdSDevin Coughlin //
7160f19cdSDevin Coughlin //===----------------------------------------------------------------------===//
8160f19cdSDevin Coughlin ///
9160f19cdSDevin Coughlin /// \file
10160f19cdSDevin Coughlin /// This file defines functionality to identify and classify MPI functions.
11160f19cdSDevin Coughlin ///
12160f19cdSDevin Coughlin //===----------------------------------------------------------------------===//
13160f19cdSDevin Coughlin 
14c5e50931SAlexander Kornienko #include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h"
15160f19cdSDevin Coughlin #include "llvm/ADT/STLExtras.h"
16160f19cdSDevin Coughlin 
17160f19cdSDevin Coughlin namespace clang {
18160f19cdSDevin Coughlin namespace ento {
19160f19cdSDevin Coughlin namespace mpi {
20160f19cdSDevin Coughlin 
identifierInit(ASTContext & ASTCtx)21160f19cdSDevin Coughlin void MPIFunctionClassifier::identifierInit(ASTContext &ASTCtx) {
22160f19cdSDevin Coughlin   // Initialize function identifiers.
23160f19cdSDevin Coughlin   initPointToPointIdentifiers(ASTCtx);
24160f19cdSDevin Coughlin   initCollectiveIdentifiers(ASTCtx);
25160f19cdSDevin Coughlin   initAdditionalIdentifiers(ASTCtx);
26160f19cdSDevin Coughlin }
27160f19cdSDevin Coughlin 
initPointToPointIdentifiers(ASTContext & ASTCtx)28160f19cdSDevin Coughlin void MPIFunctionClassifier::initPointToPointIdentifiers(ASTContext &ASTCtx) {
29160f19cdSDevin Coughlin   // Copy identifiers into the correct classification containers.
30160f19cdSDevin Coughlin   IdentInfo_MPI_Send = &ASTCtx.Idents.get("MPI_Send");
31160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Send);
32160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Send);
33160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Send);
34160f19cdSDevin Coughlin 
35160f19cdSDevin Coughlin   IdentInfo_MPI_Isend = &ASTCtx.Idents.get("MPI_Isend");
36160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Isend);
37160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Isend);
38160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Isend);
39160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Isend);
40160f19cdSDevin Coughlin 
41160f19cdSDevin Coughlin   IdentInfo_MPI_Ssend = &ASTCtx.Idents.get("MPI_Ssend");
42160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Ssend);
43160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Ssend);
44160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Ssend);
45160f19cdSDevin Coughlin 
46160f19cdSDevin Coughlin   IdentInfo_MPI_Issend = &ASTCtx.Idents.get("MPI_Issend");
47160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Issend);
48160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Issend);
49160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Issend);
50160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Issend);
51160f19cdSDevin Coughlin 
52160f19cdSDevin Coughlin   IdentInfo_MPI_Bsend = &ASTCtx.Idents.get("MPI_Bsend");
53160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Bsend);
54160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Bsend);
55160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Bsend);
56160f19cdSDevin Coughlin 
57160f19cdSDevin Coughlin   IdentInfo_MPI_Ibsend = &ASTCtx.Idents.get("MPI_Ibsend");
58160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Ibsend);
59160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Ibsend);
60160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Ibsend);
61160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Ibsend);
62160f19cdSDevin Coughlin 
63160f19cdSDevin Coughlin   IdentInfo_MPI_Rsend = &ASTCtx.Idents.get("MPI_Rsend");
64160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Rsend);
65160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Rsend);
66160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Rsend);
67160f19cdSDevin Coughlin 
68160f19cdSDevin Coughlin   IdentInfo_MPI_Irsend = &ASTCtx.Idents.get("MPI_Irsend");
69160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Irsend);
70160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Irsend);
71160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Irsend);
72160f19cdSDevin Coughlin 
73160f19cdSDevin Coughlin   IdentInfo_MPI_Recv = &ASTCtx.Idents.get("MPI_Recv");
74160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Recv);
75160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Recv);
76160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Recv);
77160f19cdSDevin Coughlin 
78160f19cdSDevin Coughlin   IdentInfo_MPI_Irecv = &ASTCtx.Idents.get("MPI_Irecv");
79160f19cdSDevin Coughlin   MPIPointToPointTypes.push_back(IdentInfo_MPI_Irecv);
80160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Irecv);
81160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Irecv);
82160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Irecv);
83160f19cdSDevin Coughlin }
84160f19cdSDevin Coughlin 
initCollectiveIdentifiers(ASTContext & ASTCtx)85160f19cdSDevin Coughlin void MPIFunctionClassifier::initCollectiveIdentifiers(ASTContext &ASTCtx) {
86160f19cdSDevin Coughlin   // Copy identifiers into the correct classification containers.
87160f19cdSDevin Coughlin   IdentInfo_MPI_Scatter = &ASTCtx.Idents.get("MPI_Scatter");
88160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Scatter);
89160f19cdSDevin Coughlin   MPIPointToCollTypes.push_back(IdentInfo_MPI_Scatter);
90160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Scatter);
91160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Scatter);
92160f19cdSDevin Coughlin 
93160f19cdSDevin Coughlin   IdentInfo_MPI_Iscatter = &ASTCtx.Idents.get("MPI_Iscatter");
94160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Iscatter);
95160f19cdSDevin Coughlin   MPIPointToCollTypes.push_back(IdentInfo_MPI_Iscatter);
96160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Iscatter);
97160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Iscatter);
98160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Iscatter);
99160f19cdSDevin Coughlin 
100160f19cdSDevin Coughlin   IdentInfo_MPI_Gather = &ASTCtx.Idents.get("MPI_Gather");
101160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Gather);
102160f19cdSDevin Coughlin   MPICollToPointTypes.push_back(IdentInfo_MPI_Gather);
103160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Gather);
104160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Gather);
105160f19cdSDevin Coughlin 
106160f19cdSDevin Coughlin   IdentInfo_MPI_Igather = &ASTCtx.Idents.get("MPI_Igather");
107160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Igather);
108160f19cdSDevin Coughlin   MPICollToPointTypes.push_back(IdentInfo_MPI_Igather);
109160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Igather);
110160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Igather);
111160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Igather);
112160f19cdSDevin Coughlin 
113160f19cdSDevin Coughlin   IdentInfo_MPI_Allgather = &ASTCtx.Idents.get("MPI_Allgather");
114160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Allgather);
115160f19cdSDevin Coughlin   MPICollToCollTypes.push_back(IdentInfo_MPI_Allgather);
116160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Allgather);
117160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Allgather);
118160f19cdSDevin Coughlin 
119160f19cdSDevin Coughlin   IdentInfo_MPI_Iallgather = &ASTCtx.Idents.get("MPI_Iallgather");
120160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Iallgather);
121160f19cdSDevin Coughlin   MPICollToCollTypes.push_back(IdentInfo_MPI_Iallgather);
122160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Iallgather);
123160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Iallgather);
124160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Iallgather);
125160f19cdSDevin Coughlin 
126160f19cdSDevin Coughlin   IdentInfo_MPI_Bcast = &ASTCtx.Idents.get("MPI_Bcast");
127160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Bcast);
128160f19cdSDevin Coughlin   MPIPointToCollTypes.push_back(IdentInfo_MPI_Bcast);
129160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Bcast);
130160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Bcast);
131160f19cdSDevin Coughlin 
132160f19cdSDevin Coughlin   IdentInfo_MPI_Ibcast = &ASTCtx.Idents.get("MPI_Ibcast");
133160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Ibcast);
134160f19cdSDevin Coughlin   MPIPointToCollTypes.push_back(IdentInfo_MPI_Ibcast);
135160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Ibcast);
136160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Ibcast);
137160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Ibcast);
138160f19cdSDevin Coughlin 
139160f19cdSDevin Coughlin   IdentInfo_MPI_Reduce = &ASTCtx.Idents.get("MPI_Reduce");
140160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Reduce);
141160f19cdSDevin Coughlin   MPICollToPointTypes.push_back(IdentInfo_MPI_Reduce);
142160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Reduce);
143160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Reduce);
144160f19cdSDevin Coughlin 
145160f19cdSDevin Coughlin   IdentInfo_MPI_Ireduce = &ASTCtx.Idents.get("MPI_Ireduce");
146160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Ireduce);
147160f19cdSDevin Coughlin   MPICollToPointTypes.push_back(IdentInfo_MPI_Ireduce);
148160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Ireduce);
149160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Ireduce);
150160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Ireduce);
151160f19cdSDevin Coughlin 
152160f19cdSDevin Coughlin   IdentInfo_MPI_Allreduce = &ASTCtx.Idents.get("MPI_Allreduce");
153160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Allreduce);
154160f19cdSDevin Coughlin   MPICollToCollTypes.push_back(IdentInfo_MPI_Allreduce);
155160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Allreduce);
156160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Allreduce);
157160f19cdSDevin Coughlin 
158160f19cdSDevin Coughlin   IdentInfo_MPI_Iallreduce = &ASTCtx.Idents.get("MPI_Iallreduce");
159160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Iallreduce);
160160f19cdSDevin Coughlin   MPICollToCollTypes.push_back(IdentInfo_MPI_Iallreduce);
161160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Iallreduce);
162160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Iallreduce);
163160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Iallreduce);
164160f19cdSDevin Coughlin 
165160f19cdSDevin Coughlin   IdentInfo_MPI_Alltoall = &ASTCtx.Idents.get("MPI_Alltoall");
166160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Alltoall);
167160f19cdSDevin Coughlin   MPICollToCollTypes.push_back(IdentInfo_MPI_Alltoall);
168160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Alltoall);
169160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Alltoall);
170160f19cdSDevin Coughlin 
171160f19cdSDevin Coughlin   IdentInfo_MPI_Ialltoall = &ASTCtx.Idents.get("MPI_Ialltoall");
172160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Ialltoall);
173160f19cdSDevin Coughlin   MPICollToCollTypes.push_back(IdentInfo_MPI_Ialltoall);
174160f19cdSDevin Coughlin   MPINonBlockingTypes.push_back(IdentInfo_MPI_Ialltoall);
175160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Ialltoall);
176160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Ialltoall);
177160f19cdSDevin Coughlin }
178160f19cdSDevin Coughlin 
initAdditionalIdentifiers(ASTContext & ASTCtx)179160f19cdSDevin Coughlin void MPIFunctionClassifier::initAdditionalIdentifiers(ASTContext &ASTCtx) {
180160f19cdSDevin Coughlin   IdentInfo_MPI_Comm_rank = &ASTCtx.Idents.get("MPI_Comm_rank");
181160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Comm_rank);
182160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Comm_rank);
183160f19cdSDevin Coughlin 
184160f19cdSDevin Coughlin   IdentInfo_MPI_Comm_size = &ASTCtx.Idents.get("MPI_Comm_size");
185160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Comm_size);
186160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Comm_size);
187160f19cdSDevin Coughlin 
188160f19cdSDevin Coughlin   IdentInfo_MPI_Wait = &ASTCtx.Idents.get("MPI_Wait");
189160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Wait);
190160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Wait);
191160f19cdSDevin Coughlin 
192160f19cdSDevin Coughlin   IdentInfo_MPI_Waitall = &ASTCtx.Idents.get("MPI_Waitall");
193160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Waitall);
194160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Waitall);
195160f19cdSDevin Coughlin 
196160f19cdSDevin Coughlin   IdentInfo_MPI_Barrier = &ASTCtx.Idents.get("MPI_Barrier");
197160f19cdSDevin Coughlin   MPICollectiveTypes.push_back(IdentInfo_MPI_Barrier);
198160f19cdSDevin Coughlin   MPIType.push_back(IdentInfo_MPI_Barrier);
199160f19cdSDevin Coughlin   assert(IdentInfo_MPI_Barrier);
200160f19cdSDevin Coughlin }
201160f19cdSDevin Coughlin 
202160f19cdSDevin Coughlin // general identifiers
isMPIType(const IdentifierInfo * IdentInfo) const203160f19cdSDevin Coughlin bool MPIFunctionClassifier::isMPIType(const IdentifierInfo *IdentInfo) const {
204160f19cdSDevin Coughlin   return llvm::is_contained(MPIType, IdentInfo);
205160f19cdSDevin Coughlin }
206160f19cdSDevin Coughlin 
isNonBlockingType(const IdentifierInfo * IdentInfo) const207160f19cdSDevin Coughlin bool MPIFunctionClassifier::isNonBlockingType(
208160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
209160f19cdSDevin Coughlin   return llvm::is_contained(MPINonBlockingTypes, IdentInfo);
210160f19cdSDevin Coughlin }
211160f19cdSDevin Coughlin 
212160f19cdSDevin Coughlin // point-to-point identifiers
isPointToPointType(const IdentifierInfo * IdentInfo) const213160f19cdSDevin Coughlin bool MPIFunctionClassifier::isPointToPointType(
214160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
215160f19cdSDevin Coughlin   return llvm::is_contained(MPIPointToPointTypes, IdentInfo);
216160f19cdSDevin Coughlin }
217160f19cdSDevin Coughlin 
218160f19cdSDevin Coughlin // collective identifiers
isCollectiveType(const IdentifierInfo * IdentInfo) const219160f19cdSDevin Coughlin bool MPIFunctionClassifier::isCollectiveType(
220160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
221160f19cdSDevin Coughlin   return llvm::is_contained(MPICollectiveTypes, IdentInfo);
222160f19cdSDevin Coughlin }
223160f19cdSDevin Coughlin 
isCollToColl(const IdentifierInfo * IdentInfo) const224160f19cdSDevin Coughlin bool MPIFunctionClassifier::isCollToColl(
225160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
226160f19cdSDevin Coughlin   return llvm::is_contained(MPICollToCollTypes, IdentInfo);
227160f19cdSDevin Coughlin }
228160f19cdSDevin Coughlin 
isScatterType(const IdentifierInfo * IdentInfo) const229160f19cdSDevin Coughlin bool MPIFunctionClassifier::isScatterType(
230160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
231160f19cdSDevin Coughlin   return IdentInfo == IdentInfo_MPI_Scatter ||
232160f19cdSDevin Coughlin          IdentInfo == IdentInfo_MPI_Iscatter;
233160f19cdSDevin Coughlin }
234160f19cdSDevin Coughlin 
isGatherType(const IdentifierInfo * IdentInfo) const235160f19cdSDevin Coughlin bool MPIFunctionClassifier::isGatherType(
236160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
237160f19cdSDevin Coughlin   return IdentInfo == IdentInfo_MPI_Gather ||
238160f19cdSDevin Coughlin          IdentInfo == IdentInfo_MPI_Igather ||
239160f19cdSDevin Coughlin          IdentInfo == IdentInfo_MPI_Allgather ||
240160f19cdSDevin Coughlin          IdentInfo == IdentInfo_MPI_Iallgather;
241160f19cdSDevin Coughlin }
242160f19cdSDevin Coughlin 
isAllgatherType(const IdentifierInfo * IdentInfo) const243160f19cdSDevin Coughlin bool MPIFunctionClassifier::isAllgatherType(
244160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
245160f19cdSDevin Coughlin   return IdentInfo == IdentInfo_MPI_Allgather ||
246160f19cdSDevin Coughlin          IdentInfo == IdentInfo_MPI_Iallgather;
247160f19cdSDevin Coughlin }
248160f19cdSDevin Coughlin 
isAlltoallType(const IdentifierInfo * IdentInfo) const249160f19cdSDevin Coughlin bool MPIFunctionClassifier::isAlltoallType(
250160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
251160f19cdSDevin Coughlin   return IdentInfo == IdentInfo_MPI_Alltoall ||
252160f19cdSDevin Coughlin          IdentInfo == IdentInfo_MPI_Ialltoall;
253160f19cdSDevin Coughlin }
254160f19cdSDevin Coughlin 
isBcastType(const IdentifierInfo * IdentInfo) const255160f19cdSDevin Coughlin bool MPIFunctionClassifier::isBcastType(const IdentifierInfo *IdentInfo) const {
256160f19cdSDevin Coughlin   return IdentInfo == IdentInfo_MPI_Bcast || IdentInfo == IdentInfo_MPI_Ibcast;
257160f19cdSDevin Coughlin }
258160f19cdSDevin Coughlin 
isReduceType(const IdentifierInfo * IdentInfo) const259160f19cdSDevin Coughlin bool MPIFunctionClassifier::isReduceType(
260160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
261160f19cdSDevin Coughlin   return IdentInfo == IdentInfo_MPI_Reduce ||
262160f19cdSDevin Coughlin          IdentInfo == IdentInfo_MPI_Ireduce ||
263160f19cdSDevin Coughlin          IdentInfo == IdentInfo_MPI_Allreduce ||
264160f19cdSDevin Coughlin          IdentInfo == IdentInfo_MPI_Iallreduce;
265160f19cdSDevin Coughlin }
266160f19cdSDevin Coughlin 
267160f19cdSDevin Coughlin // additional identifiers
isMPI_Wait(const IdentifierInfo * IdentInfo) const268160f19cdSDevin Coughlin bool MPIFunctionClassifier::isMPI_Wait(const IdentifierInfo *IdentInfo) const {
269160f19cdSDevin Coughlin   return IdentInfo == IdentInfo_MPI_Wait;
270160f19cdSDevin Coughlin }
271160f19cdSDevin Coughlin 
isMPI_Waitall(const IdentifierInfo * IdentInfo) const272160f19cdSDevin Coughlin bool MPIFunctionClassifier::isMPI_Waitall(
273160f19cdSDevin Coughlin     const IdentifierInfo *IdentInfo) const {
274160f19cdSDevin Coughlin   return IdentInfo == IdentInfo_MPI_Waitall;
275160f19cdSDevin Coughlin }
276160f19cdSDevin Coughlin 
isWaitType(const IdentifierInfo * IdentInfo) const277160f19cdSDevin Coughlin bool MPIFunctionClassifier::isWaitType(const IdentifierInfo *IdentInfo) const {
278160f19cdSDevin Coughlin   return IdentInfo == IdentInfo_MPI_Wait || IdentInfo == IdentInfo_MPI_Waitall;
279160f19cdSDevin Coughlin }
280160f19cdSDevin Coughlin 
281160f19cdSDevin Coughlin } // end of namespace: mpi
282160f19cdSDevin Coughlin } // end of namespace: ento
283160f19cdSDevin Coughlin } // end of namespace: clang
284