Add missing function comments.
[official-gcc/Ramakrishna.git] / libpcp / pcp_visitor.cc
blob190698a83a0212522eec81295bc18cef1e2ceb2a
1 // Copyright (C) 2009 Free Software Foundation, Inc.
2 // Contributed by Jan Sjodin <jan.sjodin@amd.com>.
4 // This file is part of the Polyhedral Compilation Package Library (libpcp).
6 // Libpcp is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU Lesser General Public License as published by
8 // the Free Software Foundation; either version 2.1 of the License, or
9 // (at your option) any later version.
11 // Libpcp is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
14 // more details.
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with libpcp; see the file COPYING.LIB. If not, write to the
18 // Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 // MA 02110-1301, USA.
21 // As a special exception, if you link this library with other files, some
22 // of which are compiled with GCC, to produce an executable, this library
23 // does not by itself cause the resulting executable to be covered by the
24 // GNU General Public License. This exception does not however invalidate
25 // any other reasons why the executable file might be covered by the GNU
26 // General Public License.
28 #include "pcp.h"
29 #include "pcp_visitor.h"
31 void
32 PcpVisitor::visitChildren(PcpArrayType* arrayType)
34 PcpIterator<PcpExpr*>* iter = arrayType->getDimensionsIterator();
35 for(;iter->hasNext(); iter->next())
37 iter->get()->accept(this);
39 delete iter;
42 void
43 PcpVisitor::visitChildren(PcpArith* arith)
45 PcpIterator<PcpExpr*>* iter = arith->getOperandsIterator();
46 for(;iter->hasNext(); iter->next())
48 iter->get()->accept(this);
50 delete iter;
53 void
54 PcpVisitor::visitChildren(PcpArrayAccess* arrayAccess)
56 PcpIterator<PcpExpr*>* iter = arrayAccess->getSubscriptsIterator();
57 for(;iter->hasNext(); iter->next())
59 iter->get()->accept(this);
61 delete iter;
64 void
65 PcpVisitor::visitChildren(PcpCopy* copy)
67 copy->getDest()->accept(this);
68 copy->getSrc()->accept(this);
71 void
72 PcpVisitor::visitChildren(PcpUserStmt* userStmt)
74 PcpIterator<PcpArrayAccess*>* iter = userStmt->getArrayAccessesIterator();
75 for(;iter->hasNext(); iter->next())
77 iter->get()->accept(this);
79 delete iter;
82 void
83 PcpVisitor::visitChildren(PcpSequence* sequence)
85 PcpIterator<PcpStmt*>* iter = sequence->getStmtsIterator();
86 for(;iter->hasNext(); iter->next())
88 iter->get()->accept(this);
90 delete iter;
93 void
94 PcpVisitor::visitChildren(PcpGuard* guard)
96 guard->getCondition()->accept(this);
97 guard->getBody()->accept(this);
100 void
101 PcpVisitor::visitChildren(PcpLoop* loop)
103 loop->getIv()->accept(this);
104 loop->getStart()->accept(this);
105 loop->getCondition()->accept(this);
106 loop->getStride()->accept(this);
107 loop->getBody()->accept(this);
110 void
111 PcpVisitor::visitChildren(PcpScop* scop)
113 PcpIterator<PcpVariable*>* varIter = scop->getVariablesIterator();
114 for(;varIter->hasNext(); varIter->next())
116 varIter->get()->accept(this);
118 delete varIter;
120 PcpIterator<PcpParameter*>* paramIter = scop->getParametersIterator();
121 for(;paramIter->hasNext(); paramIter->next())
123 paramIter->get()->accept(this);
125 delete paramIter;
127 scop->getBody()->accept(this);
130 void
131 PcpVisitor::visitChildren(PcpCompare* compare)
133 this->visit(compare->getLhs());
134 this->visit(compare->getRhs());
138 void
139 PcpVisitor::visit(PcpObject* object)
141 // Do nothing since this is the top level.
144 void
145 PcpVisitor::visit(PcpArrayType* arrayType)
147 this->visit((PcpObject*)arrayType);
150 void
151 PcpVisitor::visit(PcpArith* arith)
153 this->visit((PcpExpr*) arith);
156 void
157 PcpVisitor::visit(PcpConstant* constant)
159 this->visit((PcpExpr*) constant);
162 void
163 PcpVisitor::visit(PcpIv* iv)
165 this->visit((PcpExpr*) iv);
168 void
169 PcpVisitor::visit(PcpParameter* parameter)
171 this->visit((PcpExpr*) parameter);
174 void
175 PcpVisitor::visit(PcpCompare* compare)
177 this->visit((PcpBoolExpr*) compare);
180 void
181 PcpVisitor::visit(PcpBoolArith* boolArith)
183 this->visit((PcpBoolExpr*) boolArith);
186 void
187 PcpVisitor::visit(PcpVariable* variable)
189 this->visit((PcpObject*) variable);
192 void
193 PcpVisitor::visit(PcpArrayAccess* arrayAccess)
195 this->visit((PcpObject*) arrayAccess);
198 void
199 PcpVisitor::visit(PcpCopy* copy)
201 this->visit((PcpStmt*) copy);
204 void
205 PcpVisitor::visit(PcpUserStmt* userStmt)
207 this->visit((PcpStmt*) userStmt);
210 void
211 PcpVisitor::visit(PcpSequence* sequence)
213 this->visit((PcpStmt*) sequence);
216 void
217 PcpVisitor::visit(PcpGuard* guard)
219 this->visit((PcpStmt*) guard);
222 void
223 PcpVisitor::visit(PcpLoop* loop)
225 this->visit((PcpStmt*) loop);
228 void
229 PcpVisitor::visit(PcpScop* scop)
231 this->visit((PcpObject*) scop);
234 void
235 PcpVisitor::visit(PcpExpr* expr)
237 this->visit((PcpObject*) expr);
240 void
241 PcpVisitor::visit(PcpBoolExpr* boolExpr)
243 this->visit((PcpObject*) boolExpr);
246 void
247 PcpVisitor::visit(PcpStmt* stmt)
249 this->visit((PcpObject*) stmt);
252 void
253 PcpVisitor::visit(PcpAnnot* annot)
255 // Do nothing. Top level.
258 void
259 PcpVisitor::visit(PcpAnnotSet* annot)
261 // Do nothing. Top level.
264 void
265 PcpVisitor::visit(PcpAnnotInt* annotInt)
267 this->visit((PcpAnnot*) annotInt);
270 void
271 PcpVisitor::visit(PcpAnnotTerm* annotTerm)
273 this->visit((PcpAnnot*) annotTerm);
276 void
277 PcpVisitor::visit(PcpAnnotString* annotString)
279 this->visit((PcpAnnot*) annotString);
282 void
283 PcpVisitor::visit(PcpAnnotObject* annotObject)
285 this->visit((PcpAnnot*) annotObject);
288 PcpVisitor::PcpVisitor()